@progress/kendo-angular-editor 2.5.0-dev.202111240844 → 3.0.0-dev.202112211443

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 (194) hide show
  1. package/dist/cdn/js/kendo-angular-editor.js +2 -2
  2. package/dist/cdn/main.js +1 -1
  3. package/dist/es/common/error-messages.js +3 -2
  4. package/dist/es/editor.component.js +102 -69
  5. package/dist/es/index.js +1 -0
  6. package/dist/es/main.js +1 -0
  7. package/dist/es/package-metadata.js +1 -1
  8. package/dist/es/preventable-events/paste-event-data.js +4 -0
  9. package/dist/es/preventable-events/paste-event.js +25 -0
  10. package/dist/es/tools/alignment/editor-align-center-button.directive.js +5 -3
  11. package/dist/es/tools/alignment/editor-align-justify-button.directive.js +5 -3
  12. package/dist/es/tools/alignment/editor-align-left-button.directive.js +5 -3
  13. package/dist/es/tools/alignment/editor-align-right-button.directive.js +5 -3
  14. package/dist/es/tools/editor-clean-formatting-button.directive.js +5 -3
  15. package/dist/es/tools/fontfamily/editor-fontfamily.component.js +9 -3
  16. package/dist/es/tools/fontsize/editor-fontsize.component.js +9 -3
  17. package/dist/es/tools/format/editor-format.component.js +9 -3
  18. package/dist/es/tools/history/editor-redo-button.directive.js +5 -3
  19. package/dist/es/tools/history/editor-undo-button.directive.js +5 -3
  20. package/dist/es/tools/image/editor-insert-image-button.directive.js +5 -3
  21. package/dist/es/tools/indentation/editor-indent-button.directive.js +5 -3
  22. package/dist/es/tools/indentation/editor-outdent-button.directive.js +5 -3
  23. package/dist/es/tools/link/editor-create-link-button.directive.js +5 -3
  24. package/dist/es/tools/link/editor-insert-file-button.directive.js +5 -3
  25. package/dist/es/tools/link/editor-unlink-button.directive.js +5 -3
  26. package/dist/es/tools/list/editor-insert-ordered-list-button.directive.js +5 -3
  27. package/dist/es/tools/list/editor-insert-unordered-list-button.directive.js +5 -3
  28. package/dist/es/tools/print/editor-print-button.directive.js +5 -3
  29. package/dist/es/tools/select-all/select-all-button.directive.js +5 -3
  30. package/dist/es/tools/shared/editor-command-base.js +3 -1
  31. package/dist/es/tools/shared/editor-command-button.js +3 -2
  32. package/dist/es/tools/shared/editor-command-dialog.js +3 -2
  33. package/dist/es/tools/source/editor-view-source-button.directive.js +5 -3
  34. package/dist/es/tools/tables/editor-add-column-after-button.directive.js +5 -3
  35. package/dist/es/tools/tables/editor-add-column-before-button.directive.js +5 -3
  36. package/dist/es/tools/tables/editor-add-row-after-button.directive.js +5 -3
  37. package/dist/es/tools/tables/editor-add-row-before-button.directive.js +5 -3
  38. package/dist/es/tools/tables/editor-delete-column-button.directive.js +5 -3
  39. package/dist/es/tools/tables/editor-delete-row-button.directive.js +5 -3
  40. package/dist/es/tools/tables/editor-delete-table-button.directive.js +5 -3
  41. package/dist/es/tools/tables/editor-merge-cells-button.directive.js +5 -3
  42. package/dist/es/tools/tables/editor-split-cell-button.directive.js +5 -3
  43. package/dist/es/tools/tools.service.js +20 -0
  44. package/dist/es/tools/typographical-emphasis/editor-bold-button.directive.js +5 -3
  45. package/dist/es/tools/typographical-emphasis/editor-italic-button.directive.js +5 -3
  46. package/dist/es/tools/typographical-emphasis/editor-strikethrough-button.directive.js +5 -3
  47. package/dist/es/tools/typographical-emphasis/editor-subscript-button.directive.js +5 -3
  48. package/dist/es/tools/typographical-emphasis/editor-superscript-button.directive.js +5 -3
  49. package/dist/es/tools/typographical-emphasis/editor-underline-button.directive.js +5 -3
  50. package/dist/es2015/common/error-messages.js +3 -2
  51. package/dist/es2015/common/paste-cleanup-settings.d.ts +14 -0
  52. package/dist/es2015/editor.component.d.ts +18 -11
  53. package/dist/es2015/editor.component.js +102 -69
  54. package/dist/es2015/index.d.ts +1 -0
  55. package/dist/es2015/index.js +1 -0
  56. package/dist/es2015/index.metadata.json +1 -1
  57. package/dist/es2015/main.d.ts +2 -0
  58. package/dist/es2015/main.js +1 -0
  59. package/dist/es2015/package-metadata.js +1 -1
  60. package/dist/es2015/preventable-events/paste-event-data.d.ts +21 -0
  61. package/dist/es2015/preventable-events/paste-event-data.js +4 -0
  62. package/dist/es2015/preventable-events/paste-event.d.ts +27 -0
  63. package/dist/es2015/preventable-events/paste-event.js +20 -0
  64. package/dist/es2015/tools/alignment/editor-align-center-button.directive.d.ts +2 -1
  65. package/dist/es2015/tools/alignment/editor-align-center-button.directive.js +5 -3
  66. package/dist/es2015/tools/alignment/editor-align-justify-button.directive.d.ts +2 -1
  67. package/dist/es2015/tools/alignment/editor-align-justify-button.directive.js +5 -3
  68. package/dist/es2015/tools/alignment/editor-align-left-button.directive.d.ts +2 -1
  69. package/dist/es2015/tools/alignment/editor-align-left-button.directive.js +5 -3
  70. package/dist/es2015/tools/alignment/editor-align-right-button.directive.d.ts +2 -1
  71. package/dist/es2015/tools/alignment/editor-align-right-button.directive.js +5 -3
  72. package/dist/es2015/tools/editor-clean-formatting-button.directive.d.ts +2 -1
  73. package/dist/es2015/tools/editor-clean-formatting-button.directive.js +5 -3
  74. package/dist/es2015/tools/fontfamily/editor-fontfamily.component.d.ts +3 -1
  75. package/dist/es2015/tools/fontfamily/editor-fontfamily.component.js +9 -3
  76. package/dist/es2015/tools/fontsize/editor-fontsize.component.d.ts +3 -1
  77. package/dist/es2015/tools/fontsize/editor-fontsize.component.js +9 -3
  78. package/dist/es2015/tools/format/editor-format.component.d.ts +3 -1
  79. package/dist/es2015/tools/format/editor-format.component.js +9 -3
  80. package/dist/es2015/tools/history/editor-redo-button.directive.d.ts +2 -1
  81. package/dist/es2015/tools/history/editor-redo-button.directive.js +5 -3
  82. package/dist/es2015/tools/history/editor-undo-button.directive.d.ts +2 -1
  83. package/dist/es2015/tools/history/editor-undo-button.directive.js +5 -3
  84. package/dist/es2015/tools/image/editor-insert-image-button.directive.d.ts +2 -1
  85. package/dist/es2015/tools/image/editor-insert-image-button.directive.js +5 -3
  86. package/dist/es2015/tools/indentation/editor-indent-button.directive.d.ts +2 -1
  87. package/dist/es2015/tools/indentation/editor-indent-button.directive.js +5 -3
  88. package/dist/es2015/tools/indentation/editor-outdent-button.directive.d.ts +2 -1
  89. package/dist/es2015/tools/indentation/editor-outdent-button.directive.js +5 -3
  90. package/dist/es2015/tools/link/editor-create-link-button.directive.d.ts +2 -1
  91. package/dist/es2015/tools/link/editor-create-link-button.directive.js +5 -3
  92. package/dist/es2015/tools/link/editor-insert-file-button.directive.d.ts +2 -1
  93. package/dist/es2015/tools/link/editor-insert-file-button.directive.js +5 -3
  94. package/dist/es2015/tools/link/editor-unlink-button.directive.d.ts +2 -1
  95. package/dist/es2015/tools/link/editor-unlink-button.directive.js +5 -3
  96. package/dist/es2015/tools/list/editor-insert-ordered-list-button.directive.d.ts +2 -1
  97. package/dist/es2015/tools/list/editor-insert-ordered-list-button.directive.js +5 -3
  98. package/dist/es2015/tools/list/editor-insert-unordered-list-button.directive.d.ts +2 -1
  99. package/dist/es2015/tools/list/editor-insert-unordered-list-button.directive.js +5 -3
  100. package/dist/es2015/tools/print/editor-print-button.directive.d.ts +2 -1
  101. package/dist/es2015/tools/print/editor-print-button.directive.js +5 -3
  102. package/dist/es2015/tools/select-all/select-all-button.directive.d.ts +2 -1
  103. package/dist/es2015/tools/select-all/select-all-button.directive.js +5 -3
  104. package/dist/es2015/tools/shared/editor-command-base.d.ts +3 -1
  105. package/dist/es2015/tools/shared/editor-command-base.js +3 -1
  106. package/dist/es2015/tools/shared/editor-command-button.d.ts +3 -1
  107. package/dist/es2015/tools/shared/editor-command-button.js +3 -2
  108. package/dist/es2015/tools/shared/editor-command-dialog.d.ts +3 -1
  109. package/dist/es2015/tools/shared/editor-command-dialog.js +3 -2
  110. package/dist/es2015/tools/source/editor-view-source-button.directive.d.ts +2 -1
  111. package/dist/es2015/tools/source/editor-view-source-button.directive.js +5 -3
  112. package/dist/es2015/tools/tables/editor-add-column-after-button.directive.d.ts +2 -1
  113. package/dist/es2015/tools/tables/editor-add-column-after-button.directive.js +5 -3
  114. package/dist/es2015/tools/tables/editor-add-column-before-button.directive.d.ts +2 -1
  115. package/dist/es2015/tools/tables/editor-add-column-before-button.directive.js +5 -3
  116. package/dist/es2015/tools/tables/editor-add-row-after-button.directive.d.ts +2 -1
  117. package/dist/es2015/tools/tables/editor-add-row-after-button.directive.js +5 -3
  118. package/dist/es2015/tools/tables/editor-add-row-before-button.directive.d.ts +2 -1
  119. package/dist/es2015/tools/tables/editor-add-row-before-button.directive.js +5 -3
  120. package/dist/es2015/tools/tables/editor-delete-column-button.directive.d.ts +2 -1
  121. package/dist/es2015/tools/tables/editor-delete-column-button.directive.js +5 -3
  122. package/dist/es2015/tools/tables/editor-delete-row-button.directive.d.ts +2 -1
  123. package/dist/es2015/tools/tables/editor-delete-row-button.directive.js +5 -3
  124. package/dist/es2015/tools/tables/editor-delete-table-button.directive.d.ts +2 -1
  125. package/dist/es2015/tools/tables/editor-delete-table-button.directive.js +5 -3
  126. package/dist/es2015/tools/tables/editor-merge-cells-button.directive.d.ts +2 -1
  127. package/dist/es2015/tools/tables/editor-merge-cells-button.directive.js +5 -3
  128. package/dist/es2015/tools/tables/editor-split-cell-button.directive.d.ts +2 -1
  129. package/dist/es2015/tools/tables/editor-split-cell-button.directive.js +5 -3
  130. package/dist/es2015/tools/tools.service.d.ts +11 -0
  131. package/dist/es2015/tools/tools.service.js +22 -0
  132. package/dist/es2015/tools/typographical-emphasis/editor-bold-button.directive.d.ts +2 -1
  133. package/dist/es2015/tools/typographical-emphasis/editor-bold-button.directive.js +5 -3
  134. package/dist/es2015/tools/typographical-emphasis/editor-italic-button.directive.d.ts +2 -1
  135. package/dist/es2015/tools/typographical-emphasis/editor-italic-button.directive.js +5 -3
  136. package/dist/es2015/tools/typographical-emphasis/editor-strikethrough-button.directive.d.ts +2 -1
  137. package/dist/es2015/tools/typographical-emphasis/editor-strikethrough-button.directive.js +5 -3
  138. package/dist/es2015/tools/typographical-emphasis/editor-subscript-button.directive.d.ts +2 -1
  139. package/dist/es2015/tools/typographical-emphasis/editor-subscript-button.directive.js +5 -3
  140. package/dist/es2015/tools/typographical-emphasis/editor-superscript-button.directive.d.ts +2 -1
  141. package/dist/es2015/tools/typographical-emphasis/editor-superscript-button.directive.js +5 -3
  142. package/dist/es2015/tools/typographical-emphasis/editor-underline-button.directive.d.ts +2 -1
  143. package/dist/es2015/tools/typographical-emphasis/editor-underline-button.directive.js +5 -3
  144. package/dist/fesm2015/index.js +301 -186
  145. package/dist/fesm5/index.js +302 -186
  146. package/dist/npm/common/error-messages.js +3 -1
  147. package/dist/npm/editor.component.js +98 -65
  148. package/dist/npm/index.js +2 -0
  149. package/dist/npm/main.js +2 -0
  150. package/dist/npm/package-metadata.js +1 -1
  151. package/dist/npm/preventable-events/paste-event-data.js +6 -0
  152. package/dist/npm/preventable-events/paste-event.js +27 -0
  153. package/dist/npm/tools/alignment/editor-align-center-button.directive.js +5 -3
  154. package/dist/npm/tools/alignment/editor-align-justify-button.directive.js +5 -3
  155. package/dist/npm/tools/alignment/editor-align-left-button.directive.js +5 -3
  156. package/dist/npm/tools/alignment/editor-align-right-button.directive.js +5 -3
  157. package/dist/npm/tools/editor-clean-formatting-button.directive.js +5 -3
  158. package/dist/npm/tools/fontfamily/editor-fontfamily.component.js +9 -3
  159. package/dist/npm/tools/fontsize/editor-fontsize.component.js +9 -3
  160. package/dist/npm/tools/format/editor-format.component.js +9 -3
  161. package/dist/npm/tools/history/editor-redo-button.directive.js +5 -3
  162. package/dist/npm/tools/history/editor-undo-button.directive.js +5 -3
  163. package/dist/npm/tools/image/editor-insert-image-button.directive.js +5 -3
  164. package/dist/npm/tools/indentation/editor-indent-button.directive.js +5 -3
  165. package/dist/npm/tools/indentation/editor-outdent-button.directive.js +5 -3
  166. package/dist/npm/tools/link/editor-create-link-button.directive.js +5 -3
  167. package/dist/npm/tools/link/editor-insert-file-button.directive.js +5 -3
  168. package/dist/npm/tools/link/editor-unlink-button.directive.js +5 -3
  169. package/dist/npm/tools/list/editor-insert-ordered-list-button.directive.js +5 -3
  170. package/dist/npm/tools/list/editor-insert-unordered-list-button.directive.js +5 -3
  171. package/dist/npm/tools/print/editor-print-button.directive.js +5 -3
  172. package/dist/npm/tools/select-all/select-all-button.directive.js +5 -3
  173. package/dist/npm/tools/shared/editor-command-base.js +3 -1
  174. package/dist/npm/tools/shared/editor-command-button.js +3 -2
  175. package/dist/npm/tools/shared/editor-command-dialog.js +3 -2
  176. package/dist/npm/tools/source/editor-view-source-button.directive.js +5 -3
  177. package/dist/npm/tools/tables/editor-add-column-after-button.directive.js +5 -3
  178. package/dist/npm/tools/tables/editor-add-column-before-button.directive.js +5 -3
  179. package/dist/npm/tools/tables/editor-add-row-after-button.directive.js +5 -3
  180. package/dist/npm/tools/tables/editor-add-row-before-button.directive.js +5 -3
  181. package/dist/npm/tools/tables/editor-delete-column-button.directive.js +5 -3
  182. package/dist/npm/tools/tables/editor-delete-row-button.directive.js +5 -3
  183. package/dist/npm/tools/tables/editor-delete-table-button.directive.js +5 -3
  184. package/dist/npm/tools/tables/editor-merge-cells-button.directive.js +5 -3
  185. package/dist/npm/tools/tables/editor-split-cell-button.directive.js +5 -3
  186. package/dist/npm/tools/tools.service.js +22 -0
  187. package/dist/npm/tools/typographical-emphasis/editor-bold-button.directive.js +5 -3
  188. package/dist/npm/tools/typographical-emphasis/editor-italic-button.directive.js +5 -3
  189. package/dist/npm/tools/typographical-emphasis/editor-strikethrough-button.directive.js +5 -3
  190. package/dist/npm/tools/typographical-emphasis/editor-subscript-button.directive.js +5 -3
  191. package/dist/npm/tools/typographical-emphasis/editor-superscript-button.directive.js +5 -3
  192. package/dist/npm/tools/typographical-emphasis/editor-underline-button.directive.js +5 -3
  193. package/dist/systemjs/kendo-angular-editor.js +1 -1
  194. package/package.json +4 -4
@@ -4,8 +4,9 @@
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  "use strict";
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- var ɵ0 = function (arg) { return "plugins must be a function, but received " + JSON.stringify(arg) + "."; };
7
+ var ɵ0 = function (arg) { return "plugins must be a function, but received " + JSON.stringify(arg) + "."; }, ɵ1 = function (arg) { return "pastedContent must be a function, but received " + JSON.stringify(arg) + "."; };
8
8
  exports.ɵ0 = ɵ0;
9
+ exports.ɵ1 = ɵ1;
9
10
  /* tslint:disable:variable-name */
10
11
  /**
11
12
  * @hidden
@@ -14,6 +15,7 @@ exports.EditorErrorMessages = {
14
15
  schemaType: 'Expected value of type Schema. See http://www.telerik.com/kendo-angular-ui/components/editor/schema/',
15
16
  setSchemaOnce: 'The Schema cannot be changed dynamically. See http://www.telerik.com/kendo-angular-ui/components/editor/schema/',
16
17
  pluginsCallbackType: ɵ0,
18
+ pastedContentCallbackType: ɵ1,
17
19
  setPluginsOnce: 'The plugins cannot be changed dynamically. See http://www.telerik.com/kendo-angular-ui/components/editor/plugins/',
18
20
  setPlaceHolderOnce: 'The placeholder cannot be changed dynamically. See http://www.telerik.com/kendo-angular-ui/components/editor/placeholder/',
19
21
  printTool: 'The Print tool and functionality are supported only in iframe mode. See https://www.telerik.com/kendo-angular-ui-develop/components/editor/api/EditorPrintButtonDirective/'
@@ -26,15 +26,17 @@ var kendo_angular_l10n_1 = require("@progress/kendo-angular-l10n");
26
26
  var editor_localization_service_1 = require("./localization/editor-localization.service");
27
27
  var styles_1 = require("./common/styles");
28
28
  var error_messages_1 = require("./common/error-messages");
29
+ var tools_service_1 = require("./tools/tools.service");
30
+ var paste_event_1 = require("./preventable-events/paste-event");
29
31
  var EMPTY_PARAGRAPH = '<p></p>';
30
32
  var defaultPasteCleanupSettings = {
31
33
  convertMsLists: false,
32
34
  removeAttributes: [],
33
35
  removeHtmlComments: false,
34
- removeInvalidHTML: false,
36
+ removeInvalidHTML: true,
35
37
  removeMsClasses: false,
36
38
  removeMsStyles: false,
37
- stripTags: ['']
39
+ stripTags: []
38
40
  };
39
41
  var removeCommentsIf = util_1.conditionallyExecute(kendo_editor_common_1.removeComments);
40
42
  var removeInvalidHTMLIf = util_1.conditionallyExecute(kendo_editor_common_1.sanitize);
@@ -57,13 +59,14 @@ exports.ɵ0 = ɵ0;
57
59
  * Represents the [Kendo UI Editor component for Angular]({% slug overview_editor %}).
58
60
  */
59
61
  var EditorComponent = /** @class */ (function () {
60
- function EditorComponent(dialogService, localization, cdr, ngZone, element) {
62
+ function EditorComponent(dialogService, localization, cdr, ngZone, element, toolsService) {
61
63
  var _this = this;
62
64
  this.dialogService = dialogService;
63
65
  this.localization = localization;
64
66
  this.cdr = cdr;
65
67
  this.ngZone = ngZone;
66
68
  this.element = element;
69
+ this.toolsService = toolsService;
67
70
  /**
68
71
  * If set to `false`, the Editor will run in style non-encapsulated mode. This means
69
72
  * that the styles of the page will be persisted in the Editor and its content will be affected by them.
@@ -75,14 +78,6 @@ var EditorComponent = /** @class */ (function () {
75
78
  * @default false
76
79
  */
77
80
  this.applyToWord = false;
78
- /**
79
- * By design, the Editor emits `valueChange`, updates the model and the ToolBar state on each keystroke.
80
- * When you are interested in ignoring the new values for a given amout of time and take only the most recent one, you can use the `updateInterval` property.
81
- * A possible use case is to get the new values and to update the ToolBar state at a maximum rate per second in order to speed up your application.
82
- * The specified interval (in milliseconds) should be a positive number.
83
- * By default the `updateInterval` is set to 100 miliseconds. If set to zero the delay will be disabled entirely.
84
- */
85
- this.updateInterval = 100;
86
81
  /**
87
82
  * By default, whitespace is collapsed as per HTML's rules.
88
83
  * Set to `true` to preserve whitespace, but normalize newlines to spaces.
@@ -108,6 +103,11 @@ var EditorComponent = /** @class */ (function () {
108
103
  * Fires when the content area of the Editor is focused ([see example]({% slug overview_editor %}#toc-events)).
109
104
  */
110
105
  this.onFocus = new core_1.EventEmitter();
106
+ /**
107
+ * Fires when the user performs paste in the content area of the Editor ([see example]({% slug overview_editor %}#toc-events)).
108
+ * The event is preventable. If you cancel it, the Editor content will not change.
109
+ */
110
+ this.paste = new core_1.EventEmitter();
111
111
  /**
112
112
  * Fires when the content area of the Editor is blurred ([see example]({% slug overview_editor %}#toc-events)).
113
113
  */
@@ -123,10 +123,73 @@ var EditorComponent = /** @class */ (function () {
123
123
  this.valueModified = new rxjs_1.Subject();
124
124
  this._readonly = false;
125
125
  this._placeholder = '';
126
+ this.inForm = false;
126
127
  this.afterViewInit = new rxjs_1.Subject();
127
128
  this.contentAreaLoaded = new rxjs_1.Subject();
128
- this.onChangeCallback = function (_) { }; // tslint:disable-line:no-empty
129
+ this.dispatchTransaction = function (tr) {
130
+ var docChanged = tr.docChanged;
131
+ if (docChanged) {
132
+ var doc = tr.doc;
133
+ var html_1 = kendo_editor_common_1.getHtml({ doc: doc });
134
+ _this.trOnChange = tr;
135
+ _this.htmlOnChange = html_1;
136
+ _this.ngZone.run(function () {
137
+ _this.valueModified.next(html_1);
138
+ });
139
+ }
140
+ if (!docChanged || _this.inForm) {
141
+ _this.view.updateState(_this.view.state.apply(tr));
142
+ }
143
+ };
144
+ this.transformPastedHTML = function (dirtyHtml) {
145
+ var pasteCleanupSettings = tslib_1.__assign({}, defaultPasteCleanupSettings, _this.pasteCleanupSettings);
146
+ var html = util_1.pipe(removeInvalidHTMLIf(pasteCleanupSettings.removeInvalidHTML), removeCommentsIf(pasteCleanupSettings.removeHtmlComments))(dirtyHtml);
147
+ var clean = kendo_editor_common_1.pasteCleanup(html, {
148
+ convertMsLists: pasteCleanupSettings.convertMsLists,
149
+ stripTags: pasteCleanupSettings.stripTags.join('|'),
150
+ attributes: getPasteCleanupAttributes(pasteCleanupSettings)
151
+ });
152
+ if (kendo_angular_common_1.hasObservers(_this.paste)) {
153
+ var event_1 = new paste_event_1.EditorPasteEvent(clean, dirtyHtml, _this._pasteEvent);
154
+ _this.ngZone.run(function () { return _this.paste.emit(event_1); });
155
+ return event_1.isDefaultPrevented() ? '' : event_1.cleanedHtml;
156
+ }
157
+ return clean;
158
+ };
159
+ this.changeValue = function (value) {
160
+ var prev = _this._value;
161
+ _this._value = value;
162
+ if (!_this._view) {
163
+ return;
164
+ }
165
+ if (_this.htmlOnChange === value && _this.trOnChange) {
166
+ _this.view.updateState(_this.view.state.apply(_this.trOnChange));
167
+ }
168
+ else {
169
+ if ((prev || '') !== (value || '')) {
170
+ var iframeContentWindowNotPresent = _this.iframe && !_this.container.element.nativeElement.contentWindow;
171
+ if (iframeContentWindowNotPresent) {
172
+ return;
173
+ }
174
+ var state = _this.view.state;
175
+ var nextDoc = kendo_editor_common_1.parseContent(value || '', state.schema, { preserveWhitespace: _this.preserveWhitespace });
176
+ var tr = state.tr
177
+ .setSelection(new kendo_editor_common_1.AllSelection(state.doc))
178
+ .replaceSelectionWith(nextDoc);
179
+ _this.view.updateState(state.apply(tr));
180
+ }
181
+ }
182
+ _this.trOnChange = null;
183
+ _this.htmlOnChange = null;
184
+ };
185
+ this.onChangeCallback = function (value) {
186
+ _this.changeValue(value);
187
+ };
129
188
  this.onTouchedCallback = function (_) { }; // tslint:disable-line:no-empty
189
+ this.onPaste = function (_view, nativeEvent) {
190
+ _this._pasteEvent = nativeEvent;
191
+ return false;
192
+ };
130
193
  kendo_licensing_1.validatePackage(package_metadata_1.packageMetadata);
131
194
  this.direction = localization.rtl ? 'rtl' : 'ltr';
132
195
  // https://stackoverflow.com/questions/56572483/chrome-is-synchronously-handling-iframe-loading-whereas-firefox-handles-it-asyn
@@ -135,6 +198,9 @@ var EditorComponent = /** @class */ (function () {
135
198
  EditorComponent_1 = EditorComponent;
136
199
  Object.defineProperty(EditorComponent.prototype, "value", {
137
200
  get: function () {
201
+ if (this.trOnChange) {
202
+ return this.htmlOnChange;
203
+ }
138
204
  var value = this._view ? this.getSource() : this._value;
139
205
  if (value === EMPTY_PARAGRAPH) {
140
206
  return this._value ? '' : this._value;
@@ -147,23 +213,7 @@ var EditorComponent = /** @class */ (function () {
147
213
  * Sets the value of the Editor ([see example]({% slug overview_editor %}#toc-basic-usage)).
148
214
  */
149
215
  set: function (value) {
150
- if (this._previousValue === value) {
151
- return;
152
- }
153
- this._value = value;
154
- this._previousValue = value;
155
- if (this._view) {
156
- var iframeContentWindowNotPresent = this.iframe && !this.container.element.nativeElement.contentWindow;
157
- if (iframeContentWindowNotPresent) {
158
- return;
159
- }
160
- this.exec('setHTML', {
161
- content: this._value || '',
162
- parseOptions: {
163
- preserveWhitespace: this.preserveWhitespace
164
- }
165
- });
166
- }
216
+ this.changeValue(value);
167
217
  },
168
218
  enumerable: true,
169
219
  configurable: true
@@ -411,6 +461,7 @@ var EditorComponent = /** @class */ (function () {
411
461
  var rtl = _a.rtl;
412
462
  _this.direction = rtl ? 'rtl' : 'ltr';
413
463
  }));
464
+ this.subs.add(this.toolsService.needsCheck.subscribe(function () { return _this.cdr.markForCheck(); }));
414
465
  };
415
466
  EditorComponent.prototype.ngAfterViewInit = function () {
416
467
  this.afterViewInit.next();
@@ -423,6 +474,9 @@ var EditorComponent = /** @class */ (function () {
423
474
  };
424
475
  EditorComponent.prototype.ngOnChanges = function (changes) {
425
476
  var _this = this;
477
+ if (changes.value && this.view) {
478
+ this.changeValue(changes.value.currentValue);
479
+ }
426
480
  if (changes.iframe && !changes.iframe.isFirstChange()) {
427
481
  this.ngZone.onStable.pipe(operators_1.take(1)).subscribe(function () { return _this.initialize(); });
428
482
  }
@@ -508,8 +562,6 @@ var EditorComponent = /** @class */ (function () {
508
562
  var command = commands_1.editorCommands[commandName](attr);
509
563
  // Executes a ProseMirror command.
510
564
  command(this._view.state, this._view.dispatch, this._view);
511
- // See the `dispatchTransaction` comments.
512
- // this.stateChange.emit(updateToolBar(this.view));
513
565
  };
514
566
  /**
515
567
  * Opens a dialog.
@@ -594,6 +646,7 @@ var EditorComponent = /** @class */ (function () {
594
646
  * @hidden
595
647
  */
596
648
  EditorComponent.prototype.writeValue = function (value) {
649
+ this.inForm = true;
597
650
  // To avoid confusion, non-existent values are always undefined.
598
651
  this.value = value === null ? undefined : value;
599
652
  };
@@ -622,7 +675,6 @@ var EditorComponent = /** @class */ (function () {
622
675
  return;
623
676
  }
624
677
  var currentSchema = this.schema || schema_1.schema;
625
- var that = this;
626
678
  var containerNativeElement = this.container.element.nativeElement;
627
679
  var contentNode = kendo_editor_common_1.parseContent((this.value || '').trim(), currentSchema, { preserveWhitespace: this.preserveWhitespace });
628
680
  if (this.iframe) {
@@ -666,7 +718,7 @@ var EditorComponent = /** @class */ (function () {
666
718
  }),
667
719
  new kendo_editor_common_1.Plugin({
668
720
  key: new kendo_editor_common_1.PluginKey('editor-filter-disabled-state'),
669
- filterTransaction: function () { return !_this.disabled; }
721
+ filterTransaction: function () { return !_this.disabled || _this.inForm; }
670
722
  }),
671
723
  kendo_editor_common_1.history(),
672
724
  kendo_editor_common_1.keymap(kendo_editor_common_1.buildListKeymap(currentSchema)),
@@ -693,31 +745,10 @@ var EditorComponent = /** @class */ (function () {
693
745
  _this._view = new kendo_editor_common_1.EditorView({ mount: _this.viewMountElement }, {
694
746
  state: state,
695
747
  editable: function () { return !_this.readonly; },
696
- dispatchTransaction: function (tr) {
697
- // `this` is bound to the view instance.
698
- this.updateState(this.state.apply(tr));
699
- // that.cdr.detectChanges();
700
- // When the user utilizes keyboard shortcuts&mdash;for example, `Ctrl`+`b`&mdash;
701
- // `tr.docChanged` is `true` and the toolbar is not updated.
702
- // A possible future solution is to move the keymaps to the service.
703
- // if (!tr.docChanged) {
704
- // that.stateChange.emit(updateToolBar(that.view));
705
- // }
706
- var value = that.value;
707
- if (!kendo_editor_common_1.hasSameMarkup(value, that._previousValue, this.state.schema)) {
708
- that._previousValue = value;
709
- that.ngZone.run(function () { return that.valueModified.next(value); });
710
- }
711
- },
712
- transformPastedHTML: function (html) {
713
- var pasteCleanupSettings = tslib_1.__assign({}, defaultPasteCleanupSettings, _this.pasteCleanupSettings);
714
- var clean = util_1.pipe(removeCommentsIf(pasteCleanupSettings.removeHtmlComments), removeInvalidHTMLIf(pasteCleanupSettings.removeInvalidHTML))(html);
715
- var attributes = getPasteCleanupAttributes(pasteCleanupSettings);
716
- return kendo_editor_common_1.pasteCleanup(clean, {
717
- convertMsLists: pasteCleanupSettings.convertMsLists,
718
- stripTags: pasteCleanupSettings.stripTags.join('|'),
719
- attributes: attributes
720
- });
748
+ dispatchTransaction: _this.dispatchTransaction,
749
+ transformPastedHTML: _this.transformPastedHTML,
750
+ handleDOMEvents: {
751
+ paste: _this.onPaste
721
752
  }
722
753
  });
723
754
  });
@@ -758,7 +789,7 @@ var EditorComponent = /** @class */ (function () {
758
789
  _this.cdr.detectChanges();
759
790
  }
760
791
  }));
761
- this.subs.add(rxjs_1.merge(this.valueModified.pipe(operators_1.filter(function () { return _this.updateInterval > 0; }), operators_1.auditTime(this.updateInterval)), this.valueModified.pipe(operators_1.filter(function () { return _this.updateInterval === 0; }))).subscribe(function (value) {
792
+ this.subs.add(this.valueModified.subscribe(function (value) {
762
793
  _this.onChangeCallback(value);
763
794
  _this.valueChange.emit(value);
764
795
  _this.cdr.markForCheck();
@@ -852,10 +883,6 @@ var EditorComponent = /** @class */ (function () {
852
883
  tslib_1.__metadata("design:type", String),
853
884
  tslib_1.__metadata("design:paramtypes", [String])
854
885
  ], EditorComponent.prototype, "placeholder", null);
855
- tslib_1.__decorate([
856
- core_1.Input(),
857
- tslib_1.__metadata("design:type", Number)
858
- ], EditorComponent.prototype, "updateInterval", void 0);
859
886
  tslib_1.__decorate([
860
887
  core_1.Input(),
861
888
  tslib_1.__metadata("design:type", Object)
@@ -876,6 +903,10 @@ var EditorComponent = /** @class */ (function () {
876
903
  core_1.Output('focus'),
877
904
  tslib_1.__metadata("design:type", core_1.EventEmitter)
878
905
  ], EditorComponent.prototype, "onFocus", void 0);
906
+ tslib_1.__decorate([
907
+ core_1.Output(),
908
+ tslib_1.__metadata("design:type", core_1.EventEmitter)
909
+ ], EditorComponent.prototype, "paste", void 0);
879
910
  tslib_1.__decorate([
880
911
  core_1.Output('blur'),
881
912
  tslib_1.__metadata("design:type", core_1.EventEmitter)
@@ -963,6 +994,7 @@ var EditorComponent = /** @class */ (function () {
963
994
  selector: 'kendo-editor',
964
995
  providers: [
965
996
  editor_localization_service_1.EditorLocalizationService,
997
+ tools_service_1.EditorToolsService,
966
998
  {
967
999
  provide: kendo_angular_l10n_1.LocalizationService,
968
1000
  useExisting: editor_localization_service_1.EditorLocalizationService
@@ -982,7 +1014,7 @@ var EditorComponent = /** @class */ (function () {
982
1014
  }
983
1015
  ],
984
1016
  /* tslint:disable:max-line-length */
985
- template: "\n <ng-container\n kendoEditorLocalizedMessages\n i18n-alignCenter=\"kendo.editor.alignCenter|The title of the tool that aligns text in the center.\"\n alignCenter=\"Center text\"\n i18n-alignJustify=\"kendo.editor.alignJustify|The title of the tool that justifies text both left and right.\"\n alignJustify=\"Justify\"\n i18n-alignLeft=\"kendo.editor.alignLeft|The title of the tool that aligns text on the left.\"\n alignLeft=\"Align text left\"\n i18n-alignRight=\"kendo.editor.alignRight|The title of the tool that aligns text on the right.\"\n alignRight=\"Align text right\"\n i18n-backColor=\"kendo.editor.backColor|The title of the tool that changes the text background color.\"\n backColor=\"Background color\"\n i18n-bold=\"kendo.editor.bold|The title of the tool that makes text bold.\"\n bold=\"Bold\"\n i18n-cleanFormatting=\"kendo.editor.cleanFormatting|The title of the Clean Formatting tool.\"\n cleanFormatting=\"Clean formatting\"\n i18n-createLink=\"kendo.editor.createLink|The title of the tool that creates hyperlinks.\"\n createLink=\"Insert link\"\n i18n-dialogApply=\"kendo.editor.dialogApply|The label of the **Apply** button in all editor dialogs.\"\n dialogApply=\"Apply\"\n i18n-dialogCancel=\"kendo.editor.dialogCancel|The label of the **Cancel** button in all editor dialogs.\"\n dialogCancel=\"Cancel\"\n i18n-dialogInsert=\"kendo.editor.dialogInsert|The label of the **Insert** button in all editor dialogs.\"\n dialogInsert=\"Insert\"\n i18n-dialogUpdate=\"kendo.editor.dialogUpdate|The label of the **Update** button in all editor dialogs.\"\n dialogUpdate=\"Update\"\n i18n-fileText=\"kendo.editor.fileText|The caption for the file text in the insertFile dialog.\"\n fileText=\"Text\"\n i18n-fileTitle=\"kendo.editor.fileTitle|The caption for the file Title in the insertFile dialog.\"\n fileTitle=\"Title\"\n i18n-fileWebAddress=\"kendo.editor.fileWebAddress|The caption for the file URL in the insertFile dialog.\"\n fileWebAddress=\"Web address\"\n i18n-fontFamily=\"kendo.editor.fontFamily|The title of the tool that changes the text font.\"\n fontFamily=\"Select font family\"\n i18n-fontSize=\"kendo.editor.fontSize|The title of the tool that changes the text size.\"\n fontSize=\"Select font size\"\n i18n-foreColor=\"kendo.editor.foreColor|The title of the tool that changes the text color.\"\n foreColor=\"Color\"\n i18n-format=\"kendo.editor.format|The title of the tool that lets users choose block formats.\"\n format=\"Format\"\n i18n-imageAltText=\"kendo.editor.imageAltText|The caption for the image alternate text in the insertImage dialog.\"\n imageAltText=\"Alternate text\"\n i18n-imageHeight=\"kendo.editor.imageHeight|The caption for the image height in the insertImage dialog.\"\n imageHeight=\"Height (px)\"\n i18n-imageWebAddress=\"kendo.editor.imageWebAddress|The caption for the image URL in the insertImage dialog.\"\n imageWebAddress=\"Web address\"\n i18n-imageWidth=\"kendo.editor.imageWidth|The caption for the image width in the insertImage dialog.\"\n imageWidth=\"Width (px)\"\n i18n-indent=\"kendo.editor.indent|The title of the tool that indents the content.\"\n indent=\"Indent\"\n i18n-insertFile=\"kendo.editor.insertFile|The title of the tool that inserts links to files.\"\n insertFile=\"Insert file\"\n i18n-insertImage=\"kendo.editor.insertImage|The title of the tool that inserts images.\"\n insertImage=\"Insert image\"\n i18n-insertOrderedList=\"kendo.editor.insertOrderedList|The title of the tool that inserts an ordered list.\"\n insertOrderedList=\"Insert ordered list\"\n i18n-insertUnorderedList=\"kendo.editor.insertUnorderedList|The title of the tool that inserts an unordered list.\"\n insertUnorderedList=\"Insert unordered list\"\n i18n-italic=\"kendo.editor.italic|The title of the tool that makes text italicized.\"\n italic=\"Italic\"\n i18n-linkOpenInNewWindow=\"kendo.editor.linkOpenInNewWindow|The caption for the checkbox for opening the link in a new window in the createLink dialog.\"\n linkOpenInNewWindow=\"Open link in new window\"\n i18n-linkText=\"kendo.editor.linkText|The caption for the link text in the createLink dialog.\"\n linkText=\"Text\"\n i18n-linkTitle=\"kendo.editor.linkTitle|The caption for the link title in the createLink dialog.\"\n linkTitle=\"Title\"\n i18n-linkWebAddress=\"kendo.editor.linkWebAddress|The caption for the URL in the createLink dialog.\"\n linkWebAddress=\"Web address\"\n i18n-outdent=\"kendo.editor.outdent|The title of the tool that outdents the content.\"\n outdent=\"Outdent\"\n i18n-print=\"kendo.editor.print|The title of the print tool.\"\n print=\"Print\"\n i18n-redo=\"kendo.editor.redo|The title of the tool that undos the last action.\"\n redo=\"Redo\"\n i18n-selectAll=\"kendo.editor.selectAll|The title of the tool that selects all content.\"\n selectAll=\"Select All\"\n i18n-strikethrough=\"kendo.editor.strikethrough|The title of the tool that strikes through text.\"\n strikethrough=\"Strikethrough\"\n i18n-subscript=\"kendo.editor.subscript|The title of the tool that makes text subscript.\"\n subscript=\"Subscript\"\n i18n-superscript=\"kendo.editor.superscript|The title of the tool that makes text superscript.\"\n superscript=\"Superscript\"\n i18n-underline=\"kendo.editor.underline|The title of the tool that underlines text.\"\n underline=\"Underline\"\n i18n-unlink=\"kendo.editor.unlink|The title of the tool that removes hyperlinks.\"\n unlink=\"Remove Link\"\n i18n-undo=\"kendo.editor.undo|The title of the tool that undos the last action.\"\n undo=\"Undo\"\n i18n-viewSource=\"kendo.editor.viewSource|The title of the tool that shows the editor value as HTML.\"\n viewSource=\"View source\"\n i18n-insertTable=\"kendo.editor.insertTable|The title of the tool that inserts table.\"\n insertTable=\"Insert Table\"\n i18n-addColumnBefore=\"kendo.editor.addColumnBefore|The title of the tool that adds new column before currently selected column.\"\n addColumnBefore=\"Add column before\"\n i18n-addColumnAfter=\"kendo.editor.addColumnAfter|The title of the tool that adds new column after currently selected column.\"\n addColumnAfter=\"Add column after\"\n i18n-addRowBefore=\"kendo.editor.addRowBefore|The title of the tool that adds new row before currently selected row.\"\n addRowBefore=\"Add row before\"\n i18n-addRowAfter=\"kendo.editor.addRowAfter|The title of the tool that adds new row after currently selected row.\"\n addRowAfter=\"Add row after\"\n i18n-deleteColumn=\"kendo.editor.deleteColumn|The title of the tool that deletes a table column.\"\n deleteColumn=\"Delete column\"\n i18n-deleteRow=\"kendo.editor.deleteRow|The title of the tool that deletes a table row.\"\n deleteRow=\"Delete row\"\n i18n-deleteTable=\"kendo.editor.deleteTable|The title of the tool that deletes a table.\"\n deleteTable=\"Delete table\"\n >\n </ng-container>\n\n <ng-content select=\"kendo-toolbar\"></ng-content>\n <kendo-toolbar [overflow]=\"true\" [tabindex]=\"readonly ? -1 : 0\" *ngIf=\"!userToolBarElement\" #defaultToolbar>\n <kendo-toolbar-buttongroup>\n <kendo-toolbar-button kendoEditorBoldButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorItalicButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorUnderlineButton></kendo-toolbar-button>\n </kendo-toolbar-buttongroup>\n <kendo-toolbar-dropdownlist kendoEditorFormat></kendo-toolbar-dropdownlist>\n <kendo-toolbar-buttongroup>\n <kendo-toolbar-button kendoEditorAlignLeftButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorAlignCenterButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorAlignRightButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorAlignJustifyButton></kendo-toolbar-button>\n </kendo-toolbar-buttongroup>\n <kendo-toolbar-buttongroup>\n <kendo-toolbar-button kendoEditorInsertUnorderedListButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorInsertOrderedListButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorIndentButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorOutdentButton></kendo-toolbar-button>\n </kendo-toolbar-buttongroup>\n <kendo-toolbar-buttongroup>\n <kendo-toolbar-button kendoEditorCreateLinkButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorUnlinkButton></kendo-toolbar-button>\n </kendo-toolbar-buttongroup>\n <kendo-toolbar-button kendoEditorInsertImageButton></kendo-toolbar-button>\n </kendo-toolbar>\n\n <div *ngIf=\"!iframe\" #content [attr.dir]=\"direction\" class=\"k-editor-content\"></div>\n\n <div class=\"k-editor-content\" *ngIf=\"iframe\">\n <iframe #content frameborder=\"0\" class=\"k-iframe\" (load)=\"iframeOnLoad()\"></iframe>\n </div>\n\n <ng-container #dialogsContainer></ng-container>\n ",
1017
+ template: "\n <ng-container\n kendoEditorLocalizedMessages\n i18n-alignCenter=\"kendo.editor.alignCenter|The title of the tool that aligns text in the center.\"\n alignCenter=\"Center text\"\n i18n-alignJustify=\"kendo.editor.alignJustify|The title of the tool that justifies text both left and right.\"\n alignJustify=\"Justify\"\n i18n-alignLeft=\"kendo.editor.alignLeft|The title of the tool that aligns text on the left.\"\n alignLeft=\"Align text left\"\n i18n-alignRight=\"kendo.editor.alignRight|The title of the tool that aligns text on the right.\"\n alignRight=\"Align text right\"\n i18n-backColor=\"kendo.editor.backColor|The title of the tool that changes the text background color.\"\n backColor=\"Background color\"\n i18n-bold=\"kendo.editor.bold|The title of the tool that makes text bold.\"\n bold=\"Bold\"\n i18n-cleanFormatting=\"kendo.editor.cleanFormatting|The title of the Clean Formatting tool.\"\n cleanFormatting=\"Clean formatting\"\n i18n-createLink=\"kendo.editor.createLink|The title of the tool that creates hyperlinks.\"\n createLink=\"Insert link\"\n i18n-dialogApply=\"kendo.editor.dialogApply|The label of the **Apply** button in all editor dialogs.\"\n dialogApply=\"Apply\"\n i18n-dialogCancel=\"kendo.editor.dialogCancel|The label of the **Cancel** button in all editor dialogs.\"\n dialogCancel=\"Cancel\"\n i18n-dialogInsert=\"kendo.editor.dialogInsert|The label of the **Insert** button in all editor dialogs.\"\n dialogInsert=\"Insert\"\n i18n-dialogUpdate=\"kendo.editor.dialogUpdate|The label of the **Update** button in all editor dialogs.\"\n dialogUpdate=\"Update\"\n i18n-fileText=\"kendo.editor.fileText|The caption for the file text in the insertFile dialog.\"\n fileText=\"Text\"\n i18n-fileTitle=\"kendo.editor.fileTitle|The caption for the file Title in the insertFile dialog.\"\n fileTitle=\"Title\"\n i18n-fileWebAddress=\"kendo.editor.fileWebAddress|The caption for the file URL in the insertFile dialog.\"\n fileWebAddress=\"Web address\"\n i18n-fontFamily=\"kendo.editor.fontFamily|The title of the tool that changes the text font.\"\n fontFamily=\"Select font family\"\n i18n-fontSize=\"kendo.editor.fontSize|The title of the tool that changes the text size.\"\n fontSize=\"Select font size\"\n i18n-foreColor=\"kendo.editor.foreColor|The title of the tool that changes the text color.\"\n foreColor=\"Color\"\n i18n-format=\"kendo.editor.format|The title of the tool that lets users choose block formats.\"\n format=\"Format\"\n i18n-imageAltText=\"kendo.editor.imageAltText|The caption for the image alternate text in the insertImage dialog.\"\n imageAltText=\"Alternate text\"\n i18n-imageHeight=\"kendo.editor.imageHeight|The caption for the image height in the insertImage dialog.\"\n imageHeight=\"Height (px)\"\n i18n-imageWebAddress=\"kendo.editor.imageWebAddress|The caption for the image URL in the insertImage dialog.\"\n imageWebAddress=\"Web address\"\n i18n-imageWidth=\"kendo.editor.imageWidth|The caption for the image width in the insertImage dialog.\"\n imageWidth=\"Width (px)\"\n i18n-indent=\"kendo.editor.indent|The title of the tool that indents the content.\"\n indent=\"Indent\"\n i18n-insertFile=\"kendo.editor.insertFile|The title of the tool that inserts links to files.\"\n insertFile=\"Insert file\"\n i18n-insertImage=\"kendo.editor.insertImage|The title of the tool that inserts images.\"\n insertImage=\"Insert image\"\n i18n-insertOrderedList=\"kendo.editor.insertOrderedList|The title of the tool that inserts an ordered list.\"\n insertOrderedList=\"Insert ordered list\"\n i18n-insertUnorderedList=\"kendo.editor.insertUnorderedList|The title of the tool that inserts an unordered list.\"\n insertUnorderedList=\"Insert unordered list\"\n i18n-italic=\"kendo.editor.italic|The title of the tool that makes text italicized.\"\n italic=\"Italic\"\n i18n-linkOpenInNewWindow=\"kendo.editor.linkOpenInNewWindow|The caption for the checkbox for opening the link in a new window in the createLink dialog.\"\n linkOpenInNewWindow=\"Open link in new window\"\n i18n-linkText=\"kendo.editor.linkText|The caption for the link text in the createLink dialog.\"\n linkText=\"Text\"\n i18n-linkTitle=\"kendo.editor.linkTitle|The caption for the link title in the createLink dialog.\"\n linkTitle=\"Title\"\n i18n-linkWebAddress=\"kendo.editor.linkWebAddress|The caption for the URL in the createLink dialog.\"\n linkWebAddress=\"Web address\"\n i18n-outdent=\"kendo.editor.outdent|The title of the tool that outdents the content.\"\n outdent=\"Outdent\"\n i18n-print=\"kendo.editor.print|The title of the print tool.\"\n print=\"Print\"\n i18n-redo=\"kendo.editor.redo|The title of the tool that undos the last action.\"\n redo=\"Redo\"\n i18n-selectAll=\"kendo.editor.selectAll|The title of the tool that selects all content.\"\n selectAll=\"Select All\"\n i18n-strikethrough=\"kendo.editor.strikethrough|The title of the tool that strikes through text.\"\n strikethrough=\"Strikethrough\"\n i18n-subscript=\"kendo.editor.subscript|The title of the tool that makes text subscript.\"\n subscript=\"Subscript\"\n i18n-superscript=\"kendo.editor.superscript|The title of the tool that makes text superscript.\"\n superscript=\"Superscript\"\n i18n-underline=\"kendo.editor.underline|The title of the tool that underlines text.\"\n underline=\"Underline\"\n i18n-unlink=\"kendo.editor.unlink|The title of the tool that removes hyperlinks.\"\n unlink=\"Remove Link\"\n i18n-undo=\"kendo.editor.undo|The title of the tool that undos the last action.\"\n undo=\"Undo\"\n i18n-viewSource=\"kendo.editor.viewSource|The title of the tool that shows the editor value as HTML.\"\n viewSource=\"View source\"\n i18n-insertTable=\"kendo.editor.insertTable|The title of the tool that inserts table.\"\n insertTable=\"Insert Table\"\n i18n-addColumnBefore=\"kendo.editor.addColumnBefore|The title of the tool that adds new column before currently selected column.\"\n addColumnBefore=\"Add column before\"\n i18n-addColumnAfter=\"kendo.editor.addColumnAfter|The title of the tool that adds new column after currently selected column.\"\n addColumnAfter=\"Add column after\"\n i18n-addRowBefore=\"kendo.editor.addRowBefore|The title of the tool that adds new row before currently selected row.\"\n addRowBefore=\"Add row before\"\n i18n-addRowAfter=\"kendo.editor.addRowAfter|The title of the tool that adds new row after currently selected row.\"\n addRowAfter=\"Add row after\"\n i18n-deleteColumn=\"kendo.editor.deleteColumn|The title of the tool that deletes a table column.\"\n deleteColumn=\"Delete column\"\n i18n-deleteRow=\"kendo.editor.deleteRow|The title of the tool that deletes a table row.\"\n deleteRow=\"Delete row\"\n i18n-deleteTable=\"kendo.editor.deleteTable|The title of the tool that deletes a table.\"\n deleteTable=\"Delete table\"\n >\n </ng-container>\n\n <ng-content select=\"kendo-toolbar\"></ng-content>\n <kendo-toolbar [overflow]=\"true\" [tabindex]=\"readonly ? -1 : 0\" *ngIf=\"!userToolBarElement\" #defaultToolbar>\n <kendo-toolbar-buttongroup>\n <kendo-toolbar-button kendoEditorBoldButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorItalicButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorUnderlineButton></kendo-toolbar-button>\n </kendo-toolbar-buttongroup>\n <kendo-toolbar-dropdownlist kendoEditorFormat></kendo-toolbar-dropdownlist>\n <kendo-toolbar-buttongroup>\n <kendo-toolbar-button kendoEditorAlignLeftButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorAlignCenterButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorAlignRightButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorAlignJustifyButton></kendo-toolbar-button>\n </kendo-toolbar-buttongroup>\n <kendo-toolbar-buttongroup>\n <kendo-toolbar-button kendoEditorInsertUnorderedListButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorInsertOrderedListButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorIndentButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorOutdentButton></kendo-toolbar-button>\n </kendo-toolbar-buttongroup>\n <kendo-toolbar-buttongroup>\n <kendo-toolbar-button kendoEditorCreateLinkButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorUnlinkButton></kendo-toolbar-button>\n </kendo-toolbar-buttongroup>\n <kendo-toolbar-button kendoEditorInsertImageButton></kendo-toolbar-button>\n </kendo-toolbar>\n\n <div *ngIf=\"!iframe\" #content [attr.dir]=\"direction\" class=\"k-editor-content\"></div>\n\n <div class=\"k-editor-content\" *ngIf=\"iframe\">\n <iframe #content srcdoc=\"<!DOCTYPE html>\" frameborder=\"0\" class=\"k-iframe\" (load)=\"iframeOnLoad()\"></iframe>\n </div>\n\n <ng-container #dialogsContainer></ng-container>\n ",
986
1018
  styles: [
987
1019
  "\n >>> .k-editor-content > .ProseMirror {\n height: 100%;\n width: 100%;\n box-sizing: border-box;\n outline: none;\n overflow: auto;\n }\n\n .k-iframe {\n width: 100%;\n height: 100%;\n display: block;\n }\n "
988
1020
  ]
@@ -991,7 +1023,8 @@ var EditorComponent = /** @class */ (function () {
991
1023
  kendo_angular_l10n_1.LocalizationService,
992
1024
  core_1.ChangeDetectorRef,
993
1025
  core_1.NgZone,
994
- core_1.ElementRef])
1026
+ core_1.ElementRef,
1027
+ tools_service_1.EditorToolsService])
995
1028
  ], EditorComponent);
996
1029
  return EditorComponent;
997
1030
  }());
package/dist/npm/index.js CHANGED
@@ -117,6 +117,8 @@ var editor_split_cell_button_directive_1 = require("./tools/tables/editor-split-
117
117
  exports.EditorSplitCellButtonDirective = editor_split_cell_button_directive_1.EditorSplitCellButtonDirective
118
118
  var popup_table_grid_component_1 = require("./tools/tables/popup-table-grid.component");
119
119
  exports.PopupTableGridComponent = popup_table_grid_component_1.PopupTableGridComponent
120
+ var tools_service_1 = require("./tools/tools.service");
121
+ exports.EditorToolsService = tools_service_1.EditorToolsService
120
122
  var editor_bold_button_directive_1 = require("./tools/typographical-emphasis/editor-bold-button.directive");
121
123
  exports.EditorBoldButtonDirective = editor_bold_button_directive_1.EditorBoldButtonDirective
122
124
  var editor_italic_button_directive_1 = require("./tools/typographical-emphasis/editor-italic-button.directive");
package/dist/npm/main.js CHANGED
@@ -34,3 +34,5 @@ exports.dropCursor = kendo_editor_common_1.dropCursor;
34
34
  exports.gapCursor = kendo_editor_common_1.gapCursor;
35
35
  exports.tableNodes = kendo_editor_common_1.tableNodes;
36
36
  exports.getSelectionText = kendo_editor_common_1.getSelectionText;
37
+ var paste_event_1 = require("./preventable-events/paste-event");
38
+ exports.EditorPasteEvent = paste_event_1.EditorPasteEvent;
@@ -11,7 +11,7 @@ exports.packageMetadata = {
11
11
  name: '@progress/kendo-angular-editor',
12
12
  productName: 'Kendo UI for Angular',
13
13
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
14
- publishDate: 1637743184,
14
+ publishDate: 1640097479,
15
15
  version: '',
16
16
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
17
17
  };
@@ -0,0 +1,6 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ "use strict";
6
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,27 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ "use strict";
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ var tslib_1 = require("tslib");
8
+ var kendo_angular_common_1 = require("@progress/kendo-angular-common");
9
+ /**
10
+ * The Editor [`paste`]({% slug api_editor_editorcomponent %}#toc-paste) event.
11
+ */
12
+ var EditorPasteEvent = /** @class */ (function (_super) {
13
+ tslib_1.__extends(EditorPasteEvent, _super);
14
+ /**
15
+ * Constructs the event arguments for the `paste` event.
16
+ * @hidden
17
+ */
18
+ function EditorPasteEvent(cleanedHtml, originalHtml, originalEvent) {
19
+ var _this = _super.call(this) || this;
20
+ _this.cleanedHtml = cleanedHtml;
21
+ _this.originalHtml = originalHtml;
22
+ _this.originalEvent = originalEvent;
23
+ return _this;
24
+ }
25
+ return EditorPasteEvent;
26
+ }(kendo_angular_common_1.PreventableEvent));
27
+ exports.EditorPasteEvent = EditorPasteEvent;
@@ -10,6 +10,7 @@ var kendo_angular_toolbar_1 = require("@progress/kendo-angular-toolbar");
10
10
  var editor_component_1 = require("../../editor.component");
11
11
  var editor_command_button_1 = require("../shared/editor-command-button");
12
12
  var editor_localization_service_1 = require("../../localization/editor-localization.service");
13
+ var tools_service_1 = require("../tools.service");
13
14
  /**
14
15
  * A directive which configures an existing `ToolBarButtonComponent` as an Editor AlignCenter tool
15
16
  * ([see example]({% slug toolbartools_editor %}#toc-built-in-tools)).
@@ -30,8 +31,8 @@ var editor_localization_service_1 = require("../../localization/editor-localizat
30
31
  */
31
32
  var EditorAlignCenterButtonDirective = /** @class */ (function (_super) {
32
33
  tslib_1.__extends(EditorAlignCenterButtonDirective, _super);
33
- function EditorAlignCenterButtonDirective(button, editor, localization) {
34
- return _super.call(this, 'alignCenter', button, editor, localization) || this;
34
+ function EditorAlignCenterButtonDirective(button, editor, localization, toolsService) {
35
+ return _super.call(this, 'alignCenter', button, editor, localization, toolsService) || this;
35
36
  }
36
37
  EditorAlignCenterButtonDirective = tslib_1.__decorate([
37
38
  core_1.Directive({
@@ -40,7 +41,8 @@ var EditorAlignCenterButtonDirective = /** @class */ (function (_super) {
40
41
  tslib_1.__param(1, core_1.Host()),
41
42
  tslib_1.__metadata("design:paramtypes", [kendo_angular_toolbar_1.ToolBarButtonComponent,
42
43
  editor_component_1.EditorComponent,
43
- editor_localization_service_1.EditorLocalizationService])
44
+ editor_localization_service_1.EditorLocalizationService,
45
+ tools_service_1.EditorToolsService])
44
46
  ], EditorAlignCenterButtonDirective);
45
47
  return EditorAlignCenterButtonDirective;
46
48
  }(editor_command_button_1.EditorCommandButton));
@@ -10,6 +10,7 @@ var kendo_angular_toolbar_1 = require("@progress/kendo-angular-toolbar");
10
10
  var editor_component_1 = require("../../editor.component");
11
11
  var editor_command_button_1 = require("../shared/editor-command-button");
12
12
  var editor_localization_service_1 = require("../../localization/editor-localization.service");
13
+ var tools_service_1 = require("../tools.service");
13
14
  /**
14
15
  * A directive which configures an existing `ToolBarButtonComponent` as an Editor AlignJustify tool
15
16
  * ([see example]({% slug toolbartools_editor %}#toc-built-in-tools)).
@@ -30,8 +31,8 @@ var editor_localization_service_1 = require("../../localization/editor-localizat
30
31
  */
31
32
  var EditorAlignJustifyButtonDirective = /** @class */ (function (_super) {
32
33
  tslib_1.__extends(EditorAlignJustifyButtonDirective, _super);
33
- function EditorAlignJustifyButtonDirective(button, editor, localization) {
34
- return _super.call(this, 'alignJustify', button, editor, localization) || this;
34
+ function EditorAlignJustifyButtonDirective(button, editor, localization, toolsService) {
35
+ return _super.call(this, 'alignJustify', button, editor, localization, toolsService) || this;
35
36
  }
36
37
  EditorAlignJustifyButtonDirective = tslib_1.__decorate([
37
38
  core_1.Directive({
@@ -40,7 +41,8 @@ var EditorAlignJustifyButtonDirective = /** @class */ (function (_super) {
40
41
  tslib_1.__param(1, core_1.Host()),
41
42
  tslib_1.__metadata("design:paramtypes", [kendo_angular_toolbar_1.ToolBarButtonComponent,
42
43
  editor_component_1.EditorComponent,
43
- editor_localization_service_1.EditorLocalizationService])
44
+ editor_localization_service_1.EditorLocalizationService,
45
+ tools_service_1.EditorToolsService])
44
46
  ], EditorAlignJustifyButtonDirective);
45
47
  return EditorAlignJustifyButtonDirective;
46
48
  }(editor_command_button_1.EditorCommandButton));
@@ -10,6 +10,7 @@ var kendo_angular_toolbar_1 = require("@progress/kendo-angular-toolbar");
10
10
  var editor_component_1 = require("../../editor.component");
11
11
  var editor_command_button_1 = require("../shared/editor-command-button");
12
12
  var editor_localization_service_1 = require("../../localization/editor-localization.service");
13
+ var tools_service_1 = require("../tools.service");
13
14
  /**
14
15
  * A directive which configures an existing `ToolBarButtonComponent` as an Editor AlignLeft tool
15
16
  * ([see example]({% slug toolbartools_editor %}#toc-built-in-tools)).
@@ -30,8 +31,8 @@ var editor_localization_service_1 = require("../../localization/editor-localizat
30
31
  */
31
32
  var EditorAlignLeftButtonDirective = /** @class */ (function (_super) {
32
33
  tslib_1.__extends(EditorAlignLeftButtonDirective, _super);
33
- function EditorAlignLeftButtonDirective(button, editor, localization) {
34
- return _super.call(this, 'alignLeft', button, editor, localization) || this;
34
+ function EditorAlignLeftButtonDirective(button, editor, localization, toolsService) {
35
+ return _super.call(this, 'alignLeft', button, editor, localization, toolsService) || this;
35
36
  }
36
37
  EditorAlignLeftButtonDirective = tslib_1.__decorate([
37
38
  core_1.Directive({
@@ -40,7 +41,8 @@ var EditorAlignLeftButtonDirective = /** @class */ (function (_super) {
40
41
  tslib_1.__param(1, core_1.Host()),
41
42
  tslib_1.__metadata("design:paramtypes", [kendo_angular_toolbar_1.ToolBarButtonComponent,
42
43
  editor_component_1.EditorComponent,
43
- editor_localization_service_1.EditorLocalizationService])
44
+ editor_localization_service_1.EditorLocalizationService,
45
+ tools_service_1.EditorToolsService])
44
46
  ], EditorAlignLeftButtonDirective);
45
47
  return EditorAlignLeftButtonDirective;
46
48
  }(editor_command_button_1.EditorCommandButton));
@@ -10,6 +10,7 @@ var kendo_angular_toolbar_1 = require("@progress/kendo-angular-toolbar");
10
10
  var editor_component_1 = require("../../editor.component");
11
11
  var editor_command_button_1 = require("../shared/editor-command-button");
12
12
  var editor_localization_service_1 = require("../../localization/editor-localization.service");
13
+ var tools_service_1 = require("../tools.service");
13
14
  /**
14
15
  * A directive which configures an existing `ToolBarButtonComponent` as an Editor AlignRight tool
15
16
  * ([see example]({% slug toolbartools_editor %}#toc-built-in-tools)).
@@ -30,8 +31,8 @@ var editor_localization_service_1 = require("../../localization/editor-localizat
30
31
  */
31
32
  var EditorAlignRightButtonDirective = /** @class */ (function (_super) {
32
33
  tslib_1.__extends(EditorAlignRightButtonDirective, _super);
33
- function EditorAlignRightButtonDirective(button, editor, localization) {
34
- return _super.call(this, 'alignRight', button, editor, localization) || this;
34
+ function EditorAlignRightButtonDirective(button, editor, localization, toolsService) {
35
+ return _super.call(this, 'alignRight', button, editor, localization, toolsService) || this;
35
36
  }
36
37
  EditorAlignRightButtonDirective = tslib_1.__decorate([
37
38
  core_1.Directive({
@@ -40,7 +41,8 @@ var EditorAlignRightButtonDirective = /** @class */ (function (_super) {
40
41
  tslib_1.__param(1, core_1.Host()),
41
42
  tslib_1.__metadata("design:paramtypes", [kendo_angular_toolbar_1.ToolBarButtonComponent,
42
43
  editor_component_1.EditorComponent,
43
- editor_localization_service_1.EditorLocalizationService])
44
+ editor_localization_service_1.EditorLocalizationService,
45
+ tools_service_1.EditorToolsService])
44
46
  ], EditorAlignRightButtonDirective);
45
47
  return EditorAlignRightButtonDirective;
46
48
  }(editor_command_button_1.EditorCommandButton));
@@ -10,6 +10,7 @@ var kendo_angular_toolbar_1 = require("@progress/kendo-angular-toolbar");
10
10
  var editor_component_1 = require("../editor.component");
11
11
  var editor_command_button_1 = require("./shared/editor-command-button");
12
12
  var editor_localization_service_1 = require("../localization/editor-localization.service");
13
+ var tools_service_1 = require("./tools.service");
13
14
  /**
14
15
  * A directive which configures an existing `ToolBarButtonComponent` as an Editor Clean Formatting tool
15
16
  * ([see example]({% slug toolbartools_editor %}#toc-built-in-tools)).
@@ -29,8 +30,8 @@ var editor_localization_service_1 = require("../localization/editor-localization
29
30
  */
30
31
  var EditorCleanFormattingButtonDirective = /** @class */ (function (_super) {
31
32
  tslib_1.__extends(EditorCleanFormattingButtonDirective, _super);
32
- function EditorCleanFormattingButtonDirective(button, editor, localization) {
33
- return _super.call(this, 'cleanFormatting', button, editor, localization) || this;
33
+ function EditorCleanFormattingButtonDirective(button, editor, localization, toolsService) {
34
+ return _super.call(this, 'cleanFormatting', button, editor, localization, toolsService) || this;
34
35
  }
35
36
  EditorCleanFormattingButtonDirective = tslib_1.__decorate([
36
37
  core_1.Directive({
@@ -39,7 +40,8 @@ var EditorCleanFormattingButtonDirective = /** @class */ (function (_super) {
39
40
  tslib_1.__param(1, core_1.Host()),
40
41
  tslib_1.__metadata("design:paramtypes", [kendo_angular_toolbar_1.ToolBarButtonComponent,
41
42
  editor_component_1.EditorComponent,
42
- editor_localization_service_1.EditorLocalizationService])
43
+ editor_localization_service_1.EditorLocalizationService,
44
+ tools_service_1.EditorToolsService])
43
45
  ], EditorCleanFormattingButtonDirective);
44
46
  return EditorCleanFormattingButtonDirective;
45
47
  }(editor_command_button_1.EditorCommandButton));
@@ -13,6 +13,7 @@ var editor_localization_service_1 = require("../../localization/editor-localizat
13
13
  var kendo_angular_dialog_1 = require("@progress/kendo-angular-dialog");
14
14
  var font_family_dialog_component_1 = require("../../dialogs/font-family-dialog.component");
15
15
  var editor_fontfamily_dropdownlist_component_1 = require("./editor-fontfamily-dropdownlist.component");
16
+ var tools_service_1 = require("../tools.service");
16
17
  /**
17
18
  * A component which configures an existing `DropDownListComponent` as an Editor tool
18
19
  * ([see example]({% slug toolbartools_editor %}#toc-built-in-tools)).
@@ -26,11 +27,12 @@ var editor_fontfamily_dropdownlist_component_1 = require("./editor-fontfamily-dr
26
27
  */
27
28
  var EditorFontFamilyComponent = /** @class */ (function (_super) {
28
29
  tslib_1.__extends(EditorFontFamilyComponent, _super);
29
- function EditorFontFamilyComponent(editor, dialogService, localization) {
30
+ function EditorFontFamilyComponent(editor, dialogService, localization, toolsService) {
30
31
  var _this = _super.call(this) || this;
31
32
  _this.editor = editor;
32
33
  _this.dialogService = dialogService;
33
34
  _this.localization = localization;
35
+ _this.toolsService = toolsService;
34
36
  _this.disabled = false;
35
37
  _this.tabindex = -1;
36
38
  /**
@@ -79,7 +81,10 @@ var EditorFontFamilyComponent = /** @class */ (function (_super) {
79
81
  return itemArgs.dataItem.fontName === null;
80
82
  }
81
83
  };
82
- setTimeout(function () { return (_this.defaultItem = { text: _this.title, fontName: null }); });
84
+ setTimeout(function () {
85
+ _this.defaultItem = { text: _this.title, fontName: null };
86
+ _this.toolsService.needsCheck.next();
87
+ });
83
88
  this.subs = this.editor.stateChange.subscribe(function (_a) {
84
89
  var style = _a.style;
85
90
  _this.value = util_1.getUniqueStyleValues(style.selected, 'font-family') || null;
@@ -200,7 +205,8 @@ var EditorFontFamilyComponent = /** @class */ (function (_super) {
200
205
  tslib_1.__param(0, core_1.Host()),
201
206
  tslib_1.__metadata("design:paramtypes", [editor_component_1.EditorComponent,
202
207
  kendo_angular_dialog_1.DialogService,
203
- editor_localization_service_1.EditorLocalizationService])
208
+ editor_localization_service_1.EditorLocalizationService,
209
+ tools_service_1.EditorToolsService])
204
210
  ], EditorFontFamilyComponent);
205
211
  return EditorFontFamilyComponent;
206
212
  }(kendo_angular_toolbar_1.ToolBarToolComponent));