@progress/kendo-editor-common 1.11.1 → 1.11.2-dev.202402291213

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 (94) hide show
  1. package/dist/es/DOMSerializer.js +8 -8
  2. package/dist/es/align.js +1 -1
  3. package/dist/es/blockNode.js +5 -7
  4. package/dist/es/blockquote.js +1 -1
  5. package/dist/es/config/keymap.js +3 -3
  6. package/dist/es/config/schema.js +2 -1
  7. package/dist/es/find-replace.js +1 -1
  8. package/dist/es/indent.js +4 -4
  9. package/dist/es/inline-style.js +3 -3
  10. package/dist/es/listConvert.js +2 -2
  11. package/dist/es/lists.js +2 -1
  12. package/dist/es/paste.js +2 -2
  13. package/dist/es/plugins/caret-color.js +1 -1
  14. package/dist/es/plugins/csp-fix.js +4 -4
  15. package/dist/es/plugins/highlight.js +1 -1
  16. package/dist/es/plugins/image-resize.js +6 -6
  17. package/dist/es/plugins/list-markers-styles.js +3 -3
  18. package/dist/es/plugins/placeholder.js +1 -1
  19. package/dist/es/plugins/spaces-fix.js +1 -1
  20. package/dist/es/plugins/table-resize/column-resize.js +14 -12
  21. package/dist/es/plugins/table-resize/row-resize.js +7 -7
  22. package/dist/es/plugins/table-resize/table-resize.js +6 -6
  23. package/dist/es/source.js +1 -0
  24. package/dist/es/table.js +1 -0
  25. package/dist/es/utils.js +3 -3
  26. package/dist/es2015/DOMSerializer.js +37 -37
  27. package/dist/es2015/blockNode.js +9 -11
  28. package/dist/es2015/blockquote.js +1 -1
  29. package/dist/es2015/config/keymap.js +3 -3
  30. package/dist/es2015/config/schema.js +4 -3
  31. package/dist/es2015/find-replace.js +1 -1
  32. package/dist/es2015/inline-style.js +5 -5
  33. package/dist/es2015/listConvert.js +6 -6
  34. package/dist/es2015/lists.js +6 -5
  35. package/dist/es2015/mark.js +17 -17
  36. package/dist/es2015/plugins/caret-color.js +1 -1
  37. package/dist/es2015/plugins/csp-fix.js +5 -5
  38. package/dist/es2015/plugins/highlight.js +1 -1
  39. package/dist/es2015/plugins/image-resize.js +10 -10
  40. package/dist/es2015/plugins/list-markers-styles.js +2 -2
  41. package/dist/es2015/plugins/placeholder.js +1 -1
  42. package/dist/es2015/plugins/spaces-fix.js +1 -1
  43. package/dist/es2015/plugins/table-resize/column-resize.js +41 -39
  44. package/dist/es2015/plugins/table-resize/row-resize.js +27 -27
  45. package/dist/es2015/plugins/table-resize/table-resize.js +6 -6
  46. package/dist/es2015/plugins/table-resize/table-view.js +2 -2
  47. package/dist/es2015/source.js +1 -0
  48. package/dist/es2015/table.js +1 -0
  49. package/dist/es2015/utils.js +6 -6
  50. package/dist/npm/DOMSerializer.d.ts +2 -2
  51. package/dist/npm/DOMSerializer.js +8 -8
  52. package/dist/npm/align.js +5 -5
  53. package/dist/npm/blockNode.js +13 -15
  54. package/dist/npm/blockquote.js +2 -2
  55. package/dist/npm/cleanFormatting.js +2 -2
  56. package/dist/npm/config/keymap.js +7 -7
  57. package/dist/npm/config/schema.js +6 -5
  58. package/dist/npm/find-replace.js +7 -7
  59. package/dist/npm/image.js +1 -1
  60. package/dist/npm/indent.js +24 -24
  61. package/dist/npm/inline-style.js +13 -13
  62. package/dist/npm/link.js +7 -7
  63. package/dist/npm/listConvert.js +4 -4
  64. package/dist/npm/lists.d.ts +2 -1
  65. package/dist/npm/lists.js +10 -9
  66. package/dist/npm/mark.js +7 -7
  67. package/dist/npm/paste.js +8 -8
  68. package/dist/npm/plugins/caret-color.js +1 -1
  69. package/dist/npm/plugins/csp-fix.d.ts +1 -1
  70. package/dist/npm/plugins/csp-fix.js +3 -3
  71. package/dist/npm/plugins/highlight.d.ts +1 -1
  72. package/dist/npm/plugins/image-resize.d.ts +1 -1
  73. package/dist/npm/plugins/image-resize.js +4 -4
  74. package/dist/npm/plugins/list-markers-styles.js +8 -8
  75. package/dist/npm/plugins/table-resize/column-resize.js +23 -21
  76. package/dist/npm/plugins/table-resize/index.js +3 -3
  77. package/dist/npm/plugins/table-resize/row-resize.js +18 -18
  78. package/dist/npm/plugins/table-resize/table-resize.js +25 -25
  79. package/dist/npm/plugins/table-resize/table-view.js +4 -4
  80. package/dist/npm/plugins/table-resize/utils.js +1 -1
  81. package/dist/npm/source.d.ts +1 -0
  82. package/dist/npm/source.js +6 -5
  83. package/dist/npm/table.d.ts +1 -0
  84. package/dist/npm/table.js +8 -7
  85. package/dist/npm/types/command.d.ts +1 -1
  86. package/dist/npm/types/dispatchFn.d.ts +1 -1
  87. package/dist/npm/types/predicate.d.ts +1 -1
  88. package/dist/npm/utils.d.ts +1 -1
  89. package/dist/npm/utils.js +10 -10
  90. package/package.json +26 -19
  91. package/NOTICE.txt +0 -614
  92. package/dist/cdn/js/kendo-editor-common.js +0 -1
  93. package/dist/cdn/main.js +0 -1
  94. package/dist/systemjs/kendo-editor-common.js +0 -1
@@ -1,4 +1,4 @@
1
- import { setAttribute } from "./utils";
1
+ import { setAttribute } from './utils';
2
2
  var DOMSerializer = /** @class */ (function () {
3
3
  /// Create a serializer. `nodes` should map node names to functions
4
4
  /// that take a node and return a description of the corresponding
@@ -20,7 +20,7 @@ var DOMSerializer = /** @class */ (function () {
20
20
  /// node with the hole.
21
21
  DOMSerializer.renderSpec = function (docum, structure, xmlNS) {
22
22
  if (xmlNS === void 0) { xmlNS = null; }
23
- if (typeof structure === "string") {
23
+ if (typeof structure === 'string') {
24
24
  return { dom: docum.createTextNode(structure) };
25
25
  }
26
26
  if (structure.nodeType != null) {
@@ -29,7 +29,7 @@ var DOMSerializer = /** @class */ (function () {
29
29
  if (structure.dom && structure.dom.nodeType != null) {
30
30
  return structure;
31
31
  }
32
- var tagName = structure[0], space = tagName.indexOf(" ");
32
+ var tagName = structure[0], space = tagName.indexOf(' ');
33
33
  if (space > 0) {
34
34
  xmlNS = tagName.slice(0, space);
35
35
  tagName = tagName.slice(space + 1);
@@ -37,11 +37,11 @@ var DOMSerializer = /** @class */ (function () {
37
37
  var contentDOM;
38
38
  var dom = (xmlNS ? docum.createElementNS(xmlNS, tagName) : docum.createElement(tagName));
39
39
  var attrs = structure[1], start = 1;
40
- if (attrs && typeof attrs === "object" && attrs.nodeType == null && !Array.isArray(attrs)) {
40
+ if (attrs && typeof attrs === 'object' && attrs.nodeType == null && !Array.isArray(attrs)) {
41
41
  start = 2;
42
42
  for (var name_1 in attrs) {
43
43
  if (attrs[name_1] != null) {
44
- space = name_1.indexOf(" ");
44
+ space = name_1.indexOf(' ');
45
45
  if (space > 0) {
46
46
  dom.setAttributeNS(name_1.slice(0, space), name_1.slice(space + 1), attrs[name_1]);
47
47
  }
@@ -55,7 +55,7 @@ var DOMSerializer = /** @class */ (function () {
55
55
  var child = structure[i];
56
56
  if (child === 0) {
57
57
  if (i < structure.length - 1 || i > start) {
58
- throw new RangeError("Content hole must be the only child of its parent node");
58
+ throw new RangeError('Content hole must be the only child of its parent node');
59
59
  }
60
60
  return { dom: dom, contentDOM: dom };
61
61
  }
@@ -64,7 +64,7 @@ var DOMSerializer = /** @class */ (function () {
64
64
  dom.appendChild(inner);
65
65
  if (innerContent) {
66
66
  if (contentDOM) {
67
- throw new RangeError("Multiple content holes");
67
+ throw new RangeError('Multiple content holes');
68
68
  }
69
69
  contentDOM = innerContent;
70
70
  }
@@ -162,7 +162,7 @@ var DOMSerializer = /** @class */ (function () {
162
162
  var _a = DOMSerializer.renderSpec(doc(options), this.nodes[node.type.name](node)), dom = _a.dom, contentDOM = _a.contentDOM;
163
163
  if (contentDOM) {
164
164
  if (node.isLeaf) {
165
- throw new RangeError("Content hole not allowed in a leaf node spec");
165
+ throw new RangeError('Content hole not allowed in a leaf node spec');
166
166
  }
167
167
  this.serializeFragment(node.content, options, contentDOM);
168
168
  }
package/dist/es/align.js CHANGED
@@ -31,7 +31,7 @@ export var isAligned = function (state, actions) {
31
31
  var action = actions.find(function (a) { return a.node === node.type.name; });
32
32
  if (action) {
33
33
  result = action.style.every(function (style) {
34
- return !!style.value && new RegExp(style.name + ":\\s?" + style.value, 'i').test(node.attrs.style);
34
+ return !!style.value && new RegExp("".concat(style.name, ":\\s?").concat(style.value), 'i').test(node.attrs.style);
35
35
  });
36
36
  }
37
37
  }
@@ -71,7 +71,7 @@ export var blockNodes = function (state, options) {
71
71
  ranges.forEach(function (range) {
72
72
  var from = range.$from.pos;
73
73
  var to = range.$to.pos;
74
- doc.nodesBetween(from, to, function (node, pos, _parent, _index) {
74
+ doc.nodesBetween(from, to, function (node, pos) {
75
75
  if (node.isBlock && (!blocksInSelection || (pos >= from && pos + node.content.size + 2 <= to))) {
76
76
  result.push(node);
77
77
  }
@@ -90,16 +90,14 @@ export var formatBlockElements = function (value, commandName) {
90
90
  blocks.forEach(function (node) {
91
91
  if (node.type.isTextblock) {
92
92
  if (value === 'p') {
93
- var _a = node.attrs, level = _a.level, attrs = __rest(_a, ["level"]);
94
- changeTextBlock(tr, node, nodes.paragraph, attrs);
93
+ changeTextBlock(tr, node, nodes.paragraph, node.attrs);
95
94
  }
96
95
  else if (/^h[1-6]$/i.test(value)) {
97
96
  var level = parseInt(value.substr(1), 10);
98
97
  changeTextBlock(tr, node, nodes.heading, __assign(__assign({}, node.attrs), { level: level }));
99
98
  }
100
99
  else if (value === 'blockquote') {
101
- var _b = node.attrs, level = _b.level, attrs = __rest(_b, ["level"]);
102
- changeTextBlock(tr, node, nodes.blockquote, attrs);
100
+ changeTextBlock(tr, node, nodes.blockquote, node.attrs);
103
101
  }
104
102
  }
105
103
  });
@@ -140,7 +138,7 @@ export var getBlockFormats = function (state) {
140
138
  result.push('p');
141
139
  }
142
140
  else if (node.type === nodes.heading) {
143
- result.push("h" + node.attrs.level);
141
+ result.push("h".concat(node.attrs.level));
144
142
  }
145
143
  else if (node.type === nodes.blockquote && nodes.blockquote.isTextblock) {
146
144
  // In case the blockquote can have inline content.
@@ -158,7 +156,7 @@ export var addStyles = function (node, stylesToApply) {
158
156
  currentStyles = changedStyleResult.changed ? changedStyleResult.style : currentStyles;
159
157
  });
160
158
  }
161
- var reducer = function (acc, curr) { return ((acc && curr.value ? acc + ' ' : '') + curr.value ? curr.name + ": " + curr.value + ";" : ''); };
159
+ var reducer = function (acc, curr) { return ((acc && curr.value ? acc + ' ' : '') + curr.value ? "".concat(curr.name, ": ").concat(curr.value, ";") : ''); };
162
160
  currentStyles = currentStyles || stylesToApply.reduce(reducer, '');
163
161
  return Object.assign({}, node.attrs, { style: currentStyles || null });
164
162
  };
@@ -9,7 +9,7 @@ export var liftBlockquote = function (state, dispatch) {
9
9
  var target = -1;
10
10
  var range = $from.blockRange($to);
11
11
  if (range) {
12
- doc.nodesBetween(range.start, range.end, function (node, pos, _parent, _index) {
12
+ doc.nodesBetween(range.start, range.end, function (node, pos) {
13
13
  if (node.type === nodeType) {
14
14
  target = pos;
15
15
  }
@@ -14,9 +14,9 @@ export var buildKeymap = function (schema, options) {
14
14
  keys['Mod-z'] = undo;
15
15
  keys['Shift-Mod-z'] = redo;
16
16
  // tslint:disable-next-line:no-string-literal
17
- keys['Backspace'] = chainCommands(undoInputRule, deleteSelection, joinBackward, selectNodeBackward);
17
+ keys.Backspace = chainCommands(undoInputRule, deleteSelection, joinBackward, selectNodeBackward);
18
18
  // tslint:disable-next-line:no-string-literal
19
- keys['Enter'] = chainCommands(newlineInCode, createParagraphNear, liftEmptyBlock, splitBlockKeepMarks);
19
+ keys.Enter = chainCommands(newlineInCode, createParagraphNear, liftEmptyBlock, splitBlockKeepMarks);
20
20
  if (!mac) {
21
21
  keys['Mod-y'] = redo;
22
22
  }
@@ -43,7 +43,7 @@ export var buildListKeymap = function (schema) {
43
43
  var keys = {};
44
44
  if (schema.nodes.list_item) {
45
45
  // tslint:disable-next-line:no-string-literal
46
- keys['Enter'] = splitListItemKeepMarks(schema.nodes.list_item);
46
+ keys.Enter = splitListItemKeepMarks(schema.nodes.list_item);
47
47
  }
48
48
  return keys;
49
49
  };
@@ -8,7 +8,8 @@ var blockquoteDOM = ['blockquote', hole], hrDOM = ['hr'], preDOM = ['pre', ['cod
8
8
  var olDOM = ['ol', 0], ulDOM = ['ul', 0], liDOM = ['li', 0];
9
9
  var domAttributes = function (dom) {
10
10
  var result = {};
11
- var attributes = dom.attributes, attr;
11
+ var attributes = dom.attributes;
12
+ var attr;
12
13
  for (var i = 0; i < attributes.length; i++) {
13
14
  attr = attributes[i];
14
15
  result[attr.name] = attr.value;
@@ -14,7 +14,7 @@ export var findAt = function (doc, searchOptions, start, end, exit) {
14
14
  }
15
15
  var flags = matchCase ? 'g' : 'gi';
16
16
  var regExp = useRegExp ? new RegExp(searchText, flags) : createRegExp(searchText, flags);
17
- doc.nodesBetween(start, end, function (node, pos, _parent) {
17
+ doc.nodesBetween(start, end, function (node, pos) {
18
18
  if (exit(result)) {
19
19
  return false;
20
20
  }
package/dist/es/indent.js CHANGED
@@ -20,15 +20,15 @@ export var indentBlocks = function (actions, command, dir) { return function (st
20
20
  var style = dir === 'rtl' ? action.rtlStyle : action.style;
21
21
  var newStyle = {
22
22
  name: style,
23
- value: action.step > 0 ? "" + action.step + action.unit : ''
23
+ value: action.step > 0 ? "".concat(action.step).concat(action.unit) : ''
24
24
  };
25
25
  if (node.attrs.style) {
26
- var re = new RegExp(style + ":\\s?(\\d+)" + action.unit, 'i');
26
+ var re = new RegExp("".concat(style, ":\\s?(\\d+)").concat(action.unit), 'i');
27
27
  var match = node.attrs.style.match(re);
28
28
  if (match) {
29
29
  var newMargin = parseFloat(match[1]) + action.step;
30
30
  newMargin = newMargin <= 0 ? '' : newMargin;
31
- newStyle.value = "" + newMargin + (newMargin ? action.unit : '');
31
+ newStyle.value = "".concat(newMargin).concat(newMargin ? action.unit : '');
32
32
  }
33
33
  }
34
34
  newAttrs = addStyles(node, [newStyle]);
@@ -52,7 +52,7 @@ export var isIndented = function (state, rules, dir) {
52
52
  var action = rules.find(function (a) { return a.node === node.type.name; });
53
53
  if (action) {
54
54
  var style = dir === 'rtl' ? action.rtlStyle : action.style;
55
- var reIndent = new RegExp(style + ":\\s?\\d+" + action.unit, 'i');
55
+ var reIndent = new RegExp("".concat(style, ":\\s?\\d+").concat(action.unit), 'i');
56
56
  result = reIndent.test(node.attrs.style);
57
57
  }
58
58
  }
@@ -21,7 +21,7 @@ var changeStyleMark = function (tr, from, to, attrs, markType) {
21
21
  var newStyle = changeStyleFromMark(marks, attrs);
22
22
  if (newStyle.changed || attrs.newValue) {
23
23
  var style = newStyle.changed ?
24
- { style: newStyle.style || null } : { style: [attrs.style] + ": " + attrs.newValue + ";" };
24
+ { style: newStyle.style || null } : { style: "".concat([attrs.style], ": ").concat(attrs.newValue, ";") };
25
25
  var currentMark = markType.isInSet(marks) ? marks.find(function (m) { return m.type.name === 'style'; }) : null;
26
26
  var newMarkAttrs_1 = currentMark ? __assign(__assign({}, currentMark.attrs), style) : style;
27
27
  var newStyleMark = markType.create(newMarkAttrs_1);
@@ -115,7 +115,7 @@ export var toggleInlineFormat = function (options, tr, markAttrs) { return funct
115
115
  var cmd = changeStyle(marks.style, { style: altStyle.name, value: altStyle.value });
116
116
  styleRemoved = cmd(state, markDispatched, transaction);
117
117
  }
118
- var allMarks = __spreadArray([mark], altMarks).filter(function (m) { return marks[m]; });
118
+ var allMarks = __spreadArray([mark], altMarks, true).filter(function (m) { return marks[m]; });
119
119
  var toRemove = allMarks.map(function (m) { return hasMark(state, { mark: m }) && marks[m]; }).filter(function (m) { return m; });
120
120
  if (toRemove.length) {
121
121
  removeMarks(toRemove, state, markDispatched, transaction);
@@ -160,7 +160,7 @@ export var applyInlineStyle = function (options, command) { return function (sta
160
160
  }
161
161
  }
162
162
  else if (attrs.newValue) {
163
- newStyles.style = [attrs.style] + ": " + attrs.newValue + ";";
163
+ newStyles.style = "".concat([attrs.style], ": ").concat(attrs.newValue, ";");
164
164
  }
165
165
  var newMarkAttrs_2 = currentMark ? __assign(__assign({}, currentMark.attrs), newStyles) : newStyles;
166
166
  if (Object.keys(newMarkAttrs_2).some(function (attrName) { return newMarkAttrs_2[attrName] !== null; })) {
@@ -1,8 +1,8 @@
1
- import { fragmentToHtml, htmlToFragment } from "./source";
1
+ import { fragmentToHtml, htmlToFragment } from './source';
2
2
  var msoListRegExp = /style=['"]?[^'"]*?mso-list:\s*[a-zA-Z]+(\d+)\s[a-zA-Z]+(\d+)\s(\w+)/gi;
3
3
  var extractListLevels = function (html) {
4
4
  html = html.replace(msoListRegExp, function (match, list, level) {
5
- return "datalist=\"" + list + "\" datalevel=\"" + level + "\" " + match;
5
+ return "datalist=\"".concat(list, "\" datalevel=\"").concat(level, "\" ").concat(match);
6
6
  });
7
7
  return html;
8
8
  };
package/dist/es/lists.js CHANGED
@@ -136,7 +136,7 @@ function isRangeOfType(doc, $from, $to, nodeType) {
136
136
  }
137
137
  function getAncestorNodesBetween(doc, $from, $to) {
138
138
  // Returns all top-level ancestor-nodes between $from and $to
139
- var nodes = Array();
139
+ var nodes = [];
140
140
  var maxDepth = findAncestorPosition(doc, $from).depth;
141
141
  var current = doc.resolve($from.start(maxDepth));
142
142
  while (current.pos <= $to.start($to.depth)) {
@@ -214,6 +214,7 @@ function wrapInList(nodeType, attrs) {
214
214
  var reListStyle = /list\-style\-type:\s?([\w-]+)/;
215
215
  /**
216
216
  * Extracts list-style-type style from node's attributes.
217
+ *
217
218
  * @param attrs - The attributes of the list node
218
219
  * @returns The extracted list-style-type.
219
220
  */
package/dist/es/paste.js CHANGED
@@ -58,7 +58,7 @@ export var sanitizeStyleAttr = function (attr) {
58
58
  var _a;
59
59
  _a = style.split(styleValueSplit), name = _a[0], value = _a[1];
60
60
  if (supportedStyles[name] !== undefined) {
61
- result += name + ": " + value + "; ";
61
+ result += "".concat(name, ": ").concat(value, "; ");
62
62
  }
63
63
  });
64
64
  result = result.trim();
@@ -152,7 +152,7 @@ export var replaceImageSourcesFromRtf = function (html, clipboardData) {
152
152
  var extension = reExtension.exec(image);
153
153
  if (extension) {
154
154
  var hex = image.replace(reRtfImgHeader, '').replace(reNonHex, '');
155
- base64Sources.push("data:image/" + extension[1] + ";base64," + convertHexToBase64(hex));
155
+ base64Sources.push("data:image/".concat(extension[1], ";base64,").concat(convertHexToBase64(hex)));
156
156
  }
157
157
  }
158
158
  if (htmlImages.length !== base64Sources.length) {
@@ -1,5 +1,5 @@
1
1
  import { Plugin, PluginKey } from 'prosemirror-state';
2
- import { Decoration, DecorationSet } from "prosemirror-view";
2
+ import { Decoration, DecorationSet } from 'prosemirror-view';
3
3
  import { styleValue } from './../mark';
4
4
  export var caretColorKey = new PluginKey('caret-color');
5
5
  export function caretColor() {
@@ -1,5 +1,5 @@
1
- import { Plugin, PluginKey } from "prosemirror-state";
2
- import { setAttribute } from "../utils";
1
+ import { Plugin, PluginKey } from 'prosemirror-state';
2
+ import { setAttribute } from '../utils';
3
3
  var setAttributes = function (dom, attrs) {
4
4
  for (var attrName in attrs) {
5
5
  if (attrName) {
@@ -19,7 +19,7 @@ var CustomNodeView = /** @class */ (function () {
19
19
  return CustomNodeView;
20
20
  }());
21
21
  var StyleView = /** @class */ (function () {
22
- function StyleView(mark, view, _inline) {
22
+ function StyleView(mark, view) {
23
23
  this.mark = mark;
24
24
  this.view = view;
25
25
  this.dom = document.createElement('span');
@@ -44,7 +44,7 @@ export var cspFix = function () {
44
44
  image: function (node, view) { return new CustomNodeView(node, view, 'img', true); }
45
45
  },
46
46
  markViews: {
47
- style: function (mark, view, inline) { return new StyleView(mark, view, inline); }
47
+ style: function (mark, view) { return new StyleView(mark, view); }
48
48
  }
49
49
  }
50
50
  });
@@ -1,5 +1,5 @@
1
1
  import { Plugin, PluginKey } from 'prosemirror-state';
2
- import { Decoration, DecorationSet } from "prosemirror-view";
2
+ import { Decoration, DecorationSet } from 'prosemirror-view';
3
3
  // https://discuss.prosemirror.net/t/passing-data-between-plugins/1843
4
4
  export var textHighlightKey = new PluginKey('highlight');
5
5
  export function textHighlight(key) {
@@ -1,8 +1,8 @@
1
1
  import { __assign } from "tslib";
2
- import { NodeSelection, Plugin, PluginKey } from "prosemirror-state";
3
- import { Decoration, DecorationSet } from "prosemirror-view";
4
- import { dataResizeDirImage, resizeHandle } from "../config/constants";
5
- import { changeStylesString } from "../utils";
2
+ import { NodeSelection, Plugin, PluginKey } from 'prosemirror-state';
3
+ import { Decoration, DecorationSet } from 'prosemirror-view';
4
+ import { dataResizeDirImage, resizeHandle } from '../config/constants';
5
+ import { changeStylesString } from '../utils';
6
6
  import { directions, handles } from './resize-utils';
7
7
  export var imageResizeKey = new PluginKey('image-resize');
8
8
  var setSize = function (domNode, sizeType, value) {
@@ -18,11 +18,11 @@ var ResizeState = /** @class */ (function () {
18
18
  this.nodePosition = nodePosition;
19
19
  }
20
20
  ResizeState.prototype.apply = function (tr) {
21
- var state = this, next = tr.getMeta(imageResizeKey);
21
+ var next = tr.getMeta(imageResizeKey);
22
22
  if (next) {
23
23
  return new ResizeState(next.activeHandle, next.setDragging, next.rect, next.nodePosition);
24
24
  }
25
- return state;
25
+ return this;
26
26
  };
27
27
  return ResizeState;
28
28
  }());
@@ -36,7 +36,7 @@ var applyToListItems = function (tr, state, options) {
36
36
  var cleanListItems = function (tr, state, options) {
37
37
  var stylesToClean = Object.keys(options.resetValues);
38
38
  var transaction = state.tr, doc = state.doc, _a = state.selection, from = _a.from, to = _a.to;
39
- doc.nodesBetween(from, to, function (node, pos, _parent) {
39
+ doc.nodesBetween(from, to, function (node, pos) {
40
40
  if (node.type.name === options.listItem && inSelection(from, to, pos, node, doc)) {
41
41
  var attrs_1 = node.attrs;
42
42
  var nodeStyles_1 = parseStyle(node.attrs.style);
@@ -54,13 +54,13 @@ var cleanListItems = function (tr, state, options) {
54
54
  if (step instanceof RemoveMarkStep) {
55
55
  var mark = step.mark;
56
56
  if (mark.type.name === 'style' && mark.attrs.style) {
57
- var _a = mark.attrs.style.split(/\s*:\s*/), name_1 = _a[0], _value = _a[1];
57
+ var name_1 = mark.attrs.style.split(/\s*:\s*/)[0];
58
58
  var $pos = transaction.doc.resolve(step.from);
59
59
  var li = parentNode($pos, function (n) { return n.type.name === options.listItem; });
60
60
  if (li) {
61
61
  var liStyles = parseStyle(li.node.attrs.style);
62
62
  if (liStyles[name_1] && options.resetValues[name_1]) {
63
- var newMark = mark.type.create({ style: name_1 + ": " + options.resetValues[name_1] + ";" });
63
+ var newMark = mark.type.create({ style: "".concat(name_1, ": ").concat(options.resetValues[name_1], ";") });
64
64
  transaction.addMark(step.from, step.to, newMark);
65
65
  }
66
66
  }
@@ -1,5 +1,5 @@
1
1
  import { Plugin, PluginKey } from 'prosemirror-state';
2
- import { Decoration, DecorationSet } from "prosemirror-view";
2
+ import { Decoration, DecorationSet } from 'prosemirror-view';
3
3
  export function placeholder(message) {
4
4
  var decAttrs = { class: 'k-placeholder', 'data-placeholder': message };
5
5
  return new Plugin({
@@ -1,5 +1,5 @@
1
1
  import { Plugin, PluginKey } from 'prosemirror-state';
2
- import { Decoration, DecorationSet } from "prosemirror-view";
2
+ import { Decoration, DecorationSet } from 'prosemirror-view';
3
3
  // The plugin resolves the following problems:
4
4
  //
5
5
  // 1. white-space: pre-wrap does not work with text-align: justify in firefox
@@ -11,7 +11,7 @@ export function columnResizing() {
11
11
  var plugin = new Plugin({
12
12
  key: key,
13
13
  state: {
14
- init: function (_, _state) {
14
+ init: function () {
15
15
  return new ResizeState(-1, null);
16
16
  },
17
17
  apply: function (tr, prev) {
@@ -67,28 +67,30 @@ var ResizeState = /** @class */ (function () {
67
67
  this.dragging = dragging;
68
68
  }
69
69
  ResizeState.prototype.apply = function (tr) {
70
- var state = this, action = tr.getMeta(key);
70
+ var state;
71
+ var action = tr.getMeta(key);
71
72
  if (action && action.setHandle != null) {
72
73
  return new ResizeState(action.setHandle, null);
73
74
  }
74
75
  if (action && action.setDragging !== undefined) {
75
- return new ResizeState(state.activeHandle, action.setDragging);
76
+ return new ResizeState(this.activeHandle, action.setDragging);
76
77
  }
77
- if (state.activeHandle > -1 && tr.docChanged) {
78
- var handle = tr.mapping.map(state.activeHandle, -1);
78
+ if (this.activeHandle > -1 && tr.docChanged) {
79
+ var handle = tr.mapping.map(this.activeHandle, -1);
79
80
  if (!pointsAtCell(tr.doc.resolve(handle))) {
80
81
  handle = -1;
81
82
  }
82
- state = new ResizeState(handle, state.dragging);
83
+ state = new ResizeState(handle, this.dragging);
83
84
  }
84
- return state;
85
+ return state || this;
85
86
  };
86
87
  return ResizeState;
87
88
  }());
88
89
  function handleMouseMove(view, event, handleWidth) {
89
90
  var pluginState = key.getState(view.state);
90
91
  if (!pluginState.dragging) {
91
- var target = domCellAround(event.target), cell = -1;
92
+ var target = domCellAround(event.target);
93
+ var cell = -1;
92
94
  if (target) {
93
95
  var indexes = cellIndexes(target);
94
96
  var _a = target.getBoundingClientRect(), left = _a.left, right = _a.right;
@@ -172,7 +174,7 @@ function handleMouseDown(view, event, cellMinWidth) {
172
174
  var curPluginState = key.getState(view.state);
173
175
  if (curPluginState.dragging) {
174
176
  var transaction = view.state.tr;
175
- updateColumnWidth(view, transaction, curPluginState.activeHandle, draggedWidth(curPluginState.dragging, ev, cellMinWidth));
177
+ updateColumnWidth(view, transaction, curPluginState.activeHandle);
176
178
  view.dispatch(transaction.setMeta(key, { setDragging: null }));
177
179
  }
178
180
  }
@@ -182,7 +184,7 @@ function handleMouseDown(view, event, cellMinWidth) {
182
184
  }
183
185
  var curPluginState = key.getState(view.state);
184
186
  var dragged = draggedWidth(curPluginState.dragging, ev, cellMinWidth);
185
- displayColumnWidth(view, curPluginState.activeHandle, dragged, cellMinWidth);
187
+ displayColumnWidth(view, curPluginState.activeHandle, dragged);
186
188
  }
187
189
  event.view.addEventListener('mouseup', finish);
188
190
  event.view.addEventListener('mousemove', move);
@@ -199,7 +201,7 @@ function updateHandle(view, value) {
199
201
  tr.setMeta(key, { setHandle: value });
200
202
  view.dispatch(tr);
201
203
  }
202
- function updateColumnWidth(view, tr, cell, _width) {
204
+ function updateColumnWidth(view, tr, cell) {
203
205
  var _a;
204
206
  var $cell = view.state.doc.resolve(cell);
205
207
  var tableNode = $cell.node(-1), start = $cell.start(-1);
@@ -216,7 +218,7 @@ function updateColumnWidth(view, tr, cell, _width) {
216
218
  }
217
219
  tr.setNodeMarkup(tablePos, null, attrs);
218
220
  }
219
- function displayColumnWidth(view, cell, width, _cellMinWidth) {
221
+ function displayColumnWidth(view, cell, width) {
220
222
  var $cell = view.state.doc.resolve(cell);
221
223
  var table = $cell.node(-1), start = $cell.start(-1);
222
224
  var col = TableMap.get(table).colCount($cell.pos - start) + $cell.nodeAfter.attrs.colspan - 1;
@@ -17,7 +17,7 @@ export function rowResizing() {
17
17
  key: key,
18
18
  state: {
19
19
  init: function (_, state) {
20
- this.spec.props.nodeViews[tableNodeTypes(state.schema).row.name] = function (_node, _view) { return new TableRowView(); };
20
+ this.spec.props.nodeViews[tableNodeTypes(state.schema).row.name] = function () { return new TableRowView(); };
21
21
  return new ResizeState(-1, null);
22
22
  },
23
23
  apply: function (tr, prev) {
@@ -70,21 +70,21 @@ var ResizeState = /** @class */ (function () {
70
70
  this.dragging = dragging;
71
71
  }
72
72
  ResizeState.prototype.apply = function (tr) {
73
- var state = this, action = tr.getMeta(key);
73
+ var state, action = tr.getMeta(key);
74
74
  if (action && action.setHandle != null) {
75
75
  return new ResizeState(action.setHandle, null);
76
76
  }
77
77
  if (action && action.setDragging !== undefined) {
78
- return new ResizeState(state.activeHandle, action.setDragging);
78
+ return new ResizeState(this.activeHandle, action.setDragging);
79
79
  }
80
- if (state.activeHandle > -1) {
81
- var handle = tr.mapping.map(state.activeHandle, -1);
80
+ if (this.activeHandle > -1) {
81
+ var handle = tr.mapping.map(this.activeHandle, -1);
82
82
  if (!pointsAtCell(tr.doc.resolve(handle))) {
83
83
  handle = null;
84
84
  }
85
- state = new ResizeState(handle, state.dragging);
85
+ state = new ResizeState(handle, this.dragging);
86
86
  }
87
- return state;
87
+ return state || this;
88
88
  };
89
89
  return ResizeState;
90
90
  }());
@@ -19,12 +19,12 @@ var ResizeState = /** @class */ (function () {
19
19
  this.nodePosition = nodePosition;
20
20
  }
21
21
  ResizeState.prototype.apply = function (tr) {
22
- var state = this, next = tr.getMeta(key);
22
+ var next = tr.getMeta(key);
23
23
  if (next) {
24
24
  var nextState = new ResizeState(next.activeHandle, next.setDragging, next.nodePosition);
25
25
  return nextState;
26
26
  }
27
- return state;
27
+ return this;
28
28
  };
29
29
  return ResizeState;
30
30
  }());
@@ -194,7 +194,7 @@ var handleMouseDown = function (view, event) {
194
194
  function move(e) {
195
195
  handleMouseMove(view, e);
196
196
  }
197
- function finish(_e) {
197
+ function finish() {
198
198
  curWindow.removeEventListener('mouseup', finish);
199
199
  curWindow.removeEventListener('mousemove', move);
200
200
  handleMouseUp(view);
@@ -207,7 +207,7 @@ export var tableResizing = function (options) {
207
207
  if (options === void 0) { options = { node: 'table' }; }
208
208
  return new Plugin({
209
209
  key: key,
210
- view: function (_viewObj) { return ({
210
+ view: function () { return ({
211
211
  selectedNode: function (state, nodeType) {
212
212
  var selection = state.selection;
213
213
  var isNodeSelected = selection instanceof NodeSelection && nodeType === selection.node.type;
@@ -223,7 +223,7 @@ export var tableResizing = function (options) {
223
223
  return null;
224
224
  },
225
225
  update: function (view, prevState) {
226
- var _a, _b, _c, _d, _f;
226
+ var _a, _b, _c, _d, _e;
227
227
  var state = view.state;
228
228
  var nodeType = state.schema.nodes[options.node];
229
229
  var selected = this.selectedNode(state, nodeType);
@@ -255,7 +255,7 @@ export var tableResizing = function (options) {
255
255
  }
256
256
  else if (!selected && prevSelected) {
257
257
  tr.setMeta(key, { nodePosition: -1 });
258
- view.dispatch(tr.setNodeMarkup(prevSelected.pos, nodeType, __assign(__assign({}, prevSelected.node.attrs), (_f = {}, _f[resizableAttr] = false, _f))));
258
+ view.dispatch(tr.setNodeMarkup(prevSelected.pos, nodeType, __assign(__assign({}, prevSelected.node.attrs), (_e = {}, _e[resizableAttr] = false, _e))));
259
259
  }
260
260
  }
261
261
  }
package/dist/es/source.js CHANGED
@@ -172,6 +172,7 @@ export var fragmentToHtml = function (fragment) {
172
172
  };
173
173
  /**
174
174
  * Creates a DocumentFragment from the given ProseMirrorNode.
175
+ *
175
176
  * @param doc ProseMirrorNode
176
177
  * @returns DocumentFragment
177
178
  */
package/dist/es/table.js CHANGED
@@ -4,6 +4,7 @@ import { colgroupAttr, rowTypeAttr } from './config/constants';
4
4
  import { parseStrColgroup } from './config/schema';
5
5
  /**
6
6
  * Creates a table.
7
+ *
7
8
  * @returns Node
8
9
  */
9
10
  export var createTable = function (nodes, rows, columns) {
package/dist/es/utils.js CHANGED
@@ -15,7 +15,7 @@ export var changeStylesString = function (styleText, newStyle) {
15
15
  return !(nameValue[0].toLowerCase() === styleToChange && regExp.test(nameValue[1]));
16
16
  });
17
17
  if (newValue) {
18
- filtered.push(styleToChange + ": " + newValue);
18
+ filtered.push("".concat(styleToChange, ": ").concat(newValue));
19
19
  }
20
20
  return {
21
21
  style: filtered.join('; ') + (filtered.length ? ';' : ''),
@@ -251,7 +251,7 @@ export var expandSelection = function (state, dispatch, options) {
251
251
  * command(view.state, view.dispatch);
252
252
  */
253
253
  export var expandToWordWrap = function (command, options) {
254
- return function (state, dispatch, _view) {
254
+ return function (state, dispatch) {
255
255
  var _a = expandSelection(state, dispatch, options), cmdState = _a.state, cmdDispatch = _a.dispatch;
256
256
  return command(options)(cmdState, cmdDispatch);
257
257
  };
@@ -268,7 +268,7 @@ export var applyStyle = function (styleText, styleType, styleValue) {
268
268
  var styles = parseStyle(styleText);
269
269
  styles[styleType] = styleValue;
270
270
  var result = Object.keys(styles)
271
- .map(function (name) { return styles[name] ? name + ": " + styles[name] : null; })
271
+ .map(function (name) { return styles[name] ? "".concat(name, ": ").concat(styles[name]) : null; })
272
272
  .filter(Boolean)
273
273
  .join('; ');
274
274
  return result ? result + ';' : null;