jodit 4.19.6 → 4.19.7

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 (70) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +6 -6
  4. package/es2015/jodit.js +494 -102
  5. package/es2015/jodit.min.js +8 -8
  6. package/es2015/plugins/debug/debug.css +1 -1
  7. package/es2015/plugins/debug/debug.js +1 -1
  8. package/es2015/plugins/debug/debug.min.js +1 -1
  9. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  10. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  11. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  12. package/es2018/jodit.fat.min.js +6 -6
  13. package/es2018/jodit.min.js +8 -8
  14. package/es2018/plugins/debug/debug.min.js +1 -1
  15. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  16. package/es2021/jodit.css +1 -1
  17. package/es2021/jodit.fat.min.js +7 -7
  18. package/es2021/jodit.js +482 -101
  19. package/es2021/jodit.min.js +57 -57
  20. package/es2021/plugins/debug/debug.css +1 -1
  21. package/es2021/plugins/debug/debug.js +1 -1
  22. package/es2021/plugins/debug/debug.min.js +1 -1
  23. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  24. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  25. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  26. package/es2021.en/jodit.css +1 -1
  27. package/es2021.en/jodit.fat.min.js +18 -18
  28. package/es2021.en/jodit.js +482 -101
  29. package/es2021.en/jodit.min.js +18 -18
  30. package/es2021.en/plugins/debug/debug.css +1 -1
  31. package/es2021.en/plugins/debug/debug.js +1 -1
  32. package/es2021.en/plugins/debug/debug.min.js +1 -1
  33. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  34. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  35. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  36. package/es5/jodit.css +2 -2
  37. package/es5/jodit.fat.min.js +2 -2
  38. package/es5/jodit.js +578 -107
  39. package/es5/jodit.min.css +2 -2
  40. package/es5/jodit.min.js +2 -2
  41. package/es5/plugins/debug/debug.css +1 -1
  42. package/es5/plugins/debug/debug.js +1 -1
  43. package/es5/plugins/debug/debug.min.js +1 -1
  44. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  45. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  46. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  47. package/es5/polyfills.fat.min.js +1 -1
  48. package/es5/polyfills.js +1 -1
  49. package/es5/polyfills.min.js +1 -1
  50. package/esm/core/constants.js +1 -1
  51. package/esm/core/selection/style/apply-style.js +31 -2
  52. package/esm/jodit.js +14 -2
  53. package/esm/plugins/backspace/cases/check-join-neighbors.js +36 -7
  54. package/esm/plugins/backspace/cases/check-remove-empty-parent.js +3 -1
  55. package/esm/plugins/bold/bold.js +4 -1
  56. package/esm/plugins/delete/delete.d.ts +12 -0
  57. package/esm/plugins/delete/delete.js +50 -1
  58. package/esm/plugins/resize-cells/resize-cells.d.ts +25 -1
  59. package/esm/plugins/resize-cells/resize-cells.js +84 -15
  60. package/esm/plugins/select/select.d.ts +35 -0
  61. package/esm/plugins/select/select.js +153 -1
  62. package/esm/plugins/select-cells/select-cells.d.ts +24 -0
  63. package/esm/plugins/select-cells/select-cells.js +81 -18
  64. package/esm/types/style.d.ts +5 -0
  65. package/package.json +1 -1
  66. package/types/plugins/delete/delete.d.ts +12 -0
  67. package/types/plugins/resize-cells/resize-cells.d.ts +25 -1
  68. package/types/plugins/select/select.d.ts +35 -0
  69. package/types/plugins/select-cells/select-cells.d.ts +24 -0
  70. package/types/types/style.d.ts +5 -0
@@ -17,6 +17,7 @@ import { IS_INLINE, LIST_TAGS } from "../../core/constants.js";
17
17
  import { autobind, watch } from "../../core/decorators/index.js";
18
18
  import { Dom } from "../../core/dom/dom.js";
19
19
  import { pluginSystem } from "../../core/global.js";
20
+ import { toArray } from "../../core/helpers/array/to-array.js";
20
21
  import { camelCase } from "../../core/helpers/string/camel-case.js";
21
22
  import { Plugin } from "../../core/plugin/index.js";
22
23
  import { Popup, UIElement } from "../../core/ui/index.js";
@@ -48,16 +49,24 @@ export class select extends Plugin {
48
49
  * press inside a popup is remembered to tell such a drag from a real click.
49
50
  */
50
51
  this.__pressTarget = null;
52
+ /**
53
+ * The row a press to its right was beside, and the caret it put there,
54
+ * while the button is down
55
+ */
56
+ this.__pressBesideRow = null;
51
57
  }
52
58
  afterInit(jodit) {
53
59
  this.proxyEventsList.forEach(eventName => {
54
60
  jodit.e.on(eventName + '.select', this.onStartSelection);
55
61
  });
62
+ jodit.e.on('dblclick', this.__onDblClickBesideRow, { top: true });
56
63
  }
57
64
  beforeDestruct(jodit) {
58
65
  this.proxyEventsList.forEach(eventName => {
59
- jodit.e.on(eventName + '.select', this.onStartSelection);
66
+ jodit.e.off(eventName + '.select', this.onStartSelection);
60
67
  });
68
+ this.__endPressBesideRow();
69
+ jodit.e.off('dblclick', this.__onDblClickBesideRow);
61
70
  }
62
71
  onStartSelection(e) {
63
72
  const { j } = this;
@@ -137,6 +146,137 @@ export class select extends Plugin {
137
146
  s.setCursorAfter(text);
138
147
  }
139
148
  }
149
+ /**
150
+ * The table row the mouse is to the right of
151
+ */
152
+ __rowBeside(e) {
153
+ var _a;
154
+ const { j } = this;
155
+ const target = e.target;
156
+ if (j.o.readonly ||
157
+ e.button !== 0 ||
158
+ e.detail > 2 ||
159
+ !Dom.isHTMLElement(target) ||
160
+ Dom.closest(target, Dom.isCell, j.editor)) {
161
+ return null;
162
+ }
163
+ const table = toArray(target.children).find((elm) => {
164
+ if (!Dom.isTag(elm, 'table')) {
165
+ return false;
166
+ }
167
+ const box = elm.getBoundingClientRect();
168
+ return (e.clientX >= box.right &&
169
+ e.clientY >= box.top &&
170
+ e.clientY < box.bottom);
171
+ });
172
+ const rows = table
173
+ ? toArray(table.rows).filter(row => row.cells.length)
174
+ : [];
175
+ if (!table || !rows.length) {
176
+ return null;
177
+ }
178
+ const row = (_a = rows.find(row => e.clientY < row.getBoundingClientRect().bottom)) !== null && _a !== void 0 ? _a : rows[rows.length - 1];
179
+ return { table, row };
180
+ }
181
+ /**
182
+ * A press to the right of a table row puts the caret where Word's typing
183
+ * goes from there: the start of the next row's first cell, or of the block
184
+ * after the table for the last row (#1770). The browsers put it after the
185
+ * table, whichever row it's beside, so typing starts a new line below it.
186
+ * Their own press is stopped, as its drag would start after the table and
187
+ * take in the rows below first
188
+ */
189
+ onMouseDownBesideTableRow(e) {
190
+ const { j } = this;
191
+ const beside = this.__rowBeside(e);
192
+ if (!beside) {
193
+ return;
194
+ }
195
+ // A press before the last one was let go must not stack its listeners
196
+ this.__endPressBesideRow();
197
+ e.preventDefault();
198
+ this.__putCaretBesideRow(beside.table, beside.row);
199
+ this.__pressBesideRow = {
200
+ row: beside.row,
201
+ caret: j.s.range.cloneRange()
202
+ };
203
+ j.e.on(j.ew, 'mousemove', this.__onDragFromRow);
204
+ new Set([j.ew, j.ow]).forEach(win => j.e.on(win, 'mouseup', this.__onReleaseFromRow));
205
+ }
206
+ /**
207
+ * A drag from beside a row selects from the end of the row to the mouse,
208
+ * and back beside the row it's the caret again
209
+ */
210
+ __onDragFromRow(e) {
211
+ var _a, _b;
212
+ const { s } = this.j;
213
+ const press = this.__pressBesideRow;
214
+ if (!press || !(e.buttons & 1)) {
215
+ this.__endPressBesideRow();
216
+ return;
217
+ }
218
+ if (((_a = this.__rowBeside(e)) === null || _a === void 0 ? void 0 : _a.row) === press.row) {
219
+ if (!s.isCollapsed()) {
220
+ s.selectRange(press.caret.cloneRange());
221
+ }
222
+ return;
223
+ }
224
+ const { cells } = press.row;
225
+ const last = cells[cells.length - 1];
226
+ if (s.insertCursorAtPoint(e.clientX, e.clientY)) {
227
+ const { startContainer, startOffset } = s.range;
228
+ (_b = s.sel) === null || _b === void 0 ? void 0 : _b.setBaseAndExtent(last, last.childNodes.length, startContainer, startOffset);
229
+ }
230
+ }
231
+ /**
232
+ * In iframe mode, a press in an editor without the focus puts the caret at
233
+ * its end, so a release that selected nothing puts it back
234
+ */
235
+ __onReleaseFromRow() {
236
+ const press = this.__pressBesideRow;
237
+ this.__endPressBesideRow();
238
+ if (press && this.j.s.isCollapsed()) {
239
+ this.j.s.selectRange(press.caret);
240
+ }
241
+ }
242
+ __endPressBesideRow() {
243
+ const { j } = this;
244
+ this.__pressBesideRow = null;
245
+ j.e.off(j.ew, 'mousemove', this.__onDragFromRow);
246
+ new Set([j.ew, j.ow]).forEach(win => j.e.off(win, 'mouseup', this.__onReleaseFromRow));
247
+ }
248
+ /**
249
+ * A double click beside a row is two clicks there, so add-new-line,
250
+ * which adds a line on a double click with a caret, doesn't see it
251
+ */
252
+ __onDblClickBesideRow(e) {
253
+ if (this.__rowBeside(e)) {
254
+ this.j.e.stopPropagation('dblclick');
255
+ return false;
256
+ }
257
+ }
258
+ __putCaretBesideRow(table, row) {
259
+ const { j } = this;
260
+ const rows = toArray(table.rows);
261
+ const next = rows
262
+ .slice(rows.indexOf(row) + 1)
263
+ .find(row => row.cells.length);
264
+ let after = table.nextSibling;
265
+ while (after && Dom.isEmptyTextNode(after)) {
266
+ after = after.nextSibling;
267
+ }
268
+ if (next) {
269
+ j.s.setCursorIn(next.cells[0], true);
270
+ }
271
+ else if (Dom.isBlock(after) &&
272
+ !Dom.isTag(after, 'table') &&
273
+ Dom.isContentEditable(after, j.editor)) {
274
+ j.s.setCursorIn(after, true);
275
+ }
276
+ else {
277
+ j.s.setCursorAfter(table);
278
+ }
279
+ }
140
280
  /**
141
281
  * Keep pending inline formatting after a click. Toggling Bold/Italic/etc. on
142
282
  * a collapsed cursor leaves empty marker elements with the caret inside; a
@@ -216,6 +356,18 @@ __decorate([
216
356
  __decorate([
217
357
  watch([':click'])
218
358
  ], select.prototype, "onClickRightOfNestedListItem", null);
359
+ __decorate([
360
+ watch(':mousedown')
361
+ ], select.prototype, "onMouseDownBesideTableRow", null);
362
+ __decorate([
363
+ autobind
364
+ ], select.prototype, "__onDragFromRow", null);
365
+ __decorate([
366
+ autobind
367
+ ], select.prototype, "__onReleaseFromRow", null);
368
+ __decorate([
369
+ autobind
370
+ ], select.prototype, "__onDblClickBesideRow", null);
219
371
  __decorate([
220
372
  watch([':click'])
221
373
  ], select.prototype, "onClickKeepPendingFormat", null);
@@ -49,11 +49,28 @@ export declare class selectCells extends Plugin {
49
49
  * User is selecting cells now
50
50
  */
51
51
  private __isSelectionMode;
52
+ /**
53
+ * The cell the marks were last drawn to
54
+ */
55
+ private __movedTo;
56
+ /**
57
+ * A drag let go outside the table ends in a click on the editor, which
58
+ * would unmark its cells
59
+ */
60
+ private __keepMarks;
52
61
  /**
53
62
  * Mouse click inside the table
54
63
  */
55
64
  protected onStartSelection(cell: HTMLTableCellElement, event?: MouseEvent): void | false;
56
65
  protected onOutsideClick(): void;
66
+ protected onMouseDown(): void;
67
+ /**
68
+ * The click that ends a drag let go outside the table, and inside the
69
+ * editor, lands on the editor. Taken on, it would unmark the cells and
70
+ * close their popup. As for the click on a row after a drag over the
71
+ * cells, the browser's own selection from the drag goes
72
+ */
73
+ private __onClickAfterDrag;
57
74
  protected onChange(): void;
58
75
  /**
59
76
  * Mouse move inside the table
@@ -67,6 +84,13 @@ export declare class selectCells extends Plugin {
67
84
  * Stop a selection process
68
85
  */
69
86
  private __onStopSelection;
87
+ /**
88
+ * A drag let go outside the table doesn't reach the table's `mouseup`, so
89
+ * the window's ends it, leaving the cells marked as they were (#1774)
90
+ */
91
+ private __onRelease;
92
+ private __showCellsPopup;
93
+ private __stopListening;
70
94
  /**
71
95
  * Remove selection for all cells
72
96
  */
@@ -23,7 +23,6 @@ import { isMoved } from "../../core/selection/helpers/index.js";
23
23
  import { Table } from "../../modules/table/table.js";
24
24
  import "./config.js";
25
25
  const key = 'table_processor_observer';
26
- const MOUSE_MOVE_LABEL = 'onMoveTableSelectCell';
27
26
  export class selectCells extends Plugin {
28
27
  constructor() {
29
28
  super(...arguments);
@@ -44,6 +43,15 @@ export class selectCells extends Plugin {
44
43
  * User is selecting cells now
45
44
  */
46
45
  this.__isSelectionMode = false;
46
+ /**
47
+ * The cell the marks were last drawn to
48
+ */
49
+ this.__movedTo = null;
50
+ /**
51
+ * A drag let go outside the table ends in a click on the editor, which
52
+ * would unmark its cells
53
+ */
54
+ this.__keepMarks = false;
47
55
  }
48
56
  /**
49
57
  * Shortcut for Jodit.modules.Table
@@ -59,6 +67,7 @@ export class selectCells extends Plugin {
59
67
  // Handlers without a namespace run first, ahead of those that
60
68
  // move the caret, as table-keyboard-navigation's do
61
69
  .on('keydown', this.__onKeyDown, { top: true })
70
+ .on('clickEditor', this.__onClickAfterDrag, { top: true })
62
71
  .on('keydown.select-cells', (event) => {
63
72
  if (event.key === KEY_TAB) {
64
73
  this.unselectCells();
@@ -192,21 +201,36 @@ export class selectCells extends Plugin {
192
201
  }
193
202
  this.__isSelectionMode = true;
194
203
  this.__selectedCell = cell;
204
+ this.__movedTo = cell;
195
205
  this.__tableModule.addSelection(cell);
196
206
  this.j.e
197
- .on(table, 'mousemove.select-cells touchmove.select-cells',
198
- // Don't use decorator because need clear label on mouseup
199
- this.j.async.throttle(this.__onMove.bind(this, table), {
200
- label: MOUSE_MOVE_LABEL,
201
- timeout: this.j.defaultTimeout / 2
202
- }))
207
+ .on(table, 'mousemove.select-cells touchmove.select-cells', this.__onMove.bind(this, table))
203
208
  .on(table, 'mouseup.select-cells touchend.select-cells', this.__onStopSelection.bind(this, table));
209
+ new Set([this.j.ew, this.j.ow]).forEach(win => this.j.e.on(win, 'mouseup.select-cells touchend.select-cells', this.__onRelease.bind(this, table)));
204
210
  return false;
205
211
  }
206
212
  onOutsideClick() {
207
213
  this.__selectedCell = null;
208
214
  this.__onRemoveSelection();
209
215
  }
216
+ onMouseDown() {
217
+ this.__keepMarks = false;
218
+ }
219
+ /**
220
+ * The click that ends a drag let go outside the table, and inside the
221
+ * editor, lands on the editor. Taken on, it would unmark the cells and
222
+ * close their popup. As for the click on a row after a drag over the
223
+ * cells, the browser's own selection from the drag goes
224
+ */
225
+ __onClickAfterDrag() {
226
+ var _a;
227
+ if (this.__keepMarks) {
228
+ this.__keepMarks = false;
229
+ (_a = this.j.s.sel) === null || _a === void 0 ? void 0 : _a.removeAllRanges();
230
+ this.j.e.stopPropagation('clickEditor');
231
+ return false;
232
+ }
233
+ }
210
234
  onChange() {
211
235
  if (!this.j.isLocked && !this.__isSelectionMode) {
212
236
  this.__onRemoveSelection();
@@ -226,13 +250,17 @@ export class selectCells extends Plugin {
226
250
  // Inside Shadow DOM `document.elementFromPoint` returns the shadow
227
251
  // host, so the lookup must start from the shadow root
228
252
  const node = ((_a = this.j.o.shadowRoot) !== null && _a !== void 0 ? _a : this.j.ed).elementFromPoint(e.clientX, e.clientY);
229
- if (!node) {
253
+ const cell = node && Dom.closest(node, ['td', 'th'], table);
254
+ if (!cell || !this.__selectedCell) {
230
255
  return;
231
256
  }
232
- const cell = Dom.closest(node, ['td', 'th'], table);
233
- if (!cell || !this.__selectedCell) {
257
+ // The marks change only when the mouse goes into another cell, and then
258
+ // at once rather than throttled, as the browser's own selection from
259
+ // the drag shows in the cells between until they do (#1778)
260
+ if (cell === this.__movedTo) {
234
261
  return;
235
262
  }
263
+ this.__movedTo = cell;
236
264
  if (cell !== this.__selectedCell) {
237
265
  this.j.lock(key);
238
266
  }
@@ -273,7 +301,7 @@ export class selectCells extends Plugin {
273
301
  * Stop a selection process
274
302
  */
275
303
  __onStopSelection(table, e) {
276
- var _a, _b, _c;
304
+ var _a;
277
305
  if (!this.__selectedCell) {
278
306
  return;
279
307
  }
@@ -293,11 +321,33 @@ export class selectCells extends Plugin {
293
321
  if (ownTable && ownTable !== table) {
294
322
  return; // Nested tables
295
323
  }
296
- const bound = this.__tableModule.getSelectedBound(table, [
297
- cell,
298
- this.__selectedCell
299
- ]), box = this.__tableModule.formalMatrix(table);
300
- const max = (_b = box[bound[1][0]]) === null || _b === void 0 ? void 0 : _b[bound[1][1]], min = (_c = box[bound[0][0]]) === null || _c === void 0 ? void 0 : _c[bound[0][1]];
324
+ this.__showCellsPopup(table, [cell, this.__selectedCell]);
325
+ this.__stopListening();
326
+ }
327
+ /**
328
+ * A drag let go outside the table doesn't reach the table's `mouseup`, so
329
+ * the window's ends it, leaving the cells marked as they were (#1774)
330
+ */
331
+ __onRelease(table, e) {
332
+ if (this.__isSelectionMode) {
333
+ this.__isSelectionMode = false;
334
+ if (!this.j.isLockedNotBy(key)) {
335
+ this.j.unlock();
336
+ }
337
+ const cells = this.__tableModule.getAllSelectedCells();
338
+ // One let go outside the editor clicks outside it, which unmarks them
339
+ if (cells.length > 1 &&
340
+ Dom.isOrContains(this.j.editor, e.target)) {
341
+ this.__keepMarks = true;
342
+ this.__showCellsPopup(table, cells);
343
+ }
344
+ }
345
+ this.__stopListening();
346
+ }
347
+ __showCellsPopup(table, cells) {
348
+ var _a, _b;
349
+ const bound = this.__tableModule.getSelectedBound(table, cells), box = this.__tableModule.formalMatrix(table);
350
+ const max = (_a = box[bound[1][0]]) === null || _a === void 0 ? void 0 : _a[bound[1][1]], min = (_b = box[bound[0][0]]) === null || _b === void 0 ? void 0 : _b[bound[0][1]];
301
351
  // `getSelectedBound` keeps its `Infinity` sentinel when none of the
302
352
  // selected cells belong to this table's matrix — e.g. after a
303
353
  // drag-and-drop that moved/removed the cells, leaving a stale anchor and
@@ -316,10 +366,13 @@ export class selectCells extends Plugin {
316
366
  height: maxOffset.top - minOffset.top + maxOffset.height
317
367
  };
318
368
  }, 'cells');
369
+ }
370
+ __stopListening() {
319
371
  $$('table', this.j.editor).forEach(table => {
320
372
  this.j.e.off(table, 'mousemove.select-cells touchmove.select-cells mouseup.select-cells touchend.select-cells');
321
373
  });
322
- this.j.async.clearTimeout(MOUSE_MOVE_LABEL);
374
+ new Set([this.j.ew, this.j.ow]).forEach(win => this.j.e.off(win, 'mouseup.select-cells touchend.select-cells'));
375
+ this.__movedTo = null;
323
376
  }
324
377
  /**
325
378
  * Remove selection for all cells
@@ -504,7 +557,11 @@ export class selectCells extends Plugin {
504
557
  /** @override */
505
558
  beforeDestruct(jodit) {
506
559
  this.__onRemoveSelection();
507
- jodit.e.off('.select-cells').off('keydown', this.__onKeyDown);
560
+ this.__stopListening();
561
+ jodit.e
562
+ .off('.select-cells')
563
+ .off('keydown', this.__onKeyDown)
564
+ .off('clickEditor', this.__onClickAfterDrag);
508
565
  }
509
566
  }
510
567
  selectCells.requires = ['select'];
@@ -520,6 +577,12 @@ __decorate([
520
577
  __decorate([
521
578
  watch(':outsideClick')
522
579
  ], selectCells.prototype, "onOutsideClick", null);
580
+ __decorate([
581
+ watch([':mousedown', ':touchstart'])
582
+ ], selectCells.prototype, "onMouseDown", null);
583
+ __decorate([
584
+ autobind
585
+ ], selectCells.prototype, "__onClickAfterDrag", null);
523
586
  __decorate([
524
587
  watch(':change')
525
588
  ], selectCells.prototype, "onChange", null);
@@ -17,6 +17,11 @@ export interface IStyleOptions {
17
17
  element?: HTMLTagNames;
18
18
  attributes?: IAttributes;
19
19
  defaultTag?: HTMLTagNames;
20
+ /**
21
+ * Tags the element takes the place of: the selection is taken out of
22
+ * them first, as subscript and superscript take each other's place
23
+ */
24
+ exclude?: HTMLTagNames[];
20
25
  hooks?: {
21
26
  beforeWrapList?(mode: CommitMode, li: HTMLElement, style: ICommitStyle): void;
22
27
  afterWrapList?(mode: CommitMode, li: HTMLElement, style: ICommitStyle): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jodit",
3
- "version": "4.19.6",
3
+ "version": "4.19.7",
4
4
  "description": "Jodit is an awesome and useful wysiwyg editor with filebrowser",
5
5
  "main": "esm/index.js",
6
6
  "types": "types/index.d.ts",
@@ -31,6 +31,18 @@ export declare class deleteCommand extends Plugin {
31
31
  */
32
32
  private __clearSelectedCells;
33
33
  private __moveContentInLeftSibling;
34
+ /**
35
+ * A plain space the deletion leaves at an edge of the block, before a line
36
+ * break or next to another space isn't shown, and the browser drops it when
37
+ * the next char is typed. It becomes non-breaking, as in the browsers' own
38
+ * delete and in Backspace without a selection (#1522)
39
+ */
40
+ private __keepSpacesVisible;
41
+ /**
42
+ * The text, line break or other element next to the caret in its block,
43
+ * looking inside inline elements
44
+ */
45
+ private __findNeighbor;
34
46
  /**
35
47
  * If left sibling is list - return last leaf
36
48
  */
@@ -39,11 +39,24 @@ export declare class resizeCells extends Plugin {
39
39
  private startX;
40
40
  /**
41
41
  * The table's and its cells' styles as a column drag started, put back
42
- * before each new width
42
+ * as it ends, before the final widths
43
43
  */
44
44
  private startStyles;
45
45
  private startLeft;
46
46
  private startEdge;
47
+ /**
48
+ * For each of the two columns a drag resizes, the cell whose width
49
+ * `setColumnWidthByDelta` sets, with its width as the drag started, and
50
+ * the cells below it, whose widths it clears
51
+ */
52
+ private startWidths;
53
+ /**
54
+ * The table's width as the drag started, and for a drag of its edge, the
55
+ * width inside what holds it and its margin on that side
56
+ */
57
+ private startTableWidth;
58
+ private startParentWidth;
59
+ private startMargin;
47
60
  /**
48
61
  * The row whose height the handle sets, or null while it sets a width
49
62
  */
@@ -88,10 +101,21 @@ export declare class resizeCells extends Plugin {
88
101
  * row's scroller in view, scrolls it on, and the row's border with it
89
102
  */
90
103
  private scrollAlong;
104
+ /**
105
+ * The two columns a column drag resizes: the work cell's last, and the
106
+ * next cell's first
107
+ */
108
+ private resizedColumns;
91
109
  /**
92
110
  * Resize only one column
93
111
  */
94
112
  private resizeColumns;
113
+ /**
114
+ * Sets the widths `resizeColumns` would while the handle is dragged, from
115
+ * the widths the drag started with, so that a move doesn't put back every
116
+ * cell's style and lay the table out again to measure them
117
+ */
118
+ private setColumnWidths;
95
119
  /**
96
120
  * Resize whole table
97
121
  */
@@ -46,6 +46,41 @@ export declare class select extends Plugin {
46
46
  * of the end (#1296); move it to the end of the item's own text.
47
47
  */
48
48
  protected onClickRightOfNestedListItem(e: MouseEvent): void;
49
+ /**
50
+ * The row a press to its right was beside, and the caret it put there,
51
+ * while the button is down
52
+ */
53
+ private __pressBesideRow;
54
+ /**
55
+ * The table row the mouse is to the right of
56
+ */
57
+ private __rowBeside;
58
+ /**
59
+ * A press to the right of a table row puts the caret where Word's typing
60
+ * goes from there: the start of the next row's first cell, or of the block
61
+ * after the table for the last row (#1770). The browsers put it after the
62
+ * table, whichever row it's beside, so typing starts a new line below it.
63
+ * Their own press is stopped, as its drag would start after the table and
64
+ * take in the rows below first
65
+ */
66
+ protected onMouseDownBesideTableRow(e: MouseEvent): void;
67
+ /**
68
+ * A drag from beside a row selects from the end of the row to the mouse,
69
+ * and back beside the row it's the caret again
70
+ */
71
+ private __onDragFromRow;
72
+ /**
73
+ * In iframe mode, a press in an editor without the focus puts the caret at
74
+ * its end, so a release that selected nothing puts it back
75
+ */
76
+ private __onReleaseFromRow;
77
+ private __endPressBesideRow;
78
+ /**
79
+ * A double click beside a row is two clicks there, so add-new-line,
80
+ * which adds a line on a double click with a caret, doesn't see it
81
+ */
82
+ private __onDblClickBesideRow;
83
+ private __putCaretBesideRow;
49
84
  /**
50
85
  * Keep pending inline formatting after a click. Toggling Bold/Italic/etc. on
51
86
  * a collapsed cursor leaves empty marker elements with the caret inside; a
@@ -49,11 +49,28 @@ export declare class selectCells extends Plugin {
49
49
  * User is selecting cells now
50
50
  */
51
51
  private __isSelectionMode;
52
+ /**
53
+ * The cell the marks were last drawn to
54
+ */
55
+ private __movedTo;
56
+ /**
57
+ * A drag let go outside the table ends in a click on the editor, which
58
+ * would unmark its cells
59
+ */
60
+ private __keepMarks;
52
61
  /**
53
62
  * Mouse click inside the table
54
63
  */
55
64
  protected onStartSelection(cell: HTMLTableCellElement, event?: MouseEvent): void | false;
56
65
  protected onOutsideClick(): void;
66
+ protected onMouseDown(): void;
67
+ /**
68
+ * The click that ends a drag let go outside the table, and inside the
69
+ * editor, lands on the editor. Taken on, it would unmark the cells and
70
+ * close their popup. As for the click on a row after a drag over the
71
+ * cells, the browser's own selection from the drag goes
72
+ */
73
+ private __onClickAfterDrag;
57
74
  protected onChange(): void;
58
75
  /**
59
76
  * Mouse move inside the table
@@ -67,6 +84,13 @@ export declare class selectCells extends Plugin {
67
84
  * Stop a selection process
68
85
  */
69
86
  private __onStopSelection;
87
+ /**
88
+ * A drag let go outside the table doesn't reach the table's `mouseup`, so
89
+ * the window's ends it, leaving the cells marked as they were (#1774)
90
+ */
91
+ private __onRelease;
92
+ private __showCellsPopup;
93
+ private __stopListening;
70
94
  /**
71
95
  * Remove selection for all cells
72
96
  */
@@ -17,6 +17,11 @@ export interface IStyleOptions {
17
17
  element?: HTMLTagNames;
18
18
  attributes?: IAttributes;
19
19
  defaultTag?: HTMLTagNames;
20
+ /**
21
+ * Tags the element takes the place of: the selection is taken out of
22
+ * them first, as subscript and superscript take each other's place
23
+ */
24
+ exclude?: HTMLTagNames[];
20
25
  hooks?: {
21
26
  beforeWrapList?(mode: CommitMode, li: HTMLElement, style: ICommitStyle): void;
22
27
  afterWrapList?(mode: CommitMode, li: HTMLElement, style: ICommitStyle): void;