Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/escape key #4

Merged
merged 4 commits into from
Dec 22, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: bump version
  • Loading branch information
Quorafind committed Dec 22, 2022
commit e0bf99c766a3a753648e038d8025748bf385f8e2
35 changes: 4 additions & 31 deletions canvasMindMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,36 +81,6 @@ export default class CanvasMindMap extends Plugin {
}
}
});
this.addCommand({
id: 'exist-to-canvas',
name: 'Exist to Canvas',
checkCallback: (checking: boolean) => {
// Conditions to check
const canvasView = this.app.workspace.getActiveViewOfType(ItemView);
if (canvasView) {
// If checking is true, we're simply "checking" if the command can be run.
// If checking is false, then we want to actually perform the operation.
if (!checking) {
const editorInfo = app.workspace.activeEditor;
if(!editorInfo) return;

editorInfo?.toggleMode();

const node = editorInfo?.node;
const canvas = canvasView?.canvas;

canvas.wrapperEl.focus();

canvas.deselectAll();
canvas.select(node);
canvas.zoomToSelection();
}

// This command will only show up in Command Palette when the check function returns true
return true;
}
}
});
}

patchCanvas() {
Expand Down Expand Up @@ -410,7 +380,10 @@ export default class CanvasMindMap extends Plugin {
showPreview: (next) =>
function (e: any) {
next.call(this, e);
if(e) this.node.canvas.wrapperEl.focus();
if(e) {
this.node.canvas.wrapperEl.focus();
this.node.setIsEditing(false);
}
},
});
this.register(uninstaller);
Expand Down
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "canvas-mindmap",
"name": "Canvas Mindmap",
"version": "0.0.2",
"version": "0.0.3",
"minAppVersion": "1.1.0",
"description": "A plugin to make your canvas work like a mindmap.",
"author": "Boninall",
Expand All @@ -12,4 +12,4 @@
"支付宝": "https://cdn.jsdelivr.net/gh/Quorafind/.github@main/IMAGE/%E6%94%AF%E4%BB%98%E5%AE%9D%E4%BB%98%E6%AC%BE%E7%A0%81.jpg"
},
"isDesktopOnly": false
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "canvas-mindmap",
"version": "0.0.2",
"version": "0.0.3",
"description": "A plugin to make your canvas work like a mindmap.",
"main": "main.js",
"scripts": {
Expand Down