select the editing node when jump from edit subtree

This commit is contained in:
codetypes committed 2024-11-25 20:46:30 +08:00
1 parent 734879a736
commit c933541f3e
5 files changed
+27 -15

No files matched your search

+10 -1
View File
@@ -660,7 +660,7 @@ export const Editor: FC<EditorProps> = ({ onUpdate: updateState, data: editor, .
const data = findSubtree(findDataById(editor.selectedId));
if (data?.path) {
const path = `${workspace.workdir}/${data.path}`;
workspace.open(path);
workspace.open(path, Number(editor.selectedId) - Number(data.id) + 1);
}
};
@@ -1075,6 +1075,15 @@ export const Editor: FC<EditorProps> = ({ onUpdate: updateState, data: editor, .
editor.size.width = editorSize.width;
editor.size.height = editorSize.height;
}
if (typeof editor.editNode === "number") {
const id = editor.editNode.toString();
selectNode(null);
setTimeout(() => {
editor.graph.focusItem(id);
selectNode(id);
}, 100);
}
});
// check should subtree