Add config menu framework

Options don't do anything as of now, but they are saved and loaded
This commit is contained in:
MassiveBox 2025-04-15 19:42:43 +02:00
parent 6bca12c934
commit fc4ce8e69e
Signed by: massivebox
GPG key ID: 9B74D3A59181947D
3 changed files with 127 additions and 2 deletions

View file

@ -8,15 +8,23 @@ import {
} from "@/helper";
import {migrate} from "@/migration";
import {EditorManager, PluginEditor} from "@/editor";
import {PluginConfig, PluginConfigViewer} from "@/config";
export default class DrawJSPlugin extends Plugin {
onload() {
config: PluginConfig;
async onload() {
loadIcons(this);
EditorManager.registerTab(this);
migrate()
this.config = new PluginConfig();
await this.config.load();
let configViewer = new PluginConfigViewer(this.config, this);
await configViewer.load();
this.protyleSlash = [{
id: "insert-drawing",
filter: ["Insert Drawing", "Add drawing", "whiteboard", "freehand", "graphics", "jsdraw"],
@ -31,7 +39,7 @@ export default class DrawJSPlugin extends Plugin {
this.eventBus.on("open-menu-image", (e: any) => {
const ids = imgSrcToIDs(findImgSrc(e.detail.element));
if(ids === null) return;
if (ids === null) return;
e.detail.menu.addItem({
icon: "iconDraw",
label: "Edit with js-draw",