@progress/kendo-react-editor 5.19.0-dev.202309181533 → 5.19.0-dev.202309201348

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.
package/dist/es/Editor.js CHANGED
@@ -37,7 +37,7 @@ import * as React from 'react';
37
37
  import * as PropTypes from 'prop-types';
38
38
  import { ButtonGroup, Toolbar, ToolbarSeparator, toolbarButtons } from '@progress/kendo-react-buttons';
39
39
  import { classNames } from '@progress/kendo-react-common';
40
- import { EditorState, Plugin, PluginKey, EditorView, Schema, baseKeymap, keymap, history, dropCursor, gapCursor, getMark, spacesFix, tableEditing, caretColor } from '@progress/kendo-editor-common';
40
+ import { EditorState, Plugin, PluginKey, EditorView, Schema, baseKeymap, keymap, history, dropCursor, gapCursor, getMark, spacesFix, cspFix, tableEditing, caretColor } from '@progress/kendo-editor-common';
41
41
  import { marks, nodes } from './config/schema';
42
42
  import { defaultStyle, tablesStyles, rtlStyles } from './config/defaultStyles';
43
43
  import { EditorToolsSettings } from './config/toolsSettings';
@@ -350,7 +350,8 @@ var Editor = /** @class */ (function (_super) {
350
350
  history(),
351
351
  dropCursor(),
352
352
  gapCursor(),
353
- tableEditing()
353
+ tableEditing(),
354
+ cspFix()
354
355
  ];
355
356
  var shortcuts = __assign(__assign({}, EditorUtils.getShortcuts({
356
357
  types: { listItem: 'list_item', hardBreak: 'hard_break' },
@@ -5,7 +5,7 @@ export var packageMetadata = {
5
5
  name: '@progress/kendo-react-editor',
6
6
  productName: 'KendoReact',
7
7
  productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
8
- publishDate: 1695048720,
8
+ publishDate: 1695215680,
9
9
  version: '',
10
10
  licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
11
11
  };
@@ -51,6 +51,10 @@ export var TableCellProperties = function (props) {
51
51
  var onClick = React.useCallback(function () {
52
52
  setShowDialog(true);
53
53
  }, []);
54
+ var closeDialog = React.useCallback(function () {
55
+ setShowDialog(false);
56
+ view === null || view === void 0 ? void 0 : view.focus();
57
+ }, [view]);
54
58
  var onSave = React.useCallback(function (data) {
55
59
  if (view && data) {
56
60
  var tr = applyCellsData(view.state, data);
@@ -58,14 +62,11 @@ export var TableCellProperties = function (props) {
58
62
  view.dispatch(tr);
59
63
  }
60
64
  }
61
- setShowDialog(false);
62
- }, [view]);
63
- var onCancel = React.useCallback(function () {
64
- setShowDialog(false);
65
- }, []);
65
+ closeDialog();
66
+ }, [view, closeDialog]);
66
67
  return (React.createElement(React.Fragment, null,
67
68
  React.createElement(Button, __assign({ type: "button", title: loc.toLanguageString(keys.cellProperties, messages[keys.cellProperties]), icon: 'table-cell-properties', svgIcon: tableCellPropertiesIcon, onClick: onClick, disabled: !inTable }, onDownPreventDefault, buttonProps)),
68
- showDialog && view && React.createElement(TableCellPropertiesDialog, { view: view, onCancel: onCancel, onSave: onSave })));
69
+ showDialog && view && React.createElement(TableCellPropertiesDialog, { view: view, onCancel: closeDialog, onSave: onSave })));
69
70
  };
70
71
  var alignData = [
71
72
  { textKey: keys.cellPropertiesLeftTop, text: messages[keys.cellPropertiesLeftTop],
@@ -52,9 +52,10 @@ export var TableProperties = function (props) {
52
52
  var onClick = React.useCallback(function () {
53
53
  setShowDialog(true);
54
54
  }, []);
55
- var onClose = React.useCallback(function () {
55
+ var closeDialog = React.useCallback(function () {
56
56
  setShowDialog(false);
57
- }, []);
57
+ view === null || view === void 0 ? void 0 : view.focus();
58
+ }, [view]);
58
59
  var onSave = React.useCallback(function (data) {
59
60
  if (view && data) {
60
61
  var tr = applyTableData(view.state, data);
@@ -62,11 +63,11 @@ export var TableProperties = function (props) {
62
63
  view.dispatch(tr);
63
64
  }
64
65
  }
65
- setShowDialog(false);
66
- }, [view]);
66
+ closeDialog();
67
+ }, [view, closeDialog]);
67
68
  return (React.createElement(React.Fragment, null,
68
69
  React.createElement(Button, __assign({ type: "button", title: loc.toLanguageString(keys.tableProperties, messages[keys.tableProperties]), icon: 'table-properties', svgIcon: tablePropertiesIcon, onClick: onClick, disabled: !inTable }, onDownPreventDefault, buttonProps)),
69
- showDialog && React.createElement(TablePropertiesDialog, { onClose: onClose, onSave: onSave, view: view })));
70
+ showDialog && React.createElement(TablePropertiesDialog, { onClose: closeDialog, onSave: onSave, view: view })));
70
71
  };
71
72
  var alignData = [
72
73
  { textKey: keys.tablePropertiesAlignLeft, text: messages[keys.tablePropertiesAlignLeft],
@@ -209,7 +210,7 @@ var TablePropertiesDialog = function (props) {
209
210
  React.createElement("div", { className: "k-form-field k-col-span-1" },
210
211
  React.createElement("label", { className: "k-label k-form-label" }, "\u00A0"),
211
212
  React.createElement("div", { className: "k-form-field-wrap" },
212
- React.createElement(AutoComplete, { ref: heightUnit, defaultValue: defaults.heightUnit, data: units, popupSettings: popupSettings }))),
213
+ React.createElement(AutoComplete, { ref: heightUnit, defaultValue: defaults.heightUnit, data: units.filter(function (x) { return x !== '%'; }), popupSettings: popupSettings }))),
213
214
  React.createElement("div", { className: "k-form-field k-col-span-2" },
214
215
  React.createElement("label", { className: "k-label k-form-label" }, loc.toLanguageString(keys.tablePropertiesPosition, messages[keys.tablePropertiesPosition])),
215
216
  React.createElement("div", { className: "k-form-field-wrap" },
@@ -149,7 +149,7 @@ var tableDefaultData = function (state) {
149
149
  parentStyles['margin-left'] === 'auto' ? 'right' : null;
150
150
  var headerCells = headerCellsCount(table.node, map);
151
151
  var cellsPadding = tableCellsPadding(table.node);
152
- return __assign(__assign(__assign(__assign(__assign(__assign({}, initialTableData), { columns: map.width, rows: map.height }), nodeSize(table.node, 'width')), (tableParent && /%/.test(parentStyles.width || '') ? nodeSize(tableParent.node, 'width') : {})), nodeSize(table.node, 'height')), { textAlign: styles['text-align'] || '', position: pos || null, cellPadding: cellsPadding ? parseFloat(cellsPadding) : null, cellSpacing: styles['border-spacing'] ? parseFloat(styles['border-spacing']) : null, backgroundColor: styles['background-color'], borderWidth: styles['border-width'] ? parseFloat(styles['border-width']) : null, borderColor: styles['border-color'], borderStyle: styles['border-style'] || null, collapseBorders: styles['border-collapse'] === 'collapse', caption: captionStr || undefined, captionAlignment: captionStyles['text-align'] || null, captionPosition: captionStyles['caption-side'] || null, headerRows: headerCells.rows, headerColumns: headerCells.columns, associateHeaders: (headerCells.rows || headerCells.columns) ? associateHeadersType(table.node) : 'none', id: ((_b = table.node.attrs) === null || _b === void 0 ? void 0 : _b.id) || '', className: ((_c = table.node.attrs) === null || _c === void 0 ? void 0 : _c.class) || '' });
152
+ return __assign(__assign(__assign(__assign(__assign(__assign({}, initialTableData), { columns: map.width, rows: map.height }), nodeSize(table.node, 'width')), (tableParent && /%/.test(parentStyles.width || '') ? nodeSize(tableParent.node, 'width') : {})), nodeSize(table.node, 'height')), { textAlign: styles['text-align'] || '', position: pos || null, cellPadding: cellsPadding ? parseFloat(cellsPadding) : null, cellSpacing: styles['border-spacing'] ? parseFloat(styles['border-spacing']) : null, backgroundColor: styles['background-color'], borderWidth: styles['border-width'] ? parseFloat(styles['border-width']) : null, borderColor: styles['border-color'], borderStyle: styles['border-style'] || null, collapseBorders: styles['border-collapse'] === 'collapse', caption: captionStr || undefined, captionAlignment: captionStyles['text-align'] || '', captionPosition: captionStyles['caption-side'] || null, headerRows: headerCells.rows, headerColumns: headerCells.columns, associateHeaders: (headerCells.rows || headerCells.columns) ? associateHeadersType(table.node) : 'none', id: ((_b = table.node.attrs) === null || _b === void 0 ? void 0 : _b.id) || '', className: ((_c = table.node.attrs) === null || _c === void 0 ? void 0 : _c.class) || '' });
153
153
  };
154
154
  var lastCell = function (table) {
155
155
  var lastRow = table.lastChild;
@@ -353,7 +353,8 @@ var Editor = /** @class */ (function (_super) {
353
353
  (0, kendo_editor_common_1.history)(),
354
354
  (0, kendo_editor_common_1.dropCursor)(),
355
355
  (0, kendo_editor_common_1.gapCursor)(),
356
- (0, kendo_editor_common_1.tableEditing)()
356
+ (0, kendo_editor_common_1.tableEditing)(),
357
+ (0, kendo_editor_common_1.cspFix)()
357
358
  ];
358
359
  var shortcuts = __assign(__assign({}, utils_1.EditorUtils.getShortcuts({
359
360
  types: { listItem: 'list_item', hardBreak: 'hard_break' },
@@ -8,7 +8,7 @@ exports.packageMetadata = {
8
8
  name: '@progress/kendo-react-editor',
9
9
  productName: 'KendoReact',
10
10
  productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
11
- publishDate: 1695048720,
11
+ publishDate: 1695215680,
12
12
  version: '',
13
13
  licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
14
14
  };
@@ -54,6 +54,10 @@ var TableCellProperties = function (props) {
54
54
  var onClick = React.useCallback(function () {
55
55
  setShowDialog(true);
56
56
  }, []);
57
+ var closeDialog = React.useCallback(function () {
58
+ setShowDialog(false);
59
+ view === null || view === void 0 ? void 0 : view.focus();
60
+ }, [view]);
57
61
  var onSave = React.useCallback(function (data) {
58
62
  if (view && data) {
59
63
  var tr = (0, cellPropsUtils_1.applyCellsData)(view.state, data);
@@ -61,14 +65,11 @@ var TableCellProperties = function (props) {
61
65
  view.dispatch(tr);
62
66
  }
63
67
  }
64
- setShowDialog(false);
65
- }, [view]);
66
- var onCancel = React.useCallback(function () {
67
- setShowDialog(false);
68
- }, []);
68
+ closeDialog();
69
+ }, [view, closeDialog]);
69
70
  return (React.createElement(React.Fragment, null,
70
71
  React.createElement(kendo_react_buttons_1.Button, __assign({ type: "button", title: loc.toLanguageString(messages_1.keys.cellProperties, messages_1.messages[messages_1.keys.cellProperties]), icon: 'table-cell-properties', svgIcon: kendo_svg_icons_1.tableCellPropertiesIcon, onClick: onClick, disabled: !inTable }, utils_1.onDownPreventDefault, buttonProps)),
71
- showDialog && view && React.createElement(TableCellPropertiesDialog, { view: view, onCancel: onCancel, onSave: onSave })));
72
+ showDialog && view && React.createElement(TableCellPropertiesDialog, { view: view, onCancel: closeDialog, onSave: onSave })));
72
73
  };
73
74
  exports.TableCellProperties = TableCellProperties;
74
75
  var alignData = [
@@ -55,9 +55,10 @@ var TableProperties = function (props) {
55
55
  var onClick = React.useCallback(function () {
56
56
  setShowDialog(true);
57
57
  }, []);
58
- var onClose = React.useCallback(function () {
58
+ var closeDialog = React.useCallback(function () {
59
59
  setShowDialog(false);
60
- }, []);
60
+ view === null || view === void 0 ? void 0 : view.focus();
61
+ }, [view]);
61
62
  var onSave = React.useCallback(function (data) {
62
63
  if (view && data) {
63
64
  var tr = (0, tablePropsUtils_1.applyTableData)(view.state, data);
@@ -65,11 +66,11 @@ var TableProperties = function (props) {
65
66
  view.dispatch(tr);
66
67
  }
67
68
  }
68
- setShowDialog(false);
69
- }, [view]);
69
+ closeDialog();
70
+ }, [view, closeDialog]);
70
71
  return (React.createElement(React.Fragment, null,
71
72
  React.createElement(kendo_react_buttons_1.Button, __assign({ type: "button", title: loc.toLanguageString(messages_1.keys.tableProperties, messages_1.messages[messages_1.keys.tableProperties]), icon: 'table-properties', svgIcon: kendo_svg_icons_1.tablePropertiesIcon, onClick: onClick, disabled: !inTable }, utils_1.onDownPreventDefault, buttonProps)),
72
- showDialog && React.createElement(TablePropertiesDialog, { onClose: onClose, onSave: onSave, view: view })));
73
+ showDialog && React.createElement(TablePropertiesDialog, { onClose: closeDialog, onSave: onSave, view: view })));
73
74
  };
74
75
  exports.TableProperties = TableProperties;
75
76
  var alignData = [
@@ -213,7 +214,7 @@ var TablePropertiesDialog = function (props) {
213
214
  React.createElement("div", { className: "k-form-field k-col-span-1" },
214
215
  React.createElement("label", { className: "k-label k-form-label" }, "\u00A0"),
215
216
  React.createElement("div", { className: "k-form-field-wrap" },
216
- React.createElement(kendo_react_dropdowns_1.AutoComplete, { ref: heightUnit, defaultValue: defaults.heightUnit, data: utils_1.units, popupSettings: utils_1.popupSettings }))),
217
+ React.createElement(kendo_react_dropdowns_1.AutoComplete, { ref: heightUnit, defaultValue: defaults.heightUnit, data: utils_1.units.filter(function (x) { return x !== '%'; }), popupSettings: utils_1.popupSettings }))),
217
218
  React.createElement("div", { className: "k-form-field k-col-span-2" },
218
219
  React.createElement("label", { className: "k-label k-form-label" }, loc.toLanguageString(messages_1.keys.tablePropertiesPosition, messages_1.messages[messages_1.keys.tablePropertiesPosition])),
219
220
  React.createElement("div", { className: "k-form-field-wrap" },
@@ -154,7 +154,7 @@ var tableDefaultData = function (state) {
154
154
  parentStyles['margin-left'] === 'auto' ? 'right' : null;
155
155
  var headerCells = headerCellsCount(table.node, map);
156
156
  var cellsPadding = tableCellsPadding(table.node);
157
- return __assign(__assign(__assign(__assign(__assign(__assign({}, initialTableData), { columns: map.width, rows: map.height }), (0, utils_1.nodeSize)(table.node, 'width')), (tableParent && /%/.test(parentStyles.width || '') ? (0, utils_1.nodeSize)(tableParent.node, 'width') : {})), (0, utils_1.nodeSize)(table.node, 'height')), { textAlign: styles['text-align'] || '', position: pos || null, cellPadding: cellsPadding ? parseFloat(cellsPadding) : null, cellSpacing: styles['border-spacing'] ? parseFloat(styles['border-spacing']) : null, backgroundColor: styles['background-color'], borderWidth: styles['border-width'] ? parseFloat(styles['border-width']) : null, borderColor: styles['border-color'], borderStyle: styles['border-style'] || null, collapseBorders: styles['border-collapse'] === 'collapse', caption: captionStr || undefined, captionAlignment: captionStyles['text-align'] || null, captionPosition: captionStyles['caption-side'] || null, headerRows: headerCells.rows, headerColumns: headerCells.columns, associateHeaders: (headerCells.rows || headerCells.columns) ? associateHeadersType(table.node) : 'none', id: ((_b = table.node.attrs) === null || _b === void 0 ? void 0 : _b.id) || '', className: ((_c = table.node.attrs) === null || _c === void 0 ? void 0 : _c.class) || '' });
157
+ return __assign(__assign(__assign(__assign(__assign(__assign({}, initialTableData), { columns: map.width, rows: map.height }), (0, utils_1.nodeSize)(table.node, 'width')), (tableParent && /%/.test(parentStyles.width || '') ? (0, utils_1.nodeSize)(tableParent.node, 'width') : {})), (0, utils_1.nodeSize)(table.node, 'height')), { textAlign: styles['text-align'] || '', position: pos || null, cellPadding: cellsPadding ? parseFloat(cellsPadding) : null, cellSpacing: styles['border-spacing'] ? parseFloat(styles['border-spacing']) : null, backgroundColor: styles['background-color'], borderWidth: styles['border-width'] ? parseFloat(styles['border-width']) : null, borderColor: styles['border-color'], borderStyle: styles['border-style'] || null, collapseBorders: styles['border-collapse'] === 'collapse', caption: captionStr || undefined, captionAlignment: captionStyles['text-align'] || '', captionPosition: captionStyles['caption-side'] || null, headerRows: headerCells.rows, headerColumns: headerCells.columns, associateHeaders: (headerCells.rows || headerCells.columns) ? associateHeadersType(table.node) : 'none', id: ((_b = table.node.attrs) === null || _b === void 0 ? void 0 : _b.id) || '', className: ((_c = table.node.attrs) === null || _c === void 0 ? void 0 : _c.class) || '' });
158
158
  };
159
159
  exports.tableDefaultData = tableDefaultData;
160
160
  var lastCell = function (table) {