@progress/kendo-react-editor 5.15.0-dev.202307180734 → 5.15.0-dev.202307181521

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 (37) hide show
  1. package/dist/cdn/js/kendo-react-editor.js +1 -1
  2. package/dist/es/Editor.js +7 -0
  3. package/dist/es/messages/index.d.ts +162 -0
  4. package/dist/es/messages/index.js +487 -1
  5. package/dist/es/package-metadata.js +1 -1
  6. package/dist/es/tools/insertTable/tool.js +3 -2
  7. package/dist/es/tools/main.d.ts +20 -0
  8. package/dist/es/tools/main.js +12 -0
  9. package/dist/es/tools/table-wizard/tableCellProperties.d.ts +35 -0
  10. package/dist/es/tools/table-wizard/tableCellProperties.js +471 -0
  11. package/dist/es/tools/table-wizard/tableProperties.d.ts +11 -0
  12. package/dist/es/tools/table-wizard/tableProperties.js +701 -0
  13. package/dist/es/tools/table-wizard/utils.d.ts +25 -0
  14. package/dist/es/tools/table-wizard/utils.js +90 -0
  15. package/dist/es/tools/tableEdit.d.ts +9 -0
  16. package/dist/es/tools/tableEdit.js +2 -2
  17. package/dist/es/tools/utils.d.ts +30 -1
  18. package/dist/es/tools/utils.js +39 -1
  19. package/dist/npm/Editor.js +7 -0
  20. package/dist/npm/messages/index.d.ts +162 -0
  21. package/dist/npm/messages/index.js +487 -1
  22. package/dist/npm/package-metadata.js +1 -1
  23. package/dist/npm/tools/insertTable/tool.js +2 -1
  24. package/dist/npm/tools/main.d.ts +20 -0
  25. package/dist/npm/tools/main.js +12 -0
  26. package/dist/npm/tools/table-wizard/tableCellProperties.d.ts +35 -0
  27. package/dist/npm/tools/table-wizard/tableCellProperties.js +479 -0
  28. package/dist/npm/tools/table-wizard/tableProperties.d.ts +11 -0
  29. package/dist/npm/tools/table-wizard/tableProperties.js +705 -0
  30. package/dist/npm/tools/table-wizard/utils.d.ts +25 -0
  31. package/dist/npm/tools/table-wizard/utils.js +97 -0
  32. package/dist/npm/tools/tableEdit.d.ts +9 -0
  33. package/dist/npm/tools/tableEdit.js +5 -3
  34. package/dist/npm/tools/utils.d.ts +30 -1
  35. package/dist/npm/tools/utils.js +43 -1
  36. package/dist/systemjs/kendo-react-editor.js +1 -1
  37. package/package.json +13 -13
@@ -0,0 +1,25 @@
1
+ import { Node } from '@progress/kendo-editor-common';
2
+ /**
3
+ * @hidden
4
+ */
5
+ export declare const reUnit: RegExp;
6
+ /**
7
+ * @hidden
8
+ */
9
+ export declare const getUnit: (value: string) => string;
10
+ /**
11
+ * @hidden
12
+ */
13
+ export declare const nodeSize: (node: Node, style: string) => {
14
+ [x: string]: string | number | null;
15
+ };
16
+ /**
17
+ * @hidden
18
+ */
19
+ export declare const parseStyle: (styleText: string | null) => {
20
+ [x: string]: string;
21
+ };
22
+ /**
23
+ * @hidden
24
+ */
25
+ export declare function setNodeStyle(nodeAttrs: any, styleType: string, value: string): any;
@@ -0,0 +1,90 @@
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
+ /**
13
+ * @hidden
14
+ */
15
+ export var reUnit = /[\D]+$/;
16
+ /**
17
+ * @hidden
18
+ */
19
+ export var getUnit = function (value) {
20
+ var unitsMatch = value.match(reUnit);
21
+ return unitsMatch ? unitsMatch[0] : '';
22
+ };
23
+ /**
24
+ * @hidden
25
+ */
26
+ export var nodeSize = function (node, style) {
27
+ var _a;
28
+ var _b;
29
+ var value = parseStyle(((_b = node.attrs) === null || _b === void 0 ? void 0 : _b.style) || '')[style] || '';
30
+ return _a = {},
31
+ _a[style] = parseFloat(value) || null,
32
+ _a[style + 'Unit'] = getUnit(value),
33
+ _a;
34
+ };
35
+ /**
36
+ * @hidden
37
+ */
38
+ export var parseStyle = function (styleText) {
39
+ var styles = (styleText || '').split(/\s*;\s*/).filter(Boolean).map(function (s) {
40
+ var _a;
41
+ var nameValue = s.split(/\s*:\s*/);
42
+ return _a = {}, _a[nameValue[0]] = nameValue[1], _a;
43
+ }).reduce(function (acc, val) { return (__assign(__assign({}, acc), val)); }, {});
44
+ return styles;
45
+ };
46
+ var changeStylesString = function (styleText, newStyle) {
47
+ var styleToChange = newStyle.style;
48
+ var regExp = newStyle.value;
49
+ var newValue = newStyle.newValue;
50
+ if (!styleText) {
51
+ return { changed: false, style: null };
52
+ }
53
+ var styles = styleText.split(/\s*;\s*/).filter(function (s) { return Boolean(s); });
54
+ var filtered = styles.filter(function (s) {
55
+ var nameValue = s.split(/\s*:\s*/);
56
+ return !(nameValue[0].toLowerCase() === styleToChange && regExp.test(nameValue[1]));
57
+ });
58
+ if (newValue) {
59
+ filtered.push("".concat(styleToChange, ": ").concat(newValue));
60
+ }
61
+ return {
62
+ style: filtered.join('; ') + (filtered.length ? ';' : ''),
63
+ changed: Boolean(newValue) || filtered.length !== styles.length
64
+ };
65
+ };
66
+ var reAnyValue = /^.+$/;
67
+ /**
68
+ * @hidden
69
+ */
70
+ export function setNodeStyle(nodeAttrs, styleType, value) {
71
+ var attrs;
72
+ if (new RegExp('[^-]?' + styleType + ':').test(nodeAttrs.style || '')) {
73
+ var style = changeStylesString(nodeAttrs.style || '', { style: styleType, value: reAnyValue, newValue: value }).style;
74
+ attrs = __assign(__assign({}, nodeAttrs), { style: style });
75
+ }
76
+ else if (nodeAttrs.style) {
77
+ var st_1 = parseStyle(nodeAttrs.style);
78
+ st_1[styleType] = value;
79
+ attrs = __assign(__assign({}, nodeAttrs), { style: Object.keys(st_1).filter(function (s) { return Boolean(st_1[s]); }).reduce(function (acc, cur) { return acc + cur + ': ' + st_1[cur] + '; '; }, '').trim() });
80
+ }
81
+ else {
82
+ if (value) {
83
+ attrs = __assign(__assign({}, nodeAttrs), { style: styleType + ': ' + value + ';' });
84
+ }
85
+ else {
86
+ attrs = __assign({}, nodeAttrs);
87
+ }
88
+ }
89
+ return attrs;
90
+ }
@@ -1,6 +1,15 @@
1
1
  import { ComponentClass } from 'react';
2
+ import { EditorState, Transaction } from '@progress/kendo-editor-common';
2
3
  import { EditorToolsSettings } from '../config/toolsSettings';
3
4
  import { ToolProps } from './ToolProps';
5
+ /**
6
+ * @hidden
7
+ */
8
+ export declare const deleteColumnCmd: (state: EditorState, dispatch?: ((tr: Transaction) => void) | undefined) => boolean;
9
+ /**
10
+ * @hidden
11
+ */
12
+ export declare const deleteRowCmd: (state: EditorState, dispatch?: ((tr: Transaction) => void) | undefined) => boolean;
4
13
  /**
5
14
  * @hidden
6
15
  */
@@ -3,7 +3,7 @@ import { createProseMirrorTool } from './proseMirrorTool';
3
3
  /**
4
4
  * @hidden
5
5
  */
6
- var deleteColumnCmd = function (state, dispatch) {
6
+ export var deleteColumnCmd = function (state, dispatch) {
7
7
  var result = deleteColumn(state, dispatch);
8
8
  if (result && !dispatch) {
9
9
  var pos = selectionCell(state);
@@ -17,7 +17,7 @@ var deleteColumnCmd = function (state, dispatch) {
17
17
  /**
18
18
  * @hidden
19
19
  */
20
- var deleteRowCmd = function (state, dispatch) {
20
+ export var deleteRowCmd = function (state, dispatch) {
21
21
  var result = deleteRow(state, dispatch);
22
22
  if (result && !dispatch) {
23
23
  var pos = selectionCell(state);
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import { Node, ResolvedPos } from '@progress/kendo-editor-common';
2
3
  /**
3
4
  * @hidden
4
5
  */
@@ -18,4 +19,32 @@ declare const formatString: (input: string, ...args: Array<any>) => string;
18
19
  * @hidden
19
20
  */
20
21
  declare const itemRender: (li: any, itemProps: any) => any;
21
- export { onDownPreventDefault, formatString, itemRender, userSelectNone };
22
+ /**
23
+ * @hidden
24
+ */
25
+ declare const units: string[];
26
+ /**
27
+ * @hidden
28
+ */
29
+ declare const popupSettings: {
30
+ animate: {
31
+ openDuration: number;
32
+ closeDuration: number;
33
+ };
34
+ };
35
+ /**
36
+ * @hidden
37
+ */
38
+ declare const borderStyles: {
39
+ textKey: string;
40
+ text: any;
41
+ value: string;
42
+ }[];
43
+ /**
44
+ * @hidden
45
+ */
46
+ declare function parentNode(pos: ResolvedPos, predicate: (node: Node) => boolean): {
47
+ node: Node;
48
+ depth: number;
49
+ } | null;
50
+ export { onDownPreventDefault, formatString, itemRender, units, borderStyles, popupSettings, userSelectNone, parentNode };
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import { messages, keys } from './../messages';
2
3
  /**
3
4
  * @hidden
4
5
  */
@@ -31,4 +32,41 @@ var formatString = function (input) {
31
32
  var itemRender = function (li, itemProps) {
32
33
  return itemProps.dataItem.style ? React.cloneElement(li, li.props, (React.createElement("span", { style: itemProps.dataItem.style }, li.props.children))) : li;
33
34
  };
34
- export { onDownPreventDefault, formatString, itemRender, userSelectNone };
35
+ /**
36
+ * @hidden
37
+ */
38
+ var units = ['px', 'em', '%'];
39
+ /**
40
+ * @hidden
41
+ */
42
+ var popupSettings = { animate: { openDuration: 150, closeDuration: 150 } };
43
+ /**
44
+ * @hidden
45
+ */
46
+ var borderStyles = [
47
+ { textKey: keys.borderStyleNone, text: messages[keys.borderStyleNone], value: 'none' },
48
+ { textKey: keys.borderStyleSolid, text: messages[keys.borderStyleSolid], value: 'solid' },
49
+ { textKey: keys.borderStyleDotted, text: messages[keys.borderStyleDotted], value: 'dotted' },
50
+ { textKey: keys.borderStyleDashed, text: messages[keys.borderStyleDashed], value: 'dashed' },
51
+ { textKey: keys.borderStyleDouble, text: messages[keys.borderStyleDouble], value: 'double' },
52
+ { textKey: keys.borderStyleGroove, text: messages[keys.borderStyleGroove], value: 'groove' },
53
+ { textKey: keys.borderStyleRidge, text: messages[keys.borderStyleRidge], value: 'ridge' },
54
+ { textKey: keys.borderStyleInset, text: messages[keys.borderStyleInset], value: 'inset' },
55
+ { textKey: keys.borderStyleOutset, text: messages[keys.borderStyleOutset], value: 'outset' },
56
+ { textKey: keys.borderStyleInitial, text: messages[keys.borderStyleInitial], value: 'initial' },
57
+ { textKey: keys.borderStyleInherit, text: messages[keys.borderStyleInherit], value: 'inherit' },
58
+ { textKey: keys.borderStyleHidden, text: messages[keys.borderStyleHidden], value: 'hidden' }
59
+ ];
60
+ /**
61
+ * @hidden
62
+ */
63
+ function parentNode(pos, predicate) {
64
+ for (var depth = pos.depth; depth > 0; depth--) {
65
+ var node = pos.node(depth);
66
+ if (predicate(node)) {
67
+ return { node: node, depth: depth };
68
+ }
69
+ }
70
+ return null;
71
+ }
72
+ export { onDownPreventDefault, formatString, itemRender, units, borderStyles, popupSettings, userSelectNone, parentNode };
@@ -402,6 +402,13 @@ var Editor = /** @class */ (function (_super) {
402
402
  focus: this.onFocus,
403
403
  blur: this.onBlur,
404
404
  paste: this.onPaste
405
+ },
406
+ handleDrop: function (_view, _event, slice, _moved) {
407
+ var hasCaption = false;
408
+ slice.content.nodesBetween(0, slice.content.size, function (node) {
409
+ hasCaption = hasCaption || node.type.name === 'table_caption_external';
410
+ });
411
+ return hasCaption;
405
412
  }
406
413
  };
407
414
  var mountEvent = { plugins: plugins, shortcuts: shortcuts, target: target, viewProps: viewProps, dom: dom };
@@ -83,6 +83,87 @@ export declare const messages: {
83
83
  "editor.iframeTitle": string;
84
84
  "editorTools.foreColorLabel": string;
85
85
  "editorTools.backColorLabel": string;
86
+ "editor.cellProperties": string;
87
+ "editor.cellPropertiesLeftTop": string;
88
+ "editor.cellPropertiesCenterTop": string;
89
+ "editor.cellPropertiesRightTop": string;
90
+ "editor.cellPropertiesLeftMiddle": string;
91
+ "editor.cellPropertiesCenterMiddle": string;
92
+ "editor.cellPropertiesRightMiddle": string;
93
+ "editor.cellPropertiesLeftBottom": string;
94
+ "editor.cellPropertiesCenterBottom": string;
95
+ "editor.cellPropertiesRightBottom": string;
96
+ "editor.cellPropertiesNoAlignment": string;
97
+ "editor.cellPropertiesWrap": string;
98
+ "editor.cellPropertiesFitToCell": string;
99
+ "editor.cellPropertiesApplyToAllCells": string;
100
+ "editor.cellPropertiesWidth": string;
101
+ "editor.cellPropertiesApplyToColumn": string;
102
+ "editor.cellPropertiesHeight": string;
103
+ "editor.cellPropertiesApplyToRow": string;
104
+ "editor.cellPropertiesAlignment": string;
105
+ "editor.cellPropertiesTextControl": string;
106
+ "editor.cellPropertiesCellPadding": string;
107
+ "editor.cellPropertiesBackground": string;
108
+ "editor.cellPropertiesBorderWidth": string;
109
+ "editor.cellPropertiesBorderColor": string;
110
+ "editor.cellPropertiesBorderStyle": string;
111
+ "editor.cellPropertiesId": string;
112
+ "editor.cellPropertiesCssClass": string;
113
+ "editor.cellPropertiesSave": string;
114
+ "editor.cellPropertiesCancel": string;
115
+ "editor.tableProperties": string;
116
+ "editor.tablePropertiesAlignLeft": string;
117
+ "editor.tablePropertiesAlignCenter": string;
118
+ "editor.tablePropertiesAlignRight": string;
119
+ "editor.tablePropertiesNoAlignment": string;
120
+ "editor.tablePropertiesLeft": string;
121
+ "editor.tablePropertiesCenter": string;
122
+ "editor.tablePropertiesRight": string;
123
+ "editor.tablePropertiesTop": string;
124
+ "editor.tablePropertiesBottom": string;
125
+ "editor.tablePropertiesNone": string;
126
+ "editor.tablePropertiesUsingScopeAttribute": string;
127
+ "editor.tablePropertiesUsingIdAttributes": string;
128
+ "editor.tablePropertiesRows": string;
129
+ "editor.tablePropertiesColumns": string;
130
+ "editor.tablePropertiesWidth": string;
131
+ "editor.tablePropertiesHeight": string;
132
+ "editor.tablePropertiesPosition": string;
133
+ "editor.tablePropertiesAlignment": string;
134
+ "editor.tablePropertiesCellSpacing": string;
135
+ "editor.tablePropertiesCellPadding": string;
136
+ "editor.tablePropertiesTableBackground": string;
137
+ "editor.tablePropertiesBorderWidth": string;
138
+ "editor.tablePropertiesBorderColor": string;
139
+ "editor.tablePropertiesBorderStyle": string;
140
+ "editor.tablePropertiesCollapseBorders": string;
141
+ "editor.tablePropertiesID": string;
142
+ "editor.tablePropertiesCssClass": string;
143
+ "editor.tablePropertiesAccessibility": string;
144
+ "editor.tablePropertiesCaption": string;
145
+ "editor.tablePropertiesCaptionPosition": string;
146
+ "editor.tablePropertiesCaptionAlignment": string;
147
+ "editor.tablePropertiesHeaderRows": string;
148
+ "editor.tablePropertiesHeaderCols": string;
149
+ "editor.tablePropertiesAssociateHeaders": string;
150
+ "editor.tablePropertiesGeneral": string;
151
+ "editor.tablePropertiesAdvanced": string;
152
+ "editor.tablePropertiesSave": string;
153
+ "editor.tablePropertiesCancel": string;
154
+ "editor.borderStyleNone": string;
155
+ "editor.borderStyleSolid": string;
156
+ "editor.borderStyleDotted": string;
157
+ "editor.borderStyleDashed": string;
158
+ "editor.borderStyleDouble": string;
159
+ "editor.borderStyleGroove": string;
160
+ "editor.borderStyleRidge": string;
161
+ "editor.borderStyleInset": string;
162
+ "editor.borderStyleOutset": string;
163
+ "editor.borderStyleInitial": string;
164
+ "editor.borderStyleInherit": string;
165
+ "editor.borderStyleHidden": string;
166
+ "editor.sizeAuto": string;
86
167
  };
87
168
  /**
88
169
  * @hidden
@@ -169,4 +250,85 @@ export declare const keys: {
169
250
  iframeTitle: string;
170
251
  foreColorLabel: string;
171
252
  backColorLabel: string;
253
+ cellProperties: string;
254
+ cellPropertiesLeftTop: string;
255
+ cellPropertiesCenterTop: string;
256
+ cellPropertiesRightTop: string;
257
+ cellPropertiesLeftMiddle: string;
258
+ cellPropertiesCenterMiddle: string;
259
+ cellPropertiesRightMiddle: string;
260
+ cellPropertiesLeftBottom: string;
261
+ cellPropertiesCenterBottom: string;
262
+ cellPropertiesRightBottom: string;
263
+ cellPropertiesNoAlignment: string;
264
+ cellPropertiesWrap: string;
265
+ cellPropertiesFitToCell: string;
266
+ cellPropertiesApplyToAllCells: string;
267
+ cellPropertiesWidth: string;
268
+ cellPropertiesApplyToColumn: string;
269
+ cellPropertiesHeight: string;
270
+ cellPropertiesApplyToRow: string;
271
+ cellPropertiesAlignment: string;
272
+ cellPropertiesTextControl: string;
273
+ cellPropertiesCellPadding: string;
274
+ cellPropertiesBackground: string;
275
+ cellPropertiesBorderWidth: string;
276
+ cellPropertiesBorderColor: string;
277
+ cellPropertiesBorderStyle: string;
278
+ cellPropertiesId: string;
279
+ cellPropertiesCssClass: string;
280
+ cellPropertiesSave: string;
281
+ cellPropertiesCancel: string;
282
+ tableProperties: string;
283
+ tablePropertiesAlignLeft: string;
284
+ tablePropertiesAlignCenter: string;
285
+ tablePropertiesAlignRight: string;
286
+ tablePropertiesNoAlignment: string;
287
+ tablePropertiesLeft: string;
288
+ tablePropertiesCenter: string;
289
+ tablePropertiesRight: string;
290
+ tablePropertiesTop: string;
291
+ tablePropertiesBottom: string;
292
+ tablePropertiesNone: string;
293
+ tablePropertiesUsingScopeAttribute: string;
294
+ tablePropertiesUsingIdAttributes: string;
295
+ tablePropertiesRows: string;
296
+ tablePropertiesColumns: string;
297
+ tablePropertiesWidth: string;
298
+ tablePropertiesHeight: string;
299
+ tablePropertiesPosition: string;
300
+ tablePropertiesAlignment: string;
301
+ tablePropertiesCellSpacing: string;
302
+ tablePropertiesCellPadding: string;
303
+ tablePropertiesTableBackground: string;
304
+ tablePropertiesBorderWidth: string;
305
+ tablePropertiesBorderColor: string;
306
+ tablePropertiesBorderStyle: string;
307
+ tablePropertiesCollapseBorders: string;
308
+ tablePropertiesId: string;
309
+ tablePropertiesCssClass: string;
310
+ tablePropertiesAccessibility: string;
311
+ tablePropertiesCaption: string;
312
+ tablePropertiesCaptionPosition: string;
313
+ tablePropertiesCaptionAlignment: string;
314
+ tablePropertiesHeaderRows: string;
315
+ tablePropertiesHeaderCols: string;
316
+ tablePropertiesAssociateHeaders: string;
317
+ tablePropertiesGeneral: string;
318
+ tablePropertiesAdvanced: string;
319
+ tablePropertiesSave: string;
320
+ tablePropertiesCancel: string;
321
+ borderStyleNone: string;
322
+ borderStyleSolid: string;
323
+ borderStyleDotted: string;
324
+ borderStyleDashed: string;
325
+ borderStyleDouble: string;
326
+ borderStyleGroove: string;
327
+ borderStyleRidge: string;
328
+ borderStyleInset: string;
329
+ borderStyleOutset: string;
330
+ borderStyleInitial: string;
331
+ borderStyleInherit: string;
332
+ borderStyleHidden: string;
333
+ sizeAuto: string;
172
334
  };