@dile/editor 2.4.1 → 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.1",
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": "2f4e696db6cb74d33233b83b5da7ce79699c5632"
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
- addicionalCommands: { type: Object },
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.addicionalCommands = {};
196
+ this.additionalCommands = {};
197
197
  this.internals = this.attachInternals();
198
198
  }
199
199
 
@@ -247,21 +247,10 @@ export class DileEditor extends DileI18nMixin(DileEmmitChange(LitElement)) {
247
247
  </nav>
248
248
  <dile-pages selected="${this.viewSelected}" attrForSelected="name">
249
249
  <section name="markdown">
250
- <textarea
251
- id="eltextarea"
252
- .value="${this.value}"
253
- @input=${this.doTextareaKeypress}
254
- ></textarea>
250
+ ${this.textareaTemplate}
255
251
  </section>
256
252
  <section class="editor" name="design">
257
- <dile-editor-markdown
258
- id="editor"
259
- @dile-editor-change=${this.updateValue}
260
- ._menuConfig=${this._menuConfig}
261
- @dile-editor-markdown-initialized=${this.setInitialized}
262
- .addicionalCommands=${this.addicionalCommands}
263
- language="${this.language}"
264
- ></dile-editor-markdown>
253
+ ${this.editorMarkdownTemplate}
265
254
  </section>
266
255
  </dile-pages>
267
256
  </section>
@@ -270,6 +259,29 @@ export class DileEditor extends DileI18nMixin(DileEmmitChange(LitElement)) {
270
259
  `;
271
260
  }
272
261
 
262
+ get editorMarkdownTemplate() {
263
+ return html`
264
+ <dile-editor-markdown
265
+ id="editor"
266
+ @dile-editor-change=${this.updateValue}
267
+ ._menuConfig=${this._menuConfig}
268
+ @dile-editor-markdown-initialized=${this.setInitialized}
269
+ .additionalCommands=${this.additionalCommands}
270
+ language="${this.language}"
271
+ ></dile-editor-markdown>
272
+ `
273
+ }
274
+
275
+ get textareaTemplate() {
276
+ return html`
277
+ <textarea
278
+ id="eltextarea"
279
+ .value="${this.value}"
280
+ @input=${this.doTextareaKeypress}
281
+ ></textarea>
282
+ `
283
+ }
284
+
273
285
  updateValue(e) {
274
286
  this.value = e.detail.content;
275
287
  this.textarea.value = e.detail.content;
@@ -30,7 +30,7 @@ export class DileEditorMarkdown extends DileI18nMixin(LitElement) {
30
30
  static get properties() {
31
31
  return {
32
32
  _menuConfig: { type: Object },
33
- addicionalCommands: { type: Object },
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.addicionalCommands, this.language),
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
- addicionalCommands: { type: Object },
54
+ additionalCommands: { type: Object },
55
55
  };
56
56
  }
57
57
 
58
58
  constructor() {
59
59
  super();
60
- this.addicionalCommands = {}
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.addicionalCommands.toolbarItems || []);
69
- this.undoItems = getUndoItems(this.menuConfig, this.addicionalCommands.undoItems || []);
70
- this.blockItems = getBlockItems(this.menuConfig, this.addicionalCommands.blockItems || []);
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, addicionalCommands, language) => new Plugin({
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.addicionalCommands = addicionalCommands;
12
+ toolbar.additionalCommands = additionalCommands;
13
13
  toolbar.language = language;
14
14
  editorView.dom.parentNode.insertBefore(toolbar, editorView.dom);
15
15
  } else {