@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,431 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- import * as shortcuts from './../config/shortcuts';
13
- import { marks as schemaMarks, nodes as schemaNodes } from './../config/schema';
14
- import { alignBlocks as alignBlocksCommon, applyInlineStyle as applyInlineStyleCommon, applyLink as applyLinkCommon, canIndentAsListItem, canOutdentAsListItem, parseContent, canInsert as canInsertCommon, createTable as createTableCommon, formatBlockElements as formatBlockElementsCommon, getBlockFormats as getBlockFormatsCommon, getHtml as getHtmlCommon, getInlineStyles as getInlineStylesCommon, getMark as getMarkCommon, hasMark as hasMarkCommon, hasNode as hasNodeCommon, indentBlocks as indentBlocksCommon, setHtml as setHtmlCommon, insertNode as insertNodeCommon, isAligned as isAlignedCommon, isIndented as isIndentedCommon, toggleInlineFormat as toggleInlineFormatCommon, toggleList as toggleListCommon, indentHtml as indentHtmlCommon, convertMsLists as convertMsListsCommon, removeComments as removeCommentsCommon, removeTag as removeTagCommon, sanitize as sanitizeCommon, pasteCleanup as pasteCleanupCommon, sanitizeClassAttr as sanitizeClassAttrCommon, sanitizeStyleAttr as sanitizeStyleAttrCommon, removeAttribute as removeAttributeCommon, replaceImageSourcesFromRtf as replaceImageSourcesFromRtfCommon, textHighlight as textHighlightCommon, imageResizing as imageResizingCommon, imageResizeKey as imageResizeKeyCommon, tableResizing as tableResizingCommon, trimWhitespace } from '@progress/kendo-editor-common';
15
- import { editorPropsKey } from './props-key';
16
- /**
17
- * Represents a wrapping namespace for the utility functions, `nodes`, and `marks` objects of the Editor.
18
- */
19
- export var EditorUtils;
20
- (function (EditorUtils) {
21
- /**
22
- * Aligns the block elements in the selection.
23
- *
24
- * @returns {boolean}&mdash;If alignment is applied to any of the elements, returns `true`.
25
- */
26
- function alignBlocks(view, actions, command) {
27
- return Boolean(alignBlocksCommon(actions, command)(view.state, view.dispatch));
28
- }
29
- EditorUtils.alignBlocks = alignBlocks;
30
- /**
31
- * Wraps the selection in a `span` element with inline styles.
32
- *
33
- * @returns {boolean}&mdash;If a style is applied to any of the elements, returns `true`.
34
- */
35
- function applyInlineStyle(view, options, command) {
36
- return applyInlineStyleCommon(options, command)(view.state, view.dispatch);
37
- }
38
- EditorUtils.applyInlineStyle = applyInlineStyle;
39
- /**
40
- * Applies the link mark.
41
- *
42
- * @returns {boolean}&mdash;If the link is applied, returns `true`.
43
- */
44
- function applyLink(view, options, command) {
45
- return applyLinkCommon(options, command)(view.state, view.dispatch);
46
- }
47
- EditorUtils.applyLink = applyLink;
48
- /**
49
- * Checks if any of the `list` elements in the selection can be indented.
50
- *
51
- * @returns {boolean}
52
- */
53
- function canIndentList(state, nodeType) {
54
- return canIndentAsListItem(state, nodeType);
55
- }
56
- EditorUtils.canIndentList = canIndentList;
57
- /**
58
- * Checks if a node can be inserted in the current selection.
59
- *
60
- * @param {EditorState} state&mdash;The `state` object of the Editor.
61
- * @param {NodeType} nodeType&mdash;The type of the node that will be inserted.
62
- * @returns {boolean}&mdash;The node of this type can be inserted in the current selection.
63
- */
64
- function canInsert(state, nodeType) {
65
- return canInsertCommon(state, nodeType);
66
- }
67
- EditorUtils.canInsert = canInsert;
68
- /**
69
- * Checks if any of the `list` elements in the selection can be outdented.
70
- *
71
- * @returns {boolean}
72
- */
73
- function canOutdentList(state, listsTypes) {
74
- return canOutdentAsListItem(state, { listsTypes: listsTypes, nodes: [] });
75
- }
76
- EditorUtils.canOutdentList = canOutdentList;
77
- /**
78
- * Converts the MS Word lists into HTML lists.
79
- *
80
- * @param {string} html&mdash;The input HTML.
81
- * @returns {string}&mdash;The result HTML.
82
- */
83
- function convertMsLists(html) {
84
- return convertMsListsCommon(html);
85
- }
86
- EditorUtils.convertMsLists = convertMsLists;
87
- /**
88
- * Creates an Editor document from HTML content.
89
- *
90
- * @param {Schema} schema&mdash;The `schema` object of the Editor.
91
- * @param {string} html&mdash;The HTML content.
92
- * @param {ParseOptions} parseOptions&mdash;The HTML parsing options. Defaults to `{ preserveWhitespace: 'full' }`.
93
- * @returns {Node}&mdash;The `document` object of the Editor.
94
- */
95
- function createDocument(schema, html, parseOptions) {
96
- return parseContent(trimWhitespace(html), schema, parseOptions !== undefined ? parseOptions : { preserveWhitespace: 'full' });
97
- }
98
- EditorUtils.createDocument = createDocument;
99
- /**
100
- * Creates a table.
101
- *
102
- * @param {object} tableTypes&mdash;An object which contains `table`, `table_row`, and `table_cell` node types.
103
- * @param {number} rows&mdash;The number of rows.
104
- * @param {number} columns&mdash;The number of columns.
105
- * @returns {Node}&mdash;The generated table.
106
- *
107
- * @example
108
- * ```jsx-no-run
109
- * import { EditorUtils } from '@progress/kendo-react-editor';
110
- *
111
- * const nodes = editorRef.view.state.schema.nodes;
112
- * const rows = 3;
113
- * const columns = 4;
114
- *
115
- * const table = EditorUtils.createTable(nodes, rows, columns);
116
- * ```
117
- */
118
- function createTable(tableTypes, rows, columns) {
119
- return createTableCommon(tableTypes, rows, columns);
120
- }
121
- EditorUtils.createTable = createTable;
122
- /**
123
- * Formats the paragraph and heading nodes in the selection.
124
- *
125
- * @returns {boolean}&mdash;If an element is formatted, returns `true`.
126
- */
127
- function formatBlockElements(view, value, commandName) {
128
- return formatBlockElementsCommon(value, commandName)(view.state, view.dispatch);
129
- }
130
- EditorUtils.formatBlockElements = formatBlockElements;
131
- /**
132
- * Returns the paragraph and heading nodes in the selection.
133
- *
134
- * @returns {string[]}
135
- */
136
- function getBlockFormats(state) {
137
- return getBlockFormatsCommon(state);
138
- }
139
- EditorUtils.getBlockFormats = getBlockFormats;
140
- /**
141
- * Gets the HTML from the `EditorState` object.
142
- *
143
- * @param {EditorState} state&mdash;The `state` object of the Editor or an object containing editor's `doc` and `schema`
144
- *&mdash;{ doc: value, schema: value.types.schema } where the `value` variable is the editor's value prop.
145
- * @returns {string}&mdash;The HTML content.
146
- */
147
- function getHtml(state) {
148
- return getHtmlCommon(state);
149
- }
150
- EditorUtils.getHtml = getHtml;
151
- /**
152
- * @returns {string[]}&mdash;An array of matched styles that are found in the selection.
153
- */
154
- function getInlineStyles(state, style) {
155
- return getInlineStylesCommon(state, style);
156
- }
157
- EditorUtils.getInlineStyles = getInlineStyles;
158
- /**
159
- * Returns a mark of the specified type from the nodes in selection.
160
- *
161
- * @returns {Mark}
162
- */
163
- function getMark(state, markType) {
164
- return getMarkCommon(state, markType);
165
- }
166
- EditorUtils.getMark = getMark;
167
- /**
168
- * Checks if according to the specified `InlineFormatOptions` a node in the selection is present.
169
- *
170
- * @returns {boolean}
171
- */
172
- function hasMark(state, options) {
173
- return hasMarkCommon(state, options);
174
- }
175
- EditorUtils.hasMark = hasMark;
176
- /**
177
- * Checks if the selection contains a specific type of node.
178
- *
179
- * @returns {boolean}
180
- */
181
- function hasNode(state, nodeType) {
182
- return hasNodeCommon(state, nodeType);
183
- }
184
- EditorUtils.hasNode = hasNode;
185
- /**
186
- * Indents the block elements in the selection.
187
- *
188
- * @returns {boolean}&mdash;If indentation is applied to any of the elements, returns `true`.
189
- */
190
- function indentBlocks(view, actions, command, dir) {
191
- return Boolean(indentBlocksCommon(actions, command, dir)(view.state, view.dispatch));
192
- }
193
- EditorUtils.indentBlocks = indentBlocks;
194
- /**
195
- * Adds new lines after block elements and hard breaks.
196
- *
197
- * @param {string} content&mdash;The HTML content.
198
- * @returns {string}&mdash;The indented HTML.
199
- */
200
- function indentHtml(content) {
201
- return indentHtmlCommon(content);
202
- }
203
- EditorUtils.indentHtml = indentHtml;
204
- /**
205
- * Inserts a node in the selection.
206
- *
207
- * @param {EditorView} view&mdash;The `view` object of the Editor.
208
- * @param {Node} node&mdash;A `node` object of the Editor.
209
- * @param {boolean} scrollIntoView&mdash;An optional parameter.
210
- * Defines if the content element will be scrolled to the current selection.
211
- */
212
- function insertNode(view, node, scrollIntoView) {
213
- insertNodeCommon(node, scrollIntoView)(view.state, view.dispatch);
214
- }
215
- EditorUtils.insertNode = insertNode;
216
- /**
217
- * Checks if any of the block elements in the selection is aligned.
218
- *
219
- * @returns {boolean}
220
- */
221
- function isAligned(state, actions) {
222
- return isAlignedCommon(state, actions);
223
- }
224
- EditorUtils.isAligned = isAligned;
225
- /**
226
- * Checks if any of the block elements in the selection is indented.
227
- *
228
- * @returns {boolean}
229
- */
230
- function isIndented(state, actions, dir) {
231
- return isIndentedCommon(state, actions, dir);
232
- }
233
- EditorUtils.isIndented = isIndented;
234
- /**
235
- * Removes the comments from the HTML.
236
- *
237
- * @param {string} html&mdash;The input HTML.
238
- * @returns {string}&mdash;The result HTML.
239
- *
240
- * @example
241
- * ```jsx-no-run
242
- * import { EditorUtils } from '@progress/kendo-react-editor';
243
- * const html = EditorUtils.removeComments('<p>some content<!-- comment --></p>');
244
- * ```
245
- */
246
- function removeComments(html) {
247
- return removeCommentsCommon(html);
248
- }
249
- EditorUtils.removeComments = removeComments;
250
- /**
251
- * Removes the specified tag from the HTML and keeps its child nodes.
252
- *
253
- * @param {string} html&mdash;The input HTML.
254
- * @param {string} tag&mdash;A tag or multiple tags separated by a vertical slash which will be removed.
255
- * For example, `span` or `b|i|u|span`.
256
- * @returns {string}&mdash;The resulting HTML.
257
- *
258
- * @example
259
- * ```jsx-no-run
260
- * import { EditorUtils } from '@progress/kendo-react-editor';
261
- * const html = EditorUtils.removeTag('<p>some <span>content</span></p>', 'span|p');
262
- * ```
263
- */
264
- function removeTag(html, tag) {
265
- return removeTagCommon(html, tag);
266
- }
267
- EditorUtils.removeTag = removeTag;
268
- /**
269
- * A function for sanitizing the content on paste ([see example]({% slug paste_editor %})).
270
- *
271
- * @param {string} html&mdash;The input HTML.
272
- * @param {PasteCleanupSettings} settings&mdash;The settings used for sanitizing the content.
273
- * @returns {string}&mdash;The resulting HTML.
274
- */
275
- function pasteCleanup(html, settings) {
276
- return pasteCleanupCommon(html, settings);
277
- }
278
- EditorUtils.pasteCleanup = pasteCleanup;
279
- /**
280
- * A function for sanitizing the CSS classes of the pasted from MS Word content ([see example]({% slug paste_editor %})).
281
- * The function will remove any class attribute which value starts with `Mso`.
282
- * For example `<p class="MsoNormal">pasted from MS Word</p>` will result in `<p>pasted from MS Word</p>`.
283
- *
284
- * @param {Attr} attr&mdash;The DOM class attribute that will be sanitized.
285
- */
286
- function sanitizeClassAttr(attr) {
287
- sanitizeClassAttrCommon(attr);
288
- }
289
- EditorUtils.sanitizeClassAttr = sanitizeClassAttr;
290
- /**
291
- * A function for sanitizing the style attributes of the pasted from MS Word content ([see example]({% slug paste_editor %})).
292
- * The function will loop through all styles and will remove those that are invalid.
293
- * For example `<p><span style='color:#7C7C7C;mso-themecolor:accent3;mso-themeshade:191;background:silver;'>content</span></p>`,
294
- * will result in `<p><span style="color: #7C7C7C; background: silver;">content</span></p>`.
295
- *
296
- * @param {Attr} attr&mdash;The DOM style attribute that will be sanitized.
297
- */
298
- function sanitizeStyleAttr(attr) {
299
- sanitizeStyleAttrCommon(attr);
300
- }
301
- EditorUtils.sanitizeStyleAttr = sanitizeStyleAttr;
302
- /**
303
- * A function that will remove a DOM attribute from the pasted content ([see example]({% slug paste_editor %})).
304
- *
305
- * @param {Attr} attr&mdash;The DOM attribute that will be removed.
306
- */
307
- function removeAttribute(attr) {
308
- removeAttributeCommon(attr);
309
- }
310
- EditorUtils.removeAttribute = removeAttribute;
311
- /**
312
- * Removes the invalid HTML.
313
- *
314
- * @param {string} html&mdash;The HTML which will be sanitized.
315
- * @returns {string}&mdash;The sanitized HTML.
316
- *
317
- * @example
318
- * ```jsx-no-run
319
- * import { EditorUtils } from '@progress/kendo-react-editor';
320
- * const html = EditorUtils.sanitize('something pasted from MS Word, containing <o:p>, <w:sdtPr>, <v:shapes tags');
321
- * ```
322
- */
323
- function sanitize(html) {
324
- return sanitizeCommon(html);
325
- }
326
- EditorUtils.sanitize = sanitize;
327
- /**
328
- * If the input `html` contains images with 'src' pointing to local file system (it happens when pasting images and text from MS Word),
329
- * the function will extract the images sources from the RTF in base64 format and replace them in the input `html`.
330
- *
331
- * @param html&mdash;The input HTML (pasted HTML).
332
- * @param clipboardData&mdash;The paste event clipboardData object (event.clipboardData).
333
- * @returns&mdash;The html with the replaced images sources.
334
- */
335
- function replaceImageSourcesFromRtf(html, clipboardData) {
336
- return replaceImageSourcesFromRtfCommon(html, clipboardData);
337
- }
338
- EditorUtils.replaceImageSourcesFromRtf = replaceImageSourcesFromRtf;
339
- /**
340
- * Creates a plugin which highlights the matches of Find and Replace dialog.
341
- *
342
- * @param {PluginKey} key&mdash;The key of the plugin (Optional).
343
- * @returns {Plugin}&mdash;The text highlight plugin.
344
- */
345
- function textHighlight(key) {
346
- return textHighlightCommon(key);
347
- }
348
- EditorUtils.textHighlight = textHighlight;
349
- /**
350
- * Creates a plugin which adds image resizing functionality.
351
- *
352
- * @param {ImageResizeOptions} options&mdash;The resizing option (Optional).
353
- * @returns {Plugin}&mdash;The image resizing plugin.
354
- */
355
- function imageResizing(options) {
356
- return imageResizingCommon(options);
357
- }
358
- EditorUtils.imageResizing = imageResizing;
359
- /**
360
- * Returns a collection of plugins that adds table resizing functionality.
361
- *
362
- * @returns {Plugin[]}&mdash;The table resizing plugins.
363
- */
364
- function tableResizing() {
365
- return tableResizingCommon();
366
- }
367
- EditorUtils.tableResizing = tableResizing;
368
- /**
369
- * Sets the HTML to the `EditorView`.
370
- *
371
- * @param {EditorView} view&mdash;The `view` object of the Editor.
372
- * @param {string} html&mdash;The HTML content.
373
- * @param {Command} command&mdash;An optional parameter.
374
- * Defines the type of the command that will be set to the `setHtml` metadata of the transaction.
375
- * Defaults to `SetContent`.
376
- * @param {ParseOptions} parseOptions&mdash;An optional parameter.
377
- * Defines the options that will be used for parsing the HTML. Defaults to `{ preserveWhitespace: 'full' }`.
378
- */
379
- function setHtml(view, html, command, parseOptions) {
380
- var trimmed = trimWhitespace(html);
381
- setHtmlCommon(trimmed, command, parseOptions)(view.state, view.dispatch);
382
- }
383
- EditorUtils.setHtml = setHtml;
384
- /**
385
- * Toggles the inline element formatting according to the `InlineFormatOptions` and `markAttrs` settings.
386
- *
387
- * @returns {boolean}
388
- */
389
- function toggleInlineFormat(view, options, transaction, markAttrs) {
390
- return toggleInlineFormatCommon(options, transaction, markAttrs)(view.state, view.dispatch);
391
- }
392
- EditorUtils.toggleInlineFormat = toggleInlineFormat;
393
- /**
394
- * Toggles a list of the specified type.
395
- *
396
- * @returns {boolean}
397
- */
398
- function toggleList(view, types, command) {
399
- return toggleListCommon(view.state, view.dispatch, view, types, command);
400
- }
401
- EditorUtils.toggleList = toggleList;
402
- /* eslint-disable max-len */
403
- /**
404
- * A function which returns the mapped `Shortcuts` object based on the passed settings.
405
- * Useful when the default Editor nodes or tool settings are changed and the `Shortcuts` object has to be regenerated.
406
- *
407
- * @params&mdash;An object which holds specific types of nodes and tool settings that are used by the default `Shortcuts` handlers.
408
- * @returns&mdash;An object which holds the shortcuts.
409
- */
410
- // tslint:enable:max-line-length
411
- function getShortcuts(settings) {
412
- return shortcuts.getShortcuts(settings);
413
- }
414
- EditorUtils.getShortcuts = getShortcuts;
415
- /**
416
- * The `PluginKey` used in the Editor to pass editor props to the tools.
417
- */
418
- EditorUtils.propsKey = editorPropsKey;
419
- /**
420
- * The `PluginKey` used in the Editor by the image resizing plugin.
421
- */
422
- EditorUtils.imageResizeKey = imageResizeKeyCommon;
423
- /**
424
- * Represents the `marks` object of the Editor.
425
- */
426
- EditorUtils.marks = __assign({}, schemaMarks);
427
- /**
428
- * Represents the `nodes` object of the Editor.
429
- */
430
- EditorUtils.nodes = __assign({}, schemaNodes);
431
- })(EditorUtils || (EditorUtils = {}));
@@ -1,5 +0,0 @@
1
- import { PluginKey } from '@progress/kendo-editor-common';
2
- /**
3
- * @hidden
4
- */
5
- export declare const editorPropsKey: PluginKey<any>;
@@ -1,5 +0,0 @@
1
- import { PluginKey } from '@progress/kendo-editor-common';
2
- /**
3
- * @hidden
4
- */
5
- export var editorPropsKey = new PluginKey('editor-props');
@@ -1,118 +0,0 @@
1
- import * as React from 'react';
2
- import * as PropTypes from 'prop-types';
3
- import { EditorView, Node } from '@progress/kendo-editor-common';
4
- import { EditorProps } from './EditorProps';
5
- /**
6
- * @hidden
7
- */
8
- interface EditorStateInterface {
9
- view?: EditorView;
10
- linkDialog?: boolean;
11
- }
12
- /**
13
- * Represents the [KendoReact Editor component]({% slug overview_editor %}).
14
- *
15
- * @example
16
- * ```jsx
17
- * class App extends React.Component {
18
- * render() {
19
- * return (
20
- * <Editor
21
- * defaultContent="<p>Hello World</p>"
22
- * tools={[
23
- * [ EditorTools.Bold, EditorTools.Italic ]
24
- * ]}
25
- * />
26
- * );
27
- * }
28
- * }
29
- * ReactDOM.render(<App />, document.querySelector('my-app'));
30
- * ```
31
- */
32
- export declare class Editor extends React.Component<EditorProps, EditorStateInterface> {
33
- /**
34
- * @hidden
35
- */
36
- static propTypes: {
37
- defaultContent: PropTypes.Requireable<string>;
38
- value: PropTypes.Requireable<NonNullable<string | object | null | undefined>>;
39
- defaultEditMode: PropTypes.Requireable<string>;
40
- contentStyle: PropTypes.Requireable<object>;
41
- dir: PropTypes.Requireable<string>;
42
- className: PropTypes.Requireable<string>;
43
- ariaDescribedBy: PropTypes.Requireable<string>;
44
- ariaLabelledBy: PropTypes.Requireable<string>;
45
- ariaLabel: PropTypes.Requireable<string>;
46
- style: PropTypes.Requireable<object>;
47
- tools: PropTypes.Requireable<any[]>;
48
- keyboardNavigation: PropTypes.Requireable<boolean>;
49
- resizable: PropTypes.Requireable<boolean>;
50
- preserveWhitespace: PropTypes.Requireable<string | boolean>;
51
- onMount: PropTypes.Requireable<(...args: any[]) => any>;
52
- onFocus: PropTypes.Requireable<(...args: any[]) => any>;
53
- onBlur: PropTypes.Requireable<(...args: any[]) => any>;
54
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
55
- onPasteHtml: PropTypes.Requireable<(...args: any[]) => any>;
56
- onExecute: PropTypes.Requireable<(...args: any[]) => any>;
57
- };
58
- /**
59
- * @hidden
60
- */
61
- readonly state: EditorStateInterface;
62
- /**
63
- * The value of the Editor.
64
- */
65
- get value(): Node | string;
66
- /**
67
- * Returns the DOM element of the Editor.
68
- */
69
- get element(): HTMLElement | null;
70
- /**
71
- * Returns the content-editable DOM element of the Editor.
72
- */
73
- get contentElement(): HTMLDivElement | null;
74
- /**
75
- * Returns the `view` object of the Editor.
76
- */
77
- get view(): EditorView | undefined;
78
- private _element;
79
- private _view?;
80
- private _contentElement;
81
- private iframe;
82
- private trOnChange;
83
- private htmlOnChange;
84
- private pasteEvent?;
85
- private showLicenseWatermark;
86
- constructor(props: EditorProps);
87
- /**
88
- * @hidden
89
- */
90
- componentDidMount(): void;
91
- /**
92
- * @hidden
93
- */
94
- componentDidUpdate(prevProps: EditorProps): void;
95
- /**
96
- * @hidden
97
- */
98
- componentWillUnmount(): void;
99
- /**
100
- * @hidden
101
- */
102
- focus: () => void;
103
- /**
104
- * @hidden
105
- */
106
- render(): JSX.Element;
107
- private renderDialog;
108
- private renderTool;
109
- private updateTools;
110
- private initialize;
111
- private filterTransaction;
112
- private onPasteHtml;
113
- private dispatchTransaction;
114
- private onFocus;
115
- private onBlur;
116
- private onPaste;
117
- }
118
- export {};