@dile/editor 2.4.2 → 2.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dile/editor",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.3",
|
|
4
4
|
"description": "Webcomponent to create a user editor interface, configured on various ways",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"prosemirror-state": "^1.4.2",
|
|
42
42
|
"prosemirror-view": "^1.30.1"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "eb9a2765a85207c45fcc88825fd61030e65c56fb"
|
|
45
45
|
}
|
package/src/DileEditor.js
CHANGED
|
@@ -172,7 +172,7 @@ export class DileEditor extends DileI18nMixin(DileEmmitChange(LitElement)) {
|
|
|
172
172
|
/** Disable toolbar items, string with items separated by tubes like "italic|h4" */
|
|
173
173
|
disableToolbarItems: { type: String },
|
|
174
174
|
|
|
175
|
-
|
|
175
|
+
additionalCommands: { type: Object },
|
|
176
176
|
|
|
177
177
|
/** Menu config */
|
|
178
178
|
_menuConfig: { type: Object },
|
|
@@ -193,7 +193,7 @@ export class DileEditor extends DileI18nMixin(DileEmmitChange(LitElement)) {
|
|
|
193
193
|
this.message = '';
|
|
194
194
|
this.disableToolbarItems = '';
|
|
195
195
|
this._menuConfig = {...defaultToolbarConfig};
|
|
196
|
-
this.
|
|
196
|
+
this.additionalCommands = {};
|
|
197
197
|
this.internals = this.attachInternals();
|
|
198
198
|
}
|
|
199
199
|
|
|
@@ -266,7 +266,7 @@ export class DileEditor extends DileI18nMixin(DileEmmitChange(LitElement)) {
|
|
|
266
266
|
@dile-editor-change=${this.updateValue}
|
|
267
267
|
._menuConfig=${this._menuConfig}
|
|
268
268
|
@dile-editor-markdown-initialized=${this.setInitialized}
|
|
269
|
-
.
|
|
269
|
+
.additionalCommands=${this.additionalCommands}
|
|
270
270
|
language="${this.language}"
|
|
271
271
|
></dile-editor-markdown>
|
|
272
272
|
`
|
|
@@ -30,7 +30,7 @@ export class DileEditorMarkdown extends DileI18nMixin(LitElement) {
|
|
|
30
30
|
static get properties() {
|
|
31
31
|
return {
|
|
32
32
|
_menuConfig: { type: Object },
|
|
33
|
-
|
|
33
|
+
additionalCommands: { type: Object },
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
constructor() {
|
|
@@ -71,7 +71,7 @@ export class DileEditorMarkdown extends DileI18nMixin(LitElement) {
|
|
|
71
71
|
history(),
|
|
72
72
|
keymap(buildKeymap(schema)),
|
|
73
73
|
keymap(baseKeymap),
|
|
74
|
-
menuPlugin(this._menuConfig, this.
|
|
74
|
+
menuPlugin(this._menuConfig, this.additionalCommands, this.language),
|
|
75
75
|
]
|
|
76
76
|
})
|
|
77
77
|
}
|
|
@@ -51,13 +51,13 @@ export class DileEditorToolbar extends DileI18nMixin(LitElement) {
|
|
|
51
51
|
blockItems: { type: Array },
|
|
52
52
|
undoItems: { type: Array },
|
|
53
53
|
menuConfig: { type: Object },
|
|
54
|
-
|
|
54
|
+
additionalCommands: { type: Object },
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
constructor() {
|
|
59
59
|
super();
|
|
60
|
-
this.
|
|
60
|
+
this.additionalCommands = {}
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
get blockselect() {
|
|
@@ -65,9 +65,9 @@ export class DileEditorToolbar extends DileI18nMixin(LitElement) {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
firstUpdated() {
|
|
68
|
-
this.toolbarItems = getToolbarItems(this.menuConfig, this.
|
|
69
|
-
this.undoItems = getUndoItems(this.menuConfig, this.
|
|
70
|
-
this.blockItems = getBlockItems(this.menuConfig, this.
|
|
68
|
+
this.toolbarItems = getToolbarItems(this.menuConfig, this.additionalCommands.toolbarItems || []);
|
|
69
|
+
this.undoItems = getUndoItems(this.menuConfig, this.additionalCommands.undoItems || []);
|
|
70
|
+
this.blockItems = getBlockItems(this.menuConfig, this.additionalCommands.blockItems || []);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
render() {
|
|
@@ -2,14 +2,14 @@ import { Plugin } from "prosemirror-state";
|
|
|
2
2
|
|
|
3
3
|
const toolbarElement = 'dile-editor-toolbar';
|
|
4
4
|
|
|
5
|
-
export const menuPlugin = (menuConfig,
|
|
5
|
+
export const menuPlugin = (menuConfig, additionalCommands, language) => new Plugin({
|
|
6
6
|
view(editorView) {
|
|
7
7
|
let toolbar;
|
|
8
8
|
if (!editorView.dom.parentElement.querySelector(toolbarElement)) {
|
|
9
9
|
toolbar = document.createElement(toolbarElement);
|
|
10
10
|
toolbar.menuConfig = menuConfig;
|
|
11
11
|
toolbar.editorView = editorView;
|
|
12
|
-
toolbar.
|
|
12
|
+
toolbar.additionalCommands = additionalCommands;
|
|
13
13
|
toolbar.language = language;
|
|
14
14
|
editorView.dom.parentNode.insertBefore(toolbar, editorView.dom);
|
|
15
15
|
} else {
|