@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
@@ -1,444 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __assign = (this && this.__assign) || function () {
18
- __assign = Object.assign || function(t) {
19
- for (var s, i = 1, n = arguments.length; i < n; i++) {
20
- s = arguments[i];
21
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
- t[p] = s[p];
23
- }
24
- return t;
25
- };
26
- return __assign.apply(this, arguments);
27
- };
28
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
29
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
30
- if (ar || !(i in from)) {
31
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
32
- ar[i] = from[i];
33
- }
34
- }
35
- return to.concat(ar || Array.prototype.slice.call(from));
36
- };
37
- Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.Editor = void 0;
39
- var React = require("react");
40
- var PropTypes = require("prop-types");
41
- var kendo_react_buttons_1 = require("@progress/kendo-react-buttons");
42
- var kendo_react_common_1 = require("@progress/kendo-react-common");
43
- var kendo_editor_common_1 = require("@progress/kendo-editor-common");
44
- var schema_1 = require("./config/schema");
45
- var defaultStyles_1 = require("./config/defaultStyles");
46
- var toolsSettings_1 = require("./config/toolsSettings");
47
- var main_1 = require("./dialogs/main");
48
- var utils_1 = require("./utils");
49
- var props_key_1 = require("./utils/props-key");
50
- var controlled_value_1 = require("./utils/controlled-value");
51
- var browser_detection_1 = require("./utils/browser-detection");
52
- var package_metadata_1 = require("./package-metadata");
53
- var kendo_react_common_2 = require("@progress/kendo-react-common");
54
- var link = toolsSettings_1.EditorToolsSettings.link, bold = toolsSettings_1.EditorToolsSettings.bold, italic = toolsSettings_1.EditorToolsSettings.italic, underline = toolsSettings_1.EditorToolsSettings.underline;
55
- var messages_1 = require("./messages");
56
- var kendo_react_intl_1 = require("@progress/kendo-react-intl");
57
- /**
58
- * Represents the [KendoReact Editor component]({% slug overview_editor %}).
59
- *
60
- * @example
61
- * ```jsx
62
- * class App extends React.Component {
63
- * render() {
64
- * return (
65
- * <Editor
66
- * defaultContent="<p>Hello World</p>"
67
- * tools={[
68
- * [ EditorTools.Bold, EditorTools.Italic ]
69
- * ]}
70
- * />
71
- * );
72
- * }
73
- * }
74
- * ReactDOM.render(<App />, document.querySelector('my-app'));
75
- * ```
76
- */
77
- var Editor = /** @class */ (function (_super) {
78
- __extends(Editor, _super);
79
- function Editor(props) {
80
- var _this = _super.call(this, props) || this;
81
- /**
82
- * @hidden
83
- */
84
- _this.state = {
85
- view: undefined,
86
- linkDialog: false
87
- };
88
- _this._element = null;
89
- _this._contentElement = null;
90
- _this.iframe = null;
91
- _this.trOnChange = null;
92
- _this.htmlOnChange = null;
93
- _this.showLicenseWatermark = false;
94
- /**
95
- * @hidden
96
- */
97
- _this.focus = function () {
98
- if (_this.view) {
99
- _this.view.focus();
100
- }
101
- };
102
- _this.renderDialog = function (Component, settings, stateFlag) {
103
- return _this.state[stateFlag] && (React.createElement(Component, { view: _this.view, settings: settings, dir: _this.props.dir, onClose: function () {
104
- var _a;
105
- return _this.setState((_a = {}, _a[stateFlag] = false, _a));
106
- } }));
107
- };
108
- _this.renderTool = function (Tool, index) {
109
- var tool = (React.createElement(Tool, { view: _this.view, dir: _this.props.dir, key: index }));
110
- return tool.type === kendo_react_buttons_1.ToolbarSeparator ? React.createElement(Tool, { key: index }) : tool;
111
- };
112
- _this.updateTools = function (view, _prevViewState) {
113
- _this.setState({ view: view });
114
- };
115
- _this.filterTransaction = function (transaction, state) {
116
- var event = { target: _this, transaction: transaction, state: state };
117
- return (_this.props.onExecute &&
118
- _this.props.onExecute.call(undefined, event)) !== false;
119
- };
120
- _this.onPasteHtml = function (html) {
121
- if (_this.props.onPasteHtml && _this.pasteEvent) {
122
- var event_1 = {
123
- target: _this,
124
- pastedHtml: html,
125
- nativeEvent: _this.pasteEvent
126
- };
127
- var newHtml = _this.props.onPasteHtml.call(undefined, event_1);
128
- _this.pasteEvent = undefined;
129
- if (typeof newHtml === 'string') {
130
- return newHtml;
131
- }
132
- }
133
- return html;
134
- };
135
- _this.dispatchTransaction = function (transaction) {
136
- var docChanged = transaction.docChanged;
137
- if (_this.props.onChange && docChanged) {
138
- _this.trOnChange = transaction;
139
- var doc_1 = transaction.doc, schema_2 = transaction.doc.type.schema;
140
- var target_1 = _this;
141
- var event_2 = {
142
- target: target_1,
143
- value: doc_1,
144
- get html() {
145
- target_1.htmlOnChange = utils_1.EditorUtils.getHtml({ doc: doc_1, schema: schema_2 });
146
- return target_1.htmlOnChange;
147
- },
148
- transaction: transaction,
149
- schema: schema_2
150
- };
151
- _this.props.onChange.call(undefined, event_2);
152
- }
153
- if (_this.view && (_this.props.value === undefined || !docChanged)) {
154
- _this.view.updateState(_this.view.state.apply(transaction));
155
- }
156
- };
157
- _this.onFocus = function (_view, nativeEvent) {
158
- if (_this.props.onFocus) {
159
- var event_3 = {
160
- target: _this,
161
- nativeEvent: nativeEvent
162
- };
163
- _this.props.onFocus.call(undefined, event_3);
164
- }
165
- return false;
166
- };
167
- _this.onBlur = function (_view, nativeEvent) {
168
- if (_this.props.onBlur) {
169
- var event_4 = {
170
- target: _this,
171
- nativeEvent: nativeEvent
172
- };
173
- _this.props.onBlur.call(undefined, event_4);
174
- }
175
- return false;
176
- };
177
- _this.onPaste = function (_view, nativeEvent) {
178
- if (_this.props.onPasteHtml) {
179
- _this.pasteEvent = nativeEvent;
180
- }
181
- return false;
182
- };
183
- (0, kendo_react_common_2.validatePackage)(package_metadata_1.packageMetadata);
184
- _this.showLicenseWatermark = (0, kendo_react_common_2.shouldShowValidationUI)(package_metadata_1.packageMetadata);
185
- return _this;
186
- }
187
- Object.defineProperty(Editor.prototype, "value", {
188
- /**
189
- * The value of the Editor.
190
- */
191
- get: function () {
192
- if (this.trOnChange !== null) {
193
- return this.trOnChange.doc;
194
- }
195
- else if (this.props.value !== undefined) {
196
- return this.props.value;
197
- }
198
- else if (this.view) {
199
- return this.view.state.doc;
200
- }
201
- return this.props.defaultContent || '';
202
- },
203
- enumerable: false,
204
- configurable: true
205
- });
206
- Object.defineProperty(Editor.prototype, "element", {
207
- /**
208
- * Returns the DOM element of the Editor.
209
- */
210
- get: function () {
211
- return this._element;
212
- },
213
- enumerable: false,
214
- configurable: true
215
- });
216
- Object.defineProperty(Editor.prototype, "contentElement", {
217
- /**
218
- * Returns the content-editable DOM element of the Editor.
219
- */
220
- get: function () {
221
- return this._contentElement;
222
- },
223
- enumerable: false,
224
- configurable: true
225
- });
226
- Object.defineProperty(Editor.prototype, "view", {
227
- /**
228
- * Returns the `view` object of the Editor.
229
- */
230
- get: function () {
231
- return this._view;
232
- },
233
- enumerable: false,
234
- configurable: true
235
- });
236
- /**
237
- * @hidden
238
- */
239
- Editor.prototype.componentDidMount = function () {
240
- if (!this.iframe || !browser_detection_1.firefox) {
241
- this.initialize();
242
- }
243
- };
244
- /**
245
- * @hidden
246
- */
247
- Editor.prototype.componentDidUpdate = function (prevProps) {
248
- var value = this.props.value;
249
- var view = this.view;
250
- if (value === undefined || !view) {
251
- return;
252
- }
253
- (0, controlled_value_1.updateEditorValue)(view, value, prevProps.value, this.trOnChange, this.htmlOnChange);
254
- this.trOnChange = null;
255
- this.htmlOnChange = null;
256
- };
257
- /**
258
- * @hidden
259
- */
260
- Editor.prototype.componentWillUnmount = function () {
261
- if (this.view) {
262
- this.view.destroy();
263
- }
264
- this._view = undefined;
265
- var iframeWindow = this.iframe && this.iframe.contentWindow;
266
- if (iframeWindow) {
267
- if (this._contentElement && this._contentElement.parentNode) {
268
- this._contentElement.parentNode.removeChild(this._contentElement);
269
- }
270
- var head = iframeWindow.document.head;
271
- while (head && head.firstChild) {
272
- head.removeChild(head.firstChild);
273
- }
274
- }
275
- };
276
- /**
277
- * @hidden
278
- */
279
- Editor.prototype.render = function () {
280
- var _this = this;
281
- 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;
282
- var localization = (0, kendo_react_intl_1.provideLocalizationService)(this);
283
- if (this.view) {
284
- var editorProps = props_key_1.editorPropsKey.getState(this.view.state);
285
- editorProps.preserveWhitespace = preserveWhitespace;
286
- }
287
- var contentStyle = this.props.contentStyle;
288
- if (contentStyle === undefined && (style || {}).height === undefined) {
289
- contentStyle = { height: '300px' };
290
- }
291
- var buttons = tools.map(function (item, index) {
292
- return Array.isArray(item) ?
293
- React.createElement(kendo_react_buttons_1.ButtonGroup, { key: index }, item.map(_this.renderTool, index)) :
294
- _this.renderTool(item, index);
295
- });
296
- return (React.createElement("div", { ref: function (e) { return _this._element = e; }, className: (0, kendo_react_common_1.classNames)('k-editor', className, { 'k-editor-resizable': this.props.resizable }), dir: this.props.dir, style: style },
297
- buttons.length > 0 && (React.createElement(kendo_react_buttons_1.Toolbar, { className: 'k-editor-toolbar', keyboardNavigation: this.props.keyboardNavigation }, buttons)),
298
- defaultEditMode === 'iframe' ?
299
- (React.createElement("div", { className: "k-editor-content" },
300
- React.createElement("iframe", { onLoad: browser_detection_1.firefox ? function () {
301
- _this.initialize();
302
- } : undefined, ref: function (e) { return _this.iframe = e; }, frameBorder: "0", title: localization.toLanguageString(messages_1.keys.iframeTitle, messages_1.messages[messages_1.keys.iframeTitle]), style: contentStyle, className: "k-iframe" }))) :
303
- (React.createElement("div", { style: contentStyle, className: "k-editor-content" },
304
- 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 }))),
305
- this.renderDialog(main_1.EditorDialogs.InsertLinkDialog, link, 'linkDialog'),
306
- this.showLicenseWatermark && React.createElement(kendo_react_common_2.WatermarkOverlay, null)));
307
- };
308
- Editor.prototype.initialize = function () {
309
- var _this = this;
310
- var iframeWindow = this.iframe && this.iframe.contentWindow;
311
- if (iframeWindow) {
312
- var iframeDocument_1 = iframeWindow.document;
313
- [defaultStyles_1.defaultStyle, defaultStyles_1.tablesStyles, this.props.dir === 'rtl' ? defaultStyles_1.rtlStyles : undefined].forEach(function (styles) {
314
- if (styles) {
315
- var style = iframeDocument_1.createElement('style');
316
- style.appendChild(iframeDocument_1.createTextNode(styles));
317
- iframeDocument_1.head.appendChild(style);
318
- }
319
- });
320
- var meta = iframeDocument_1.createElement('meta');
321
- meta.setAttribute('charset', 'utf-8');
322
- iframeDocument_1.head.appendChild(meta);
323
- // The content has to be wrapped because the `dropCursor` plugin raises a `body.offsetParent is null` error.
324
- this._contentElement = iframeDocument_1.createElement('div');
325
- iframeDocument_1.body.appendChild(this._contentElement);
326
- this._contentElement.classList.add('k-content');
327
- }
328
- var dom = this._contentElement;
329
- if (!dom) {
330
- return;
331
- }
332
- var _a = this.props.preserveWhitespace, preserveWhitespace = _a === void 0 ? 'full' : _a;
333
- var target = this;
334
- var plugins = [
335
- // https://prosemirror.net/docs/ref/#state.PluginSpec
336
- new kendo_editor_common_1.Plugin({
337
- view: function () { return ({ update: _this.updateTools }); },
338
- key: new kendo_editor_common_1.PluginKey('toolbar-tools-update-plugin')
339
- }),
340
- new kendo_editor_common_1.Plugin({
341
- filterTransaction: this.filterTransaction,
342
- key: new kendo_editor_common_1.PluginKey('onExecute-event-plugin')
343
- }),
344
- new kendo_editor_common_1.Plugin({
345
- key: props_key_1.editorPropsKey,
346
- state: {
347
- init: function () { return ({ preserveWhitespace: preserveWhitespace }); },
348
- apply: function (_, val) { return val; }
349
- }
350
- }),
351
- (0, kendo_editor_common_1.spacesFix)(),
352
- (0, kendo_editor_common_1.caretColor)(),
353
- (0, kendo_editor_common_1.history)(),
354
- (0, kendo_editor_common_1.dropCursor)(),
355
- (0, kendo_editor_common_1.gapCursor)(),
356
- (0, kendo_editor_common_1.tableEditing)(),
357
- (0, kendo_editor_common_1.cspFix)()
358
- ];
359
- var shortcuts = __assign(__assign({}, utils_1.EditorUtils.getShortcuts({
360
- types: { listItem: 'list_item', hardBreak: 'hard_break' },
361
- toolsSettings: { bold: bold, italic: italic, underline: underline }
362
- })), { 'Mod-k': function () {
363
- var linkDialog = _this.state.linkDialog;
364
- var editorView = _this.view;
365
- if (editorView) {
366
- var editorState = editorView.state;
367
- var collapsed = editorState.selection.empty;
368
- var linkMark = (0, kendo_editor_common_1.getMark)(editorState, editorState.schema.marks[link.mark]);
369
- var disabled = collapsed && !linkMark;
370
- if (!linkDialog && !disabled) {
371
- _this.setState({ linkDialog: true });
372
- }
373
- }
374
- return !linkDialog;
375
- }, 'Alt-F10': function () {
376
- var _a;
377
- var toolbar = (_a = _this.element) === null || _a === void 0 ? void 0 : _a.querySelector('.k-toolbar');
378
- if (toolbar) {
379
- var button = toolbar.querySelector(kendo_react_buttons_1.toolbarButtons.join(','));
380
- if (button) {
381
- button.focus();
382
- return true;
383
- }
384
- }
385
- return false;
386
- } });
387
- var _b = this.props, _c = _b.defaultContent, defaultContent = _c === void 0 ? '' : _c, value = _b.value, onMount = _b.onMount;
388
- var doc = (value && typeof value !== 'string') ? value :
389
- utils_1.EditorUtils.createDocument(new kendo_editor_common_1.Schema({ nodes: schema_1.nodes, marks: schema_1.marks }), value || defaultContent, { preserveWhitespace: preserveWhitespace });
390
- var viewProps = {
391
- state: kendo_editor_common_1.EditorState.create({
392
- plugins: __spreadArray(__spreadArray([], plugins, true), [(0, kendo_editor_common_1.keymap)(shortcuts), (0, kendo_editor_common_1.keymap)(kendo_editor_common_1.baseKeymap)], false),
393
- doc: doc
394
- }),
395
- transformPastedHTML: this.onPasteHtml,
396
- dispatchTransaction: this.dispatchTransaction,
397
- handleDOMEvents: {
398
- focus: this.onFocus,
399
- blur: this.onBlur,
400
- paste: this.onPaste
401
- },
402
- handleDrop: function (_view, _event, slice, _moved) {
403
- var hasCaption = false;
404
- slice.content.nodesBetween(0, slice.content.size, function (node) {
405
- hasCaption = hasCaption || node.type.name === 'table_caption_external';
406
- });
407
- return hasCaption;
408
- }
409
- };
410
- var mountEvent = { plugins: plugins, shortcuts: shortcuts, target: target, viewProps: viewProps, dom: dom };
411
- var view = this._view = (onMount && onMount.call(undefined, mountEvent)) || new kendo_editor_common_1.EditorView({ mount: dom }, viewProps);
412
- this.setState({
413
- view: view
414
- });
415
- };
416
- /**
417
- * @hidden
418
- */
419
- Editor.propTypes = {
420
- defaultContent: PropTypes.string,
421
- value: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
422
- defaultEditMode: PropTypes.oneOf(['iframe', 'div']),
423
- contentStyle: PropTypes.object,
424
- dir: PropTypes.string,
425
- className: PropTypes.string,
426
- ariaDescribedBy: PropTypes.string,
427
- ariaLabelledBy: PropTypes.string,
428
- ariaLabel: PropTypes.string,
429
- style: PropTypes.object,
430
- tools: PropTypes.arrayOf(PropTypes.any),
431
- keyboardNavigation: PropTypes.bool,
432
- resizable: PropTypes.bool,
433
- preserveWhitespace: PropTypes.oneOf([true, false, 'full']),
434
- onMount: PropTypes.func,
435
- onFocus: PropTypes.func,
436
- onBlur: PropTypes.func,
437
- onChange: PropTypes.func,
438
- onPasteHtml: PropTypes.func,
439
- onExecute: PropTypes.func
440
- };
441
- return Editor;
442
- }(React.Component));
443
- exports.Editor = Editor;
444
- (0, kendo_react_intl_1.registerForLocalization)(Editor);
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,12 +0,0 @@
1
- /**
2
- * @hidden
3
- */
4
- export declare const 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 declare const 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 declare const rtlStyles = "body { direction: rtl }";
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.rtlStyles = exports.tablesStyles = exports.defaultStyle = void 0;
4
- /**
5
- * @hidden
6
- */
7
- exports.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";
8
- /**
9
- * @hidden
10
- */
11
- exports.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";
12
- /**
13
- * @hidden
14
- */
15
- exports.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,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +0,0 @@
1
- export { marks, nodes } from '@progress/kendo-editor-common';
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.nodes = exports.marks = void 0;
4
- var kendo_editor_common_1 = require("@progress/kendo-editor-common");
5
- Object.defineProperty(exports, "marks", { enumerable: true, get: function () { return kendo_editor_common_1.marks; } });
6
- Object.defineProperty(exports, "nodes", { enumerable: true, get: function () { return kendo_editor_common_1.nodes; } });
@@ -1,24 +0,0 @@
1
- import { EditorState, Transaction, EditorView } from '@progress/kendo-editor-common';
2
- import { EditorToolsSettings } from './toolsSettings';
3
- declare const bold: EditorToolsSettings.InlineFormatSettings, underline: EditorToolsSettings.InlineFormatSettings, italic: EditorToolsSettings.InlineFormatSettings;
4
- /**
5
- * @hidden
6
- */
7
- export interface Shortcuts {
8
- [key: string]: (state: EditorState, dispatch: (tr: Transaction) => void, view: EditorView) => boolean;
9
- }
10
- /**
11
- * @hidden
12
- */
13
- export declare const getShortcuts: (settings?: {
14
- types?: {
15
- listItem: string;
16
- hardBreak: string;
17
- } | undefined;
18
- toolsSettings?: {
19
- bold?: EditorToolsSettings.InlineFormatOptions | undefined;
20
- italic?: EditorToolsSettings.InlineFormatOptions | undefined;
21
- underline?: EditorToolsSettings.InlineFormatOptions | undefined;
22
- } | undefined;
23
- } | undefined) => Shortcuts;
24
- export {};
@@ -1,38 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.getShortcuts = void 0;
15
- var kendo_editor_common_1 = require("@progress/kendo-editor-common");
16
- var toolsSettings_1 = require("./toolsSettings");
17
- var bold = toolsSettings_1.EditorToolsSettings.bold, underline = toolsSettings_1.EditorToolsSettings.underline, italic = toolsSettings_1.EditorToolsSettings.italic;
18
- var mac = typeof navigator !== 'undefined' ? /Mac/.test(navigator.platform) : false;
19
- /**
20
- * @hidden
21
- */
22
- var getShortcuts = function (settings) {
23
- var insertBr = (0, kendo_editor_common_1.chainCommands)(kendo_editor_common_1.exitCode, function (state, dispatch) {
24
- var hardBreak = settings && settings.types && settings.types.hardBreak || 'hard_break';
25
- var br = state.schema.nodes[hardBreak];
26
- if (dispatch) {
27
- dispatch(state.tr.replaceSelectionWith(br.create()).scrollIntoView());
28
- }
29
- return true;
30
- });
31
- var listItem = settings && settings.types && settings.types.listItem || 'list_item';
32
- var toolsSettings = settings && settings.toolsSettings || {};
33
- var shortcutsSettings = __assign(__assign(__assign(__assign({ 'Mod-b': function (state, dispatch) { return (0, kendo_editor_common_1.toggleInlineFormat)(toolsSettings.bold || bold)(state, dispatch); }, 'Mod-i': function (state, dispatch) { return (0, kendo_editor_common_1.toggleInlineFormat)(toolsSettings.italic || italic)(state, dispatch); }, 'Mod-u': function (state, dispatch) { return (0, kendo_editor_common_1.toggleInlineFormat)(toolsSettings.underline || underline)(state, dispatch); }, 'Mod-z': kendo_editor_common_1.undo, 'Shift-Mod-z': kendo_editor_common_1.redo }, __assign({}, !mac ? { 'Mod-y': kendo_editor_common_1.redo } : {})), { 'Backspace': kendo_editor_common_1.undoInputRule, 'Mod-Enter': insertBr, 'Shift-Enter': insertBr }), __assign({}, mac ? { 'Ctrl-Enter': insertBr } : {})), { 'Enter': function (state, dispatch) {
34
- return (0, kendo_editor_common_1.splitListItem)(state.schema.nodes[listItem])(state, dispatch);
35
- }, 'Tab': (0, kendo_editor_common_1.goToNextCell)(1), 'Shift-Tab': (0, kendo_editor_common_1.goToNextCell)(-1) });
36
- return shortcutsSettings;
37
- };
38
- exports.getShortcuts = getShortcuts;