double click to edit subtree

This commit is contained in:
codetypes committed 2024-03-13 00:28:37 +08:00
1 parent 6b5abae6a3
commit fed08a0f45
9 files changed
+176 -108

No files matched your search

+14 -2
View File
@@ -93,12 +93,16 @@ export default class TreeTabs extends Component<TreeTabsProps, TreeTabsState> {
ipcRenderer.on(MainEventType.UNDO, () => {
const editor = this.getCurEditor();
editor?.undo();
if (editor?.isInEditor) {
editor.undo();
}
});
ipcRenderer.on(MainEventType.REDO, () => {
const editor = this.getCurEditor();
editor?.redo();
if (editor?.isInEditor) {
editor.redo();
}
});
}
@@ -143,6 +147,10 @@ export default class TreeTabs extends Component<TreeTabsProps, TreeTabsState> {
trees = trees.filter((tree) => tree.filepath != path);
const length = trees.length;
this.setState({ trees: trees, curTree: length > 0 ? trees[0].filepath : null });
if (length > 0) {
const editor = this.editors[trees[0].filepath];
editor?.reload();
}
}
render() {
@@ -184,6 +192,10 @@ export default class TreeTabs extends Component<TreeTabsProps, TreeTabsState> {
this.forceUpdate();
}
}}
onOpenSubtree={(path) => {
const settings = Utils.getRemoteSettings();
this.openFile(settings.workdir + "/" + path);
}}
ref={(ref) => {
this.editors[tree.filepath] = ref;
}}