@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.
- package/LICENSE.md +1 -1
- package/build/table.js +1 -1
- package/ckeditor5-metadata.json +6 -6
- package/dist/index-editor.css +81 -16
- package/dist/index.css +108 -23
- package/dist/index.css.map +1 -1
- package/dist/index.js +74 -91
- package/dist/index.js.map +1 -1
- package/package.json +10 -9
- package/src/commands/insertcolumncommand.js +4 -0
- package/src/commands/insertrowcommand.js +4 -0
- package/src/commands/mergecellcommand.js +8 -0
- package/src/commands/splitcellcommand.js +4 -0
- package/src/tablecaption/tablecaptionediting.js +7 -0
- package/src/tablecaption/tablecaptionui.js +3 -2
- package/src/tablecellproperties/commands/tablecellpropertycommand.js +8 -0
- package/src/tablecellproperties/tablecellpropertiesui.js +25 -3
- package/src/tablecellproperties/ui/tablecellpropertiesview.d.ts +2 -1
- package/src/tablecellproperties/ui/tablecellpropertiesview.js +82 -13
- package/src/tablecolumnresize/constants.d.ts +4 -0
- package/src/tablecolumnresize/constants.js +4 -0
- package/src/tablecolumnresize/tablecolumnresizeediting.d.ts +8 -0
- package/src/tablecolumnresize/tablecolumnresizeediting.js +48 -7
- package/src/tableediting.js +4 -0
- package/src/tablemouse/mouseeventsobserver.js +3 -6
- package/src/tableproperties/commands/tablepropertycommand.js +8 -0
- package/src/tableproperties/tablepropertiesui.d.ts +1 -1
- package/src/tableproperties/tablepropertiesui.js +25 -7
- package/src/tableproperties/ui/tablepropertiesview.d.ts +2 -1
- package/src/tableproperties/ui/tablepropertiesview.js +70 -9
- package/src/tableselection.js +19 -1
- package/src/tableui.js +7 -9
- package/src/tablewalker.js +99 -4
- package/src/ui/colorinputview.js +34 -0
- package/src/ui/inserttableview.js +12 -0
- package/src/utils/table-properties.js +1 -1
- package/theme/formrow.css +0 -10
- package/theme/tableform.css +6 -0
- package/src/ui/formrowview.d.ts +0 -61
- package/src/ui/formrowview.js +0 -57
- package/theme/form.css +0 -11
- package/theme/icons/table-cell-properties.svg +0 -1
- package/theme/icons/table-column.svg +0 -1
- package/theme/icons/table-merge-cell.svg +0 -1
- package/theme/icons/table-properties.svg +0 -1
- package/theme/icons/table-row.svg +0 -1
package/dist/index.js
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
|
-
import { Command, Plugin
|
|
5
|
+
import { Command, Plugin } from '@ckeditor/ckeditor5-core/dist/index.js';
|
|
6
6
|
import { toWidgetEditable, toWidget, Widget, isWidget, WidgetToolbarRepository } from '@ckeditor/ckeditor5-widget/dist/index.js';
|
|
7
7
|
import { first, global, CKEditorError, KeystrokeHandler, FocusTracker, Collection, getLocalizedArrowKeyCodeDirection, Rect, DomEmitterMixin } from '@ckeditor/ckeditor5-utils/dist/index.js';
|
|
8
|
-
import {
|
|
8
|
+
import { IconTable, IconTableColumn, IconTableRow, IconTableMergeCell, IconCheck, IconCancel, IconAlignBottom, IconAlignMiddle, IconAlignTop, IconAlignJustify, IconAlignRight, IconAlignCenter, IconAlignLeft, IconTableCellProperties, IconObjectInlineRight, IconObjectCenter, IconObjectInlineLeft, IconTableProperties, IconCaption } from '@ckeditor/ckeditor5-icons/dist/index.js';
|
|
9
|
+
import { View, addKeyboardHandlingForGrid, ButtonView, createDropdown, MenuBarMenuView, SwitchButtonView, SplitButtonView, addListToDropdown, ViewModel, ViewCollection, FocusCycler, InputTextView, ColorSelectorView, FormHeaderView, FormRowView, submitHandler, LabelView, LabeledFieldView, createLabeledDropdown, createLabeledInputText, ToolbarView, BalloonPanelView, ContextualBalloon, normalizeColorOptions, getLocalizedColorOptions, clickOutsideHandler } from '@ckeditor/ckeditor5-ui/dist/index.js';
|
|
9
10
|
import { ClipboardMarkersUtils, ClipboardPipeline } from '@ckeditor/ckeditor5-clipboard/dist/index.js';
|
|
10
11
|
import { DomEventObserver, isColor, isLength, isPercentage, addBorderRules, addPaddingRules, addBackgroundRules, enablePlaceholder, Element } from '@ckeditor/ckeditor5-engine/dist/index.js';
|
|
11
|
-
import { isObject, debounce, isEqual, throttle } from '
|
|
12
|
+
import { isObject, debounce, isEqual, throttle } from 'es-toolkit/compat';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
@@ -2238,6 +2239,9 @@ import { isObject, debounce, isEqual, throttle } from 'lodash-es';
|
|
|
2238
2239
|
/**
|
|
2239
2240
|
* Determines how many digits after the decimal point are used to store the column width as a percentage value.
|
|
2240
2241
|
*/ const COLUMN_WIDTH_PRECISION = 2;
|
|
2242
|
+
/**
|
|
2243
|
+
* The distance in pixels that the mouse has to move to start resizing the column.
|
|
2244
|
+
*/ const COLUMN_RESIZE_DISTANCE_THRESHOLD = 3;
|
|
2241
2245
|
|
|
2242
2246
|
/**
|
|
2243
2247
|
* Returns all the inserted or changed table model elements in a given change set. Only the tables
|
|
@@ -4750,12 +4754,6 @@ function getMaxOffset(tableCell, start, currentMaxOffset, which) {
|
|
|
4750
4754
|
}
|
|
4751
4755
|
}
|
|
4752
4756
|
|
|
4753
|
-
var tableColumnIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z\" opacity=\".6\"/><path d=\"M18 7v1H2V7h16zm0 5v1H2v-1h16z\" opacity=\".6\"/><path d=\"M14 1v18a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V1a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1zm-2 1H8v4h4V2zm0 6H8v4h4V8zm0 6H8v4h4v-4z\"/></svg>";
|
|
4754
|
-
|
|
4755
|
-
var tableRowIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z\" opacity=\".6\"/><path d=\"M7 2h1v16H7V2zm5 0h1v16h-1V2z\" opacity=\".6\"/><path d=\"M1 6h18a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H1a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zm1 2v4h4V8H2zm6 0v4h4V8H8zm6 0v4h4V8h-4z\"/></svg>";
|
|
4756
|
-
|
|
4757
|
-
var tableMergeCellIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z\" opacity=\".6\"/><path d=\"M7 2h1v16H7V2zm5 0h1v7h-1V2zm6 5v1H2V7h16zM8 12v1H2v-1h6z\" opacity=\".6\"/><path d=\"M7 7h12a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1zm1 2v9h10V9H8z\"/></svg>";
|
|
4758
|
-
|
|
4759
4757
|
/**
|
|
4760
4758
|
* The table UI plugin. It introduces:
|
|
4761
4759
|
*
|
|
@@ -4790,7 +4788,7 @@ var tableMergeCellIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2
|
|
|
4790
4788
|
dropdownView.bind('isEnabled').to(command);
|
|
4791
4789
|
// Decorate dropdown's button.
|
|
4792
4790
|
dropdownView.buttonView.set({
|
|
4793
|
-
icon:
|
|
4791
|
+
icon: IconTable,
|
|
4794
4792
|
label: t('Insert table'),
|
|
4795
4793
|
tooltip: true
|
|
4796
4794
|
});
|
|
@@ -4832,7 +4830,7 @@ var tableMergeCellIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2
|
|
|
4832
4830
|
});
|
|
4833
4831
|
menuView.buttonView.set({
|
|
4834
4832
|
label: t('Table'),
|
|
4835
|
-
icon:
|
|
4833
|
+
icon: IconTable
|
|
4836
4834
|
});
|
|
4837
4835
|
menuView.panelView.children.add(insertTableView);
|
|
4838
4836
|
menuView.bind('isEnabled').to(command);
|
|
@@ -4880,7 +4878,7 @@ var tableMergeCellIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2
|
|
|
4880
4878
|
}
|
|
4881
4879
|
}
|
|
4882
4880
|
];
|
|
4883
|
-
return this._prepareDropdown(t('Column'),
|
|
4881
|
+
return this._prepareDropdown(t('Column'), IconTableColumn, options, locale);
|
|
4884
4882
|
});
|
|
4885
4883
|
editor.ui.componentFactory.add('tableRow', (locale)=>{
|
|
4886
4884
|
const options = [
|
|
@@ -4924,7 +4922,7 @@ var tableMergeCellIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2
|
|
|
4924
4922
|
}
|
|
4925
4923
|
}
|
|
4926
4924
|
];
|
|
4927
|
-
return this._prepareDropdown(t('Row'),
|
|
4925
|
+
return this._prepareDropdown(t('Row'), IconTableRow, options, locale);
|
|
4928
4926
|
});
|
|
4929
4927
|
editor.ui.componentFactory.add('mergeTableCells', (locale)=>{
|
|
4930
4928
|
const options = [
|
|
@@ -4974,7 +4972,7 @@ var tableMergeCellIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2
|
|
|
4974
4972
|
}
|
|
4975
4973
|
}
|
|
4976
4974
|
];
|
|
4977
|
-
return this._prepareMergeSplitButtonDropdown(t('Merge cells'),
|
|
4975
|
+
return this._prepareMergeSplitButtonDropdown(t('Merge cells'), IconTableMergeCell, options, locale);
|
|
4978
4976
|
});
|
|
4979
4977
|
}
|
|
4980
4978
|
/**
|
|
@@ -5350,7 +5348,25 @@ var tableMergeCellIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2
|
|
|
5350
5348
|
const startRow = Math.min(startLocation.row, endLocation.row);
|
|
5351
5349
|
const endRow = Math.max(startLocation.row, endLocation.row);
|
|
5352
5350
|
const startColumn = Math.min(startLocation.column, endLocation.column);
|
|
5353
|
-
|
|
5351
|
+
// Adjust the selection to include the entire row if a cell with colspan is selected.
|
|
5352
|
+
// This ensures that the selection covers the full width of the colspan cell.
|
|
5353
|
+
//
|
|
5354
|
+
// Example:
|
|
5355
|
+
// +---+---+---+---+
|
|
5356
|
+
// | A | B | C | D |
|
|
5357
|
+
// +---+---+---+---+
|
|
5358
|
+
// | E |
|
|
5359
|
+
// +---+---+---+---+
|
|
5360
|
+
//
|
|
5361
|
+
// If the selection starts at `B` and ends at `E`, the entire first row should be selected.
|
|
5362
|
+
//
|
|
5363
|
+
// In other words, the selection will represent the following cells:
|
|
5364
|
+
// * Without this adjustment, only `B`, `A` and `E` would be selected.
|
|
5365
|
+
// * With this adjustment, `A`, `B`, `C`, `D`, and `E` are selected.
|
|
5366
|
+
//
|
|
5367
|
+
// See: https://github.com/ckeditor/ckeditor5/issues/17538
|
|
5368
|
+
const endColumnExtraColspan = parseInt(targetCell.getAttribute('colspan') || '1') - 1;
|
|
5369
|
+
const endColumn = Math.max(startLocation.column, endLocation.column + endColumnExtraColspan);
|
|
5354
5370
|
// 2-dimensional array of the selected cells to ease flipping the order of cells for backward selections.
|
|
5355
5371
|
const selectionMap = new Array(endRow - startRow + 1).fill(null).map(()=>[]);
|
|
5356
5372
|
const walkerOptions = {
|
|
@@ -7210,56 +7226,6 @@ function colorConfigToColorGridDefinitions(colorConfig) {
|
|
|
7210
7226
|
}));
|
|
7211
7227
|
}
|
|
7212
7228
|
|
|
7213
|
-
/**
|
|
7214
|
-
* The class representing a single row in a complex form,
|
|
7215
|
-
* used by {@link module:table/tablecellproperties/ui/tablecellpropertiesview~TableCellPropertiesView}.
|
|
7216
|
-
*
|
|
7217
|
-
* **Note**: For now this class is private. When more use cases arrive (beyond ckeditor5-table),
|
|
7218
|
-
* it will become a component in ckeditor5-ui.
|
|
7219
|
-
*
|
|
7220
|
-
* @internal
|
|
7221
|
-
*/ class FormRowView extends View {
|
|
7222
|
-
/**
|
|
7223
|
-
* A collection of row items (buttons, dropdowns, etc.).
|
|
7224
|
-
*/ children;
|
|
7225
|
-
/**
|
|
7226
|
-
* Creates an instance of the form row class.
|
|
7227
|
-
*
|
|
7228
|
-
* @param locale The locale instance.
|
|
7229
|
-
* @param options.labelView When passed, the row gets the `group` and `aria-labelledby`
|
|
7230
|
-
* DOM attributes and gets described by the label.
|
|
7231
|
-
*/ constructor(locale, options = {}){
|
|
7232
|
-
super(locale);
|
|
7233
|
-
const bind = this.bindTemplate;
|
|
7234
|
-
this.set('class', options.class || null);
|
|
7235
|
-
this.children = this.createCollection();
|
|
7236
|
-
if (options.children) {
|
|
7237
|
-
options.children.forEach((child)=>this.children.add(child));
|
|
7238
|
-
}
|
|
7239
|
-
this.set('_role', null);
|
|
7240
|
-
this.set('_ariaLabelledBy', null);
|
|
7241
|
-
if (options.labelView) {
|
|
7242
|
-
this.set({
|
|
7243
|
-
_role: 'group',
|
|
7244
|
-
_ariaLabelledBy: options.labelView.id
|
|
7245
|
-
});
|
|
7246
|
-
}
|
|
7247
|
-
this.setTemplate({
|
|
7248
|
-
tag: 'div',
|
|
7249
|
-
attributes: {
|
|
7250
|
-
class: [
|
|
7251
|
-
'ck',
|
|
7252
|
-
'ck-form__row',
|
|
7253
|
-
bind.to('class')
|
|
7254
|
-
],
|
|
7255
|
-
role: bind.to('_role'),
|
|
7256
|
-
'aria-labelledby': bind.to('_ariaLabelledBy')
|
|
7257
|
-
},
|
|
7258
|
-
children: this.children
|
|
7259
|
-
});
|
|
7260
|
-
}
|
|
7261
|
-
}
|
|
7262
|
-
|
|
7263
7229
|
/**
|
|
7264
7230
|
* The class representing a table cell properties form, allowing users to customize
|
|
7265
7231
|
* certain style aspects of a table cell, for instance, border, padding, text alignment, etc..
|
|
@@ -7705,13 +7671,13 @@ function colorConfigToColorGridDefinitions(colorConfig) {
|
|
|
7705
7671
|
const t = this.t;
|
|
7706
7672
|
const alignmentLabel = new LabelView(locale);
|
|
7707
7673
|
const ALIGNMENT_ICONS = {
|
|
7708
|
-
left:
|
|
7709
|
-
center:
|
|
7710
|
-
right:
|
|
7711
|
-
justify:
|
|
7712
|
-
top:
|
|
7713
|
-
middle:
|
|
7714
|
-
bottom:
|
|
7674
|
+
left: IconAlignLeft,
|
|
7675
|
+
center: IconAlignCenter,
|
|
7676
|
+
right: IconAlignRight,
|
|
7677
|
+
justify: IconAlignJustify,
|
|
7678
|
+
top: IconAlignTop,
|
|
7679
|
+
middle: IconAlignMiddle,
|
|
7680
|
+
bottom: IconAlignBottom
|
|
7715
7681
|
};
|
|
7716
7682
|
alignmentLabel.text = t('Table cell text alignment');
|
|
7717
7683
|
// -- Horizontal ---------------------------------------------------
|
|
@@ -7780,7 +7746,7 @@ function colorConfigToColorGridDefinitions(colorConfig) {
|
|
|
7780
7746
|
];
|
|
7781
7747
|
saveButtonView.set({
|
|
7782
7748
|
label: t('Save'),
|
|
7783
|
-
icon:
|
|
7749
|
+
icon: IconCheck,
|
|
7784
7750
|
class: 'ck-button-save',
|
|
7785
7751
|
type: 'submit',
|
|
7786
7752
|
withText: true
|
|
@@ -7790,7 +7756,7 @@ function colorConfigToColorGridDefinitions(colorConfig) {
|
|
|
7790
7756
|
});
|
|
7791
7757
|
cancelButtonView.set({
|
|
7792
7758
|
label: t('Cancel'),
|
|
7793
|
-
icon:
|
|
7759
|
+
icon: IconCancel,
|
|
7794
7760
|
class: 'ck-button-cancel',
|
|
7795
7761
|
withText: true
|
|
7796
7762
|
});
|
|
@@ -7934,8 +7900,6 @@ const BALLOON_POSITIONS = /* #__PURE__ */ (()=>[
|
|
|
7934
7900
|
return Rect.getBoundingRect(rects);
|
|
7935
7901
|
}
|
|
7936
7902
|
|
|
7937
|
-
var tableCellProperties = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"m11.105 18-.17 1H2.5A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1h15A1.5 1.5 0 0 1 19 2.5v9.975l-.85-.124-.15-.302V8h-5v4h.021l-.172.351-1.916.28-.151.027c-.287.063-.54.182-.755.341L8 13v5h3.105zM2 12h5V8H2v4zm10-4H8v4h4V8zM2 2v5h5V2H2zm0 16h5v-5H2v5zM13 7h5V2h-5v5zM8 2v5h4V2H8z\" opacity=\".6\"/><path d=\"m15.5 11.5 1.323 2.68 2.957.43-2.14 2.085.505 2.946L15.5 18.25l-2.645 1.39.505-2.945-2.14-2.086 2.957-.43L15.5 11.5zM13 6a1 1 0 0 1 1 1v3.172a2.047 2.047 0 0 0-.293.443l-.858 1.736-1.916.28-.151.027A1.976 1.976 0 0 0 9.315 14H7a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h6zm-1 2H8v4h4V8z\"/></svg>";
|
|
7938
|
-
|
|
7939
7903
|
/**
|
|
7940
7904
|
* Returns a string if all four values of box sides are equal.
|
|
7941
7905
|
*
|
|
@@ -8122,7 +8086,7 @@ const propertyToCommandMap$1 = {
|
|
|
8122
8086
|
const view = new ButtonView(locale);
|
|
8123
8087
|
view.set({
|
|
8124
8088
|
label: t('Cell properties'),
|
|
8125
|
-
icon:
|
|
8089
|
+
icon: IconTableCellProperties,
|
|
8126
8090
|
tooltip: true
|
|
8127
8091
|
});
|
|
8128
8092
|
this.listenTo(view, 'execute', ()=>this._showView());
|
|
@@ -10044,9 +10008,9 @@ const FLOAT_VALUES_REG_EXP = /^(left|none|right)$/;
|
|
|
10044
10008
|
fillToolbar({
|
|
10045
10009
|
view: this,
|
|
10046
10010
|
icons: {
|
|
10047
|
-
left:
|
|
10048
|
-
center:
|
|
10049
|
-
right:
|
|
10011
|
+
left: IconObjectInlineLeft,
|
|
10012
|
+
center: IconObjectCenter,
|
|
10013
|
+
right: IconObjectInlineRight
|
|
10050
10014
|
},
|
|
10051
10015
|
toolbar: alignmentToolbar,
|
|
10052
10016
|
labels: this._alignmentLabels,
|
|
@@ -10077,7 +10041,7 @@ const FLOAT_VALUES_REG_EXP = /^(left|none|right)$/;
|
|
|
10077
10041
|
];
|
|
10078
10042
|
saveButtonView.set({
|
|
10079
10043
|
label: t('Save'),
|
|
10080
|
-
icon:
|
|
10044
|
+
icon: IconCheck,
|
|
10081
10045
|
class: 'ck-button-save',
|
|
10082
10046
|
type: 'submit',
|
|
10083
10047
|
withText: true
|
|
@@ -10087,7 +10051,7 @@ const FLOAT_VALUES_REG_EXP = /^(left|none|right)$/;
|
|
|
10087
10051
|
});
|
|
10088
10052
|
cancelButtonView.set({
|
|
10089
10053
|
label: t('Cancel'),
|
|
10090
|
-
icon:
|
|
10054
|
+
icon: IconCancel,
|
|
10091
10055
|
class: 'ck-button-cancel',
|
|
10092
10056
|
withText: true
|
|
10093
10057
|
});
|
|
@@ -10125,8 +10089,6 @@ function isBorderStyleSet(value) {
|
|
|
10125
10089
|
return value !== 'none';
|
|
10126
10090
|
}
|
|
10127
10091
|
|
|
10128
|
-
var tableProperties = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M8 2v5h4V2h1v5h5v1h-5v4h.021l-.172.351-1.916.28-.151.027c-.287.063-.54.182-.755.341L8 13v5H7v-5H2v-1h5V8H2V7h5V2h1zm4 6H8v4h4V8z\" opacity=\".6\"/><path d=\"m15.5 11.5 1.323 2.68 2.957.43-2.14 2.085.505 2.946L15.5 18.25l-2.645 1.39.505-2.945-2.14-2.086 2.957-.43L15.5 11.5zM17 1a2 2 0 0 1 2 2v9.475l-.85-.124-.857-1.736a2.048 2.048 0 0 0-.292-.44L17 3H3v14h7.808l.402.392L10.935 19H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h14z\"/></svg>";
|
|
10129
|
-
|
|
10130
10092
|
const ERROR_TEXT_TIMEOUT = 500;
|
|
10131
10093
|
// Map of view properties and related commands.
|
|
10132
10094
|
const propertyToCommandMap = {
|
|
@@ -10200,7 +10162,7 @@ const propertyToCommandMap = {
|
|
|
10200
10162
|
const view = new ButtonView(locale);
|
|
10201
10163
|
view.set({
|
|
10202
10164
|
label: t('Table properties'),
|
|
10203
|
-
icon:
|
|
10165
|
+
icon: IconTableProperties,
|
|
10204
10166
|
tooltip: true
|
|
10205
10167
|
});
|
|
10206
10168
|
this.listenTo(view, 'execute', ()=>this._showView());
|
|
@@ -10799,7 +10761,7 @@ const propertyToCommandMap = {
|
|
|
10799
10761
|
const command = editor.commands.get('toggleTableCaption');
|
|
10800
10762
|
const view = new ButtonView(locale);
|
|
10801
10763
|
view.set({
|
|
10802
|
-
icon:
|
|
10764
|
+
icon: IconCaption,
|
|
10803
10765
|
tooltip: true,
|
|
10804
10766
|
isToggleable: true
|
|
10805
10767
|
});
|
|
@@ -10957,6 +10919,9 @@ const propertyToCommandMap = {
|
|
|
10957
10919
|
/**
|
|
10958
10920
|
* A local reference to the {@link module:table/tableutils~TableUtils} plugin.
|
|
10959
10921
|
*/ _tableUtilsPlugin;
|
|
10922
|
+
/**
|
|
10923
|
+
* Starting mouse position data used to add a threshold to the resizing process.
|
|
10924
|
+
*/ _initialMouseEventData = null;
|
|
10960
10925
|
/**
|
|
10961
10926
|
* @inheritDoc
|
|
10962
10927
|
*/ static get requires() {
|
|
@@ -11273,13 +11238,20 @@ const propertyToCommandMap = {
|
|
|
11273
11238
|
}
|
|
11274
11239
|
domEventData.preventDefault();
|
|
11275
11240
|
eventInfo.stop();
|
|
11276
|
-
|
|
11277
|
-
|
|
11241
|
+
this._initialMouseEventData = domEventData;
|
|
11242
|
+
}
|
|
11243
|
+
/**
|
|
11244
|
+
* Starts the resizing process after the threshold is reached.
|
|
11245
|
+
*/ _startResizingAfterThreshold() {
|
|
11246
|
+
const domEventData = this._initialMouseEventData;
|
|
11247
|
+
const { target } = domEventData;
|
|
11248
|
+
const modelTable = this.editor.editing.mapper.toModelElement(target.findAncestor('figure'));
|
|
11278
11249
|
const viewTable = target.findAncestor('table');
|
|
11279
|
-
|
|
11250
|
+
// Calculate the initial column widths in pixels.
|
|
11251
|
+
const columnWidthsInPx = _calculateDomColumnWidths(modelTable, this._tableUtilsPlugin, this.editor);
|
|
11280
11252
|
// Insert colgroup for the table that is resized for the first time.
|
|
11281
11253
|
if (!Array.from(viewTable.getChildren()).find((viewCol)=>viewCol.is('element', 'colgroup'))) {
|
|
11282
|
-
|
|
11254
|
+
this.editor.editing.view.change((viewWriter)=>{
|
|
11283
11255
|
_insertColgroupElement(viewWriter, columnWidthsInPx, viewTable);
|
|
11284
11256
|
});
|
|
11285
11257
|
}
|
|
@@ -11287,7 +11259,7 @@ const propertyToCommandMap = {
|
|
|
11287
11259
|
this._resizingData = this._getResizingData(domEventData, columnWidthsInPx);
|
|
11288
11260
|
// At this point we change only the editor view - we don't want other users to see our changes yet,
|
|
11289
11261
|
// so we can't apply them in the model.
|
|
11290
|
-
|
|
11262
|
+
this.editor.editing.view.change((writer)=>_applyResizingAttributesToTable(writer, viewTable, this._resizingData));
|
|
11291
11263
|
/**
|
|
11292
11264
|
* Calculates the DOM columns' widths. It is done by taking the width of the widest cell
|
|
11293
11265
|
* from each table column (we rely on the {@link module:table/tablewalker~TableWalker}
|
|
@@ -11348,6 +11320,16 @@ const propertyToCommandMap = {
|
|
|
11348
11320
|
* @param eventInfo An object containing information about the fired event.
|
|
11349
11321
|
* @param mouseEventData The native DOM event.
|
|
11350
11322
|
*/ _onMouseMoveHandler(eventInfo, mouseEventData) {
|
|
11323
|
+
if (this._initialMouseEventData) {
|
|
11324
|
+
const mouseEvent = this._initialMouseEventData.domEvent;
|
|
11325
|
+
const distanceX = Math.abs(mouseEventData.clientX - mouseEvent.clientX);
|
|
11326
|
+
if (distanceX >= COLUMN_RESIZE_DISTANCE_THRESHOLD) {
|
|
11327
|
+
this._startResizingAfterThreshold();
|
|
11328
|
+
this._initialMouseEventData = null;
|
|
11329
|
+
} else {
|
|
11330
|
+
return;
|
|
11331
|
+
}
|
|
11332
|
+
}
|
|
11351
11333
|
if (!this._isResizingActive) {
|
|
11352
11334
|
return;
|
|
11353
11335
|
}
|
|
@@ -11384,6 +11366,7 @@ const propertyToCommandMap = {
|
|
|
11384
11366
|
* * If resizing is active but not allowed, it cancels the resizing process restoring the original widths.
|
|
11385
11367
|
* * Otherwise it propagates the changes from view to the model by executing the adequate commands.
|
|
11386
11368
|
*/ _onMouseUpHandler() {
|
|
11369
|
+
this._initialMouseEventData = null;
|
|
11387
11370
|
if (!this._isResizingActive) {
|
|
11388
11371
|
return;
|
|
11389
11372
|
}
|