Code quality improvements

This commit is contained in:
MassiveBox 2025-04-09 22:53:40 +02:00
parent ea9b0be856
commit e23cc424f8
Signed by: massivebox
GPG key ID: 9B74D3A59181947D
3 changed files with 176 additions and 133 deletions

View file

@ -6,18 +6,15 @@ import {
findImgSrc,
imgSrcToIDs, generateTimeString, generateRandomString
} from "@/helper";
import {editorTabInit, openEditorTab} from "@/editorTab";
import {migrate} from "@/migration";
import {EditorManager, PluginEditor} from "@/editor";
export default class DrawJSPlugin extends Plugin {
onload() {
loadIcons(this);
this.addTab({
'type': "whiteboard",
init() { editorTabInit(this) }
});
EditorManager.registerTab(this);
migrate()
this.protyleSlash = [{
@ -28,7 +25,7 @@ export default class DrawJSPlugin extends Plugin {
const fileID = generateRandomString();
const syncID = generateTimeString() + '-' + generateRandomString();
protyle.insert(getMarkdownBlock(fileID, syncID), true, false);
openEditorTab(this, fileID, syncID);
new EditorManager(new PluginEditor(fileID, syncID)).open(this)
}
}];
@ -39,7 +36,7 @@ export default class DrawJSPlugin extends Plugin {
icon: "iconDraw",
label: "Edit with js-draw",
click: () => {
openEditorTab(this, ids.fileID, ids.syncID);
new EditorManager(new PluginEditor(ids.fileID, ids.syncID)).open(this)
}
})
})