From c84f7307826e2da705366afad2dc108a0275a743 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Otgaar?= Date: Wed, 19 Nov 2025 17:31:13 +0000 Subject: [PATCH] Apply 1 suggestion(s) to 1 file(s) Co-authored-by: Twirre --- .../components/NodeComponents.tsx | 49 ------------------- 1 file changed, 49 deletions(-) diff --git a/src/pages/VisProgPage/visualProgrammingUI/components/NodeComponents.tsx b/src/pages/VisProgPage/visualProgrammingUI/components/NodeComponents.tsx index fde47b1..7eae77e 100644 --- a/src/pages/VisProgPage/visualProgrammingUI/components/NodeComponents.tsx +++ b/src/pages/VisProgPage/visualProgrammingUI/components/NodeComponents.tsx @@ -32,52 +32,3 @@ export function Toolbar({nodeId, allowDelete}: ToolbarProps) { ); } -// Renaming component -/** - * Adds a component that can be used to edit a node's label entry inside its Data - * can be added to any custom node that has a label inside its Data - * - * @param {string} nodeLabel - * @param {string} nodeId - * @returns {React.JSX.Element} - * @constructor - */ -export function EditableName({nodeLabel = "new node", nodeId} : { nodeLabel : string, nodeId: string}) { - const {updateNodeData} = useFlowStore(); - - const updateData = (event: React.FocusEvent) => { - const input = event.target.value; - updateNodeData(nodeId, {label: input}); - event.currentTarget.setAttribute("readOnly", "true"); - window.getSelection()?.empty(); - event.currentTarget.classList.replace("nodrag", "drag"); // enable dragging of the node with cursor on the input box - }; - - const updateOnEnter = (event: React.KeyboardEvent) => { if (event.key === "Enter") (event.target as HTMLInputElement).blur(); }; - - const enableEditing = (event: React.MouseEvent) => { - if(event.currentTarget.hasAttribute("readOnly")) { - event.currentTarget.removeAttribute("readOnly"); // enable editing - event.currentTarget.select(); // select the text input - window.getSelection()?.collapseToEnd(); // move the caret to the end of the current value - event.currentTarget.classList.replace("drag", "nodrag"); // disable dragging using input box - } - } - - return ( -
- - -
- ) -} -