@progress/kendo-react-editor 6.1.1 → 7.0.0-develop.2

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 (231) hide show
  1. package/{dist/es/Editor.d.ts → Editor.d.ts} +5 -1
  2. package/{dist/npm/EditorProps.d.ts → EditorProps.d.ts} +4 -1
  3. package/LICENSE.md +1 -1
  4. package/{dist/es/config → config}/defaultStyles.d.ts +4 -0
  5. package/config/pasteSettings.d.ts +10 -0
  6. package/config/schema.d.ts +5 -0
  7. package/{dist/es/config → config}/shortcuts.d.ts +10 -6
  8. package/{dist/es/config → config}/toolsSettings.d.ts +4 -1
  9. package/{dist/npm/dialogs → dialogs}/EditorDialogProps.d.ts +4 -1
  10. package/{dist/npm/dialogs → dialogs}/FindReplace.d.ts +5 -1
  11. package/{dist/npm/dialogs/main.d.ts → dialogs/index.d.ts} +4 -0
  12. package/{dist/npm/dialogs → dialogs}/insertImage.d.ts +5 -1
  13. package/{dist/es/dialogs → dialogs}/insertLink.d.ts +5 -1
  14. package/{dist/npm/dialogs → dialogs}/viewHtml.d.ts +5 -1
  15. package/dist/cdn/js/kendo-react-editor.js +226 -1
  16. package/{dist/es/main.d.ts → index.d.ts} +10 -6
  17. package/index.js +226 -0
  18. package/index.mjs +4133 -0
  19. package/{dist/npm/messages → messages}/index.d.ts +4 -0
  20. package/package-metadata.d.ts +9 -0
  21. package/package.json +37 -52
  22. package/{dist/es/tools → tools}/ToolProps.d.ts +4 -1
  23. package/tools/align.d.ts +11 -0
  24. package/{dist/es/tools → tools}/applyColor.d.ts +4 -0
  25. package/{dist/npm/tools → tools}/cleanFormatting.d.ts +4 -0
  26. package/{dist/npm/tools → tools}/findReplace.d.ts +5 -1
  27. package/{dist/npm/tools → tools}/fontStyle.d.ts +4 -0
  28. package/{dist/es/tools → tools}/formatBlock.d.ts +4 -0
  29. package/{dist/npm/tools → tools}/history.d.ts +4 -0
  30. package/{dist/npm/tools → tools}/indent.d.ts +4 -0
  31. package/{dist/npm/tools/main.d.ts → tools/index.d.ts} +6 -2
  32. package/{dist/es/tools → tools}/inlineFormat.d.ts +4 -0
  33. package/tools/insertImage.d.ts +17 -0
  34. package/{dist/npm/tools → tools}/insertLink.d.ts +4 -0
  35. package/tools/insertTable/index.d.ts +7 -0
  36. package/{dist/npm/tools → tools}/insertTable/popup.d.ts +5 -1
  37. package/{dist/npm/tools → tools}/insertTable/popupGrid.d.ts +6 -2
  38. package/{dist/es/tools → tools}/insertTable/tool.d.ts +4 -0
  39. package/tools/lists-styled.d.ts +8 -0
  40. package/{dist/es/tools → tools}/lists.d.ts +4 -0
  41. package/{dist/es/tools → tools}/outdent.d.ts +4 -0
  42. package/{dist/npm/tools → tools}/pdf.d.ts +4 -0
  43. package/{dist/npm/tools → tools}/print.d.ts +4 -0
  44. package/{dist/npm/tools → tools}/proseMirrorTool.d.ts +4 -0
  45. package/{dist/npm/tools → tools}/selectAll.d.ts +4 -0
  46. package/{dist/npm/tools → tools}/table-wizard/cellPropsUtils.d.ts +4 -0
  47. package/{dist/npm/tools → tools}/table-wizard/tableCellProperties.d.ts +5 -1
  48. package/tools/table-wizard/tableProperties.d.ts +15 -0
  49. package/{dist/es/tools → tools}/table-wizard/tablePropsUtils.d.ts +5 -1
  50. package/{dist/es/tools → tools}/table-wizard/utils.d.ts +4 -0
  51. package/{dist/npm/tools → tools}/tableEdit.d.ts +4 -0
  52. package/{dist/npm/tools → tools}/unlink.d.ts +4 -0
  53. package/{dist/npm/tools → tools}/utils.d.ts +4 -0
  54. package/{dist/es/tools → tools}/viewHtml.d.ts +4 -0
  55. package/utils/browser-detection.d.ts +8 -0
  56. package/utils/controlled-value.d.ts +9 -0
  57. package/{dist/npm/utils → utils}/index.d.ts +4 -0
  58. package/utils/props-key.d.ts +9 -0
  59. package/about.md +0 -3
  60. package/dist/es/Editor.js +0 -441
  61. package/dist/es/EditorProps.d.ts +0 -197
  62. package/dist/es/EditorProps.js +0 -1
  63. package/dist/es/config/defaultStyles.js +0 -12
  64. package/dist/es/config/pasteSettings.d.ts +0 -6
  65. package/dist/es/config/pasteSettings.js +0 -1
  66. package/dist/es/config/schema.d.ts +0 -1
  67. package/dist/es/config/schema.js +0 -1
  68. package/dist/es/config/shortcuts.js +0 -34
  69. package/dist/es/config/toolsSettings.js +0 -522
  70. package/dist/es/dialogs/EditorDialogProps.d.ts +0 -27
  71. package/dist/es/dialogs/EditorDialogProps.js +0 -1
  72. package/dist/es/dialogs/FindReplace.d.ts +0 -71
  73. package/dist/es/dialogs/FindReplace.js +0 -248
  74. package/dist/es/dialogs/insertImage.d.ts +0 -28
  75. package/dist/es/dialogs/insertImage.js +0 -119
  76. package/dist/es/dialogs/insertLink.js +0 -94
  77. package/dist/es/dialogs/main.d.ts +0 -49
  78. package/dist/es/dialogs/main.js +0 -69
  79. package/dist/es/dialogs/viewHtml.d.ts +0 -25
  80. package/dist/es/dialogs/viewHtml.js +0 -79
  81. package/dist/es/main.js +0 -201
  82. package/dist/es/messages/index.d.ts +0 -334
  83. package/dist/es/messages/index.js +0 -989
  84. package/dist/es/package-metadata.d.ts +0 -5
  85. package/dist/es/package-metadata.js +0 -11
  86. package/dist/es/tools/ToolProps.js +0 -1
  87. package/dist/es/tools/align.d.ts +0 -7
  88. package/dist/es/tools/align.js +0 -70
  89. package/dist/es/tools/applyColor.js +0 -34
  90. package/dist/es/tools/cleanFormatting.d.ts +0 -16
  91. package/dist/es/tools/cleanFormatting.js +0 -50
  92. package/dist/es/tools/findReplace.d.ts +0 -29
  93. package/dist/es/tools/findReplace.js +0 -76
  94. package/dist/es/tools/fontStyle.d.ts +0 -28
  95. package/dist/es/tools/fontStyle.js +0 -91
  96. package/dist/es/tools/formatBlock.js +0 -89
  97. package/dist/es/tools/history.d.ts +0 -26
  98. package/dist/es/tools/history.js +0 -16
  99. package/dist/es/tools/indent.d.ts +0 -17
  100. package/dist/es/tools/indent.js +0 -90
  101. package/dist/es/tools/inlineFormat.js +0 -75
  102. package/dist/es/tools/insertImage.d.ts +0 -13
  103. package/dist/es/tools/insertImage.js +0 -78
  104. package/dist/es/tools/insertLink.d.ts +0 -24
  105. package/dist/es/tools/insertLink.js +0 -85
  106. package/dist/es/tools/insertTable/index.d.ts +0 -3
  107. package/dist/es/tools/insertTable/index.js +0 -3
  108. package/dist/es/tools/insertTable/popup.d.ts +0 -93
  109. package/dist/es/tools/insertTable/popup.js +0 -102
  110. package/dist/es/tools/insertTable/popupGrid.d.ts +0 -31
  111. package/dist/es/tools/insertTable/popupGrid.js +0 -54
  112. package/dist/es/tools/insertTable/tool.js +0 -106
  113. package/dist/es/tools/lists-styled.d.ts +0 -5
  114. package/dist/es/tools/lists-styled.js +0 -80
  115. package/dist/es/tools/lists.js +0 -84
  116. package/dist/es/tools/main.d.ts +0 -714
  117. package/dist/es/tools/main.js +0 -740
  118. package/dist/es/tools/outdent.js +0 -85
  119. package/dist/es/tools/pdf.d.ts +0 -25
  120. package/dist/es/tools/pdf.js +0 -44
  121. package/dist/es/tools/print.d.ts +0 -16
  122. package/dist/es/tools/print.js +0 -48
  123. package/dist/es/tools/proseMirrorTool.d.ts +0 -12
  124. package/dist/es/tools/proseMirrorTool.js +0 -67
  125. package/dist/es/tools/selectAll.d.ts +0 -16
  126. package/dist/es/tools/selectAll.js +0 -45
  127. package/dist/es/tools/table-wizard/cellPropsUtils.d.ts +0 -36
  128. package/dist/es/tools/table-wizard/cellPropsUtils.js +0 -203
  129. package/dist/es/tools/table-wizard/tableCellProperties.d.ts +0 -20
  130. package/dist/es/tools/table-wizard/tableCellProperties.js +0 -247
  131. package/dist/es/tools/table-wizard/tableProperties.d.ts +0 -11
  132. package/dist/es/tools/table-wizard/tableProperties.js +0 -294
  133. package/dist/es/tools/table-wizard/tablePropsUtils.js +0 -498
  134. package/dist/es/tools/table-wizard/utils.js +0 -144
  135. package/dist/es/tools/tableEdit.d.ts +0 -98
  136. package/dist/es/tools/tableEdit.js +0 -90
  137. package/dist/es/tools/unlink.d.ts +0 -17
  138. package/dist/es/tools/unlink.js +0 -77
  139. package/dist/es/tools/utils.d.ts +0 -50
  140. package/dist/es/tools/utils.js +0 -72
  141. package/dist/es/tools/viewHtml.js +0 -79
  142. package/dist/es/utils/browser-detection.d.ts +0 -4
  143. package/dist/es/utils/browser-detection.js +0 -5
  144. package/dist/es/utils/controlled-value.d.ts +0 -5
  145. package/dist/es/utils/controlled-value.js +0 -31
  146. package/dist/es/utils/index.d.ts +0 -363
  147. package/dist/es/utils/index.js +0 -431
  148. package/dist/es/utils/props-key.d.ts +0 -5
  149. package/dist/es/utils/props-key.js +0 -5
  150. package/dist/npm/Editor.d.ts +0 -118
  151. package/dist/npm/Editor.js +0 -444
  152. package/dist/npm/EditorProps.js +0 -2
  153. package/dist/npm/config/defaultStyles.d.ts +0 -12
  154. package/dist/npm/config/defaultStyles.js +0 -15
  155. package/dist/npm/config/pasteSettings.d.ts +0 -6
  156. package/dist/npm/config/pasteSettings.js +0 -2
  157. package/dist/npm/config/schema.d.ts +0 -1
  158. package/dist/npm/config/schema.js +0 -6
  159. package/dist/npm/config/shortcuts.d.ts +0 -24
  160. package/dist/npm/config/shortcuts.js +0 -38
  161. package/dist/npm/config/toolsSettings.d.ts +0 -490
  162. package/dist/npm/config/toolsSettings.js +0 -525
  163. package/dist/npm/dialogs/EditorDialogProps.js +0 -2
  164. package/dist/npm/dialogs/FindReplace.js +0 -251
  165. package/dist/npm/dialogs/insertImage.js +0 -122
  166. package/dist/npm/dialogs/insertLink.d.ts +0 -26
  167. package/dist/npm/dialogs/insertLink.js +0 -97
  168. package/dist/npm/dialogs/main.js +0 -72
  169. package/dist/npm/dialogs/viewHtml.js +0 -82
  170. package/dist/npm/main.d.ts +0 -176
  171. package/dist/npm/main.js +0 -189
  172. package/dist/npm/messages/index.js +0 -992
  173. package/dist/npm/package-metadata.d.ts +0 -5
  174. package/dist/npm/package-metadata.js +0 -14
  175. package/dist/npm/tools/ToolProps.d.ts +0 -38
  176. package/dist/npm/tools/ToolProps.js +0 -2
  177. package/dist/npm/tools/align.d.ts +0 -7
  178. package/dist/npm/tools/align.js +0 -74
  179. package/dist/npm/tools/applyColor.d.ts +0 -12
  180. package/dist/npm/tools/applyColor.js +0 -38
  181. package/dist/npm/tools/cleanFormatting.js +0 -54
  182. package/dist/npm/tools/findReplace.js +0 -79
  183. package/dist/npm/tools/fontStyle.js +0 -94
  184. package/dist/npm/tools/formatBlock.d.ts +0 -18
  185. package/dist/npm/tools/formatBlock.js +0 -92
  186. package/dist/npm/tools/history.js +0 -19
  187. package/dist/npm/tools/indent.js +0 -93
  188. package/dist/npm/tools/inlineFormat.d.ts +0 -47
  189. package/dist/npm/tools/inlineFormat.js +0 -78
  190. package/dist/npm/tools/insertImage.d.ts +0 -13
  191. package/dist/npm/tools/insertImage.js +0 -82
  192. package/dist/npm/tools/insertLink.js +0 -88
  193. package/dist/npm/tools/insertTable/index.d.ts +0 -3
  194. package/dist/npm/tools/insertTable/index.js +0 -7
  195. package/dist/npm/tools/insertTable/popup.js +0 -105
  196. package/dist/npm/tools/insertTable/popupGrid.js +0 -56
  197. package/dist/npm/tools/insertTable/tool.d.ts +0 -24
  198. package/dist/npm/tools/insertTable/tool.js +0 -109
  199. package/dist/npm/tools/lists-styled.d.ts +0 -5
  200. package/dist/npm/tools/lists-styled.js +0 -84
  201. package/dist/npm/tools/lists.d.ts +0 -27
  202. package/dist/npm/tools/lists.js +0 -87
  203. package/dist/npm/tools/main.js +0 -743
  204. package/dist/npm/tools/outdent.d.ts +0 -17
  205. package/dist/npm/tools/outdent.js +0 -88
  206. package/dist/npm/tools/pdf.js +0 -48
  207. package/dist/npm/tools/print.js +0 -52
  208. package/dist/npm/tools/proseMirrorTool.js +0 -71
  209. package/dist/npm/tools/selectAll.js +0 -49
  210. package/dist/npm/tools/table-wizard/cellPropsUtils.js +0 -208
  211. package/dist/npm/tools/table-wizard/tableCellProperties.js +0 -253
  212. package/dist/npm/tools/table-wizard/tableProperties.d.ts +0 -11
  213. package/dist/npm/tools/table-wizard/tableProperties.js +0 -298
  214. package/dist/npm/tools/table-wizard/tablePropsUtils.d.ts +0 -52
  215. package/dist/npm/tools/table-wizard/tablePropsUtils.js +0 -504
  216. package/dist/npm/tools/table-wizard/utils.d.ts +0 -39
  217. package/dist/npm/tools/table-wizard/utils.js +0 -153
  218. package/dist/npm/tools/tableEdit.js +0 -95
  219. package/dist/npm/tools/unlink.js +0 -80
  220. package/dist/npm/tools/utils.js +0 -82
  221. package/dist/npm/tools/viewHtml.d.ts +0 -24
  222. package/dist/npm/tools/viewHtml.js +0 -82
  223. package/dist/npm/utils/browser-detection.d.ts +0 -4
  224. package/dist/npm/utils/browser-detection.js +0 -8
  225. package/dist/npm/utils/controlled-value.d.ts +0 -5
  226. package/dist/npm/utils/controlled-value.js +0 -35
  227. package/dist/npm/utils/index.js +0 -434
  228. package/dist/npm/utils/props-key.d.ts +0 -5
  229. package/dist/npm/utils/props-key.js +0 -8
  230. package/dist/systemjs/kendo-react-editor.js +0 -1
  231. package/e2e-next/editor.basic.tests.ts +0 -24
package/dist/es/Editor.js DELETED
@@ -1,441 +0,0 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- var __assign = (this && this.__assign) || function () {
17
- __assign = Object.assign || function(t) {
18
- for (var s, i = 1, n = arguments.length; i < n; i++) {
19
- s = arguments[i];
20
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
21
- t[p] = s[p];
22
- }
23
- return t;
24
- };
25
- return __assign.apply(this, arguments);
26
- };
27
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
28
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
29
- if (ar || !(i in from)) {
30
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
31
- ar[i] = from[i];
32
- }
33
- }
34
- return to.concat(ar || Array.prototype.slice.call(from));
35
- };
36
- import * as React from 'react';
37
- import * as PropTypes from 'prop-types';
38
- import { ButtonGroup, Toolbar, ToolbarSeparator, toolbarButtons } from '@progress/kendo-react-buttons';
39
- import { classNames } from '@progress/kendo-react-common';
40
- import { EditorState, Plugin, PluginKey, EditorView, Schema, baseKeymap, keymap, history, dropCursor, gapCursor, getMark, spacesFix, cspFix, tableEditing, caretColor } from '@progress/kendo-editor-common';
41
- import { marks, nodes } from './config/schema';
42
- import { defaultStyle, tablesStyles, rtlStyles } from './config/defaultStyles';
43
- import { EditorToolsSettings } from './config/toolsSettings';
44
- import { EditorDialogs } from './dialogs/main';
45
- import { EditorUtils } from './utils';
46
- import { editorPropsKey } from './utils/props-key';
47
- import { updateEditorValue } from './utils/controlled-value';
48
- import { firefox } from './utils/browser-detection';
49
- import { packageMetadata } from './package-metadata';
50
- import { shouldShowValidationUI, validatePackage, WatermarkOverlay } from '@progress/kendo-react-common';
51
- var link = EditorToolsSettings.link, bold = EditorToolsSettings.bold, italic = EditorToolsSettings.italic, underline = EditorToolsSettings.underline;
52
- import { messages, keys } from './messages';
53
- import { registerForLocalization, provideLocalizationService } from '@progress/kendo-react-intl';
54
- /**
55
- * Represents the [KendoReact Editor component]({% slug overview_editor %}).
56
- *
57
- * @example
58
- * ```jsx
59
- * class App extends React.Component {
60
- * render() {
61
- * return (
62
- * <Editor
63
- * defaultContent="<p>Hello World</p>"
64
- * tools={[
65
- * [ EditorTools.Bold, EditorTools.Italic ]
66
- * ]}
67
- * />
68
- * );
69
- * }
70
- * }
71
- * ReactDOM.render(<App />, document.querySelector('my-app'));
72
- * ```
73
- */
74
- var Editor = /** @class */ (function (_super) {
75
- __extends(Editor, _super);
76
- function Editor(props) {
77
- var _this = _super.call(this, props) || this;
78
- /**
79
- * @hidden
80
- */
81
- _this.state = {
82
- view: undefined,
83
- linkDialog: false
84
- };
85
- _this._element = null;
86
- _this._contentElement = null;
87
- _this.iframe = null;
88
- _this.trOnChange = null;
89
- _this.htmlOnChange = null;
90
- _this.showLicenseWatermark = false;
91
- /**
92
- * @hidden
93
- */
94
- _this.focus = function () {
95
- if (_this.view) {
96
- _this.view.focus();
97
- }
98
- };
99
- _this.renderDialog = function (Component, settings, stateFlag) {
100
- return _this.state[stateFlag] && (React.createElement(Component, { view: _this.view, settings: settings, dir: _this.props.dir, onClose: function () {
101
- var _a;
102
- return _this.setState((_a = {}, _a[stateFlag] = false, _a));
103
- } }));
104
- };
105
- _this.renderTool = function (Tool, index) {
106
- var tool = (React.createElement(Tool, { view: _this.view, dir: _this.props.dir, key: index }));
107
- return tool.type === ToolbarSeparator ? React.createElement(Tool, { key: index }) : tool;
108
- };
109
- _this.updateTools = function (view, _prevViewState) {
110
- _this.setState({ view: view });
111
- };
112
- _this.filterTransaction = function (transaction, state) {
113
- var event = { target: _this, transaction: transaction, state: state };
114
- return (_this.props.onExecute &&
115
- _this.props.onExecute.call(undefined, event)) !== false;
116
- };
117
- _this.onPasteHtml = function (html) {
118
- if (_this.props.onPasteHtml && _this.pasteEvent) {
119
- var event_1 = {
120
- target: _this,
121
- pastedHtml: html,
122
- nativeEvent: _this.pasteEvent
123
- };
124
- var newHtml = _this.props.onPasteHtml.call(undefined, event_1);
125
- _this.pasteEvent = undefined;
126
- if (typeof newHtml === 'string') {
127
- return newHtml;
128
- }
129
- }
130
- return html;
131
- };
132
- _this.dispatchTransaction = function (transaction) {
133
- var docChanged = transaction.docChanged;
134
- if (_this.props.onChange && docChanged) {
135
- _this.trOnChange = transaction;
136
- var doc_1 = transaction.doc, schema_1 = transaction.doc.type.schema;
137
- var target_1 = _this;
138
- var event_2 = {
139
- target: target_1,
140
- value: doc_1,
141
- get html() {
142
- target_1.htmlOnChange = EditorUtils.getHtml({ doc: doc_1, schema: schema_1 });
143
- return target_1.htmlOnChange;
144
- },
145
- transaction: transaction,
146
- schema: schema_1
147
- };
148
- _this.props.onChange.call(undefined, event_2);
149
- }
150
- if (_this.view && (_this.props.value === undefined || !docChanged)) {
151
- _this.view.updateState(_this.view.state.apply(transaction));
152
- }
153
- };
154
- _this.onFocus = function (_view, nativeEvent) {
155
- if (_this.props.onFocus) {
156
- var event_3 = {
157
- target: _this,
158
- nativeEvent: nativeEvent
159
- };
160
- _this.props.onFocus.call(undefined, event_3);
161
- }
162
- return false;
163
- };
164
- _this.onBlur = function (_view, nativeEvent) {
165
- if (_this.props.onBlur) {
166
- var event_4 = {
167
- target: _this,
168
- nativeEvent: nativeEvent
169
- };
170
- _this.props.onBlur.call(undefined, event_4);
171
- }
172
- return false;
173
- };
174
- _this.onPaste = function (_view, nativeEvent) {
175
- if (_this.props.onPasteHtml) {
176
- _this.pasteEvent = nativeEvent;
177
- }
178
- return false;
179
- };
180
- validatePackage(packageMetadata);
181
- _this.showLicenseWatermark = shouldShowValidationUI(packageMetadata);
182
- return _this;
183
- }
184
- Object.defineProperty(Editor.prototype, "value", {
185
- /**
186
- * The value of the Editor.
187
- */
188
- get: function () {
189
- if (this.trOnChange !== null) {
190
- return this.trOnChange.doc;
191
- }
192
- else if (this.props.value !== undefined) {
193
- return this.props.value;
194
- }
195
- else if (this.view) {
196
- return this.view.state.doc;
197
- }
198
- return this.props.defaultContent || '';
199
- },
200
- enumerable: false,
201
- configurable: true
202
- });
203
- Object.defineProperty(Editor.prototype, "element", {
204
- /**
205
- * Returns the DOM element of the Editor.
206
- */
207
- get: function () {
208
- return this._element;
209
- },
210
- enumerable: false,
211
- configurable: true
212
- });
213
- Object.defineProperty(Editor.prototype, "contentElement", {
214
- /**
215
- * Returns the content-editable DOM element of the Editor.
216
- */
217
- get: function () {
218
- return this._contentElement;
219
- },
220
- enumerable: false,
221
- configurable: true
222
- });
223
- Object.defineProperty(Editor.prototype, "view", {
224
- /**
225
- * Returns the `view` object of the Editor.
226
- */
227
- get: function () {
228
- return this._view;
229
- },
230
- enumerable: false,
231
- configurable: true
232
- });
233
- /**
234
- * @hidden
235
- */
236
- Editor.prototype.componentDidMount = function () {
237
- if (!this.iframe || !firefox) {
238
- this.initialize();
239
- }
240
- };
241
- /**
242
- * @hidden
243
- */
244
- Editor.prototype.componentDidUpdate = function (prevProps) {
245
- var value = this.props.value;
246
- var view = this.view;
247
- if (value === undefined || !view) {
248
- return;
249
- }
250
- updateEditorValue(view, value, prevProps.value, this.trOnChange, this.htmlOnChange);
251
- this.trOnChange = null;
252
- this.htmlOnChange = null;
253
- };
254
- /**
255
- * @hidden
256
- */
257
- Editor.prototype.componentWillUnmount = function () {
258
- if (this.view) {
259
- this.view.destroy();
260
- }
261
- this._view = undefined;
262
- var iframeWindow = this.iframe && this.iframe.contentWindow;
263
- if (iframeWindow) {
264
- if (this._contentElement && this._contentElement.parentNode) {
265
- this._contentElement.parentNode.removeChild(this._contentElement);
266
- }
267
- var head = iframeWindow.document.head;
268
- while (head && head.firstChild) {
269
- head.removeChild(head.firstChild);
270
- }
271
- }
272
- };
273
- /**
274
- * @hidden
275
- */
276
- Editor.prototype.render = function () {
277
- var _this = this;
278
- var _a = this.props, _b = _a.tools, tools = _b === void 0 ? [] : _b, _c = _a.defaultEditMode, defaultEditMode = _c === void 0 ? 'iframe' : _c, _d = _a.preserveWhitespace, preserveWhitespace = _d === void 0 ? 'full' : _d, style = _a.style, className = _a.className;
279
- var localization = provideLocalizationService(this);
280
- if (this.view) {
281
- var editorProps = editorPropsKey.getState(this.view.state);
282
- editorProps.preserveWhitespace = preserveWhitespace;
283
- }
284
- var contentStyle = this.props.contentStyle;
285
- if (contentStyle === undefined && (style || {}).height === undefined) {
286
- contentStyle = { height: '300px' };
287
- }
288
- var buttons = tools.map(function (item, index) {
289
- return Array.isArray(item) ?
290
- React.createElement(ButtonGroup, { key: index }, item.map(_this.renderTool, index)) :
291
- _this.renderTool(item, index);
292
- });
293
- return (React.createElement("div", { ref: function (e) { return _this._element = e; }, className: classNames('k-editor', className, { 'k-editor-resizable': this.props.resizable }), dir: this.props.dir, style: style },
294
- buttons.length > 0 && (React.createElement(Toolbar, { className: 'k-editor-toolbar', keyboardNavigation: this.props.keyboardNavigation }, buttons)),
295
- defaultEditMode === 'iframe' ?
296
- (React.createElement("div", { className: "k-editor-content" },
297
- React.createElement("iframe", { onLoad: firefox ? function () {
298
- _this.initialize();
299
- } : undefined, ref: function (e) { return _this.iframe = e; }, frameBorder: "0", title: localization.toLanguageString(keys.iframeTitle, messages[keys.iframeTitle]), style: contentStyle, className: "k-iframe" }))) :
300
- (React.createElement("div", { style: contentStyle, className: "k-editor-content" },
301
- React.createElement("div", { ref: function (e) { return _this._contentElement = e; }, suppressContentEditableWarning: true, role: "textbox", "aria-labelledby": this.props.ariaLabelledBy, "aria-describedby": this.props.ariaDescribedBy, "aria-label": this.props.ariaLabel }))),
302
- this.renderDialog(EditorDialogs.InsertLinkDialog, link, 'linkDialog'),
303
- this.showLicenseWatermark && React.createElement(WatermarkOverlay, null)));
304
- };
305
- Editor.prototype.initialize = function () {
306
- var _this = this;
307
- var iframeWindow = this.iframe && this.iframe.contentWindow;
308
- if (iframeWindow) {
309
- var iframeDocument_1 = iframeWindow.document;
310
- [defaultStyle, tablesStyles, this.props.dir === 'rtl' ? rtlStyles : undefined].forEach(function (styles) {
311
- if (styles) {
312
- var style = iframeDocument_1.createElement('style');
313
- style.appendChild(iframeDocument_1.createTextNode(styles));
314
- iframeDocument_1.head.appendChild(style);
315
- }
316
- });
317
- var meta = iframeDocument_1.createElement('meta');
318
- meta.setAttribute('charset', 'utf-8');
319
- iframeDocument_1.head.appendChild(meta);
320
- // The content has to be wrapped because the `dropCursor` plugin raises a `body.offsetParent is null` error.
321
- this._contentElement = iframeDocument_1.createElement('div');
322
- iframeDocument_1.body.appendChild(this._contentElement);
323
- this._contentElement.classList.add('k-content');
324
- }
325
- var dom = this._contentElement;
326
- if (!dom) {
327
- return;
328
- }
329
- var _a = this.props.preserveWhitespace, preserveWhitespace = _a === void 0 ? 'full' : _a;
330
- var target = this;
331
- var plugins = [
332
- // https://prosemirror.net/docs/ref/#state.PluginSpec
333
- new Plugin({
334
- view: function () { return ({ update: _this.updateTools }); },
335
- key: new PluginKey('toolbar-tools-update-plugin')
336
- }),
337
- new Plugin({
338
- filterTransaction: this.filterTransaction,
339
- key: new PluginKey('onExecute-event-plugin')
340
- }),
341
- new Plugin({
342
- key: editorPropsKey,
343
- state: {
344
- init: function () { return ({ preserveWhitespace: preserveWhitespace }); },
345
- apply: function (_, val) { return val; }
346
- }
347
- }),
348
- spacesFix(),
349
- caretColor(),
350
- history(),
351
- dropCursor(),
352
- gapCursor(),
353
- tableEditing(),
354
- cspFix()
355
- ];
356
- var shortcuts = __assign(__assign({}, EditorUtils.getShortcuts({
357
- types: { listItem: 'list_item', hardBreak: 'hard_break' },
358
- toolsSettings: { bold: bold, italic: italic, underline: underline }
359
- })), { 'Mod-k': function () {
360
- var linkDialog = _this.state.linkDialog;
361
- var editorView = _this.view;
362
- if (editorView) {
363
- var editorState = editorView.state;
364
- var collapsed = editorState.selection.empty;
365
- var linkMark = getMark(editorState, editorState.schema.marks[link.mark]);
366
- var disabled = collapsed && !linkMark;
367
- if (!linkDialog && !disabled) {
368
- _this.setState({ linkDialog: true });
369
- }
370
- }
371
- return !linkDialog;
372
- }, 'Alt-F10': function () {
373
- var _a;
374
- var toolbar = (_a = _this.element) === null || _a === void 0 ? void 0 : _a.querySelector('.k-toolbar');
375
- if (toolbar) {
376
- var button = toolbar.querySelector(toolbarButtons.join(','));
377
- if (button) {
378
- button.focus();
379
- return true;
380
- }
381
- }
382
- return false;
383
- } });
384
- var _b = this.props, _c = _b.defaultContent, defaultContent = _c === void 0 ? '' : _c, value = _b.value, onMount = _b.onMount;
385
- var doc = (value && typeof value !== 'string') ? value :
386
- EditorUtils.createDocument(new Schema({ nodes: nodes, marks: marks }), value || defaultContent, { preserveWhitespace: preserveWhitespace });
387
- var viewProps = {
388
- state: EditorState.create({
389
- plugins: __spreadArray(__spreadArray([], plugins, true), [keymap(shortcuts), keymap(baseKeymap)], false),
390
- doc: doc
391
- }),
392
- transformPastedHTML: this.onPasteHtml,
393
- dispatchTransaction: this.dispatchTransaction,
394
- handleDOMEvents: {
395
- focus: this.onFocus,
396
- blur: this.onBlur,
397
- paste: this.onPaste
398
- },
399
- handleDrop: function (_view, _event, slice, _moved) {
400
- var hasCaption = false;
401
- slice.content.nodesBetween(0, slice.content.size, function (node) {
402
- hasCaption = hasCaption || node.type.name === 'table_caption_external';
403
- });
404
- return hasCaption;
405
- }
406
- };
407
- var mountEvent = { plugins: plugins, shortcuts: shortcuts, target: target, viewProps: viewProps, dom: dom };
408
- var view = this._view = (onMount && onMount.call(undefined, mountEvent)) || new EditorView({ mount: dom }, viewProps);
409
- this.setState({
410
- view: view
411
- });
412
- };
413
- /**
414
- * @hidden
415
- */
416
- Editor.propTypes = {
417
- defaultContent: PropTypes.string,
418
- value: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
419
- defaultEditMode: PropTypes.oneOf(['iframe', 'div']),
420
- contentStyle: PropTypes.object,
421
- dir: PropTypes.string,
422
- className: PropTypes.string,
423
- ariaDescribedBy: PropTypes.string,
424
- ariaLabelledBy: PropTypes.string,
425
- ariaLabel: PropTypes.string,
426
- style: PropTypes.object,
427
- tools: PropTypes.arrayOf(PropTypes.any),
428
- keyboardNavigation: PropTypes.bool,
429
- resizable: PropTypes.bool,
430
- preserveWhitespace: PropTypes.oneOf([true, false, 'full']),
431
- onMount: PropTypes.func,
432
- onFocus: PropTypes.func,
433
- onBlur: PropTypes.func,
434
- onChange: PropTypes.func,
435
- onPasteHtml: PropTypes.func,
436
- onExecute: PropTypes.func
437
- };
438
- return Editor;
439
- }(React.Component));
440
- export { Editor };
441
- registerForLocalization(Editor);
@@ -1,197 +0,0 @@
1
- /// <reference types="react" />
2
- import { EditorState, Plugin, Transaction, EditorView, Schema, Node } from '@progress/kendo-editor-common';
3
- import { EditorUtils } from './utils';
4
- import { Editor } from './Editor';
5
- interface EditorEvent {
6
- /**
7
- * An event target.
8
- */
9
- target: Editor;
10
- }
11
- /**
12
- * Represents the object of the `onChange` Editor event.
13
- */
14
- export interface EditorChangeEvent extends EditorEvent {
15
- /**
16
- * Represents the [Editor document](https://prosemirror.net/docs/guide/#doc).
17
- */
18
- value: Node;
19
- /**
20
- * A getter of the Editor HTML content.
21
- * Once called, it will convert the Editor document into HTML string.
22
- * Note that, since onChange event is triggered on every key while typing,
23
- * this conversion may not be suitable if the Editor is dealing with large amount of content.
24
- */
25
- html: string;
26
- /**
27
- * The Editor Schema object.
28
- */
29
- schema: Schema;
30
- /**
31
- * The Transaction which causes the change.
32
- */
33
- transaction: Transaction;
34
- }
35
- /**
36
- * Represents the object of the `onMount` Editor event.
37
- */
38
- export interface EditorMountEvent extends EditorEvent {
39
- /**
40
- * The content-editable DOM element of the Editor.
41
- */
42
- dom: HTMLDivElement;
43
- /**
44
- * The default plugins collection of the Editor.
45
- */
46
- plugins: Array<Plugin>;
47
- /**
48
- * The default key bindings of the Editor.
49
- */
50
- shortcuts: EditorUtils.Shortcuts;
51
- /**
52
- * The default [viewProps](https://prosemirror.net/docs/ref/#view.DirectEditorProps) object of the Editor.
53
- */
54
- viewProps: {
55
- state: EditorState;
56
- [key: string]: any;
57
- };
58
- }
59
- /**
60
- * Represents the object of the `onPaste` Editor event.
61
- */
62
- export interface EditorPasteEvent extends EditorEvent {
63
- /**
64
- * The HTML that will be pasted in the Editor.
65
- */
66
- pastedHtml: string;
67
- /**
68
- * The native paste event.
69
- */
70
- nativeEvent: ClipboardEvent;
71
- }
72
- /**
73
- * Represents the object of the `onExecute` Editor event.
74
- */
75
- export interface EditorExecuteEvent extends EditorEvent {
76
- /**
77
- * The transaction that will be executed.
78
- */
79
- transaction: Transaction;
80
- /**
81
- * The state of the Editor.
82
- */
83
- state: EditorState;
84
- }
85
- /**
86
- * Represents the object of the `onFocus` Editor event.
87
- */
88
- export interface EditorFocusEvent extends EditorEvent {
89
- /**
90
- * The native focus event.
91
- */
92
- nativeEvent: FocusEvent;
93
- }
94
- /**
95
- * Represents the object of the `onBlur` Editor event.
96
- */
97
- export interface EditorBlurEvent extends EditorEvent {
98
- /**
99
- * The native blur event.
100
- */
101
- nativeEvent: FocusEvent;
102
- }
103
- /**
104
- * Represents the props of the [KendoReact Editor component]({% slug overview_editor %}).
105
- */
106
- export interface EditorProps {
107
- /**
108
- * Sets the default HTML content of the Editor.
109
- */
110
- defaultContent?: string;
111
- /**
112
- * Sets the initial edit mode of the Editor. Defaults to `iframe`.
113
- */
114
- defaultEditMode?: 'iframe' | 'div';
115
- /**
116
- * Sets styles to the content element wrapper of the Editor.
117
- */
118
- contentStyle?: React.CSSProperties;
119
- /**
120
- * Represents the `dir` HTML attribute.
121
- */
122
- dir?: string;
123
- /**
124
- * Sets additional classes to the Editor.
125
- */
126
- className?: string;
127
- /**
128
- * Sets styles to the Editor.
129
- */
130
- style?: React.CSSProperties;
131
- /**
132
- * Identifies the element(s) which will describe the component, similar to [HTML aria-describedby attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-describedby_attribute).
133
- */
134
- ariaDescribedBy?: string;
135
- /**
136
- * Identifies the element(s) which will label the component.
137
- */
138
- ariaLabelledBy?: string;
139
- /**
140
- * The accessible label of the component.
141
- */
142
- ariaLabel?: string;
143
- /**
144
- * Specifies if the Editor will be resizable.
145
- */
146
- resizable?: boolean;
147
- /**
148
- * Sets the tools of the Editor. By default, the Editor renders no tools.
149
- */
150
- tools?: Array<any>;
151
- /**
152
- * Fires each time the Editor is about to mount.
153
- * Useful for configuring the `EditorView` object.
154
- * To initialize `EditorView`, use the properties of the `event` object.
155
- */
156
- onMount?: (event: EditorMountEvent) => EditorView | void;
157
- /**
158
- * Fires each time the Editor is about to insert pasted content.
159
- * Useful for modifying pasted content.
160
- */
161
- onPasteHtml?: (event: EditorPasteEvent) => string | void;
162
- /**
163
- * Fires each time the Editor is about to apply a transaction.
164
- * To prevent the transaction, return `false`.
165
- */
166
- onExecute?: (event: EditorExecuteEvent) => boolean | void;
167
- /**
168
- * Fires when the Editor's content element has received focus.
169
- */
170
- onFocus?: (event: EditorFocusEvent) => void;
171
- /**
172
- * Fires when the Editor's content element has lost focus.
173
- */
174
- onBlur?: (event: EditorBlurEvent) => void;
175
- /**
176
- * Fires each time the value of the Editor is about to change.
177
- */
178
- onChange?: (event: EditorChangeEvent) => void;
179
- /**
180
- * The value of the Editor.
181
- */
182
- value?: Node | string;
183
- /**
184
- * If set to `false`, it will turn off the built-in keyboard navigation of the Editor's Toolbar.
185
- */
186
- keyboardNavigation?: boolean;
187
- /**
188
- * Defines the options that will be used for parsing the HTML.
189
- * If `false` is set, the whitespace is collapsed as per HTML's rules.
190
- * Pass `true` to preserve whitespace, but normalize newlines to spaces.
191
- * `full` will preserve whitespace entirely.
192
- *
193
- * Defaults to `full`.
194
- */
195
- preserveWhitespace?: boolean | 'full';
196
- }
197
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,12 +0,0 @@
1
- /**
2
- * @hidden
3
- */
4
- export var defaultStyle = "\nhtml, body {\n margin: 0;\n height: 100%;\n padding: 0;\n}\n\nhtml {\n min-height: 100%;\n}\n\nbody {\n box-sizing: border-box;\n position: relative;\n word-wrap: break-word;\n padding: 8px;\n}\n\nbody > .k-content {\n outline: 0;\n height: 100%;\n white-space: pre-wrap;\n}\n\n.k-content > p {\n margin: 0 0 1em;\n}\n\n.k-content table {\n white-space: pre-wrap;\n}\n\n.k-content .k-text-selected, .k-content::selection {\n color: HighlightText;\n background-color: Highlight;\n}\n\n.k-content .k-text-highlighted {\n background-color: #bbdefb;\n}\n\n.k-content .ProseMirror-selectednode {\n outline: 2px solid #8cf;\n}\n\n.ProseMirror-hideselection *::selection { background: transparent; }\n.ProseMirror-hideselection *::-moz-selection { background: transparent; }\n.ProseMirror-hideselection { caret-color: transparent; }\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n}\n\n.ProseMirror-gapcursor:after {\n content: \"\";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}\n\n.k-editor-resize-handles-wrapper {\n position: absolute;\n visibility: hidden;\n}\n\n.k-editor-resize-handle {\n position: absolute;\n visibility: visible;\n background-color: #fff;\n border: 1px solid #000;\n z-index: 100;\n width: 5px;\n height: 5px;\n}\n\n.k-editor-resize-handle.northwest {\n top: 0;\n left: 0;\n transform: translate(-50%, -50%);\n cursor: nw-resize;\n}\n\n.k-editor-resize-handle.north {\n top: 0;\n left: 50%;\n transform: translate(-50%, -50%);\n cursor: n-resize;\n}\n\n.k-editor-resize-handle.northeast {\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n cursor: ne-resize;\n}\n\n.k-editor-resize-handle.southwest {\n left: 0;\n bottom: 0;\n transform: translate(-50%, 50%);\n cursor: sw-resize;\n}\n\n.k-editor-resize-handle.south {\n bottom: 0;\n left: 50%;\n transform: translate(-50%, 50%);\n cursor: s-resize;\n}\n\n.k-editor-resize-handle.southeast {\n right: 0;\n bottom: 0;\n transform: translate(50%, 50%);\n cursor: se-resize;\n}\n\n.k-editor-resize-handle.west {\n top: 50%;\n left: 0;\n transform: translate(-50%, -50%);\n cursor: w-resize;\n}\n\n.k-editor-resize-handle.east {\n top: 50%;\n right: 0;\n transform: translate(50%, -50%);\n cursor: e-resize;\n}\n\n.k-editor-resize-wrap-element {\n display: inline-block;\n position: relative;\n}\n\n.ProseMirror .row-resize-handle {\n position: absolute;\n right: 0; left: 0; bottom: 0;\n transform: translate(0, 50%);\n height: 4px;\n z-index: 20;\n background-color: #adf;\n pointer-events: none;\n}\n\n.ProseMirror .column-resize-handle {\n position: absolute;\n right: -2px; top: 0; bottom: 0;\n width: 4px;\n z-index: 20;\n background-color: #adf;\n pointer-events: none;\n}\n\n.ProseMirror.resize-cursor {\n cursor: ew-resize;\n cursor: col-resize;\n}\n\n.ProseMirror.resize-cursor-vertical {\n cursor: sn-resize;\n cursor: row-resize;\n}\n\n.k-editor-resize-wrap-element table td p,\n.k-editor-resize-wrap-element table th p {\n margin: 0 auto;\n}\n";
5
- /**
6
- * @hidden
7
- */
8
- export var tablesStyles = "\n .ProseMirror .tableWrapper {\n overflow-x: auto;\n margin: 1em 0;\n }\n\n .ProseMirror table {\n margin: 0;\n border-collapse: collapse;\n table-layout: fixed;\n width: 100%;\n overflow: hidden;\n }\n\n .ProseMirror td, .ProseMirror th {\n min-width: 1em;\n border: 1px solid #ddd;\n padding: 3px 5px;\n vertical-align: top;\n box-sizing: border-box;\n position: relative;\n }\n\n .ProseMirror th {\n font-weight: bold;\n text-align: left;\n }\n\n /* Give selected cells a blue overlay */\n .ProseMirror .selectedCell:after {\n z-index: 2;\n position: absolute;\n content: \"\";\n left: 0; right: 0; top: 0; bottom: 0;\n background: rgba(200, 200, 255, 0.4);\n pointer-events: none;\n }\n";
9
- /**
10
- * @hidden
11
- */
12
- export var rtlStyles = 'body { direction: rtl }';
@@ -1,6 +0,0 @@
1
- import { PasteCleanupSettings as PasteSettings } from '@progress/kendo-editor-common';
2
- /**
3
- * The settings passed to `pasteCleanup` function ([see example]({% slug paste_editor %})).
4
- */
5
- export interface PasteCleanupSettings extends PasteSettings {
6
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export { marks, nodes } from '@progress/kendo-editor-common';
@@ -1 +0,0 @@
1
- export { marks, nodes } from '@progress/kendo-editor-common';