Skip to content

Commit

Permalink
Added global plugin vars
Browse files Browse the repository at this point in the history
  • Loading branch information
rpeyron committed Nov 4, 2021
1 parent ffa1483 commit 5038d40
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/asyncapi/asyncapi-plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class AsyncApiEditorPlugin extends BaseEditor {

}

new AsyncApiEditorPlugin('asyncApi', {
(window as any).pluginAsyncApiEditorPlugin = new AsyncApiEditorPlugin('asyncApi', {
attributeName: "asyncApiData",
contextual: "Edit with Async API Editor",
title: "AsyncAPI Editor",
Expand Down
24 changes: 12 additions & 12 deletions src/editor-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export interface BaseEditorOptions {
/** The name of attribute to consider */
attributeName: string

/** Weither the editor should react on double clic or not (default: false) */
/** Weither the editor should react on double click or not (default: false) */
ignoreDoubleClic?: boolean

/** If defined and not empty, adds a menu with this title to edit the item */
Expand All @@ -31,7 +31,7 @@ export interface BaseEditorOptions {

export interface BaseEditorPaletteItem {

/** The palette to inlude the palette item in.
/** The palette to include the palette item in.
* The palette will be search with the provided name.
* If not found, will be created, with the label if provided or with the name if not.
*/
Expand Down Expand Up @@ -120,20 +120,14 @@ export class BaseEditor {

this.options = options;

function showDialogCell(cell: mxCell) {
var shape = editorUi.editor.graph.view.states["map"][cell.mxObjectId].shape;
if (shape) {
me.showDialog(editorUi, shape);
}
}

// Double clic
if (!this.options.ignoreDoubleClic) {
editorUi.editor.graph.addListener(mxEvent.DOUBLE_CLICK, function (sender, evt) {
var cell = evt.getProperty("cell");
if (me.isCellHandled(cell)) {
evt.consume();
showDialogCell(cell);
me.showDialogCell(editorUi, cell);
}
});
}
Expand All @@ -146,7 +140,7 @@ export class BaseEditor {
prevPopupMethod(menu, cell, evt);
if(me.isCellHandled(cell)) {
menu.addItem(me.options.contextual, null, function() {
showDialogCell(cell);
me.showDialogCell(editorUi, cell);
})
}}
}
Expand Down Expand Up @@ -263,6 +257,14 @@ export class BaseEditor {

}

showDialogCell(editorUi: any, cell: mxCell) {
var shape = editorUi.editor.graph.view.states["map"][cell.mxObjectId].shape;
if (shape) {
this.showDialog(editorUi, shape);
}
}


// Default implementation does nothing
onFillWindow(editorUi: any, div: HTMLDivElement, win: mxWindow, shape: mxShape) {

Expand Down Expand Up @@ -322,8 +324,6 @@ export class BaseEditor {
}
}



}


Expand Down
2 changes: 1 addition & 1 deletion src/editorjs/editorjs-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class EditorjsEditorPlugin extends BaseEditor {
}
}

new EditorjsEditorPlugin("editorjs", {
(window as any).pluginEditorjsEditorPlugin = new EditorjsEditorPlugin("editorjs", {
attributeName: "editorjsData",
contextual: "Edit with EditorJS",
title: "EditorJS Editor",
Expand Down
2 changes: 1 addition & 1 deletion src/markdown/markdown-plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class MarkdownEditorPlugin extends BaseEditor {

}

new MarkdownEditorPlugin('markdown', {
(window as any).pluginMarkdownEditorPlugin = new MarkdownEditorPlugin('markdown', {
attributeName: "markdownData",
contextual: "Edit with Markdown Editor",
title: "Markdown Editor",
Expand Down
2 changes: 1 addition & 1 deletion src/quill/quill-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class QuillEditorPlugin extends BaseEditor {
}
}

new QuillEditorPlugin("quill", {
(window as any).pluginQuillEditorPlugin = new QuillEditorPlugin("quill", {
attributeName: "quillData",
contextual: "Edit HTML with Quill",
title: "Quill Editor",
Expand Down
2 changes: 1 addition & 1 deletion src/swagger/swagger-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class SwaggerEditorPlugin extends BaseEditor {

}

new SwaggerEditorPlugin('swagger', {
(window as any).pluginSwaggerEditorPlugin = new SwaggerEditorPlugin('swagger', {
attributeName: "swaggerData",
contextual: "Edit with Swagger Editor",
title: "Swagger Editor",
Expand Down
2 changes: 1 addition & 1 deletion src/tinyeditor/tinyeditor-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class TinyEditorPlugin extends BaseEditor {
}
}

new TinyEditorPlugin("tinyeditor", {
(window as any).pluginTinyEditorPlugin = new TinyEditorPlugin("tinyeditor", {
attributeName: "tinyeditorData",
contextual: "Edit HTML with TinyEditor",
title: "TinyEditor Editor",
Expand Down
2 changes: 1 addition & 1 deletion src/tiptap/tiptap-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class TiptapEditorPlugin extends BaseEditor {
}
}

new TiptapEditorPlugin("tiptap", {
(window as any).pluginTiptapEditorPlugin = new TiptapEditorPlugin("tiptap", {
attributeName: "tiptapData",
contextual: "Edit HTML with TipTap",
title: "TipTap Editor",
Expand Down

0 comments on commit 5038d40

Please sign in to comment.