@progress/kendo-vue-editor 2.7.3 → 3.0.0-dev.202201141128

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.
Files changed (118) hide show
  1. package/dist/cdn/js/kendo-vue-editor.js +1 -1
  2. package/dist/es/Editor.d.ts +49 -131
  3. package/dist/es/Editor.js +51 -25
  4. package/dist/es/EditorProps.d.ts +11 -5
  5. package/dist/es/additionalTypes.ts +7 -1
  6. package/dist/es/config/toolsSettings.d.ts +4 -0
  7. package/dist/es/dialogs/FindReplace.d.ts +6 -7
  8. package/dist/es/dialogs/FindReplace.js +203 -131
  9. package/dist/es/dialogs/insertImage.d.ts +5 -6
  10. package/dist/es/dialogs/insertImage.js +23 -13
  11. package/dist/es/dialogs/insertLink.d.ts +5 -6
  12. package/dist/es/dialogs/insertLink.js +12 -8
  13. package/dist/es/dialogs/viewHtml.d.ts +5 -6
  14. package/dist/es/dialogs/viewHtml.js +3 -3
  15. package/dist/es/main.d.ts +19 -0
  16. package/dist/es/main.js +19 -0
  17. package/dist/es/package-metadata.js +1 -1
  18. package/dist/es/tools/align.d.ts +5 -6
  19. package/dist/es/tools/align.js +5 -5
  20. package/dist/es/tools/applyColor.d.ts +5 -6
  21. package/dist/es/tools/applyColor.js +9 -5
  22. package/dist/es/tools/cleanFormatting.d.ts +5 -6
  23. package/dist/es/tools/cleanFormatting.js +5 -5
  24. package/dist/es/tools/findReplace.d.ts +5 -6
  25. package/dist/es/tools/findReplace.js +7 -7
  26. package/dist/es/tools/fontStyle.d.ts +5 -6
  27. package/dist/es/tools/fontStyle.js +5 -5
  28. package/dist/es/tools/formatBlock.d.ts +5 -6
  29. package/dist/es/tools/formatBlock.js +5 -5
  30. package/dist/es/tools/indent.d.ts +5 -6
  31. package/dist/es/tools/indent.js +5 -5
  32. package/dist/es/tools/inlineFormat.d.ts +5 -6
  33. package/dist/es/tools/inlineFormat.js +5 -5
  34. package/dist/es/tools/insertImage.d.ts +5 -6
  35. package/dist/es/tools/insertImage.js +5 -5
  36. package/dist/es/tools/insertLink.d.ts +5 -6
  37. package/dist/es/tools/insertLink.js +5 -5
  38. package/dist/es/tools/insertTable/popup.d.ts +5 -6
  39. package/dist/es/tools/insertTable/popup.js +3 -3
  40. package/dist/es/tools/insertTable/popupGrid.d.ts +5 -6
  41. package/dist/es/tools/insertTable/popupGrid.js +3 -3
  42. package/dist/es/tools/insertTable/tool.d.ts +5 -6
  43. package/dist/es/tools/insertTable/tool.js +5 -5
  44. package/dist/es/tools/lists.d.ts +5 -6
  45. package/dist/es/tools/lists.js +5 -5
  46. package/dist/es/tools/outdent.d.ts +5 -6
  47. package/dist/es/tools/outdent.js +5 -5
  48. package/dist/es/tools/pdf.d.ts +5 -6
  49. package/dist/es/tools/pdf.js +5 -5
  50. package/dist/es/tools/print.d.ts +5 -6
  51. package/dist/es/tools/print.js +5 -5
  52. package/dist/es/tools/proseMirrorTool.d.ts +5 -6
  53. package/dist/es/tools/proseMirrorTool.js +5 -5
  54. package/dist/es/tools/selectAll.d.ts +5 -6
  55. package/dist/es/tools/selectAll.js +5 -5
  56. package/dist/es/tools/unlink.d.ts +5 -6
  57. package/dist/es/tools/unlink.js +5 -5
  58. package/dist/es/tools/viewHtml.d.ts +5 -6
  59. package/dist/es/tools/viewHtml.js +5 -5
  60. package/dist/npm/Editor.d.ts +49 -131
  61. package/dist/npm/Editor.js +52 -26
  62. package/dist/npm/EditorProps.d.ts +11 -5
  63. package/dist/npm/additionalTypes.ts +7 -1
  64. package/dist/npm/config/toolsSettings.d.ts +4 -0
  65. package/dist/npm/dialogs/FindReplace.d.ts +6 -7
  66. package/dist/npm/dialogs/FindReplace.js +206 -133
  67. package/dist/npm/dialogs/insertImage.d.ts +5 -6
  68. package/dist/npm/dialogs/insertImage.js +25 -15
  69. package/dist/npm/dialogs/insertLink.d.ts +5 -6
  70. package/dist/npm/dialogs/insertLink.js +14 -10
  71. package/dist/npm/dialogs/viewHtml.d.ts +5 -6
  72. package/dist/npm/dialogs/viewHtml.js +5 -5
  73. package/dist/npm/main.d.ts +19 -0
  74. package/dist/npm/main.js +38 -0
  75. package/dist/npm/package-metadata.js +1 -1
  76. package/dist/npm/tools/align.d.ts +5 -6
  77. package/dist/npm/tools/align.js +7 -7
  78. package/dist/npm/tools/applyColor.d.ts +5 -6
  79. package/dist/npm/tools/applyColor.js +11 -7
  80. package/dist/npm/tools/cleanFormatting.d.ts +5 -6
  81. package/dist/npm/tools/cleanFormatting.js +7 -7
  82. package/dist/npm/tools/findReplace.d.ts +5 -6
  83. package/dist/npm/tools/findReplace.js +9 -9
  84. package/dist/npm/tools/fontStyle.d.ts +5 -6
  85. package/dist/npm/tools/fontStyle.js +7 -7
  86. package/dist/npm/tools/formatBlock.d.ts +5 -6
  87. package/dist/npm/tools/formatBlock.js +7 -7
  88. package/dist/npm/tools/indent.d.ts +5 -6
  89. package/dist/npm/tools/indent.js +7 -7
  90. package/dist/npm/tools/inlineFormat.d.ts +5 -6
  91. package/dist/npm/tools/inlineFormat.js +7 -7
  92. package/dist/npm/tools/insertImage.d.ts +5 -6
  93. package/dist/npm/tools/insertImage.js +7 -7
  94. package/dist/npm/tools/insertLink.d.ts +5 -6
  95. package/dist/npm/tools/insertLink.js +7 -7
  96. package/dist/npm/tools/insertTable/popup.d.ts +5 -6
  97. package/dist/npm/tools/insertTable/popup.js +5 -5
  98. package/dist/npm/tools/insertTable/popupGrid.d.ts +5 -6
  99. package/dist/npm/tools/insertTable/popupGrid.js +5 -5
  100. package/dist/npm/tools/insertTable/tool.d.ts +5 -6
  101. package/dist/npm/tools/insertTable/tool.js +7 -7
  102. package/dist/npm/tools/lists.d.ts +5 -6
  103. package/dist/npm/tools/lists.js +7 -7
  104. package/dist/npm/tools/outdent.d.ts +5 -6
  105. package/dist/npm/tools/outdent.js +7 -7
  106. package/dist/npm/tools/pdf.d.ts +5 -6
  107. package/dist/npm/tools/pdf.js +7 -7
  108. package/dist/npm/tools/print.d.ts +5 -6
  109. package/dist/npm/tools/print.js +7 -7
  110. package/dist/npm/tools/proseMirrorTool.d.ts +5 -6
  111. package/dist/npm/tools/proseMirrorTool.js +7 -7
  112. package/dist/npm/tools/selectAll.d.ts +5 -6
  113. package/dist/npm/tools/selectAll.js +7 -7
  114. package/dist/npm/tools/unlink.d.ts +5 -6
  115. package/dist/npm/tools/unlink.js +7 -7
  116. package/dist/npm/tools/viewHtml.d.ts +5 -6
  117. package/dist/npm/tools/viewHtml.js +7 -7
  118. package/package.json +12 -12
@@ -33,7 +33,7 @@ var __spreadArrays = undefined && undefined.__spreadArrays || function () {
33
33
  Object.defineProperty(exports, "__esModule", {
34
34
  value: true
35
35
  });
36
- exports.EditorVue3 = exports.Editor = exports.allTools = void 0; // @ts-ignore
36
+ exports.EditorVue2 = exports.Editor = exports.allTools = void 0; // @ts-ignore
37
37
 
38
38
  var Vue = require("vue");
39
39
 
@@ -275,7 +275,7 @@ exports.allTools = {
275
275
  }
276
276
  }; // tslint:enable:max-line-length
277
277
 
278
- var Editor = {
278
+ var EditorVue2 = {
279
279
  name: 'KendoEditor',
280
280
  props: {
281
281
  defaultContent: String,
@@ -290,7 +290,10 @@ var Editor = {
290
290
  contentStyle: Object,
291
291
  dir: String,
292
292
  tools: Array,
293
- keyboardNavigation: Boolean,
293
+ keyboardNavigation: {
294
+ type: Boolean,
295
+ default: true
296
+ },
294
297
  resizable: Boolean,
295
298
  preserveWhitespace: {
296
299
  type: [String, Boolean],
@@ -298,7 +301,9 @@ var Editor = {
298
301
  validator: function validator(value) {
299
302
  return [true, false, 'full'].includes(value);
300
303
  }
301
- }
304
+ },
305
+ pasteHtml: Function,
306
+ extendView: Function
302
307
  },
303
308
  data: function data() {
304
309
  return {
@@ -383,10 +388,10 @@ var Editor = {
383
388
  _d = _a.preserveWhitespace,
384
389
  preserveWhitespace = _d === void 0 ? 'full' : _d,
385
390
  style = _a.style;
386
- var view = this.v3 ? this._view : this.view;
391
+ var view = this.getView();
387
392
 
388
- if (view) {
389
- var editorProps = props_key_1.editorPropsKey.getState(view.state);
393
+ if (this.view) {
394
+ var editorProps = props_key_1.editorPropsKey.getState(this.view.state);
390
395
  editorProps.preserveWhitespace = preserveWhitespace;
391
396
  }
392
397
 
@@ -430,8 +435,14 @@ var Editor = {
430
435
  return h(this.v3 ? markRaw(exports.allTools[currentTool].comp) : exports.allTools[currentTool].comp, this.v3 ? toolProps : {
431
436
  props: toolProps
432
437
  });
438
+ } else if (ct === 'Separator') {
439
+ return (// @ts-ignore
440
+ h(kendo_vue_buttons_1.ToolbarSeparator, {
441
+ key: index
442
+ })
443
+ );
433
444
  } else {
434
- var tool = kendo_vue_common_1.templateRendering.call(this, ct, kendo_vue_common_1.getListeners.call(this));
445
+ var tool = kendo_vue_common_1.templateRendering.call(this, ct.render, kendo_vue_common_1.getListeners.call(this));
435
446
  return kendo_vue_common_1.getTemplate.call(this, {
436
447
  h: h,
437
448
  template: tool,
@@ -440,11 +451,11 @@ var Editor = {
440
451
  additionalProps: {
441
452
  view: view,
442
453
  dir: this.$props.dir,
443
- key: index
454
+ key: kendo_vue_common_1.guid(),
455
+ settings: ct.props
444
456
  }
445
457
  });
446
- } // return tool.type === ToolbarSeparator ? <Tool key={index} /> : tool;
447
-
458
+ }
448
459
  };
449
460
 
450
461
  var renderTools = function renderTools(item, index) {
@@ -501,14 +512,29 @@ var Editor = {
501
512
  }, [h("div", {
502
513
  ref: this.v3 ? function (el) {
503
514
  _this.contentElementRef = el;
504
- } : 'contentElement',
505
- suppressContentEditableWarning: true,
506
- attrs: this.v3 ? undefined : {
507
- suppressContentEditableWarning: true
508
- }
515
+ } : 'contentElement'
509
516
  })]), renderDialog.call(this)]);
510
517
  },
511
518
  methods: {
519
+ getView: function getView() {
520
+ return this.v3 ? this._view : this.view;
521
+ },
522
+ getHTML: function getHTML() {
523
+ var view = this.getView();
524
+
525
+ if (view) {
526
+ return utils_1.EditorUtils.getHtml(view.state);
527
+ }
528
+
529
+ return '';
530
+ },
531
+ setHTML: function setHTML(value) {
532
+ var view = this.getView();
533
+
534
+ if (view) {
535
+ utils_1.EditorUtils.setHtml(view, value);
536
+ }
537
+ },
512
538
  focus: function focus() {
513
539
  if (this._view) {
514
540
  this._view.focus();
@@ -618,8 +644,7 @@ var Editor = {
618
644
  var _b = this.$props,
619
645
  _c = _b.defaultContent,
620
646
  defaultContent = _c === void 0 ? '' : _c,
621
- value = _b.value,
622
- onMount = _b.onMount;
647
+ value = _b.value;
623
648
  var doc = value && typeof value !== 'string' ? value : utils_1.EditorUtils.createDocument(new kendo_editor_common_1.Schema({
624
649
  nodes: schema_1.nodes,
625
650
  marks: schema_1.marks
@@ -646,7 +671,8 @@ var Editor = {
646
671
  viewProps: viewProps,
647
672
  dom: dom
648
673
  };
649
- var view = this._view = onMount && onMount.call(undefined, mountEvent) || new kendo_editor_common_1.EditorView({
674
+ this.$emit('loaded', mountEvent);
675
+ var view = this._view = this.$props.extendView && this.$props.extendView(mountEvent) || new kendo_editor_common_1.EditorView({
650
676
  mount: dom
651
677
  }, viewProps);
652
678
  this.view = view;
@@ -661,13 +687,13 @@ var Editor = {
661
687
  return true;
662
688
  },
663
689
  onPasteHtml: function onPasteHtml(html) {
664
- if (this.$props.onPasteHtml && this.pasteEvent) {
690
+ if (this.$props.pasteHtml && this.pasteEvent) {
665
691
  var event_1 = {
666
692
  target: this,
667
693
  pastedHtml: html,
668
- nativeEvent: this.pasteEvent
694
+ event: this.pasteEvent
669
695
  };
670
- var newHtml = this.$props.onPasteHtml.call(undefined, event_1);
696
+ var newHtml = this.$props.pasteHtml(event_1);
671
697
  this.pasteEvent = undefined;
672
698
 
673
699
  if (typeof newHtml === 'string') {
@@ -730,7 +756,7 @@ var Editor = {
730
756
  return false;
731
757
  },
732
758
  onPaste: function onPaste(_view, nativeEvent) {
733
- if (this.$props.onPasteHtml) {
759
+ if (this.$props.pasteHtml) {
734
760
  this.pasteEvent = nativeEvent;
735
761
  }
736
762
 
@@ -741,6 +767,6 @@ var Editor = {
741
767
  }
742
768
  }
743
769
  };
744
- exports.Editor = Editor;
745
- var EditorVue3 = Editor;
746
- exports.EditorVue3 = EditorVue3;
770
+ exports.EditorVue2 = EditorVue2;
771
+ var Editor = EditorVue2;
772
+ exports.Editor = Editor;
@@ -66,7 +66,7 @@ export interface EditorPasteEvent extends EditorEvent {
66
66
  /**
67
67
  * The native paste event.
68
68
  */
69
- nativeEvent: ClipboardEvent;
69
+ event: ClipboardEvent;
70
70
  }
71
71
  /**
72
72
  * Represents the object of the `onExecute` Editor event.
@@ -127,17 +127,23 @@ export interface EditorProps {
127
127
  * Sets the tools of the Editor. By default, the Editor renders no tools.
128
128
  */
129
129
  tools?: Array<any>;
130
+ /**
131
+ * A funciton that fires each time the Editor is about to insert pasted content.
132
+ * Useful for modifying pasted content.
133
+ */
134
+ pasteHtml?: (event: EditorPasteEvent) => string | void;
130
135
  /**
131
136
  * Fires each time the Editor is about to mount.
132
137
  * Useful for configuring the `EditorView` object.
133
138
  * To initialize `EditorView`, use the properties of the `event` object.
134
139
  */
135
- onMount?: (event: EditorMountEvent) => EditorView | void;
140
+ extendView?: (event: EditorMountEvent) => EditorView | void;
136
141
  /**
137
- * Fires each time the Editor is about to insert pasted content.
138
- * Useful for modifying pasted content.
142
+ * Fires each time the Editor is about to mount.
143
+ * Useful for configuring the `EditorView` object.
144
+ * To initialize `EditorView`, use the properties of the `event` object.
139
145
  */
140
- onPastehtml?: (event: EditorPasteEvent) => string | void;
146
+ onLoaded?: (event: EditorMountEvent) => EditorView | void;
141
147
  /**
142
148
  * Fires each time the Editor is about to apply a transaction.
143
149
  * To prevent the transaction, return `false`.
@@ -1,3 +1,9 @@
1
1
  // @ts-ignore
2
2
  import { DefineComponent } from 'vue';
3
- export { DefineComponent };
3
+ // @ts-ignore
4
+ import * as Vue from 'vue';
5
+ // @ts-ignore
6
+ type Vue2type = Vue.default;
7
+ // @ts-ignore
8
+ import { RecordPropsDefinition, ComponentOptions } from 'vue/types/options';
9
+ export { DefineComponent, RecordPropsDefinition, ComponentOptions, Vue2type };
@@ -154,6 +154,10 @@ export declare namespace EditorToolsSettings {
154
154
  * The name of the applied command.
155
155
  */
156
156
  commandName: string;
157
+ /**
158
+ * The dir of the applied command.
159
+ */
160
+ dir?: String;
157
161
  }
158
162
  /**
159
163
  * The setting of the IndentAction tool.
@@ -1,5 +1,4 @@
1
- import { DefineComponent } from '../additionalTypes';
2
- import { RecordPropsDefinition, ComponentOptions } from 'vue/types/options';
1
+ import { DefineComponent, RecordPropsDefinition, ComponentOptions, Vue2type } from '../additionalTypes';
3
2
  declare type DefaultData<V> = object | ((this: V) => {});
4
3
  declare type DefaultMethods<V> = {
5
4
  [key: string]: (this: V, ...args: any[]) => any;
@@ -8,7 +7,7 @@ import { EditorToolsSettings } from './../config/toolsSettings';
8
7
  import { TextSelection, EditorView } from '@progress/kendo-editor-common';
9
8
  interface FindAndReplaceDialogData {
10
9
  selectedTab: number;
11
- matches?: TextSelection<any>[];
10
+ matches: TextSelection<any>[];
12
11
  nextMatch?: TextSelection<any>;
13
12
  searchText: string;
14
13
  replaceText: string;
@@ -58,8 +57,8 @@ export interface FindAndReplaceDialogState {
58
57
  /**
59
58
  * @hidden
60
59
  */
61
- export interface FindAndReplaceDialogAll extends Vue, FindAndReplaceDialogMethods, FindAndReplaceDialogData, FindAndReplaceDialogComputed, FindAndReplaceDialogState {
60
+ export interface FindAndReplaceDialogAll extends Vue2type, FindAndReplaceDialogMethods, FindAndReplaceDialogData, FindAndReplaceDialogComputed, FindAndReplaceDialogState {
62
61
  }
63
- declare let FindAndReplaceDialog: ComponentOptions<FindAndReplaceDialogAll, DefaultData<FindAndReplaceDialogData>, DefaultMethods<FindAndReplaceDialogAll>, FindAndReplaceDialogComputed, RecordPropsDefinition<FindAndReplaceDialogProps>>;
64
- declare const FindAndReplaceDialogVue3: DefineComponent<FindAndReplaceDialogProps, any, FindAndReplaceDialogData, FindAndReplaceDialogComputed, FindAndReplaceDialogMethods, {}, {}, {}, string, FindAndReplaceDialogProps, FindAndReplaceDialogProps, {}>;
65
- export { FindAndReplaceDialog, FindAndReplaceDialogVue3 };
62
+ declare let FindAndReplaceDialogVue2: ComponentOptions<FindAndReplaceDialogAll, DefaultData<FindAndReplaceDialogData>, DefaultMethods<FindAndReplaceDialogAll>, FindAndReplaceDialogComputed, RecordPropsDefinition<FindAndReplaceDialogProps>>;
63
+ declare const FindAndReplaceDialog: DefineComponent<FindAndReplaceDialogProps, any, FindAndReplaceDialogData, FindAndReplaceDialogComputed, FindAndReplaceDialogMethods, {}, {}, {}, string, FindAndReplaceDialogProps, FindAndReplaceDialogProps, {}>;
64
+ export { FindAndReplaceDialog, FindAndReplaceDialogVue2 };