@ckeditor/ckeditor5-table 0.0.0-nightly-20250305.0 → 0.0.0-nightly-20250306.0

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 (46) hide show
  1. package/LICENSE.md +1 -1
  2. package/build/table.js +1 -1
  3. package/ckeditor5-metadata.json +6 -6
  4. package/dist/index-editor.css +81 -16
  5. package/dist/index.css +108 -23
  6. package/dist/index.css.map +1 -1
  7. package/dist/index.js +74 -91
  8. package/dist/index.js.map +1 -1
  9. package/package.json +10 -9
  10. package/src/commands/insertcolumncommand.js +4 -0
  11. package/src/commands/insertrowcommand.js +4 -0
  12. package/src/commands/mergecellcommand.js +8 -0
  13. package/src/commands/splitcellcommand.js +4 -0
  14. package/src/tablecaption/tablecaptionediting.js +7 -0
  15. package/src/tablecaption/tablecaptionui.js +3 -2
  16. package/src/tablecellproperties/commands/tablecellpropertycommand.js +8 -0
  17. package/src/tablecellproperties/tablecellpropertiesui.js +25 -3
  18. package/src/tablecellproperties/ui/tablecellpropertiesview.d.ts +2 -1
  19. package/src/tablecellproperties/ui/tablecellpropertiesview.js +82 -13
  20. package/src/tablecolumnresize/constants.d.ts +4 -0
  21. package/src/tablecolumnresize/constants.js +4 -0
  22. package/src/tablecolumnresize/tablecolumnresizeediting.d.ts +8 -0
  23. package/src/tablecolumnresize/tablecolumnresizeediting.js +48 -7
  24. package/src/tableediting.js +4 -0
  25. package/src/tablemouse/mouseeventsobserver.js +3 -6
  26. package/src/tableproperties/commands/tablepropertycommand.js +8 -0
  27. package/src/tableproperties/tablepropertiesui.d.ts +1 -1
  28. package/src/tableproperties/tablepropertiesui.js +25 -7
  29. package/src/tableproperties/ui/tablepropertiesview.d.ts +2 -1
  30. package/src/tableproperties/ui/tablepropertiesview.js +70 -9
  31. package/src/tableselection.js +19 -1
  32. package/src/tableui.js +7 -9
  33. package/src/tablewalker.js +99 -4
  34. package/src/ui/colorinputview.js +34 -0
  35. package/src/ui/inserttableview.js +12 -0
  36. package/src/utils/table-properties.js +1 -1
  37. package/theme/formrow.css +0 -10
  38. package/theme/tableform.css +6 -0
  39. package/src/ui/formrowview.d.ts +0 -61
  40. package/src/ui/formrowview.js +0 -57
  41. package/theme/form.css +0 -11
  42. package/theme/icons/table-cell-properties.svg +0 -1
  43. package/theme/icons/table-column.svg +0 -1
  44. package/theme/icons/table-merge-cell.svg +0 -1
  45. package/theme/icons/table-properties.svg +0 -1
  46. package/theme/icons/table-row.svg +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-table",
3
- "version": "0.0.0-nightly-20250305.0",
3
+ "version": "0.0.0-nightly-20250306.0",
4
4
  "description": "Table feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -13,14 +13,15 @@
13
13
  "type": "module",
14
14
  "main": "src/index.js",
15
15
  "dependencies": {
16
- "ckeditor5": "0.0.0-nightly-20250305.0",
17
- "@ckeditor/ckeditor5-clipboard": "0.0.0-nightly-20250305.0",
18
- "@ckeditor/ckeditor5-core": "0.0.0-nightly-20250305.0",
19
- "@ckeditor/ckeditor5-engine": "0.0.0-nightly-20250305.0",
20
- "@ckeditor/ckeditor5-ui": "0.0.0-nightly-20250305.0",
21
- "@ckeditor/ckeditor5-utils": "0.0.0-nightly-20250305.0",
22
- "@ckeditor/ckeditor5-widget": "0.0.0-nightly-20250305.0",
23
- "lodash-es": "4.17.21"
16
+ "ckeditor5": "0.0.0-nightly-20250306.0",
17
+ "@ckeditor/ckeditor5-clipboard": "0.0.0-nightly-20250306.0",
18
+ "@ckeditor/ckeditor5-core": "0.0.0-nightly-20250306.0",
19
+ "@ckeditor/ckeditor5-engine": "0.0.0-nightly-20250306.0",
20
+ "@ckeditor/ckeditor5-icons": "0.0.0-nightly-20250306.0",
21
+ "@ckeditor/ckeditor5-ui": "0.0.0-nightly-20250306.0",
22
+ "@ckeditor/ckeditor5-utils": "0.0.0-nightly-20250306.0",
23
+ "@ckeditor/ckeditor5-widget": "0.0.0-nightly-20250306.0",
24
+ "es-toolkit": "1.32.0"
24
25
  },
25
26
  "author": "CKSource (http://cksource.com/)",
26
27
  "license": "SEE LICENSE IN LICENSE.md",
@@ -25,6 +25,10 @@ import { Command } from 'ckeditor5/src/core.js';
25
25
  * ```
26
26
  */
27
27
  export default class InsertColumnCommand extends Command {
28
+ /**
29
+ * The order of insertion relative to the column in which the caret is located.
30
+ */
31
+ order;
28
32
  /**
29
33
  * Creates a new `InsertColumnCommand` instance.
30
34
  *
@@ -25,6 +25,10 @@ import { Command } from 'ckeditor5/src/core.js';
25
25
  * ```
26
26
  */
27
27
  export default class InsertRowCommand extends Command {
28
+ /**
29
+ * The order of insertion relative to the row in which the caret is located.
30
+ */
31
+ order;
28
32
  /**
29
33
  * Creates a new `InsertRowCommand` instance.
30
34
  *
@@ -25,6 +25,14 @@ import { removeEmptyRowsColumns } from '../utils/structure.js';
25
25
  * (for `'mergeTableCellUp'` and `'mergeTableCellDown'`), the command will be disabled.
26
26
  */
27
27
  export default class MergeCellCommand extends Command {
28
+ /**
29
+ * The direction that indicates which cell will be merged with the currently selected one.
30
+ */
31
+ direction;
32
+ /**
33
+ * Whether the merge is horizontal (left/right) or vertical (up/down).
34
+ */
35
+ isHorizontal;
28
36
  /**
29
37
  * Creates a new `MergeCellCommand` instance.
30
38
  *
@@ -19,6 +19,10 @@ import { Command } from 'ckeditor5/src/core.js';
19
19
  * ```
20
20
  */
21
21
  export default class SplitCellCommand extends Command {
22
+ /**
23
+ * The direction that indicates which cell will be split.
24
+ */
25
+ direction;
22
26
  /**
23
27
  * Creates a new `SplitCellCommand` instance.
24
28
  *
@@ -15,6 +15,13 @@ import { isTable, matchTableCaptionViewElement } from './utils.js';
15
15
  * The table caption editing plugin.
16
16
  */
17
17
  export default class TableCaptionEditing extends Plugin {
18
+ /**
19
+ * A map that keeps saved JSONified table captions and table model elements they are
20
+ * associated with.
21
+ *
22
+ * To learn more about this system, see {@link #_saveCaption}.
23
+ */
24
+ _savedCaptionsMap;
18
25
  /**
19
26
  * @inheritDoc
20
27
  */
@@ -5,8 +5,9 @@
5
5
  /**
6
6
  * @module table/tablecaption/tablecaptionui
7
7
  */
8
- import { Plugin, icons } from 'ckeditor5/src/core.js';
8
+ import { Plugin } from 'ckeditor5/src/core.js';
9
9
  import { ButtonView } from 'ckeditor5/src/ui.js';
10
+ import { IconCaption } from 'ckeditor5/src/icons.js';
10
11
  import { getCaptionFromModelSelection } from './utils.js';
11
12
  /**
12
13
  * The table caption UI plugin. It introduces the `'toggleTableCaption'` UI button.
@@ -35,7 +36,7 @@ export default class TableCaptionUI extends Plugin {
35
36
  const command = editor.commands.get('toggleTableCaption');
36
37
  const view = new ButtonView(locale);
37
38
  view.set({
38
- icon: icons.caption,
39
+ icon: IconCaption,
39
40
  tooltip: true,
40
41
  isToggleable: true
41
42
  });
@@ -12,6 +12,14 @@ import { Command } from 'ckeditor5/src/core.js';
12
12
  * The command is a base command for other table cell property commands.
13
13
  */
14
14
  export default class TableCellPropertyCommand extends Command {
15
+ /**
16
+ * The attribute that will be set by the command.
17
+ */
18
+ attributeName;
19
+ /**
20
+ * The default value for the attribute.
21
+ */
22
+ _defaultValue;
15
23
  /**
16
24
  * Creates a new `TableCellPropertyCommand` instance.
17
25
  *
@@ -6,13 +6,13 @@
6
6
  * @module table/tablecellproperties/tablecellpropertiesui
7
7
  */
8
8
  import { Plugin } from 'ckeditor5/src/core.js';
9
+ import { IconTableCellProperties } from 'ckeditor5/src/icons.js';
9
10
  import { ButtonView, clickOutsideHandler, ContextualBalloon, getLocalizedColorOptions, normalizeColorOptions } from 'ckeditor5/src/ui.js';
10
11
  import TableCellPropertiesView from './ui/tablecellpropertiesview.js';
11
12
  import { colorFieldValidator, getLocalizedColorErrorText, getLocalizedLengthErrorText, defaultColors, lengthFieldValidator, lineWidthFieldValidator } from '../utils/ui/table-properties.js';
12
- import { debounce } from 'lodash-es';
13
+ import { debounce } from 'es-toolkit/compat';
13
14
  import { getTableWidgetAncestor } from '../utils/ui/widget.js';
14
15
  import { getBalloonCellPositionData, repositionContextualBalloon } from '../utils/ui/contextualballoon.js';
15
- import tableCellProperties from './../../theme/icons/table-cell-properties.svg';
16
16
  import { getNormalizedDefaultCellProperties } from '../utils/table-properties.js';
17
17
  const ERROR_TEXT_TIMEOUT = 500;
18
18
  // Map of view properties and related commands.
@@ -34,6 +34,28 @@ const propertyToCommandMap = {
34
34
  * It uses the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon contextual balloon plugin}.
35
35
  */
36
36
  export default class TableCellPropertiesUI extends Plugin {
37
+ /**
38
+ * The default table cell properties.
39
+ */
40
+ _defaultTableCellProperties;
41
+ /**
42
+ * The contextual balloon plugin instance.
43
+ */
44
+ _balloon;
45
+ /**
46
+ * The cell properties form view displayed inside the balloon.
47
+ */
48
+ view;
49
+ /**
50
+ * The batch used to undo all changes made by the form (which are live, as the user types)
51
+ * when "Cancel" was pressed. Each time the view is shown, a new batch is created.
52
+ */
53
+ _undoStepBatch;
54
+ /**
55
+ * Flag used to indicate whether view is ready to execute update commands
56
+ * (it finished loading initial data).
57
+ */
58
+ _isReady;
37
59
  /**
38
60
  * @inheritDoc
39
61
  */
@@ -81,7 +103,7 @@ export default class TableCellPropertiesUI extends Plugin {
81
103
  const view = new ButtonView(locale);
82
104
  view.set({
83
105
  label: t('Cell properties'),
84
- icon: tableCellProperties,
106
+ icon: IconTableCellProperties,
85
107
  tooltip: true
86
108
  });
87
109
  this.listenTo(view, 'execute', () => this._showView());
@@ -9,7 +9,8 @@ import { ButtonView, FocusCycler, LabeledFieldView, ToolbarView, View, ViewColle
9
9
  import { KeystrokeHandler, FocusTracker, type Locale } from 'ckeditor5/src/utils.js';
10
10
  import type ColorInputView from '../../ui/colorinputview.js';
11
11
  import type { TableCellPropertiesOptions } from '../../tableconfig.js';
12
- import '../../../theme/form.css';
12
+ import '@ckeditor/ckeditor5-ui/theme/components/form/form.css';
13
+ import '../../../theme/formrow.css';
13
14
  import '../../../theme/tableform.css';
14
15
  import '../../../theme/tablecellproperties.css';
15
16
  export interface TableCellPropertiesViewOptions {
@@ -5,12 +5,13 @@
5
5
  /**
6
6
  * @module table/tablecellproperties/ui/tablecellpropertiesview
7
7
  */
8
- import { addListToDropdown, ButtonView, createLabeledDropdown, createLabeledInputText, FocusCycler, FormHeaderView, LabeledFieldView, LabelView, submitHandler, ToolbarView, View, ViewCollection } from 'ckeditor5/src/ui.js';
8
+ import { addListToDropdown, ButtonView, createLabeledDropdown, createLabeledInputText, FocusCycler, FormRowView, FormHeaderView, LabeledFieldView, LabelView, submitHandler, ToolbarView, View, ViewCollection } from 'ckeditor5/src/ui.js';
9
9
  import { KeystrokeHandler, FocusTracker } from 'ckeditor5/src/utils.js';
10
- import { icons } from 'ckeditor5/src/core.js';
10
+ import { IconAlignBottom, IconAlignCenter, IconAlignJustify, IconAlignLeft, IconAlignMiddle, IconAlignRight, IconAlignTop, IconCancel, IconCheck } from 'ckeditor5/src/icons.js';
11
11
  import { fillToolbar, getBorderStyleDefinitions, getBorderStyleLabels, getLabeledColorInputCreator } from '../../utils/ui/table-properties.js';
12
- import FormRowView from '../../ui/formrowview.js';
13
- import '../../../theme/form.css';
12
+ // eslint-disable-next-line ckeditor5-rules/ckeditor-imports
13
+ import '@ckeditor/ckeditor5-ui/theme/components/form/form.css';
14
+ import '../../../theme/formrow.css';
14
15
  import '../../../theme/tableform.css';
15
16
  import '../../../theme/tablecellproperties.css';
16
17
  /**
@@ -18,6 +19,74 @@ import '../../../theme/tablecellproperties.css';
18
19
  * certain style aspects of a table cell, for instance, border, padding, text alignment, etc..
19
20
  */
20
21
  export default class TableCellPropertiesView extends View {
22
+ /**
23
+ * Options passed to the view. See {@link #constructor} to learn more.
24
+ */
25
+ options;
26
+ /**
27
+ * Tracks information about the DOM focus in the form.
28
+ */
29
+ focusTracker;
30
+ /**
31
+ * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
32
+ */
33
+ keystrokes;
34
+ /**
35
+ * A collection of child views in the form.
36
+ */
37
+ children;
38
+ /**
39
+ * A dropdown that allows selecting the style of the table cell border.
40
+ */
41
+ borderStyleDropdown;
42
+ /**
43
+ * An input that allows specifying the width of the table cell border.
44
+ */
45
+ borderWidthInput;
46
+ /**
47
+ * An input that allows specifying the color of the table cell border.
48
+ */
49
+ borderColorInput;
50
+ /**
51
+ * An input that allows specifying the table cell background color.
52
+ */
53
+ backgroundInput;
54
+ /**
55
+ * An input that allows specifying the table cell padding.
56
+ */
57
+ paddingInput;
58
+ /**
59
+ * An input that allows specifying the table cell width.
60
+ */
61
+ widthInput;
62
+ /**
63
+ * An input that allows specifying the table cell height.
64
+ */
65
+ heightInput;
66
+ /**
67
+ * A toolbar with buttons that allow changing the horizontal text alignment in a table cell.
68
+ */
69
+ horizontalAlignmentToolbar;
70
+ /**
71
+ * A toolbar with buttons that allow changing the vertical text alignment in a table cell.
72
+ */
73
+ verticalAlignmentToolbar;
74
+ /**
75
+ * The "Save" button view.
76
+ */
77
+ saveButtonView;
78
+ /**
79
+ * The "Cancel" button view.
80
+ */
81
+ cancelButtonView;
82
+ /**
83
+ * A collection of views that can be focused in the form.
84
+ */
85
+ _focusables;
86
+ /**
87
+ * Helps cycling over {@link #_focusables} in the form.
88
+ */
89
+ _focusCycler;
21
90
  /**
22
91
  * @param locale The {@link module:core/editor/editor~Editor#locale} instance.
23
92
  * @param options Additional configuration of the view.
@@ -412,13 +481,13 @@ export default class TableCellPropertiesView extends View {
412
481
  const t = this.t;
413
482
  const alignmentLabel = new LabelView(locale);
414
483
  const ALIGNMENT_ICONS = {
415
- left: icons.alignLeft,
416
- center: icons.alignCenter,
417
- right: icons.alignRight,
418
- justify: icons.alignJustify,
419
- top: icons.alignTop,
420
- middle: icons.alignMiddle,
421
- bottom: icons.alignBottom
484
+ left: IconAlignLeft,
485
+ center: IconAlignCenter,
486
+ right: IconAlignRight,
487
+ justify: IconAlignJustify,
488
+ top: IconAlignTop,
489
+ middle: IconAlignMiddle,
490
+ bottom: IconAlignBottom
422
491
  };
423
492
  alignmentLabel.text = t('Table cell text alignment');
424
493
  // -- Horizontal ---------------------------------------------------
@@ -489,7 +558,7 @@ export default class TableCellPropertiesView extends View {
489
558
  ];
490
559
  saveButtonView.set({
491
560
  label: t('Save'),
492
- icon: icons.check,
561
+ icon: IconCheck,
493
562
  class: 'ck-button-save',
494
563
  type: 'submit',
495
564
  withText: true
@@ -499,7 +568,7 @@ export default class TableCellPropertiesView extends View {
499
568
  });
500
569
  cancelButtonView.set({
501
570
  label: t('Cancel'),
502
- icon: icons.cancel,
571
+ icon: IconCancel,
503
572
  class: 'ck-button-cancel',
504
573
  withText: true
505
574
  });
@@ -18,3 +18,7 @@ export declare const COLUMN_MIN_WIDTH_IN_PIXELS = 40;
18
18
  * Determines how many digits after the decimal point are used to store the column width as a percentage value.
19
19
  */
20
20
  export declare const COLUMN_WIDTH_PRECISION = 2;
21
+ /**
22
+ * The distance in pixels that the mouse has to move to start resizing the column.
23
+ */
24
+ export declare const COLUMN_RESIZE_DISTANCE_THRESHOLD = 3;
@@ -18,3 +18,7 @@ export const COLUMN_MIN_WIDTH_IN_PIXELS = 40;
18
18
  * Determines how many digits after the decimal point are used to store the column width as a percentage value.
19
19
  */
20
20
  export const COLUMN_WIDTH_PRECISION = 2;
21
+ /**
22
+ * The distance in pixels that the mouse has to move to start resizing the column.
23
+ */
24
+ export const COLUMN_RESIZE_DISTANCE_THRESHOLD = 3;
@@ -35,6 +35,10 @@ export default class TableColumnResizeEditing extends Plugin {
35
35
  * A local reference to the {@link module:table/tableutils~TableUtils} plugin.
36
36
  */
37
37
  private _tableUtilsPlugin;
38
+ /**
39
+ * Starting mouse position data used to add a threshold to the resizing process.
40
+ */
41
+ private _initialMouseEventData;
38
42
  /**
39
43
  * @inheritDoc
40
44
  */
@@ -111,6 +115,10 @@ export default class TableColumnResizeEditing extends Plugin {
111
115
  * @param domEventData The data related to the DOM event.
112
116
  */
113
117
  private _onMouseDownHandler;
118
+ /**
119
+ * Starts the resizing process after the threshold is reached.
120
+ */
121
+ private _startResizingAfterThreshold;
114
122
  /**
115
123
  * Handles the `mousemove` event.
116
124
  * * If resizing process is not in progress, it does nothing.
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * @module table/tablecolumnresize/tablecolumnresizeediting
7
7
  */
8
- import { throttle, isEqual } from 'lodash-es';
8
+ import { throttle, isEqual } from 'es-toolkit/compat';
9
9
  import { global, DomEmitterMixin } from 'ckeditor5/src/utils.js';
10
10
  import { Plugin } from 'ckeditor5/src/core.js';
11
11
  import MouseEventsObserver from '../../src/tablemouse/mouseeventsobserver.js';
@@ -15,11 +15,32 @@ import TableWalker from '../tablewalker.js';
15
15
  import TableWidthsCommand from './tablewidthscommand.js';
16
16
  import { downcastTableResizedClass, upcastColgroupElement } from './converters.js';
17
17
  import { clamp, createFilledArray, sumArray, getColumnEdgesIndexes, getChangedResizedTables, getColumnMinWidthAsPercentage, getElementWidthInPixels, getTableWidthInPixels, normalizeColumnWidths, toPrecision, getDomCellOuterWidth, updateColumnElements, getColumnGroupElement, getTableColumnElements, getTableColumnsWidths } from './utils.js';
18
- import { COLUMN_MIN_WIDTH_IN_PIXELS } from './constants.js';
18
+ import { COLUMN_MIN_WIDTH_IN_PIXELS, COLUMN_RESIZE_DISTANCE_THRESHOLD } from './constants.js';
19
19
  /**
20
20
  * The table column resize editing plugin.
21
21
  */
22
22
  export default class TableColumnResizeEditing extends Plugin {
23
+ /**
24
+ * A flag indicating if the column resizing is in progress.
25
+ */
26
+ _isResizingActive;
27
+ /**
28
+ * A temporary storage for the required data needed to correctly calculate the widths of the resized columns. This storage is
29
+ * initialized when column resizing begins, and is purged upon completion.
30
+ */
31
+ _resizingData;
32
+ /**
33
+ * DOM emitter.
34
+ */
35
+ _domEmitter;
36
+ /**
37
+ * A local reference to the {@link module:table/tableutils~TableUtils} plugin.
38
+ */
39
+ _tableUtilsPlugin;
40
+ /**
41
+ * Starting mouse position data used to add a threshold to the resizing process.
42
+ */
43
+ _initialMouseEventData = null;
23
44
  /**
24
45
  * @inheritDoc
25
46
  */
@@ -336,13 +357,21 @@ export default class TableColumnResizeEditing extends Plugin {
336
357
  }
337
358
  domEventData.preventDefault();
338
359
  eventInfo.stop();
339
- // The column widths are calculated upon mousedown to allow lazy applying the `columnWidths` attribute on the table.
340
- const columnWidthsInPx = _calculateDomColumnWidths(modelTable, this._tableUtilsPlugin, editor);
360
+ this._initialMouseEventData = domEventData;
361
+ }
362
+ /**
363
+ * Starts the resizing process after the threshold is reached.
364
+ */
365
+ _startResizingAfterThreshold() {
366
+ const domEventData = this._initialMouseEventData;
367
+ const { target } = domEventData;
368
+ const modelTable = this.editor.editing.mapper.toModelElement(target.findAncestor('figure'));
341
369
  const viewTable = target.findAncestor('table');
342
- const editingView = editor.editing.view;
370
+ // Calculate the initial column widths in pixels.
371
+ const columnWidthsInPx = _calculateDomColumnWidths(modelTable, this._tableUtilsPlugin, this.editor);
343
372
  // Insert colgroup for the table that is resized for the first time.
344
373
  if (!Array.from(viewTable.getChildren()).find(viewCol => viewCol.is('element', 'colgroup'))) {
345
- editingView.change(viewWriter => {
374
+ this.editor.editing.view.change(viewWriter => {
346
375
  _insertColgroupElement(viewWriter, columnWidthsInPx, viewTable);
347
376
  });
348
377
  }
@@ -350,7 +379,7 @@ export default class TableColumnResizeEditing extends Plugin {
350
379
  this._resizingData = this._getResizingData(domEventData, columnWidthsInPx);
351
380
  // At this point we change only the editor view - we don't want other users to see our changes yet,
352
381
  // so we can't apply them in the model.
353
- editingView.change(writer => _applyResizingAttributesToTable(writer, viewTable, this._resizingData));
382
+ this.editor.editing.view.change(writer => _applyResizingAttributesToTable(writer, viewTable, this._resizingData));
354
383
  /**
355
384
  * Calculates the DOM columns' widths. It is done by taking the width of the widest cell
356
385
  * from each table column (we rely on the {@link module:table/tablewalker~TableWalker}
@@ -415,6 +444,17 @@ export default class TableColumnResizeEditing extends Plugin {
415
444
  * @param mouseEventData The native DOM event.
416
445
  */
417
446
  _onMouseMoveHandler(eventInfo, mouseEventData) {
447
+ if (this._initialMouseEventData) {
448
+ const mouseEvent = this._initialMouseEventData.domEvent;
449
+ const distanceX = Math.abs(mouseEventData.clientX - mouseEvent.clientX);
450
+ if (distanceX >= COLUMN_RESIZE_DISTANCE_THRESHOLD) {
451
+ this._startResizingAfterThreshold();
452
+ this._initialMouseEventData = null;
453
+ }
454
+ else {
455
+ return;
456
+ }
457
+ }
418
458
  if (!this._isResizingActive) {
419
459
  return;
420
460
  }
@@ -455,6 +495,7 @@ export default class TableColumnResizeEditing extends Plugin {
455
495
  * * Otherwise it propagates the changes from view to the model by executing the adequate commands.
456
496
  */
457
497
  _onMouseUpHandler() {
498
+ this._initialMouseEventData = null;
458
499
  if (!this._isResizingActive) {
459
500
  return;
460
501
  }
@@ -30,6 +30,10 @@ import '../theme/tableediting.css';
30
30
  * The table editing feature.
31
31
  */
32
32
  export default class TableEditing extends Plugin {
33
+ /**
34
+ * Handlers for creating additional slots in the table.
35
+ */
36
+ _additionalSlots;
33
37
  /**
34
38
  * @inheritDoc
35
39
  */
@@ -20,12 +20,9 @@ import { DomEventObserver } from 'ckeditor5/src/engine.js';
20
20
  * The observer is registered by the {@link module:table/tableselection~TableSelection} plugin.
21
21
  */
22
22
  export default class MouseEventsObserver extends DomEventObserver {
23
- constructor() {
24
- super(...arguments);
25
- this.domEventType = [
26
- 'mousemove', 'mouseleave'
27
- ];
28
- }
23
+ domEventType = [
24
+ 'mousemove', 'mouseleave'
25
+ ];
29
26
  /**
30
27
  * @inheritDoc
31
28
  */
@@ -10,6 +10,14 @@ import { getSelectionAffectedTable } from '../../utils/common.js';
10
10
  * This command is a base command for other table property commands.
11
11
  */
12
12
  export default class TablePropertyCommand extends Command {
13
+ /**
14
+ * The attribute that will be set by the command.
15
+ */
16
+ attributeName;
17
+ /**
18
+ * The default value for the attribute.
19
+ */
20
+ _defaultValue;
13
21
  /**
14
22
  * Creates a new `TablePropertyCommand` instance.
15
23
  *
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * @module table/tableproperties/tablepropertiesui
7
7
  */
8
- import { type Editor, Plugin } from 'ckeditor5/src/core.js';
8
+ import { Plugin, type Editor } from 'ckeditor5/src/core.js';
9
9
  import { ContextualBalloon } from 'ckeditor5/src/ui.js';
10
10
  import TablePropertiesView from './ui/tablepropertiesview.js';
11
11
  /**
@@ -6,10 +6,10 @@
6
6
  * @module table/tableproperties/tablepropertiesui
7
7
  */
8
8
  import { Plugin } from 'ckeditor5/src/core.js';
9
+ import { IconTableProperties } from 'ckeditor5/src/icons.js';
9
10
  import { ButtonView, ContextualBalloon, clickOutsideHandler, getLocalizedColorOptions, normalizeColorOptions } from 'ckeditor5/src/ui.js';
10
- import { debounce } from 'lodash-es';
11
+ import { debounce } from 'es-toolkit/compat';
11
12
  import TablePropertiesView from './ui/tablepropertiesview.js';
12
- import tableProperties from './../../theme/icons/table-properties.svg';
13
13
  import { colorFieldValidator, getLocalizedColorErrorText, getLocalizedLengthErrorText, lengthFieldValidator, lineWidthFieldValidator, defaultColors } from '../utils/ui/table-properties.js';
14
14
  import { getSelectionAffectedTableWidget } from '../utils/ui/widget.js';
15
15
  import { getBalloonTablePositionData, repositionContextualBalloon } from '../utils/ui/contextualballoon.js';
@@ -32,6 +32,28 @@ const propertyToCommandMap = {
32
32
  * It uses the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon contextual balloon plugin}.
33
33
  */
34
34
  export default class TablePropertiesUI extends Plugin {
35
+ /**
36
+ * The default table properties.
37
+ */
38
+ _defaultTableProperties;
39
+ /**
40
+ * The contextual balloon plugin instance.
41
+ */
42
+ _balloon;
43
+ /**
44
+ * The properties form view displayed inside the balloon.
45
+ */
46
+ view = null;
47
+ /**
48
+ * The batch used to undo all changes made by the form (which are live, as the user types)
49
+ * when "Cancel" was pressed. Each time the view is shown, a new batch is created.
50
+ */
51
+ _undoStepBatch;
52
+ /**
53
+ * Flag used to indicate whether view is ready to execute update commands
54
+ * (it finished loading initial data).
55
+ */
56
+ _isReady;
35
57
  /**
36
58
  * @inheritDoc
37
59
  */
@@ -55,10 +77,6 @@ export default class TablePropertiesUI extends Plugin {
55
77
  */
56
78
  constructor(editor) {
57
79
  super(editor);
58
- /**
59
- * The properties form view displayed inside the balloon.
60
- */
61
- this.view = null;
62
80
  editor.config.define('table.tableProperties', {
63
81
  borderColors: defaultColors,
64
82
  backgroundColors: defaultColors
@@ -78,7 +96,7 @@ export default class TablePropertiesUI extends Plugin {
78
96
  const view = new ButtonView(locale);
79
97
  view.set({
80
98
  label: t('Table properties'),
81
- icon: tableProperties,
99
+ icon: IconTableProperties,
82
100
  tooltip: true
83
101
  });
84
102
  this.listenTo(view, 'execute', () => this._showView());
@@ -7,7 +7,8 @@
7
7
  */
8
8
  import { ButtonView, FocusCycler, LabeledFieldView, ToolbarView, View, ViewCollection, type DropdownView, type InputTextView, type NormalizedColorOption, type ColorPickerConfig, type FocusableView } from 'ckeditor5/src/ui.js';
9
9
  import { FocusTracker, KeystrokeHandler, type Locale } from 'ckeditor5/src/utils.js';
10
- import '../../../theme/form.css';
10
+ import '@ckeditor/ckeditor5-ui/theme/components/form/form.css';
11
+ import '../../../theme/formrow.css';
11
12
  import '../../../theme/tableform.css';
12
13
  import '../../../theme/tableproperties.css';
13
14
  import type ColorInputView from '../../ui/colorinputview.js';