@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,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
  const 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
@@ -7,10 +7,10 @@ import { parseStyle, setNodeStyle } from './../../utils';
7
7
  import { cellIndexes, domCellAround, otherResizeHandle, otherResizing, edgeCell, tableColumnResizeKey as key } from './utils';
8
8
  export function columnResizing() {
9
9
  const handleWidth = 5, cellMinWidth = 25;
10
- let plugin = new Plugin({
10
+ const plugin = new Plugin({
11
11
  key,
12
12
  state: {
13
- init(_, _state) {
13
+ init() {
14
14
  return new ResizeState(-1, null);
15
15
  },
16
16
  apply(tr, prev) {
@@ -22,7 +22,7 @@ export function columnResizing() {
22
22
  if (otherResizeHandle(key, state)) {
23
23
  return null;
24
24
  }
25
- let pluginState = key.getState(state);
25
+ const pluginState = key.getState(state);
26
26
  return pluginState.activeHandle > -1 ? { class: 'resize-cursor' } : null;
27
27
  },
28
28
  handleDOMEvents: {
@@ -42,7 +42,7 @@ export function columnResizing() {
42
42
  },
43
43
  decorations(state) {
44
44
  if (!otherResizing(key, state)) {
45
- let pluginState = key.getState(state);
45
+ const pluginState = key.getState(state);
46
46
  if (pluginState.activeHandle > -1) {
47
47
  return handleDecorations(state, pluginState.activeHandle);
48
48
  }
@@ -66,30 +66,32 @@ class ResizeState {
66
66
  this.dragging = dragging;
67
67
  }
68
68
  apply(tr) {
69
- let state = this, action = tr.getMeta(key);
69
+ let state;
70
+ const action = tr.getMeta(key);
70
71
  if (action && action.setHandle != null) {
71
72
  return new ResizeState(action.setHandle, null);
72
73
  }
73
74
  if (action && action.setDragging !== undefined) {
74
- return new ResizeState(state.activeHandle, action.setDragging);
75
+ return new ResizeState(this.activeHandle, action.setDragging);
75
76
  }
76
- if (state.activeHandle > -1 && tr.docChanged) {
77
- let handle = tr.mapping.map(state.activeHandle, -1);
77
+ if (this.activeHandle > -1 && tr.docChanged) {
78
+ let handle = tr.mapping.map(this.activeHandle, -1);
78
79
  if (!pointsAtCell(tr.doc.resolve(handle))) {
79
80
  handle = -1;
80
81
  }
81
- state = new ResizeState(handle, state.dragging);
82
+ state = new ResizeState(handle, this.dragging);
82
83
  }
83
- return state;
84
+ return state || this;
84
85
  }
85
86
  }
86
87
  function handleMouseMove(view, event, handleWidth) {
87
- let pluginState = key.getState(view.state);
88
+ const pluginState = key.getState(view.state);
88
89
  if (!pluginState.dragging) {
89
- let target = domCellAround(event.target), cell = -1;
90
+ const target = domCellAround(event.target);
91
+ let cell = -1;
90
92
  if (target) {
91
93
  const indexes = cellIndexes(target);
92
- let { left, right } = target.getBoundingClientRect();
94
+ const { left, right } = target.getBoundingClientRect();
93
95
  if (Math.abs(event.clientX - left) <= handleWidth && indexes.cellIndex > 0) {
94
96
  indexes.cellIndex -= target.colSpan;
95
97
  cell = edgeCell(view, event, indexes);
@@ -104,17 +106,17 @@ function handleMouseMove(view, event, handleWidth) {
104
106
  }
105
107
  }
106
108
  function handleMouseLeave(view) {
107
- let pluginState = key.getState(view.state);
109
+ const pluginState = key.getState(view.state);
108
110
  if (pluginState.activeHandle > -1 && !pluginState.dragging) {
109
111
  updateHandle(view, -1);
110
112
  }
111
113
  }
112
114
  function handleMouseDown(view, event, cellMinWidth) {
113
- let pluginState = key.getState(view.state);
115
+ const pluginState = key.getState(view.state);
114
116
  if (pluginState.activeHandle === -1 || pluginState.dragging) {
115
117
  return false;
116
118
  }
117
- let $cell = view.state.doc.resolve(pluginState.activeHandle);
119
+ const $cell = view.state.doc.resolve(pluginState.activeHandle);
118
120
  const row = $cell.parent;
119
121
  const cellIndex = $cell.index();
120
122
  let colSpan = 0;
@@ -122,9 +124,9 @@ function handleMouseDown(view, event, cellMinWidth) {
122
124
  colSpan += row.child(i).attrs.colspan;
123
125
  }
124
126
  const tableNode = $cell.node($cell.depth - 1);
125
- let dom = view.domAtPos(pluginState.activeHandle);
126
- let domCell = dom.node.childNodes[dom.offset];
127
- let tableDom = domCell.closest('table');
127
+ const dom = view.domAtPos(pluginState.activeHandle);
128
+ const domCell = dom.node.childNodes[dom.offset];
129
+ const tableDom = domCell.closest('table');
128
130
  let col, tableAttrs;
129
131
  if (tableNode.attrs[colgroupAttr]) {
130
132
  const colgroup = tableDom.firstChild;
@@ -149,7 +151,7 @@ function handleMouseDown(view, event, cellMinWidth) {
149
151
  col.style.width = col.offsetWidth + 'px';
150
152
  tableAttrs = Object.assign(Object.assign({}, tableNode.attrs), { [colgroupAttr]: '<colgroup>' + cols.reduce((acc, cur) => acc + cur.outerHTML, '') + '</colgroup>' });
151
153
  }
152
- let width = parseFloat(col.style.width);
154
+ const width = parseFloat(col.style.width);
153
155
  const tr = view.state.tr.setMeta(key, { setDragging: { startX: event.clientX, startWidth: width } });
154
156
  if (!tableDom.style.width) {
155
157
  const widths = Array.from(col.parentNode.children).map((c) => c.style.width);
@@ -166,10 +168,10 @@ function handleMouseDown(view, event, cellMinWidth) {
166
168
  function finish(ev) {
167
169
  ev.view.removeEventListener('mouseup', finish);
168
170
  ev.view.removeEventListener('mousemove', move);
169
- let curPluginState = key.getState(view.state);
171
+ const curPluginState = key.getState(view.state);
170
172
  if (curPluginState.dragging) {
171
173
  const transaction = view.state.tr;
172
- updateColumnWidth(view, transaction, curPluginState.activeHandle, draggedWidth(curPluginState.dragging, ev, cellMinWidth));
174
+ updateColumnWidth(view, transaction, curPluginState.activeHandle);
173
175
  view.dispatch(transaction.setMeta(key, { setDragging: null }));
174
176
  }
175
177
  }
@@ -177,9 +179,9 @@ function handleMouseDown(view, event, cellMinWidth) {
177
179
  if (!ev.which) {
178
180
  return finish(ev);
179
181
  }
180
- let curPluginState = key.getState(view.state);
181
- let dragged = draggedWidth(curPluginState.dragging, ev, cellMinWidth);
182
- displayColumnWidth(view, curPluginState.activeHandle, dragged, cellMinWidth);
182
+ const curPluginState = key.getState(view.state);
183
+ const dragged = draggedWidth(curPluginState.dragging, ev, cellMinWidth);
184
+ displayColumnWidth(view, curPluginState.activeHandle, dragged);
183
185
  }
184
186
  event.view.addEventListener('mouseup', finish);
185
187
  event.view.addEventListener('mousemove', move);
@@ -187,7 +189,7 @@ function handleMouseDown(view, event, cellMinWidth) {
187
189
  return true;
188
190
  }
189
191
  function draggedWidth(dragging, event, cellMinWidth) {
190
- let offset = event.clientX - dragging.startX;
192
+ const offset = event.clientX - dragging.startX;
191
193
  return Math.max(cellMinWidth, dragging.startWidth + offset);
192
194
  }
193
195
  function updateHandle(view, value) {
@@ -196,9 +198,9 @@ function updateHandle(view, value) {
196
198
  tr.setMeta(key, { setHandle: value });
197
199
  view.dispatch(tr);
198
200
  }
199
- function updateColumnWidth(view, tr, cell, _width) {
200
- let $cell = view.state.doc.resolve(cell);
201
- let tableNode = $cell.node(-1), start = $cell.start(-1);
201
+ function updateColumnWidth(view, tr, cell) {
202
+ const $cell = view.state.doc.resolve(cell);
203
+ const tableNode = $cell.node(-1), start = $cell.start(-1);
202
204
  const tablePos = $cell.posAtIndex(0, $cell.depth - 1) - 1;
203
205
  const tableDom = view.nodeDOM(start).closest('table');
204
206
  let attrs = tableNode.attrs;
@@ -212,10 +214,10 @@ function updateColumnWidth(view, tr, cell, _width) {
212
214
  }
213
215
  tr.setNodeMarkup(tablePos, null, attrs);
214
216
  }
215
- function displayColumnWidth(view, cell, width, _cellMinWidth) {
216
- let $cell = view.state.doc.resolve(cell);
217
- let table = $cell.node(-1), start = $cell.start(-1);
218
- let col = TableMap.get(table).colCount($cell.pos - start) + $cell.nodeAfter.attrs.colspan - 1;
217
+ function displayColumnWidth(view, cell, width) {
218
+ const $cell = view.state.doc.resolve(cell);
219
+ const table = $cell.node(-1), start = $cell.start(-1);
220
+ const col = TableMap.get(table).colCount($cell.pos - start) + $cell.nodeAfter.attrs.colspan - 1;
219
221
  let dom = view.domAtPos($cell.start(-1)).node;
220
222
  if (dom.nodeName !== 'TABLE') {
221
223
  dom = dom.closest('table');
@@ -233,9 +235,9 @@ function displayColumnWidth(view, cell, width, _cellMinWidth) {
233
235
  }
234
236
  }
235
237
  function handleDecorations(state, cell) {
236
- let decorations = [];
237
- let $cell = state.doc.resolve(cell);
238
- let table = $cell.node(-1), map = TableMap.get(table), start = $cell.start(-1);
238
+ const decorations = [];
239
+ const $cell = state.doc.resolve(cell);
240
+ const table = $cell.node(-1), map = TableMap.get(table), start = $cell.start(-1);
239
241
  const cellsPositions = [];
240
242
  const cellPos = cell - start;
241
243
  let column = -1;
@@ -247,14 +249,14 @@ function handleDecorations(state, cell) {
247
249
  }
248
250
  const cells = [];
249
251
  cellsPositions.forEach((row) => {
250
- let c = row[column];
252
+ const c = row[column];
251
253
  if (row[column] !== row[column + 1]) {
252
254
  cells.push(c);
253
255
  }
254
256
  });
255
257
  cells.forEach((cPos => {
256
- let pos = start + cPos + table.nodeAt(cPos).nodeSize - 1;
257
- let dom = document.createElement('div');
258
+ const pos = start + cPos + table.nodeAt(cPos).nodeSize - 1;
259
+ const dom = document.createElement('div');
258
260
  dom.className = 'column-resize-handle';
259
261
  decorations.push(Decoration.widget(pos, dom));
260
262
  }));
@@ -10,11 +10,11 @@ class TableRowView {
10
10
  }
11
11
  export function rowResizing() {
12
12
  const handleWidth = 5;
13
- let plugin = new Plugin({
13
+ const plugin = new Plugin({
14
14
  key,
15
15
  state: {
16
16
  init(_, state) {
17
- this.spec.props.nodeViews[tableNodeTypes(state.schema).row.name] = (_node, _view) => new TableRowView();
17
+ this.spec.props.nodeViews[tableNodeTypes(state.schema).row.name] = () => new TableRowView();
18
18
  return new ResizeState(-1, null);
19
19
  },
20
20
  apply(tr, prev) {
@@ -26,7 +26,7 @@ export function rowResizing() {
26
26
  if (otherResizeHandle(key, state)) {
27
27
  return null;
28
28
  }
29
- let pluginState = key.getState(state);
29
+ const pluginState = key.getState(state);
30
30
  return pluginState.activeHandle > -1 ? { class: 'resize-cursor-vertical' } : null;
31
31
  },
32
32
  handleDOMEvents: {
@@ -48,7 +48,7 @@ export function rowResizing() {
48
48
  if (otherResizing(key, state)) {
49
49
  return DecorationSet.empty;
50
50
  }
51
- let pluginState = key.getState(state);
51
+ const pluginState = key.getState(state);
52
52
  if (pluginState.activeHandle > -1) {
53
53
  return handleDecorations(state, pluginState.activeHandle);
54
54
  }
@@ -67,30 +67,30 @@ class ResizeState {
67
67
  this.dragging = dragging;
68
68
  }
69
69
  apply(tr) {
70
- let state = this, action = tr.getMeta(key);
70
+ let state, action = tr.getMeta(key);
71
71
  if (action && action.setHandle != null) {
72
72
  return new ResizeState(action.setHandle, null);
73
73
  }
74
74
  if (action && action.setDragging !== undefined) {
75
- return new ResizeState(state.activeHandle, action.setDragging);
75
+ return new ResizeState(this.activeHandle, action.setDragging);
76
76
  }
77
- if (state.activeHandle > -1) {
78
- let handle = tr.mapping.map(state.activeHandle, -1);
77
+ if (this.activeHandle > -1) {
78
+ let handle = tr.mapping.map(this.activeHandle, -1);
79
79
  if (!pointsAtCell(tr.doc.resolve(handle))) {
80
80
  handle = null;
81
81
  }
82
- state = new ResizeState(handle, state.dragging);
82
+ state = new ResizeState(handle, this.dragging);
83
83
  }
84
- return state;
84
+ return state || this;
85
85
  }
86
86
  }
87
87
  function handleMouseMove(view, event, handleWidth) {
88
- let pluginState = key.getState(view.state);
88
+ const pluginState = key.getState(view.state);
89
89
  if (!pluginState.dragging) {
90
90
  let target = domCellAround(event.target), cell = -1;
91
91
  if (target) {
92
92
  const indexes = cellIndexes(target);
93
- let { top, bottom } = target.getBoundingClientRect();
93
+ const { top, bottom } = target.getBoundingClientRect();
94
94
  if (Math.abs(event.clientY - top) <= handleWidth && indexes.rowIndex > 0) {
95
95
  indexes.rowIndex -= target.rowSpan;
96
96
  cell = edgeCell(view, event, indexes);
@@ -105,22 +105,22 @@ function handleMouseMove(view, event, handleWidth) {
105
105
  }
106
106
  }
107
107
  function handleMouseLeave(view) {
108
- let pluginState = key.getState(view.state);
108
+ const pluginState = key.getState(view.state);
109
109
  if (pluginState.activeHandle > -1 && !pluginState.dragging) {
110
110
  updateHandle(view, -1);
111
111
  }
112
112
  }
113
113
  function handleMouseDown(view, event) {
114
- let pluginState = key.getState(view.state);
114
+ const pluginState = key.getState(view.state);
115
115
  if (pluginState.activeHandle === -1 || pluginState.dragging) {
116
116
  return false;
117
117
  }
118
118
  const doc = view.state.doc;
119
- let $cell = doc.resolve(pluginState.activeHandle);
120
- let row = $cell.parent;
121
- let table = $cell.node(-1);
122
- let rowHeightStr = parseStyle(row.attrs.style).height;
123
- let tableHeight = parseStyle(table.attrs.style).height;
119
+ const $cell = doc.resolve(pluginState.activeHandle);
120
+ const row = $cell.parent;
121
+ const table = $cell.node(-1);
122
+ const rowHeightStr = parseStyle(row.attrs.style).height;
123
+ const tableHeight = parseStyle(table.attrs.style).height;
124
124
  let rowHeight = rowHeightStr ? parseFloat(rowHeightStr) : 0;
125
125
  if (!rowHeightStr) {
126
126
  const tr = view.nodeDOM(pluginState.activeHandle);
@@ -135,7 +135,7 @@ function handleMouseDown(view, event) {
135
135
  function finish(ev) {
136
136
  ev.view.removeEventListener('mouseup', finish);
137
137
  ev.view.removeEventListener('mousemove', move);
138
- let curPluginState = key.getState(view.state);
138
+ const curPluginState = key.getState(view.state);
139
139
  if (curPluginState.dragging) {
140
140
  const tr = view.state.tr.setMeta(key, { setDragging: null });
141
141
  updateRowHeight(view, tr, curPluginState.activeHandle);
@@ -146,9 +146,9 @@ function handleMouseDown(view, event) {
146
146
  if (!ev.which) {
147
147
  return finish(ev);
148
148
  }
149
- let curPluginState = key.getState(view.state);
150
- let dragged = draggedHeight(curPluginState.dragging, ev);
151
- let offset = ev.clientY - curPluginState.dragging.startY;
149
+ const curPluginState = key.getState(view.state);
150
+ const dragged = draggedHeight(curPluginState.dragging, ev);
151
+ const offset = ev.clientY - curPluginState.dragging.startY;
152
152
  displayRowHeight(view, curPluginState.activeHandle, dragged, offset, tableHeight);
153
153
  }
154
154
  event.view.addEventListener('mouseup', finish);
@@ -178,8 +178,8 @@ function updateRowHeight(view, tr, cellPos) {
178
178
  const table = dom && dom.closest('table');
179
179
  const tableHeight = table && table.style.height;
180
180
  if (tableHeight) {
181
- let $pos = doc.resolve(rowPos);
182
- let tablePos = $pos.start($pos.depth) - 1;
181
+ const $pos = doc.resolve(rowPos);
182
+ const tablePos = $pos.start($pos.depth) - 1;
183
183
  tr.setNodeMarkup(tablePos, null, setNodeStyle($pos.parent.attrs, 'height', tableHeight));
184
184
  }
185
185
  }
@@ -222,8 +222,8 @@ function handleDecorations(state, cell) {
222
222
  });
223
223
  cells.forEach((cPos) => {
224
224
  const cellNode = table.nodeAt(cPos);
225
- let widgetPos = start + cPos + (cellNode ? cellNode.nodeSize : 0) - 1;
226
- let dom = document.createElement('div');
225
+ const widgetPos = start + cPos + (cellNode ? cellNode.nodeSize : 0) - 1;
226
+ const dom = document.createElement('div');
227
227
  dom.className = 'row-resize-handle';
228
228
  decorations.push(Decoration.widget(widgetPos, dom));
229
229
  });
@@ -18,12 +18,12 @@ class ResizeState {
18
18
  this.nodePosition = nodePosition;
19
19
  }
20
20
  apply(tr) {
21
- let state = this, next = tr.getMeta(key);
21
+ const next = tr.getMeta(key);
22
22
  if (next) {
23
23
  const nextState = new ResizeState(next.activeHandle, next.setDragging, next.nodePosition);
24
24
  return nextState;
25
25
  }
26
- return state;
26
+ return this;
27
27
  }
28
28
  }
29
29
  const handleMouseMove = (view, event) => {
@@ -33,7 +33,7 @@ const handleMouseMove = (view, event) => {
33
33
  if (nodePosition < 0 || !dragging) {
34
34
  return;
35
35
  }
36
- let tableDom = getTable(view.nodeDOM(nodePosition));
36
+ const tableDom = getTable(view.nodeDOM(nodePosition));
37
37
  const rect = tableDom.getBoundingClientRect();
38
38
  const dir = directions[activeHandle];
39
39
  const diffX = (event.clientX - dragging.startX) * dir.x;
@@ -115,7 +115,7 @@ const toPixels = (view, tr, tablePos, attrs) => {
115
115
  widthChanged = true;
116
116
  }
117
117
  });
118
- let tableAttrs = Object.assign({}, attrs);
118
+ const tableAttrs = Object.assign({}, attrs);
119
119
  if (widthChanged) {
120
120
  tableAttrs[colgroupAttr] = colgroup.outerHTML;
121
121
  }
@@ -192,7 +192,7 @@ const handleMouseDown = (view, event) => {
192
192
  function move(e) {
193
193
  handleMouseMove(view, e);
194
194
  }
195
- function finish(_e) {
195
+ function finish() {
196
196
  curWindow.removeEventListener('mouseup', finish);
197
197
  curWindow.removeEventListener('mousemove', move);
198
198
  handleMouseUp(view);
@@ -204,7 +204,7 @@ const handleMouseDown = (view, event) => {
204
204
  export const tableResizing = (options = { node: 'table' }) => {
205
205
  return new Plugin({
206
206
  key: key,
207
- view: (_viewObj) => ({
207
+ view: () => ({
208
208
  selectedNode(state, nodeType) {
209
209
  const selection = state.selection;
210
210
  const isNodeSelected = selection instanceof NodeSelection && nodeType === selection.node.type;
@@ -69,7 +69,7 @@ export class TableView {
69
69
  }
70
70
  setAttributes(table, attrs) {
71
71
  const skip = [colgroupAttr, resizableAttr];
72
- for (let attrName in attrs) {
72
+ for (const attrName in attrs) {
73
73
  if (attrName && skip.indexOf(attrName) === -1) {
74
74
  setAttribute(table, attrName, attrs[attrName]);
75
75
  }
@@ -107,7 +107,7 @@ export class TableWrapperView {
107
107
  this.view = undefined;
108
108
  }
109
109
  setAttributes(dom, attrs) {
110
- for (let attrName in attrs) {
110
+ for (const attrName in attrs) {
111
111
  if (attrName) {
112
112
  setAttribute(dom, attrName, attrs[attrName]);
113
113
  }
@@ -169,6 +169,7 @@ export const fragmentToHtml = (fragment) => {
169
169
  };
170
170
  /**
171
171
  * Creates a DocumentFragment from the given ProseMirrorNode.
172
+ *
172
173
  * @param doc ProseMirrorNode
173
174
  * @returns DocumentFragment
174
175
  */
@@ -3,6 +3,7 @@ import { colgroupAttr, rowTypeAttr } from './config/constants';
3
3
  import { parseStrColgroup } from './config/schema';
4
4
  /**
5
5
  * Creates a table.
6
+ *
6
7
  * @returns Node
7
8
  */
8
9
  export const createTable = (nodes, rows, columns) => {
@@ -40,9 +40,9 @@ export function setNodeStyle(nodeAttrs, styleType, value) {
40
40
  * Determines if a given node type can be inserted at the current cursor position.
41
41
  */
42
42
  export const canInsert = (state, nodeType) => {
43
- let $from = state.selection.$from;
43
+ const $from = state.selection.$from;
44
44
  for (let d = $from.depth; d >= 0; d--) {
45
- let index = $from.index(d);
45
+ const index = $from.index(d);
46
46
  if ($from.node(d).canReplaceWith(index, index, nodeType)) {
47
47
  return true;
48
48
  }
@@ -73,7 +73,7 @@ export const findNthParentNodeOfType = (nodeType, depth = 1) => {
73
73
  };
74
74
  export function parentNode(pos, predicate) {
75
75
  for (let depth = pos.depth; depth > 0; depth--) {
76
- let node = pos.node(depth);
76
+ const node = pos.node(depth);
77
77
  if (predicate(node)) {
78
78
  return { node, depth };
79
79
  }
@@ -82,7 +82,7 @@ export function parentNode(pos, predicate) {
82
82
  }
83
83
  const filterEmptyAttrs = (attrs) => {
84
84
  const result = {};
85
- for (let attr in attrs) {
85
+ for (const attr in attrs) {
86
86
  if (attr && (attrs[attr] || attrs[attr] === 0)) {
87
87
  result[attr] = attrs[attr];
88
88
  }
@@ -245,7 +245,7 @@ export const expandSelection = (state, dispatch, options) => {
245
245
  * command(view.state, view.dispatch);
246
246
  */
247
247
  export const expandToWordWrap = (command, options) => {
248
- return (state, dispatch, _view) => {
248
+ return (state, dispatch) => {
249
249
  const { state: cmdState, dispatch: cmdDispatch } = expandSelection(state, dispatch, options);
250
250
  return command(options)(cmdState, cmdDispatch);
251
251
  };
@@ -268,7 +268,7 @@ export const applyStyle = (styleText, styleType, styleValue) => {
268
268
  };
269
269
  const setStyleAttr = (element, styleString) => {
270
270
  const styles = parseStyle(styleString);
271
- for (let style in styles) {
271
+ for (const style in styles) {
272
272
  if (style && typeof element.style[style] !== 'undefined') {
273
273
  element.style[style] = styles[style];
274
274
  }
@@ -1,5 +1,5 @@
1
- import { DOMOutputSpec, Fragment, Mark, Node, Schema } from "prosemirror-model";
2
- declare type DOMNode = InstanceType<typeof window.Node>;
1
+ import { DOMOutputSpec, Fragment, Mark, Node, Schema } from 'prosemirror-model';
2
+ type DOMNode = InstanceType<typeof window.Node>;
3
3
  export declare class DOMSerializer {
4
4
  readonly nodes: {
5
5
  [node: string]: (node: Node) => DOMOutputSpec;
@@ -23,7 +23,7 @@ var DOMSerializer = /** @class */ (function () {
23
23
  /// node with the hole.
24
24
  DOMSerializer.renderSpec = function (docum, structure, xmlNS) {
25
25
  if (xmlNS === void 0) { xmlNS = null; }
26
- if (typeof structure === "string") {
26
+ if (typeof structure === 'string') {
27
27
  return { dom: docum.createTextNode(structure) };
28
28
  }
29
29
  if (structure.nodeType != null) {
@@ -32,7 +32,7 @@ var DOMSerializer = /** @class */ (function () {
32
32
  if (structure.dom && structure.dom.nodeType != null) {
33
33
  return structure;
34
34
  }
35
- var tagName = structure[0], space = tagName.indexOf(" ");
35
+ var tagName = structure[0], space = tagName.indexOf(' ');
36
36
  if (space > 0) {
37
37
  xmlNS = tagName.slice(0, space);
38
38
  tagName = tagName.slice(space + 1);
@@ -40,16 +40,16 @@ var DOMSerializer = /** @class */ (function () {
40
40
  var contentDOM;
41
41
  var dom = (xmlNS ? docum.createElementNS(xmlNS, tagName) : docum.createElement(tagName));
42
42
  var attrs = structure[1], start = 1;
43
- if (attrs && typeof attrs === "object" && attrs.nodeType == null && !Array.isArray(attrs)) {
43
+ if (attrs && typeof attrs === 'object' && attrs.nodeType == null && !Array.isArray(attrs)) {
44
44
  start = 2;
45
45
  for (var name_1 in attrs) {
46
46
  if (attrs[name_1] != null) {
47
- space = name_1.indexOf(" ");
47
+ space = name_1.indexOf(' ');
48
48
  if (space > 0) {
49
49
  dom.setAttributeNS(name_1.slice(0, space), name_1.slice(space + 1), attrs[name_1]);
50
50
  }
51
51
  else {
52
- utils_1.setAttribute(dom, name_1, attrs[name_1]);
52
+ (0, utils_1.setAttribute)(dom, name_1, attrs[name_1]);
53
53
  }
54
54
  }
55
55
  }
@@ -58,7 +58,7 @@ var DOMSerializer = /** @class */ (function () {
58
58
  var child = structure[i];
59
59
  if (child === 0) {
60
60
  if (i < structure.length - 1 || i > start) {
61
- throw new RangeError("Content hole must be the only child of its parent node");
61
+ throw new RangeError('Content hole must be the only child of its parent node');
62
62
  }
63
63
  return { dom: dom, contentDOM: dom };
64
64
  }
@@ -67,7 +67,7 @@ var DOMSerializer = /** @class */ (function () {
67
67
  dom.appendChild(inner);
68
68
  if (innerContent) {
69
69
  if (contentDOM) {
70
- throw new RangeError("Multiple content holes");
70
+ throw new RangeError('Multiple content holes');
71
71
  }
72
72
  contentDOM = innerContent;
73
73
  }
@@ -165,7 +165,7 @@ var DOMSerializer = /** @class */ (function () {
165
165
  var _a = DOMSerializer.renderSpec(doc(options), this.nodes[node.type.name](node)), dom = _a.dom, contentDOM = _a.contentDOM;
166
166
  if (contentDOM) {
167
167
  if (node.isLeaf) {
168
- throw new RangeError("Content hole not allowed in a leaf node spec");
168
+ throw new RangeError('Content hole not allowed in a leaf node spec');
169
169
  }
170
170
  this.serializeFragment(node.content, options, contentDOM);
171
171
  }
package/dist/npm/align.js CHANGED
@@ -8,15 +8,15 @@ var blockNode_1 = require("./blockNode");
8
8
  * @returns {boolean} - Returns true if any alignment is applied.
9
9
  */
10
10
  var alignBlocks = function (actions, commandName) { return function (state, dispatch) {
11
- var blocks = blockNode_1.blockNodes(state);
11
+ var blocks = (0, blockNode_1.blockNodes)(state);
12
12
  var tr = state.tr;
13
13
  tr.setMeta('commandName', commandName);
14
14
  blocks.forEach(function (node) {
15
15
  if (node.type.isTextblock) {
16
16
  var action = actions.find(function (n) { return n.node === node.type.name; });
17
17
  if (action) {
18
- var newAttrs = blockNode_1.addStyles(node, action.style);
19
- blockNode_1.changeTextBlock(tr, node, node.type, newAttrs);
18
+ var newAttrs = (0, blockNode_1.addStyles)(node, action.style);
19
+ (0, blockNode_1.changeTextBlock)(tr, node, node.type, newAttrs);
20
20
  }
21
21
  }
22
22
  });
@@ -28,14 +28,14 @@ var alignBlocks = function (actions, commandName) { return function (state, disp
28
28
  }; };
29
29
  exports.alignBlocks = alignBlocks;
30
30
  var isAligned = function (state, actions) {
31
- var blocks = blockNode_1.blockNodes(state);
31
+ var blocks = (0, blockNode_1.blockNodes)(state);
32
32
  var result = false;
33
33
  blocks.forEach(function (node) {
34
34
  if (!result && node.type.isTextblock && node.attrs.style) {
35
35
  var action = actions.find(function (a) { return a.node === node.type.name; });
36
36
  if (action) {
37
37
  result = action.style.every(function (style) {
38
- return !!style.value && new RegExp(style.name + ":\\s?" + style.value, 'i').test(node.attrs.style);
38
+ return !!style.value && new RegExp("".concat(style.name, ":\\s?").concat(style.value), 'i').test(node.attrs.style);
39
39
  });
40
40
  }
41
41
  }