Skip to content

Commit

Permalink
[2778] Authorize empty string for direct edit
Browse files Browse the repository at this point in the history
Bug: #2778
Signed-off-by: Florian ROUËNÉ <florian.rouene@obeosoft.com>
  • Loading branch information
frouene committed Dec 13, 2023
1 parent a25cbc6 commit 2fcf59d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 28 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Expand Up @@ -63,6 +63,7 @@ info: {
=== Bug fixes

- https://github.com/eclipse-sirius/sirius-web/issues/2812[#2812] [trees] Fix an issue that prevents icon to be displayed in treeNodes.
- https://github.com/eclipse-sirius/sirius-web/issues/2778[#2778] [diagram] Authorize empty string for direct edit.

=== New Features

Expand Down
Expand Up @@ -141,20 +141,17 @@ export const DiagramDirectEditInput = ({ labelId, editingKey, onClose, transform
}, [initialLabelItemError, initialLabelItemData]);

const doRename = () => {
const isNameValid = state.newLabel.length >= 1;
if (isNameValid) {
renameElement({
variables: {
input: {
id: crypto.randomUUID(),
editingContextId: editingContextId,
representationId: diagramId,
labelId: labelId,
newText: state.newLabel,
},
renameElement({
variables: {
input: {
id: crypto.randomUUID(),
editingContextId: editingContextId,
representationId: diagramId,
labelId: labelId,
newText: state.newLabel,
},
});
}
},
});
};

const handleChange = (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
Expand Down
Expand Up @@ -123,22 +123,17 @@ export const TreeItemDirectEditInput = ({
}, [renameTreeItemData, renameTreeItemError]);

const doRename = () => {
const isNameValid = state.newLabel.length >= 1;
if (isNameValid) {
renameTreeItem({
variables: {
input: {
id: crypto.randomUUID(),
editingContextId: editingContextId,
representationId: treeId,
treeItemId: treeItemId,
newLabel: state.newLabel,
},
renameTreeItem({
variables: {
input: {
id: crypto.randomUUID(),
editingContextId: editingContextId,
representationId: treeId,
treeItemId: treeItemId,
newLabel: state.newLabel,
},
});
} else {
onClose();
}
},
});
};

const handleChange = (event) => {
Expand Down

0 comments on commit 2fcf59d

Please sign in to comment.