@ckeditor/ckeditor5-table 45.0.0-alpha.1 → 45.0.0-alpha.10
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/lang/translations/tr.po
CHANGED
|
@@ -269,28 +269,28 @@ msgstr "Tablo"
|
|
|
269
269
|
|
|
270
270
|
msgctxt "Label for the insert table layout toolbar button."
|
|
271
271
|
msgid "Insert table layout"
|
|
272
|
-
msgstr ""
|
|
272
|
+
msgstr "Tablo düzeni ekle"
|
|
273
273
|
|
|
274
274
|
msgctxt "The accessible label used in the table layout insert UI element."
|
|
275
275
|
msgid "Table layout"
|
|
276
|
-
msgstr ""
|
|
276
|
+
msgstr "Tablo düzeni"
|
|
277
277
|
|
|
278
278
|
msgctxt "The accessible label of the layout table type dropdown button."
|
|
279
279
|
msgid "Layout table"
|
|
280
|
-
msgstr ""
|
|
280
|
+
msgstr "Düzen tablosu"
|
|
281
281
|
|
|
282
282
|
msgctxt "The accessible label of the content table type dropdown button."
|
|
283
283
|
msgid "Content table"
|
|
284
|
-
msgstr ""
|
|
284
|
+
msgstr "İçerik tablosu"
|
|
285
285
|
|
|
286
286
|
msgctxt "The accessible label of the table balloon button that displays a user interface to choose table type."
|
|
287
287
|
msgid "Choose table type"
|
|
288
|
-
msgstr ""
|
|
288
|
+
msgstr "Tablo türünü seç"
|
|
289
289
|
|
|
290
290
|
msgctxt "The accessible label of the table type toolbar button."
|
|
291
291
|
msgid "Table type"
|
|
292
|
-
msgstr ""
|
|
292
|
+
msgstr "Tablo türü"
|
|
293
293
|
|
|
294
294
|
msgctxt "The accessible label of dropdown list that displays a user interface to choose table type."
|
|
295
295
|
msgid "Table type options"
|
|
296
|
-
msgstr ""
|
|
296
|
+
msgstr "Tablo türü seçenekleri"
|
package/lang/translations/uk.po
CHANGED
|
@@ -269,28 +269,28 @@ msgstr "Таблиця"
|
|
|
269
269
|
|
|
270
270
|
msgctxt "Label for the insert table layout toolbar button."
|
|
271
271
|
msgid "Insert table layout"
|
|
272
|
-
msgstr ""
|
|
272
|
+
msgstr "Вставити формат таблиці"
|
|
273
273
|
|
|
274
274
|
msgctxt "The accessible label used in the table layout insert UI element."
|
|
275
275
|
msgid "Table layout"
|
|
276
|
-
msgstr ""
|
|
276
|
+
msgstr "Формат таблиці"
|
|
277
277
|
|
|
278
278
|
msgctxt "The accessible label of the layout table type dropdown button."
|
|
279
279
|
msgid "Layout table"
|
|
280
|
-
msgstr ""
|
|
280
|
+
msgstr "Формат таблиці"
|
|
281
281
|
|
|
282
282
|
msgctxt "The accessible label of the content table type dropdown button."
|
|
283
283
|
msgid "Content table"
|
|
284
|
-
msgstr ""
|
|
284
|
+
msgstr "Вміст таблиці"
|
|
285
285
|
|
|
286
286
|
msgctxt "The accessible label of the table balloon button that displays a user interface to choose table type."
|
|
287
287
|
msgid "Choose table type"
|
|
288
|
-
msgstr ""
|
|
288
|
+
msgstr "Вибрати тип таблиці"
|
|
289
289
|
|
|
290
290
|
msgctxt "The accessible label of the table type toolbar button."
|
|
291
291
|
msgid "Table type"
|
|
292
|
-
msgstr ""
|
|
292
|
+
msgstr "Тип таблиці"
|
|
293
293
|
|
|
294
294
|
msgctxt "The accessible label of dropdown list that displays a user interface to choose table type."
|
|
295
295
|
msgid "Table type options"
|
|
296
|
-
msgstr ""
|
|
296
|
+
msgstr "Опції типу таблиці"
|
package/lang/translations/vi.po
CHANGED
|
@@ -269,28 +269,28 @@ msgstr "Bảng"
|
|
|
269
269
|
|
|
270
270
|
msgctxt "Label for the insert table layout toolbar button."
|
|
271
271
|
msgid "Insert table layout"
|
|
272
|
-
msgstr ""
|
|
272
|
+
msgstr "Chèn bố cục bảng"
|
|
273
273
|
|
|
274
274
|
msgctxt "The accessible label used in the table layout insert UI element."
|
|
275
275
|
msgid "Table layout"
|
|
276
|
-
msgstr ""
|
|
276
|
+
msgstr "Bố cục bảng"
|
|
277
277
|
|
|
278
278
|
msgctxt "The accessible label of the layout table type dropdown button."
|
|
279
279
|
msgid "Layout table"
|
|
280
|
-
msgstr ""
|
|
280
|
+
msgstr "Bảng bố cục"
|
|
281
281
|
|
|
282
282
|
msgctxt "The accessible label of the content table type dropdown button."
|
|
283
283
|
msgid "Content table"
|
|
284
|
-
msgstr ""
|
|
284
|
+
msgstr "Bảng nội dung"
|
|
285
285
|
|
|
286
286
|
msgctxt "The accessible label of the table balloon button that displays a user interface to choose table type."
|
|
287
287
|
msgid "Choose table type"
|
|
288
|
-
msgstr ""
|
|
288
|
+
msgstr "Chọn loại bảng"
|
|
289
289
|
|
|
290
290
|
msgctxt "The accessible label of the table type toolbar button."
|
|
291
291
|
msgid "Table type"
|
|
292
|
-
msgstr ""
|
|
292
|
+
msgstr "Loại bảng"
|
|
293
293
|
|
|
294
294
|
msgctxt "The accessible label of dropdown list that displays a user interface to choose table type."
|
|
295
295
|
msgid "Table type options"
|
|
296
|
-
msgstr ""
|
|
296
|
+
msgstr "Tùy chọn loại bảng"
|
|
@@ -269,28 +269,28 @@ msgstr "表格"
|
|
|
269
269
|
|
|
270
270
|
msgctxt "Label for the insert table layout toolbar button."
|
|
271
271
|
msgid "Insert table layout"
|
|
272
|
-
msgstr ""
|
|
272
|
+
msgstr "插入表格布局"
|
|
273
273
|
|
|
274
274
|
msgctxt "The accessible label used in the table layout insert UI element."
|
|
275
275
|
msgid "Table layout"
|
|
276
|
-
msgstr ""
|
|
276
|
+
msgstr "表格布局"
|
|
277
277
|
|
|
278
278
|
msgctxt "The accessible label of the layout table type dropdown button."
|
|
279
279
|
msgid "Layout table"
|
|
280
|
-
msgstr ""
|
|
280
|
+
msgstr "布局表格"
|
|
281
281
|
|
|
282
282
|
msgctxt "The accessible label of the content table type dropdown button."
|
|
283
283
|
msgid "Content table"
|
|
284
|
-
msgstr ""
|
|
284
|
+
msgstr "内容表格"
|
|
285
285
|
|
|
286
286
|
msgctxt "The accessible label of the table balloon button that displays a user interface to choose table type."
|
|
287
287
|
msgid "Choose table type"
|
|
288
|
-
msgstr ""
|
|
288
|
+
msgstr "选择表格类型"
|
|
289
289
|
|
|
290
290
|
msgctxt "The accessible label of the table type toolbar button."
|
|
291
291
|
msgid "Table type"
|
|
292
|
-
msgstr ""
|
|
292
|
+
msgstr "表格类型"
|
|
293
293
|
|
|
294
294
|
msgctxt "The accessible label of dropdown list that displays a user interface to choose table type."
|
|
295
295
|
msgid "Table type options"
|
|
296
|
-
msgstr ""
|
|
296
|
+
msgstr "表格类型选项"
|
package/lang/translations/zh.po
CHANGED
|
@@ -269,28 +269,28 @@ msgstr "表格"
|
|
|
269
269
|
|
|
270
270
|
msgctxt "Label for the insert table layout toolbar button."
|
|
271
271
|
msgid "Insert table layout"
|
|
272
|
-
msgstr ""
|
|
272
|
+
msgstr "插入表格版面配置"
|
|
273
273
|
|
|
274
274
|
msgctxt "The accessible label used in the table layout insert UI element."
|
|
275
275
|
msgid "Table layout"
|
|
276
|
-
msgstr ""
|
|
276
|
+
msgstr "表格版面配置"
|
|
277
277
|
|
|
278
278
|
msgctxt "The accessible label of the layout table type dropdown button."
|
|
279
279
|
msgid "Layout table"
|
|
280
|
-
msgstr ""
|
|
280
|
+
msgstr "版面配置表格"
|
|
281
281
|
|
|
282
282
|
msgctxt "The accessible label of the content table type dropdown button."
|
|
283
283
|
msgid "Content table"
|
|
284
|
-
msgstr ""
|
|
284
|
+
msgstr "內容表格"
|
|
285
285
|
|
|
286
286
|
msgctxt "The accessible label of the table balloon button that displays a user interface to choose table type."
|
|
287
287
|
msgid "Choose table type"
|
|
288
|
-
msgstr ""
|
|
288
|
+
msgstr "選擇表格類型"
|
|
289
289
|
|
|
290
290
|
msgctxt "The accessible label of the table type toolbar button."
|
|
291
291
|
msgid "Table type"
|
|
292
|
-
msgstr ""
|
|
292
|
+
msgstr "表格類型"
|
|
293
293
|
|
|
294
294
|
msgctxt "The accessible label of dropdown list that displays a user interface to choose table type."
|
|
295
295
|
msgid "Table type options"
|
|
296
|
-
msgstr ""
|
|
296
|
+
msgstr "表格類型選項"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-table",
|
|
3
|
-
"version": "45.0.0-alpha.
|
|
3
|
+
"version": "45.0.0-alpha.10",
|
|
4
4
|
"description": "Table feature for CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
"type": "module",
|
|
14
14
|
"main": "src/index.js",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"ckeditor5": "45.0.0-alpha.
|
|
17
|
-
"@ckeditor/ckeditor5-clipboard": "45.0.0-alpha.
|
|
18
|
-
"@ckeditor/ckeditor5-core": "45.0.0-alpha.
|
|
19
|
-
"@ckeditor/ckeditor5-engine": "45.0.0-alpha.
|
|
20
|
-
"@ckeditor/ckeditor5-icons": "45.0.0-alpha.
|
|
21
|
-
"@ckeditor/ckeditor5-ui": "45.0.0-alpha.
|
|
22
|
-
"@ckeditor/ckeditor5-utils": "45.0.0-alpha.
|
|
23
|
-
"@ckeditor/ckeditor5-widget": "45.0.0-alpha.
|
|
16
|
+
"ckeditor5": "45.0.0-alpha.10",
|
|
17
|
+
"@ckeditor/ckeditor5-clipboard": "45.0.0-alpha.10",
|
|
18
|
+
"@ckeditor/ckeditor5-core": "45.0.0-alpha.10",
|
|
19
|
+
"@ckeditor/ckeditor5-engine": "45.0.0-alpha.10",
|
|
20
|
+
"@ckeditor/ckeditor5-icons": "45.0.0-alpha.10",
|
|
21
|
+
"@ckeditor/ckeditor5-ui": "45.0.0-alpha.10",
|
|
22
|
+
"@ckeditor/ckeditor5-utils": "45.0.0-alpha.10",
|
|
23
|
+
"@ckeditor/ckeditor5-widget": "45.0.0-alpha.10",
|
|
24
24
|
"es-toolkit": "1.32.0"
|
|
25
25
|
},
|
|
26
26
|
"author": "CKSource (http://cksource.com/)",
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module table/converters/tableproperties
|
|
7
7
|
*/
|
|
8
|
-
import type { Conversion, ViewElement } from 'ckeditor5/src/engine.js';
|
|
8
|
+
import type { Conversion, UpcastConversionData, ViewElement } from 'ckeditor5/src/engine.js';
|
|
9
9
|
/**
|
|
10
10
|
* Conversion helper for upcasting attributes using normalized styles.
|
|
11
11
|
*
|
|
@@ -52,3 +52,7 @@ export declare function downcastTableAttribute(conversion: Conversion, options:
|
|
|
52
52
|
modelAttribute: string;
|
|
53
53
|
styleName: string;
|
|
54
54
|
}): void;
|
|
55
|
+
/**
|
|
56
|
+
* Returns the default value for table or table cell property adjusted for layout tables.
|
|
57
|
+
*/
|
|
58
|
+
export declare function getDefaultValueAdjusted(defaultValue: string, layoutTableDefault: string, data: UpcastConversionData<ViewElement>): string;
|
|
@@ -27,16 +27,7 @@ export function upcastStyleToAttribute(conversion, options) {
|
|
|
27
27
|
if (!shouldUpcast(viewElement)) {
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
// Adjust default for layout tables.
|
|
32
|
-
if (data.modelRange) {
|
|
33
|
-
const modelElement = first(data.modelRange.getItems({ shallow: true }));
|
|
34
|
-
const tableElement = modelElement && modelElement.is('element') &&
|
|
35
|
-
modelElement.findAncestor('table', { includeSelf: true });
|
|
36
|
-
if (tableElement && tableElement.getAttribute('tableType') == 'layout') {
|
|
37
|
-
localDefaultValue = '';
|
|
38
|
-
}
|
|
39
|
-
}
|
|
30
|
+
const localDefaultValue = getDefaultValueAdjusted(defaultValue, '', data);
|
|
40
31
|
const normalized = viewElement.getNormalizedStyle(styleName);
|
|
41
32
|
const value = reduceBoxSides ? reduceBoxSidesValue(normalized) : normalized;
|
|
42
33
|
if (localDefaultValue !== value) {
|
|
@@ -157,6 +148,17 @@ export function downcastTableAttribute(conversion, options) {
|
|
|
157
148
|
}
|
|
158
149
|
}));
|
|
159
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* Returns the default value for table or table cell property adjusted for layout tables.
|
|
153
|
+
*/
|
|
154
|
+
export function getDefaultValueAdjusted(defaultValue, layoutTableDefault, data) {
|
|
155
|
+
const modelElement = data.modelRange && first(data.modelRange.getItems({ shallow: true }));
|
|
156
|
+
const tableElement = modelElement && modelElement.is('element') && modelElement.findAncestor('table', { includeSelf: true });
|
|
157
|
+
if (tableElement && tableElement.getAttribute('tableType') === 'layout') {
|
|
158
|
+
return layoutTableDefault;
|
|
159
|
+
}
|
|
160
|
+
return defaultValue;
|
|
161
|
+
}
|
|
160
162
|
/**
|
|
161
163
|
* Reduces the full top, right, bottom, left object to a single string if all sides are equal.
|
|
162
164
|
* Returns original style otherwise.
|
|
@@ -6,9 +6,8 @@
|
|
|
6
6
|
* @module table/tablecellproperties/tablecellpropertiesediting
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import { first } from 'ckeditor5/src/utils.js';
|
|
10
9
|
import { addBorderRules, addPaddingRules, addBackgroundRules } from 'ckeditor5/src/engine.js';
|
|
11
|
-
import { downcastAttributeToStyle, upcastBorderStyles } from '../converters/tableproperties.js';
|
|
10
|
+
import { downcastAttributeToStyle, getDefaultValueAdjusted, upcastBorderStyles } from '../converters/tableproperties.js';
|
|
12
11
|
import TableEditing from './../tableediting.js';
|
|
13
12
|
import TableCellWidthEditing from '../tablecellwidth/tablecellwidthediting.js';
|
|
14
13
|
import TableCellPaddingCommand from './commands/tablecellpaddingcommand.js';
|
|
@@ -168,16 +167,7 @@ function enableHorizontalAlignmentProperty(schema, conversion, defaultValue) {
|
|
|
168
167
|
model: {
|
|
169
168
|
key: 'tableCellHorizontalAlignment',
|
|
170
169
|
value: (viewElement, conversionApi, data) => {
|
|
171
|
-
|
|
172
|
-
// Adjust default for layout tables.
|
|
173
|
-
if (data.modelRange) {
|
|
174
|
-
const modelElement = first(data.modelRange.getItems({ shallow: true }));
|
|
175
|
-
const tableElement = modelElement && modelElement.is('element') &&
|
|
176
|
-
modelElement.findAncestor('table', { includeSelf: true });
|
|
177
|
-
if (tableElement && tableElement.getAttribute('tableType') == 'layout') {
|
|
178
|
-
localDefaultValue = 'left';
|
|
179
|
-
}
|
|
180
|
-
}
|
|
170
|
+
const localDefaultValue = getDefaultValueAdjusted(defaultValue, 'left', data);
|
|
181
171
|
const align = viewElement.getStyle('text-align');
|
|
182
172
|
return align === localDefaultValue ? null : align;
|
|
183
173
|
}
|
|
@@ -194,16 +184,7 @@ function enableHorizontalAlignmentProperty(schema, conversion, defaultValue) {
|
|
|
194
184
|
model: {
|
|
195
185
|
key: 'tableCellHorizontalAlignment',
|
|
196
186
|
value: (viewElement, conversionApi, data) => {
|
|
197
|
-
|
|
198
|
-
// Adjust default for layout tables.
|
|
199
|
-
if (data.modelRange) {
|
|
200
|
-
const modelElement = first(data.modelRange.getItems({ shallow: true }));
|
|
201
|
-
const tableElement = modelElement && modelElement.is('element') &&
|
|
202
|
-
modelElement.findAncestor('table', { includeSelf: true });
|
|
203
|
-
if (tableElement && tableElement.getAttribute('tableType') == 'layout') {
|
|
204
|
-
localDefaultValue = 'left';
|
|
205
|
-
}
|
|
206
|
-
}
|
|
187
|
+
const localDefaultValue = getDefaultValueAdjusted(defaultValue, 'left', data);
|
|
207
188
|
const align = viewElement.getAttribute('align');
|
|
208
189
|
return align === localDefaultValue ? null : align;
|
|
209
190
|
}
|
|
@@ -244,16 +225,7 @@ function enableVerticalAlignmentProperty(schema, conversion, defaultValue) {
|
|
|
244
225
|
model: {
|
|
245
226
|
key: 'tableCellVerticalAlignment',
|
|
246
227
|
value: (viewElement, conversionApi, data) => {
|
|
247
|
-
|
|
248
|
-
// Adjust default for layout tables.
|
|
249
|
-
if (data.modelRange) {
|
|
250
|
-
const modelElement = first(data.modelRange.getItems({ shallow: true }));
|
|
251
|
-
const tableElement = modelElement && modelElement.is('element') &&
|
|
252
|
-
modelElement.findAncestor('table', { includeSelf: true });
|
|
253
|
-
if (tableElement && tableElement.getAttribute('tableType') == 'layout') {
|
|
254
|
-
localDefaultValue = 'middle';
|
|
255
|
-
}
|
|
256
|
-
}
|
|
228
|
+
const localDefaultValue = getDefaultValueAdjusted(defaultValue, 'middle', data);
|
|
257
229
|
const align = viewElement.getStyle('vertical-align');
|
|
258
230
|
return align === localDefaultValue ? null : align;
|
|
259
231
|
}
|
|
@@ -270,16 +242,7 @@ function enableVerticalAlignmentProperty(schema, conversion, defaultValue) {
|
|
|
270
242
|
model: {
|
|
271
243
|
key: 'tableCellVerticalAlignment',
|
|
272
244
|
value: (viewElement, conversionApi, data) => {
|
|
273
|
-
|
|
274
|
-
// Adjust default for layout tables.
|
|
275
|
-
if (data.modelRange) {
|
|
276
|
-
const modelElement = first(data.modelRange.getItems({ shallow: true }));
|
|
277
|
-
const tableElement = modelElement && modelElement.is('element') &&
|
|
278
|
-
modelElement.findAncestor('table', { includeSelf: true });
|
|
279
|
-
if (tableElement && tableElement.getAttribute('tableType') == 'layout') {
|
|
280
|
-
localDefaultValue = 'middle';
|
|
281
|
-
}
|
|
282
|
-
}
|
|
245
|
+
const localDefaultValue = getDefaultValueAdjusted(defaultValue, 'middle', data);
|
|
283
246
|
const valign = viewElement.getAttribute('valign');
|
|
284
247
|
return valign === localDefaultValue ? null : valign;
|
|
285
248
|
}
|
|
@@ -104,6 +104,34 @@ export default class TableColumnResizeEditing extends Plugin {
|
|
|
104
104
|
* Registers listeners to handle resizing process.
|
|
105
105
|
*/
|
|
106
106
|
private _registerResizingListeners;
|
|
107
|
+
/**
|
|
108
|
+
* Calculate and set `top` and `bottom` styles to the column resizer element to fit the height of the table.
|
|
109
|
+
*
|
|
110
|
+
* @param viewResizer The column resizer element.
|
|
111
|
+
*/
|
|
112
|
+
private _recalculateResizerElement;
|
|
113
|
+
/**
|
|
114
|
+
* Remove `top` and `bottom` styles of the column resizer element.
|
|
115
|
+
*
|
|
116
|
+
* @param viewResizer The column resizer element.
|
|
117
|
+
*/
|
|
118
|
+
private _resetResizerStyles;
|
|
119
|
+
/**
|
|
120
|
+
* Handles the `mouseover` event on column resizer element.
|
|
121
|
+
* Recalculates the `top` and `bottom` styles of the column resizer element to fit the height of the table.
|
|
122
|
+
*
|
|
123
|
+
* @param eventInfo An object containing information about the fired event.
|
|
124
|
+
* @param domEventData The data related to the DOM event.
|
|
125
|
+
*/
|
|
126
|
+
private _onMouseOverHandler;
|
|
127
|
+
/**
|
|
128
|
+
* Handles the `mouseout` event on column resizer element.
|
|
129
|
+
* When resizing is not active, it resets the `top` and `bottom` styles of the column resizer element.
|
|
130
|
+
*
|
|
131
|
+
* @param eventInfo An object containing information about the fired event.
|
|
132
|
+
* @param domEventData The data related to the DOM event.
|
|
133
|
+
*/
|
|
134
|
+
private _onMouseOutHandler;
|
|
107
135
|
/**
|
|
108
136
|
* Handles the `mousedown` event on column resizer element:
|
|
109
137
|
* * calculates the initial column pixel widths,
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @module table/tablecolumnresize/tablecolumnresizeediting
|
|
7
7
|
*/
|
|
8
8
|
import { throttle, isEqual } from 'es-toolkit/compat';
|
|
9
|
-
import { global, DomEmitterMixin } from 'ckeditor5/src/utils.js';
|
|
9
|
+
import { global, DomEmitterMixin, Rect, toUnit } from 'ckeditor5/src/utils.js';
|
|
10
10
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
11
11
|
import MouseEventsObserver from '../../src/tablemouse/mouseeventsobserver.js';
|
|
12
12
|
import TableEditing from '../tableediting.js';
|
|
@@ -16,6 +16,7 @@ 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
18
|
import { COLUMN_MIN_WIDTH_IN_PIXELS, COLUMN_RESIZE_DISTANCE_THRESHOLD } from './constants.js';
|
|
19
|
+
const toPx = /* #__PURE__ */ toUnit('px');
|
|
19
20
|
/**
|
|
20
21
|
* The table column resize editing plugin.
|
|
21
22
|
*/
|
|
@@ -326,10 +327,83 @@ export default class TableColumnResizeEditing extends Plugin {
|
|
|
326
327
|
_registerResizingListeners() {
|
|
327
328
|
const editingView = this.editor.editing.view;
|
|
328
329
|
editingView.addObserver(MouseEventsObserver);
|
|
330
|
+
editingView.document.on('mouseover', this._onMouseOverHandler.bind(this), { priority: 'high' });
|
|
329
331
|
editingView.document.on('mousedown', this._onMouseDownHandler.bind(this), { priority: 'high' });
|
|
332
|
+
editingView.document.on('mouseout', this._onMouseOutHandler.bind(this), { priority: 'high' });
|
|
330
333
|
this._domEmitter.listenTo(global.window.document, 'mousemove', throttle(this._onMouseMoveHandler.bind(this), 50));
|
|
331
334
|
this._domEmitter.listenTo(global.window.document, 'mouseup', this._onMouseUpHandler.bind(this));
|
|
332
335
|
}
|
|
336
|
+
/**
|
|
337
|
+
* Calculate and set `top` and `bottom` styles to the column resizer element to fit the height of the table.
|
|
338
|
+
*
|
|
339
|
+
* @param viewResizer The column resizer element.
|
|
340
|
+
*/
|
|
341
|
+
_recalculateResizerElement(viewResizer) {
|
|
342
|
+
const editor = this.editor;
|
|
343
|
+
const domConverter = editor.editing.view.domConverter;
|
|
344
|
+
// Get DOM target figure ancestor element.
|
|
345
|
+
const domTable = domConverter.mapViewToDom(viewResizer.findAncestor('table'));
|
|
346
|
+
// Get DOM table cell element.
|
|
347
|
+
const domCell = domConverter.mapViewToDom(viewResizer.findAncestor(item => ['td', 'th'].includes(item.name)));
|
|
348
|
+
const rectTable = new Rect(domTable);
|
|
349
|
+
const rectCell = new Rect(domCell);
|
|
350
|
+
// Calculate the top, and bottom positions of the column resizer element.
|
|
351
|
+
const targetTopPosition = toPx(Number((rectTable.top - rectCell.top).toFixed(4)));
|
|
352
|
+
const targetBottomPosition = toPx(Number((rectCell.bottom - rectTable.bottom).toFixed(4)));
|
|
353
|
+
// Set `top` and `bottom` styles to the column resizer element.
|
|
354
|
+
editor.editing.view.change(viewWriter => {
|
|
355
|
+
viewWriter.setStyle('top', targetTopPosition, viewResizer);
|
|
356
|
+
viewWriter.setStyle('bottom', targetBottomPosition, viewResizer);
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Remove `top` and `bottom` styles of the column resizer element.
|
|
361
|
+
*
|
|
362
|
+
* @param viewResizer The column resizer element.
|
|
363
|
+
*/
|
|
364
|
+
_resetResizerStyles(viewResizer) {
|
|
365
|
+
this.editor.editing.view.change(viewWriter => {
|
|
366
|
+
viewWriter.removeStyle('top', viewResizer);
|
|
367
|
+
viewWriter.removeStyle('bottom', viewResizer);
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Handles the `mouseover` event on column resizer element.
|
|
372
|
+
* Recalculates the `top` and `bottom` styles of the column resizer element to fit the height of the table.
|
|
373
|
+
*
|
|
374
|
+
* @param eventInfo An object containing information about the fired event.
|
|
375
|
+
* @param domEventData The data related to the DOM event.
|
|
376
|
+
*/
|
|
377
|
+
_onMouseOverHandler(eventInfo, domEventData) {
|
|
378
|
+
const target = domEventData.target;
|
|
379
|
+
if (!target.hasClass('ck-table-column-resizer')) {
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
if (!this._isResizingAllowed) {
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
this._recalculateResizerElement(target);
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Handles the `mouseout` event on column resizer element.
|
|
389
|
+
* When resizing is not active, it resets the `top` and `bottom` styles of the column resizer element.
|
|
390
|
+
*
|
|
391
|
+
* @param eventInfo An object containing information about the fired event.
|
|
392
|
+
* @param domEventData The data related to the DOM event.
|
|
393
|
+
*/
|
|
394
|
+
_onMouseOutHandler(eventInfo, domEventData) {
|
|
395
|
+
const target = domEventData.target;
|
|
396
|
+
if (!target.hasClass('ck-table-column-resizer')) {
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
if (!this._isResizingAllowed) {
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
if (this._isResizingActive) {
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
this._resetResizerStyles(target);
|
|
406
|
+
}
|
|
333
407
|
/**
|
|
334
408
|
* Handles the `mousedown` event on column resizer element:
|
|
335
409
|
* * calculates the initial column pixel widths,
|
|
@@ -461,7 +535,7 @@ export default class TableColumnResizeEditing extends Plugin {
|
|
|
461
535
|
this._onMouseUpHandler();
|
|
462
536
|
return;
|
|
463
537
|
}
|
|
464
|
-
const { columnPosition, flags: { isRightEdge, isTableCentered, isLtrContent }, elements: { viewFigure, viewLeftColumn, viewRightColumn }, widths: { viewFigureParentWidth, tableWidth, leftColumnWidth, rightColumnWidth } } = this._resizingData;
|
|
538
|
+
const { columnPosition, flags: { isRightEdge, isTableCentered, isLtrContent }, elements: { viewFigure, viewLeftColumn, viewRightColumn, viewResizer }, widths: { viewFigureParentWidth, tableWidth, leftColumnWidth, rightColumnWidth } } = this._resizingData;
|
|
465
539
|
const dxLowerBound = -leftColumnWidth + COLUMN_MIN_WIDTH_IN_PIXELS;
|
|
466
540
|
const dxUpperBound = isRightEdge ?
|
|
467
541
|
viewFigureParentWidth - tableWidth :
|
|
@@ -486,6 +560,7 @@ export default class TableColumnResizeEditing extends Plugin {
|
|
|
486
560
|
writer.setStyle('width', `${rightColumnWidthAsPercentage}%`, viewRightColumn);
|
|
487
561
|
}
|
|
488
562
|
});
|
|
563
|
+
this._recalculateResizerElement(viewResizer);
|
|
489
564
|
}
|
|
490
565
|
/**
|
|
491
566
|
* Handles the `mouseup` event.
|
|
@@ -556,6 +631,10 @@ export default class TableColumnResizeEditing extends Plugin {
|
|
|
556
631
|
editingView.change(writer => {
|
|
557
632
|
writer.removeClass('ck-table-column-resizer__active', viewResizer);
|
|
558
633
|
});
|
|
634
|
+
const element = editingView.domConverter.mapViewToDom(viewResizer);
|
|
635
|
+
if (!element.matches(':hover')) {
|
|
636
|
+
this._resetResizerStyles(viewResizer);
|
|
637
|
+
}
|
|
559
638
|
this._isResizingActive = false;
|
|
560
639
|
this._resizingData = null;
|
|
561
640
|
}
|
package/src/tablelayout.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ import TableColumnResize from './tablecolumnresize.js';
|
|
|
13
13
|
/**
|
|
14
14
|
* The table plugin.
|
|
15
15
|
*
|
|
16
|
-
* For a detailed overview, check the {@glink features/tables/tables
|
|
16
|
+
* For a detailed overview, check the {@glink features/tables/layout-tables Layout table feature documentation}.
|
|
17
17
|
*/
|
|
18
18
|
export default class TableLayout extends Plugin {
|
|
19
19
|
/**
|
package/src/tablelayout.js
CHANGED
|
@@ -13,7 +13,7 @@ import TableColumnResize from './tablecolumnresize.js';
|
|
|
13
13
|
/**
|
|
14
14
|
* The table plugin.
|
|
15
15
|
*
|
|
16
|
-
* For a detailed overview, check the {@glink features/tables/tables
|
|
16
|
+
* For a detailed overview, check the {@glink features/tables/layout-tables Layout table feature documentation}.
|
|
17
17
|
*/
|
|
18
18
|
export default class TableLayout extends Plugin {
|
|
19
19
|
/**
|
|
@@ -6,10 +6,9 @@
|
|
|
6
6
|
* @module table/tableproperties/tablepropertiesediting
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import { first } from 'ckeditor5/src/utils.js';
|
|
10
9
|
import { addBackgroundRules, addBorderRules } from 'ckeditor5/src/engine.js';
|
|
11
10
|
import TableEditing from '../tableediting.js';
|
|
12
|
-
import { downcastAttributeToStyle, downcastTableAttribute, upcastBorderStyles, upcastStyleToAttribute } from '../converters/tableproperties.js';
|
|
11
|
+
import { downcastAttributeToStyle, downcastTableAttribute, getDefaultValueAdjusted, upcastBorderStyles, upcastStyleToAttribute } from '../converters/tableproperties.js';
|
|
13
12
|
import TableBackgroundColorCommand from './commands/tablebackgroundcolorcommand.js';
|
|
14
13
|
import TableBorderColorCommand from './commands/tablebordercolorcommand.js';
|
|
15
14
|
import TableBorderStyleCommand from './commands/tableborderstylecommand.js';
|
|
@@ -178,14 +177,7 @@ function enableAlignmentProperty(schema, conversion, defaultValue) {
|
|
|
178
177
|
model: {
|
|
179
178
|
key: 'tableAlignment',
|
|
180
179
|
value: (viewElement, conversionApi, data) => {
|
|
181
|
-
|
|
182
|
-
// Adjust default for layout tables.
|
|
183
|
-
if (data.modelRange) {
|
|
184
|
-
const modelElement = first(data.modelRange.getItems({ shallow: true }));
|
|
185
|
-
if (modelElement && modelElement.is('element') && modelElement.getAttribute('tableType') == 'layout') {
|
|
186
|
-
localDefaultValue = '';
|
|
187
|
-
}
|
|
188
|
-
}
|
|
180
|
+
const localDefaultValue = getDefaultValueAdjusted(defaultValue, '', data);
|
|
189
181
|
let align = viewElement.getStyle('float');
|
|
190
182
|
// CSS: `float:none` => Model: `alignment:center`.
|
|
191
183
|
if (align === 'none') {
|
|
@@ -194,6 +186,24 @@ function enableAlignmentProperty(schema, conversion, defaultValue) {
|
|
|
194
186
|
return align === localDefaultValue ? null : align;
|
|
195
187
|
}
|
|
196
188
|
}
|
|
189
|
+
})
|
|
190
|
+
// Support for the `margin-left:auto; margin-right:auto;` CSS definition for the table alignment.
|
|
191
|
+
.attributeToAttribute({
|
|
192
|
+
view: {
|
|
193
|
+
name: /^(table|figure)$/,
|
|
194
|
+
styles: {
|
|
195
|
+
'margin-left': 'auto',
|
|
196
|
+
'margin-right': 'auto'
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
model: {
|
|
200
|
+
key: 'tableAlignment',
|
|
201
|
+
value: (viewElement, conversionApi, data) => {
|
|
202
|
+
const localDefaultValue = getDefaultValueAdjusted(defaultValue, '', data);
|
|
203
|
+
const align = 'center';
|
|
204
|
+
return align === localDefaultValue ? null : align;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
197
207
|
})
|
|
198
208
|
// Support for the `align` attribute as the backward compatibility while pasting from other sources.
|
|
199
209
|
.attributeToAttribute({
|
|
@@ -206,14 +216,7 @@ function enableAlignmentProperty(schema, conversion, defaultValue) {
|
|
|
206
216
|
name: 'table',
|
|
207
217
|
key: 'tableAlignment',
|
|
208
218
|
value: (viewElement, conversionApi, data) => {
|
|
209
|
-
|
|
210
|
-
// Adjust default for layout tables.
|
|
211
|
-
if (data.modelRange) {
|
|
212
|
-
const modelElement = first(data.modelRange.getItems({ shallow: true }));
|
|
213
|
-
if (modelElement && modelElement.is('element') && modelElement.getAttribute('tableType') == 'layout') {
|
|
214
|
-
localDefaultValue = '';
|
|
215
|
-
}
|
|
216
|
-
}
|
|
219
|
+
const localDefaultValue = getDefaultValueAdjusted(defaultValue, '', data);
|
|
217
220
|
const align = viewElement.getAttribute('align');
|
|
218
221
|
return align === localDefaultValue ? null : align;
|
|
219
222
|
}
|
|
@@ -16,10 +16,6 @@
|
|
|
16
16
|
table-layout: fixed;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
.ck-content .table table {
|
|
20
|
-
overflow: hidden;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
19
|
.ck-content .table td,
|
|
24
20
|
.ck-content .table th {
|
|
25
21
|
/* To prevent text overflowing beyond its cell when columns are resized by resize handler
|
|
@@ -58,12 +54,6 @@
|
|
|
58
54
|
.ck.ck-editor__editable .table .ck-table-column-resizer__active {
|
|
59
55
|
background-color: var(--ck-color-selector-column-resizer-hover);
|
|
60
56
|
opacity: 0.25;
|
|
61
|
-
/* The resizer element resides in each cell so to occupy the entire height of the table, which is unknown from a CSS point of view,
|
|
62
|
-
it is extended to an extremely high height. Even for screens with a very high pixel density, the resizer will fulfill its role as
|
|
63
|
-
it should, i.e. for a screen of 476 ppi the total height of the resizer will take over 350 sheets of A4 format, which is totally
|
|
64
|
-
unrealistic height for a single table. */
|
|
65
|
-
top: -999999px;
|
|
66
|
-
bottom: -999999px;
|
|
67
57
|
}
|
|
68
58
|
|
|
69
59
|
.ck.ck-editor__editable[dir=rtl] .table .ck-table-column-resizer {
|