@ckeditor/ckeditor5-table 45.0.0-alpha.1 → 45.0.0-alpha.11
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/build/table.js +1 -1
- package/build/translations/ar.js +1 -1
- package/build/translations/bg.js +1 -1
- package/build/translations/bn.js +1 -1
- package/build/translations/ca.js +1 -1
- package/build/translations/cs.js +1 -1
- package/build/translations/da.js +1 -1
- package/build/translations/de.js +1 -1
- package/build/translations/el.js +1 -1
- package/build/translations/es.js +1 -1
- package/build/translations/et.js +1 -1
- package/build/translations/fi.js +1 -1
- package/build/translations/fr.js +1 -1
- package/build/translations/he.js +1 -1
- package/build/translations/hi.js +1 -1
- package/build/translations/hu.js +1 -1
- package/build/translations/id.js +1 -1
- package/build/translations/it.js +1 -1
- package/build/translations/ja.js +1 -1
- package/build/translations/ko.js +1 -1
- package/build/translations/lt.js +1 -1
- package/build/translations/lv.js +1 -1
- package/build/translations/ms.js +1 -1
- package/build/translations/nl.js +1 -1
- package/build/translations/no.js +1 -1
- package/build/translations/pl.js +1 -1
- package/build/translations/pt-br.js +1 -1
- package/build/translations/pt.js +1 -1
- package/build/translations/ro.js +1 -1
- package/build/translations/ru.js +1 -1
- package/build/translations/sk.js +1 -1
- package/build/translations/sr.js +1 -1
- package/build/translations/sv.js +1 -1
- package/build/translations/th.js +1 -1
- package/build/translations/tr.js +1 -1
- package/build/translations/uk.js +1 -1
- package/build/translations/vi.js +1 -1
- package/build/translations/zh-cn.js +1 -1
- package/build/translations/zh.js +1 -1
- package/ckeditor5-metadata.json +2 -2
- package/dist/index-content.css +0 -4
- package/dist/index-editor.css +9 -3
- package/dist/index.css +13 -11
- package/dist/index.css.map +1 -1
- package/dist/index.js +123 -88
- package/dist/index.js.map +1 -1
- package/dist/translations/ar.js +1 -1
- package/dist/translations/ar.umd.js +1 -1
- package/dist/translations/bg.js +1 -1
- package/dist/translations/bg.umd.js +1 -1
- package/dist/translations/bn.js +1 -1
- package/dist/translations/bn.umd.js +1 -1
- package/dist/translations/ca.js +1 -1
- package/dist/translations/ca.umd.js +1 -1
- package/dist/translations/cs.js +1 -1
- package/dist/translations/cs.umd.js +1 -1
- package/dist/translations/da.js +1 -1
- package/dist/translations/da.umd.js +1 -1
- package/dist/translations/de.js +1 -1
- package/dist/translations/de.umd.js +1 -1
- package/dist/translations/el.js +1 -1
- package/dist/translations/el.umd.js +1 -1
- package/dist/translations/es.js +1 -1
- package/dist/translations/es.umd.js +1 -1
- package/dist/translations/et.js +1 -1
- package/dist/translations/et.umd.js +1 -1
- package/dist/translations/fi.js +1 -1
- package/dist/translations/fi.umd.js +1 -1
- package/dist/translations/fr.js +1 -1
- package/dist/translations/fr.umd.js +1 -1
- package/dist/translations/he.js +1 -1
- package/dist/translations/he.umd.js +1 -1
- package/dist/translations/hi.js +1 -1
- package/dist/translations/hi.umd.js +1 -1
- package/dist/translations/hu.js +1 -1
- package/dist/translations/hu.umd.js +1 -1
- package/dist/translations/id.js +1 -1
- package/dist/translations/id.umd.js +1 -1
- package/dist/translations/it.js +1 -1
- package/dist/translations/it.umd.js +1 -1
- package/dist/translations/ja.js +1 -1
- package/dist/translations/ja.umd.js +1 -1
- package/dist/translations/ko.js +1 -1
- package/dist/translations/ko.umd.js +1 -1
- package/dist/translations/lt.js +1 -1
- package/dist/translations/lt.umd.js +1 -1
- package/dist/translations/lv.js +1 -1
- package/dist/translations/lv.umd.js +1 -1
- package/dist/translations/ms.js +1 -1
- package/dist/translations/ms.umd.js +1 -1
- package/dist/translations/nl.js +1 -1
- package/dist/translations/nl.umd.js +1 -1
- package/dist/translations/no.js +1 -1
- package/dist/translations/no.umd.js +1 -1
- package/dist/translations/pl.js +1 -1
- package/dist/translations/pl.umd.js +1 -1
- package/dist/translations/pt-br.js +1 -1
- package/dist/translations/pt-br.umd.js +1 -1
- package/dist/translations/pt.js +1 -1
- package/dist/translations/pt.umd.js +1 -1
- package/dist/translations/ro.js +1 -1
- package/dist/translations/ro.umd.js +1 -1
- package/dist/translations/ru.js +1 -1
- package/dist/translations/ru.umd.js +1 -1
- package/dist/translations/sk.js +1 -1
- package/dist/translations/sk.umd.js +1 -1
- package/dist/translations/sr.js +1 -1
- package/dist/translations/sr.umd.js +1 -1
- package/dist/translations/sv.js +1 -1
- package/dist/translations/sv.umd.js +1 -1
- package/dist/translations/th.js +1 -1
- package/dist/translations/th.umd.js +1 -1
- package/dist/translations/tr.js +1 -1
- package/dist/translations/tr.umd.js +1 -1
- package/dist/translations/uk.js +1 -1
- package/dist/translations/uk.umd.js +1 -1
- package/dist/translations/vi.js +1 -1
- package/dist/translations/vi.umd.js +1 -1
- package/dist/translations/zh-cn.js +1 -1
- package/dist/translations/zh-cn.umd.js +1 -1
- package/dist/translations/zh.js +1 -1
- package/dist/translations/zh.umd.js +1 -1
- package/lang/translations/ar.po +7 -7
- package/lang/translations/bg.po +7 -7
- package/lang/translations/bn.po +7 -7
- package/lang/translations/ca.po +7 -7
- package/lang/translations/cs.po +7 -7
- package/lang/translations/da.po +7 -7
- package/lang/translations/de.po +7 -7
- package/lang/translations/el.po +7 -7
- package/lang/translations/es.po +7 -7
- package/lang/translations/et.po +7 -7
- package/lang/translations/fi.po +7 -7
- package/lang/translations/fr.po +7 -7
- package/lang/translations/he.po +7 -7
- package/lang/translations/hi.po +7 -7
- package/lang/translations/hu.po +7 -7
- package/lang/translations/id.po +7 -7
- package/lang/translations/it.po +7 -7
- package/lang/translations/ja.po +7 -7
- package/lang/translations/ko.po +7 -7
- package/lang/translations/lt.po +7 -7
- package/lang/translations/lv.po +7 -7
- package/lang/translations/ms.po +7 -7
- package/lang/translations/nl.po +7 -7
- package/lang/translations/no.po +7 -7
- package/lang/translations/pl.po +7 -7
- package/lang/translations/pt-br.po +7 -7
- package/lang/translations/pt.po +7 -7
- package/lang/translations/ro.po +7 -7
- package/lang/translations/ru.po +7 -7
- package/lang/translations/sk.po +7 -7
- package/lang/translations/sr.po +7 -7
- package/lang/translations/sv.po +7 -7
- package/lang/translations/th.po +7 -7
- package/lang/translations/tr.po +7 -7
- package/lang/translations/uk.po +7 -7
- package/lang/translations/vi.po +7 -7
- package/lang/translations/zh-cn.po +7 -7
- package/lang/translations/zh.po +7 -7
- package/package.json +9 -9
- package/src/converters/tableproperties.d.ts +5 -1
- package/src/converters/tableproperties.js +12 -10
- package/src/tablecellproperties/tablecellpropertiesediting.js +5 -42
- package/src/tablecolumnresize/tablecolumnresizeediting.d.ts +28 -0
- package/src/tablecolumnresize/tablecolumnresizeediting.js +81 -2
- package/src/tablelayout.d.ts +1 -1
- package/src/tablelayout.js +1 -1
- package/src/tableproperties/tablepropertiesediting.js +21 -18
- package/theme/tablecolumnresize.css +0 -10
- package/theme/tablelayout.css +13 -1
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
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
|
-
import { first, global, CKEditorError, KeystrokeHandler, FocusTracker, Collection, getLocalizedArrowKeyCodeDirection, Rect, DomEmitterMixin } from '@ckeditor/ckeditor5-utils/dist/index.js';
|
|
7
|
+
import { first, global, CKEditorError, KeystrokeHandler, FocusTracker, Collection, getLocalizedArrowKeyCodeDirection, Rect, DomEmitterMixin, toUnit } from '@ckeditor/ckeditor5-utils/dist/index.js';
|
|
8
8
|
import { IconTable, IconTableColumn, IconTableRow, IconTableMergeCell, IconCheck, IconCancel, IconAlignBottom, IconAlignMiddle, IconAlignTop, IconAlignJustify, IconAlignRight, IconAlignCenter, IconAlignLeft, IconTableCellProperties, IconTableLayout, IconTableProperties, IconObjectInlineRight, IconObjectCenter, IconObjectInlineLeft, IconCaption } from '@ckeditor/ckeditor5-icons/dist/index.js';
|
|
9
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, DropdownButtonView } from '@ckeditor/ckeditor5-ui/dist/index.js';
|
|
10
10
|
import { ClipboardMarkersUtils, ClipboardPipeline } from '@ckeditor/ckeditor5-clipboard/dist/index.js';
|
|
@@ -34,19 +34,7 @@ import { isObject, debounce, isEqual, throttle } from 'es-toolkit/compat';
|
|
|
34
34
|
if (!shouldUpcast(viewElement)) {
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
// Adjust default for layout tables.
|
|
39
|
-
if (data.modelRange) {
|
|
40
|
-
const modelElement = first(data.modelRange.getItems({
|
|
41
|
-
shallow: true
|
|
42
|
-
}));
|
|
43
|
-
const tableElement = modelElement && modelElement.is('element') && modelElement.findAncestor('table', {
|
|
44
|
-
includeSelf: true
|
|
45
|
-
});
|
|
46
|
-
if (tableElement && tableElement.getAttribute('tableType') == 'layout') {
|
|
47
|
-
localDefaultValue = '';
|
|
48
|
-
}
|
|
49
|
-
}
|
|
37
|
+
const localDefaultValue = getDefaultValueAdjusted(defaultValue, '', data);
|
|
50
38
|
const normalized = viewElement.getNormalizedStyle(styleName);
|
|
51
39
|
const value = reduceBoxSides ? reduceBoxSidesValue(normalized) : normalized;
|
|
52
40
|
if (localDefaultValue !== value) {
|
|
@@ -171,6 +159,20 @@ import { isObject, debounce, isEqual, throttle } from 'es-toolkit/compat';
|
|
|
171
159
|
}
|
|
172
160
|
}));
|
|
173
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* Returns the default value for table or table cell property adjusted for layout tables.
|
|
164
|
+
*/ function getDefaultValueAdjusted(defaultValue, layoutTableDefault, data) {
|
|
165
|
+
const modelElement = data.modelRange && first(data.modelRange.getItems({
|
|
166
|
+
shallow: true
|
|
167
|
+
}));
|
|
168
|
+
const tableElement = modelElement && modelElement.is('element') && modelElement.findAncestor('table', {
|
|
169
|
+
includeSelf: true
|
|
170
|
+
});
|
|
171
|
+
if (tableElement && tableElement.getAttribute('tableType') === 'layout') {
|
|
172
|
+
return layoutTableDefault;
|
|
173
|
+
}
|
|
174
|
+
return defaultValue;
|
|
175
|
+
}
|
|
174
176
|
/**
|
|
175
177
|
* Reduces the full top, right, bottom, left object to a single string if all sides are equal.
|
|
176
178
|
* Returns original style otherwise.
|
|
@@ -9081,19 +9083,7 @@ const ALIGN_VALUES_REG_EXP$1 = /^(left|center|right|justify)$/;
|
|
|
9081
9083
|
model: {
|
|
9082
9084
|
key: 'tableCellHorizontalAlignment',
|
|
9083
9085
|
value: (viewElement, conversionApi, data)=>{
|
|
9084
|
-
|
|
9085
|
-
// Adjust default for layout tables.
|
|
9086
|
-
if (data.modelRange) {
|
|
9087
|
-
const modelElement = first(data.modelRange.getItems({
|
|
9088
|
-
shallow: true
|
|
9089
|
-
}));
|
|
9090
|
-
const tableElement = modelElement && modelElement.is('element') && modelElement.findAncestor('table', {
|
|
9091
|
-
includeSelf: true
|
|
9092
|
-
});
|
|
9093
|
-
if (tableElement && tableElement.getAttribute('tableType') == 'layout') {
|
|
9094
|
-
localDefaultValue = 'left';
|
|
9095
|
-
}
|
|
9096
|
-
}
|
|
9086
|
+
const localDefaultValue = getDefaultValueAdjusted(defaultValue, 'left', data);
|
|
9097
9087
|
const align = viewElement.getStyle('text-align');
|
|
9098
9088
|
return align === localDefaultValue ? null : align;
|
|
9099
9089
|
}
|
|
@@ -9109,19 +9099,7 @@ const ALIGN_VALUES_REG_EXP$1 = /^(left|center|right|justify)$/;
|
|
|
9109
9099
|
model: {
|
|
9110
9100
|
key: 'tableCellHorizontalAlignment',
|
|
9111
9101
|
value: (viewElement, conversionApi, data)=>{
|
|
9112
|
-
|
|
9113
|
-
// Adjust default for layout tables.
|
|
9114
|
-
if (data.modelRange) {
|
|
9115
|
-
const modelElement = first(data.modelRange.getItems({
|
|
9116
|
-
shallow: true
|
|
9117
|
-
}));
|
|
9118
|
-
const tableElement = modelElement && modelElement.is('element') && modelElement.findAncestor('table', {
|
|
9119
|
-
includeSelf: true
|
|
9120
|
-
});
|
|
9121
|
-
if (tableElement && tableElement.getAttribute('tableType') == 'layout') {
|
|
9122
|
-
localDefaultValue = 'left';
|
|
9123
|
-
}
|
|
9124
|
-
}
|
|
9102
|
+
const localDefaultValue = getDefaultValueAdjusted(defaultValue, 'left', data);
|
|
9125
9103
|
const align = viewElement.getAttribute('align');
|
|
9126
9104
|
return align === localDefaultValue ? null : align;
|
|
9127
9105
|
}
|
|
@@ -9161,19 +9139,7 @@ const ALIGN_VALUES_REG_EXP$1 = /^(left|center|right|justify)$/;
|
|
|
9161
9139
|
model: {
|
|
9162
9140
|
key: 'tableCellVerticalAlignment',
|
|
9163
9141
|
value: (viewElement, conversionApi, data)=>{
|
|
9164
|
-
|
|
9165
|
-
// Adjust default for layout tables.
|
|
9166
|
-
if (data.modelRange) {
|
|
9167
|
-
const modelElement = first(data.modelRange.getItems({
|
|
9168
|
-
shallow: true
|
|
9169
|
-
}));
|
|
9170
|
-
const tableElement = modelElement && modelElement.is('element') && modelElement.findAncestor('table', {
|
|
9171
|
-
includeSelf: true
|
|
9172
|
-
});
|
|
9173
|
-
if (tableElement && tableElement.getAttribute('tableType') == 'layout') {
|
|
9174
|
-
localDefaultValue = 'middle';
|
|
9175
|
-
}
|
|
9176
|
-
}
|
|
9142
|
+
const localDefaultValue = getDefaultValueAdjusted(defaultValue, 'middle', data);
|
|
9177
9143
|
const align = viewElement.getStyle('vertical-align');
|
|
9178
9144
|
return align === localDefaultValue ? null : align;
|
|
9179
9145
|
}
|
|
@@ -9189,19 +9155,7 @@ const ALIGN_VALUES_REG_EXP$1 = /^(left|center|right|justify)$/;
|
|
|
9189
9155
|
model: {
|
|
9190
9156
|
key: 'tableCellVerticalAlignment',
|
|
9191
9157
|
value: (viewElement, conversionApi, data)=>{
|
|
9192
|
-
|
|
9193
|
-
// Adjust default for layout tables.
|
|
9194
|
-
if (data.modelRange) {
|
|
9195
|
-
const modelElement = first(data.modelRange.getItems({
|
|
9196
|
-
shallow: true
|
|
9197
|
-
}));
|
|
9198
|
-
const tableElement = modelElement && modelElement.is('element') && modelElement.findAncestor('table', {
|
|
9199
|
-
includeSelf: true
|
|
9200
|
-
});
|
|
9201
|
-
if (tableElement && tableElement.getAttribute('tableType') == 'layout') {
|
|
9202
|
-
localDefaultValue = 'middle';
|
|
9203
|
-
}
|
|
9204
|
-
}
|
|
9158
|
+
const localDefaultValue = getDefaultValueAdjusted(defaultValue, 'middle', data);
|
|
9205
9159
|
const valign = viewElement.getAttribute('valign');
|
|
9206
9160
|
return valign === localDefaultValue ? null : valign;
|
|
9207
9161
|
}
|
|
@@ -9566,6 +9520,7 @@ const ALIGN_VALUES_REG_EXP$1 = /^(left|center|right|justify)$/;
|
|
|
9566
9520
|
});
|
|
9567
9521
|
}
|
|
9568
9522
|
|
|
9523
|
+
const toPx = /* #__PURE__ */ toUnit('px');
|
|
9569
9524
|
/**
|
|
9570
9525
|
* The table column resize editing plugin.
|
|
9571
9526
|
*/ class TableColumnResizeEditing extends Plugin {
|
|
@@ -9869,12 +9824,88 @@ const ALIGN_VALUES_REG_EXP$1 = /^(left|center|right|justify)$/;
|
|
|
9869
9824
|
*/ _registerResizingListeners() {
|
|
9870
9825
|
const editingView = this.editor.editing.view;
|
|
9871
9826
|
editingView.addObserver(MouseEventsObserver);
|
|
9827
|
+
editingView.document.on('mouseover', this._onMouseOverHandler.bind(this), {
|
|
9828
|
+
priority: 'high'
|
|
9829
|
+
});
|
|
9872
9830
|
editingView.document.on('mousedown', this._onMouseDownHandler.bind(this), {
|
|
9873
9831
|
priority: 'high'
|
|
9874
9832
|
});
|
|
9833
|
+
editingView.document.on('mouseout', this._onMouseOutHandler.bind(this), {
|
|
9834
|
+
priority: 'high'
|
|
9835
|
+
});
|
|
9875
9836
|
this._domEmitter.listenTo(global.window.document, 'mousemove', throttle(this._onMouseMoveHandler.bind(this), 50));
|
|
9876
9837
|
this._domEmitter.listenTo(global.window.document, 'mouseup', this._onMouseUpHandler.bind(this));
|
|
9877
9838
|
}
|
|
9839
|
+
/**
|
|
9840
|
+
* Calculate and set `top` and `bottom` styles to the column resizer element to fit the height of the table.
|
|
9841
|
+
*
|
|
9842
|
+
* @param viewResizer The column resizer element.
|
|
9843
|
+
*/ _recalculateResizerElement(viewResizer) {
|
|
9844
|
+
const editor = this.editor;
|
|
9845
|
+
const domConverter = editor.editing.view.domConverter;
|
|
9846
|
+
// Get DOM target figure ancestor element.
|
|
9847
|
+
const domTable = domConverter.mapViewToDom(viewResizer.findAncestor('table'));
|
|
9848
|
+
// Get DOM table cell element.
|
|
9849
|
+
const domCell = domConverter.mapViewToDom(viewResizer.findAncestor((item)=>[
|
|
9850
|
+
'td',
|
|
9851
|
+
'th'
|
|
9852
|
+
].includes(item.name)));
|
|
9853
|
+
const rectTable = new Rect(domTable);
|
|
9854
|
+
const rectCell = new Rect(domCell);
|
|
9855
|
+
// Calculate the top, and bottom positions of the column resizer element.
|
|
9856
|
+
const targetTopPosition = toPx(Number((rectTable.top - rectCell.top).toFixed(4)));
|
|
9857
|
+
const targetBottomPosition = toPx(Number((rectCell.bottom - rectTable.bottom).toFixed(4)));
|
|
9858
|
+
// Set `top` and `bottom` styles to the column resizer element.
|
|
9859
|
+
editor.editing.view.change((viewWriter)=>{
|
|
9860
|
+
viewWriter.setStyle('top', targetTopPosition, viewResizer);
|
|
9861
|
+
viewWriter.setStyle('bottom', targetBottomPosition, viewResizer);
|
|
9862
|
+
});
|
|
9863
|
+
}
|
|
9864
|
+
/**
|
|
9865
|
+
* Remove `top` and `bottom` styles of the column resizer element.
|
|
9866
|
+
*
|
|
9867
|
+
* @param viewResizer The column resizer element.
|
|
9868
|
+
*/ _resetResizerStyles(viewResizer) {
|
|
9869
|
+
this.editor.editing.view.change((viewWriter)=>{
|
|
9870
|
+
viewWriter.removeStyle('top', viewResizer);
|
|
9871
|
+
viewWriter.removeStyle('bottom', viewResizer);
|
|
9872
|
+
});
|
|
9873
|
+
}
|
|
9874
|
+
/**
|
|
9875
|
+
* Handles the `mouseover` event on column resizer element.
|
|
9876
|
+
* Recalculates the `top` and `bottom` styles of the column resizer element to fit the height of the table.
|
|
9877
|
+
*
|
|
9878
|
+
* @param eventInfo An object containing information about the fired event.
|
|
9879
|
+
* @param domEventData The data related to the DOM event.
|
|
9880
|
+
*/ _onMouseOverHandler(eventInfo, domEventData) {
|
|
9881
|
+
const target = domEventData.target;
|
|
9882
|
+
if (!target.hasClass('ck-table-column-resizer')) {
|
|
9883
|
+
return;
|
|
9884
|
+
}
|
|
9885
|
+
if (!this._isResizingAllowed) {
|
|
9886
|
+
return;
|
|
9887
|
+
}
|
|
9888
|
+
this._recalculateResizerElement(target);
|
|
9889
|
+
}
|
|
9890
|
+
/**
|
|
9891
|
+
* Handles the `mouseout` event on column resizer element.
|
|
9892
|
+
* When resizing is not active, it resets the `top` and `bottom` styles of the column resizer element.
|
|
9893
|
+
*
|
|
9894
|
+
* @param eventInfo An object containing information about the fired event.
|
|
9895
|
+
* @param domEventData The data related to the DOM event.
|
|
9896
|
+
*/ _onMouseOutHandler(eventInfo, domEventData) {
|
|
9897
|
+
const target = domEventData.target;
|
|
9898
|
+
if (!target.hasClass('ck-table-column-resizer')) {
|
|
9899
|
+
return;
|
|
9900
|
+
}
|
|
9901
|
+
if (!this._isResizingAllowed) {
|
|
9902
|
+
return;
|
|
9903
|
+
}
|
|
9904
|
+
if (this._isResizingActive) {
|
|
9905
|
+
return;
|
|
9906
|
+
}
|
|
9907
|
+
this._resetResizerStyles(target);
|
|
9908
|
+
}
|
|
9878
9909
|
/**
|
|
9879
9910
|
* Handles the `mousedown` event on column resizer element:
|
|
9880
9911
|
* * calculates the initial column pixel widths,
|
|
@@ -9999,7 +10030,7 @@ const ALIGN_VALUES_REG_EXP$1 = /^(left|center|right|justify)$/;
|
|
|
9999
10030
|
this._onMouseUpHandler();
|
|
10000
10031
|
return;
|
|
10001
10032
|
}
|
|
10002
|
-
const { columnPosition, flags: { isRightEdge, isTableCentered, isLtrContent }, elements: { viewFigure, viewLeftColumn, viewRightColumn }, widths: { viewFigureParentWidth, tableWidth, leftColumnWidth, rightColumnWidth } } = this._resizingData;
|
|
10033
|
+
const { columnPosition, flags: { isRightEdge, isTableCentered, isLtrContent }, elements: { viewFigure, viewLeftColumn, viewRightColumn, viewResizer }, widths: { viewFigureParentWidth, tableWidth, leftColumnWidth, rightColumnWidth } } = this._resizingData;
|
|
10003
10034
|
const dxLowerBound = -leftColumnWidth + COLUMN_MIN_WIDTH_IN_PIXELS;
|
|
10004
10035
|
const dxUpperBound = isRightEdge ? viewFigureParentWidth - tableWidth : rightColumnWidth - COLUMN_MIN_WIDTH_IN_PIXELS;
|
|
10005
10036
|
// The multiplier is needed for calculating the proper movement offset:
|
|
@@ -10021,6 +10052,7 @@ const ALIGN_VALUES_REG_EXP$1 = /^(left|center|right|justify)$/;
|
|
|
10021
10052
|
writer.setStyle('width', `${rightColumnWidthAsPercentage}%`, viewRightColumn);
|
|
10022
10053
|
}
|
|
10023
10054
|
});
|
|
10055
|
+
this._recalculateResizerElement(viewResizer);
|
|
10024
10056
|
}
|
|
10025
10057
|
/**
|
|
10026
10058
|
* Handles the `mouseup` event.
|
|
@@ -10085,6 +10117,10 @@ const ALIGN_VALUES_REG_EXP$1 = /^(left|center|right|justify)$/;
|
|
|
10085
10117
|
editingView.change((writer)=>{
|
|
10086
10118
|
writer.removeClass('ck-table-column-resizer__active', viewResizer);
|
|
10087
10119
|
});
|
|
10120
|
+
const element = editingView.domConverter.mapViewToDom(viewResizer);
|
|
10121
|
+
if (!element.matches(':hover')) {
|
|
10122
|
+
this._resetResizerStyles(viewResizer);
|
|
10123
|
+
}
|
|
10088
10124
|
this._isResizingActive = false;
|
|
10089
10125
|
this._resizingData = null;
|
|
10090
10126
|
}
|
|
@@ -10535,7 +10571,7 @@ const TABLE_TYPES = [
|
|
|
10535
10571
|
/**
|
|
10536
10572
|
* The table plugin.
|
|
10537
10573
|
*
|
|
10538
|
-
* For a detailed overview, check the {@glink features/tables/tables
|
|
10574
|
+
* For a detailed overview, check the {@glink features/tables/layout-tables Layout table feature documentation}.
|
|
10539
10575
|
*/ class TableLayout extends Plugin {
|
|
10540
10576
|
/**
|
|
10541
10577
|
* @inheritDoc
|
|
@@ -11073,16 +11109,7 @@ const FLOAT_VALUES_REG_EXP = /^(left|none|right)$/;
|
|
|
11073
11109
|
model: {
|
|
11074
11110
|
key: 'tableAlignment',
|
|
11075
11111
|
value: (viewElement, conversionApi, data)=>{
|
|
11076
|
-
|
|
11077
|
-
// Adjust default for layout tables.
|
|
11078
|
-
if (data.modelRange) {
|
|
11079
|
-
const modelElement = first(data.modelRange.getItems({
|
|
11080
|
-
shallow: true
|
|
11081
|
-
}));
|
|
11082
|
-
if (modelElement && modelElement.is('element') && modelElement.getAttribute('tableType') == 'layout') {
|
|
11083
|
-
localDefaultValue = '';
|
|
11084
|
-
}
|
|
11085
|
-
}
|
|
11112
|
+
const localDefaultValue = getDefaultValueAdjusted(defaultValue, '', data);
|
|
11086
11113
|
let align = viewElement.getStyle('float');
|
|
11087
11114
|
// CSS: `float:none` => Model: `alignment:center`.
|
|
11088
11115
|
if (align === 'none') {
|
|
@@ -11091,6 +11118,23 @@ const FLOAT_VALUES_REG_EXP = /^(left|none|right)$/;
|
|
|
11091
11118
|
return align === localDefaultValue ? null : align;
|
|
11092
11119
|
}
|
|
11093
11120
|
}
|
|
11121
|
+
})// Support for the `margin-left:auto; margin-right:auto;` CSS definition for the table alignment.
|
|
11122
|
+
.attributeToAttribute({
|
|
11123
|
+
view: {
|
|
11124
|
+
name: /^(table|figure)$/,
|
|
11125
|
+
styles: {
|
|
11126
|
+
'margin-left': 'auto',
|
|
11127
|
+
'margin-right': 'auto'
|
|
11128
|
+
}
|
|
11129
|
+
},
|
|
11130
|
+
model: {
|
|
11131
|
+
key: 'tableAlignment',
|
|
11132
|
+
value: (viewElement, conversionApi, data)=>{
|
|
11133
|
+
const localDefaultValue = getDefaultValueAdjusted(defaultValue, '', data);
|
|
11134
|
+
const align = 'center';
|
|
11135
|
+
return align === localDefaultValue ? null : align;
|
|
11136
|
+
}
|
|
11137
|
+
}
|
|
11094
11138
|
})// Support for the `align` attribute as the backward compatibility while pasting from other sources.
|
|
11095
11139
|
.attributeToAttribute({
|
|
11096
11140
|
view: {
|
|
@@ -11102,16 +11146,7 @@ const FLOAT_VALUES_REG_EXP = /^(left|none|right)$/;
|
|
|
11102
11146
|
name: 'table',
|
|
11103
11147
|
key: 'tableAlignment',
|
|
11104
11148
|
value: (viewElement, conversionApi, data)=>{
|
|
11105
|
-
|
|
11106
|
-
// Adjust default for layout tables.
|
|
11107
|
-
if (data.modelRange) {
|
|
11108
|
-
const modelElement = first(data.modelRange.getItems({
|
|
11109
|
-
shallow: true
|
|
11110
|
-
}));
|
|
11111
|
-
if (modelElement && modelElement.is('element') && modelElement.getAttribute('tableType') == 'layout') {
|
|
11112
|
-
localDefaultValue = '';
|
|
11113
|
-
}
|
|
11114
|
-
}
|
|
11149
|
+
const localDefaultValue = getDefaultValueAdjusted(defaultValue, '', data);
|
|
11115
11150
|
const align = viewElement.getAttribute('align');
|
|
11116
11151
|
return align === localDefaultValue ? null : align;
|
|
11117
11152
|
}
|