@ckeditor/ckeditor5-table 45.0.0-alpha.0 → 45.0.0-alpha.2
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/dist/index.js +240 -47
- 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.js +25 -5
- package/src/tablecellproperties/commands/tablecellpropertycommand.d.ts +11 -1
- package/src/tablecellproperties/commands/tablecellpropertycommand.js +32 -2
- package/src/tablecellproperties/tablecellpropertiesediting.js +50 -9
- package/src/tablecellproperties/tablecellpropertiesui.d.ts +13 -1
- package/src/tablecellproperties/tablecellpropertiesui.js +36 -9
- package/src/tableproperties/commands/tablepropertycommand.d.ts +11 -1
- package/src/tableproperties/commands/tablepropertycommand.js +15 -1
- package/src/tableproperties/tablepropertiesediting.js +49 -11
- package/src/tableproperties/tablepropertiesui.d.ts +13 -1
- package/src/tableproperties/tablepropertiesui.js +30 -8
- package/src/tableproperties/ui/tablepropertiesview.d.ts +2 -2
- package/src/utils/table-properties.d.ts +3 -3
- package/src/utils/ui/table-properties.js +7 -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.2",
|
|
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.2",
|
|
17
|
+
"@ckeditor/ckeditor5-clipboard": "45.0.0-alpha.2",
|
|
18
|
+
"@ckeditor/ckeditor5-core": "45.0.0-alpha.2",
|
|
19
|
+
"@ckeditor/ckeditor5-engine": "45.0.0-alpha.2",
|
|
20
|
+
"@ckeditor/ckeditor5-icons": "45.0.0-alpha.2",
|
|
21
|
+
"@ckeditor/ckeditor5-ui": "45.0.0-alpha.2",
|
|
22
|
+
"@ckeditor/ckeditor5-utils": "45.0.0-alpha.2",
|
|
23
|
+
"@ckeditor/ckeditor5-widget": "45.0.0-alpha.2",
|
|
24
24
|
"es-toolkit": "1.32.0"
|
|
25
25
|
},
|
|
26
26
|
"author": "CKSource (http://cksource.com/)",
|
|
@@ -2,6 +2,7 @@
|
|
|
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 { first } from 'ckeditor5/src/utils.js';
|
|
5
6
|
/**
|
|
6
7
|
* Conversion helper for upcasting attributes using normalized styles.
|
|
7
8
|
*
|
|
@@ -22,13 +23,23 @@ export function upcastStyleToAttribute(conversion, options) {
|
|
|
22
23
|
},
|
|
23
24
|
model: {
|
|
24
25
|
key: modelAttribute,
|
|
25
|
-
value: (viewElement) => {
|
|
26
|
+
value: (viewElement, conversionApi, data) => {
|
|
26
27
|
if (!shouldUpcast(viewElement)) {
|
|
27
28
|
return;
|
|
28
29
|
}
|
|
30
|
+
let localDefaultValue = defaultValue;
|
|
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
|
+
}
|
|
29
40
|
const normalized = viewElement.getNormalizedStyle(styleName);
|
|
30
41
|
const value = reduceBoxSides ? reduceBoxSidesValue(normalized) : normalized;
|
|
31
|
-
if (
|
|
42
|
+
if (localDefaultValue !== value) {
|
|
32
43
|
return value;
|
|
33
44
|
}
|
|
34
45
|
}
|
|
@@ -77,6 +88,15 @@ export function upcastBorderStyles(conversion, viewElementName, modelAttributes,
|
|
|
77
88
|
return;
|
|
78
89
|
}
|
|
79
90
|
const modelElement = [...data.modelRange.getItems({ shallow: true })].pop();
|
|
91
|
+
const tableElement = modelElement.findAncestor('table', { includeSelf: true });
|
|
92
|
+
let localDefaultBorder = defaultBorder;
|
|
93
|
+
if (tableElement && tableElement.getAttribute('tableType') == 'layout') {
|
|
94
|
+
localDefaultBorder = {
|
|
95
|
+
style: 'none',
|
|
96
|
+
color: '',
|
|
97
|
+
width: ''
|
|
98
|
+
};
|
|
99
|
+
}
|
|
80
100
|
conversionApi.consumable.consume(data.viewItem, matcherPattern);
|
|
81
101
|
const normalizedBorder = {
|
|
82
102
|
style: data.viewItem.getNormalizedStyle('border-style'),
|
|
@@ -88,13 +108,13 @@ export function upcastBorderStyles(conversion, viewElementName, modelAttributes,
|
|
|
88
108
|
color: reduceBoxSidesValue(normalizedBorder.color),
|
|
89
109
|
width: reduceBoxSidesValue(normalizedBorder.width)
|
|
90
110
|
};
|
|
91
|
-
if (reducedBorder.style !==
|
|
111
|
+
if (reducedBorder.style !== localDefaultBorder.style) {
|
|
92
112
|
conversionApi.writer.setAttribute(modelAttributes.style, reducedBorder.style, modelElement);
|
|
93
113
|
}
|
|
94
|
-
if (reducedBorder.color !==
|
|
114
|
+
if (reducedBorder.color !== localDefaultBorder.color) {
|
|
95
115
|
conversionApi.writer.setAttribute(modelAttributes.color, reducedBorder.color, modelElement);
|
|
96
116
|
}
|
|
97
|
-
if (reducedBorder.width !==
|
|
117
|
+
if (reducedBorder.width !== localDefaultBorder.width) {
|
|
98
118
|
conversionApi.writer.setAttribute(modelAttributes.width, reducedBorder.width, modelElement);
|
|
99
119
|
}
|
|
100
120
|
}));
|
|
@@ -19,8 +19,18 @@ export default class TableCellPropertyCommand extends Command {
|
|
|
19
19
|
readonly attributeName: string;
|
|
20
20
|
/**
|
|
21
21
|
* The default value for the attribute.
|
|
22
|
+
*
|
|
23
|
+
* @readonly
|
|
24
|
+
*/
|
|
25
|
+
protected _defaultValue: string | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* The default value for the attribute for the content table.
|
|
28
|
+
*/
|
|
29
|
+
private readonly _defaultContentTableValue;
|
|
30
|
+
/**
|
|
31
|
+
* The default value for the attribute for the layout table.
|
|
22
32
|
*/
|
|
23
|
-
|
|
33
|
+
private readonly _defaultLayoutTableValue;
|
|
24
34
|
/**
|
|
25
35
|
* Creates a new `TableCellPropertyCommand` instance.
|
|
26
36
|
*
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* @module table/tablecellproperties/commands/tablecellpropertycommand
|
|
7
7
|
*/
|
|
8
8
|
import { Command } from 'ckeditor5/src/core.js';
|
|
9
|
+
import { getSelectionAffectedTable } from '../../utils/common.js';
|
|
9
10
|
/**
|
|
10
11
|
* The table cell attribute command.
|
|
11
12
|
*
|
|
@@ -18,8 +19,18 @@ export default class TableCellPropertyCommand extends Command {
|
|
|
18
19
|
attributeName;
|
|
19
20
|
/**
|
|
20
21
|
* The default value for the attribute.
|
|
22
|
+
*
|
|
23
|
+
* @readonly
|
|
21
24
|
*/
|
|
22
25
|
_defaultValue;
|
|
26
|
+
/**
|
|
27
|
+
* The default value for the attribute for the content table.
|
|
28
|
+
*/
|
|
29
|
+
_defaultContentTableValue;
|
|
30
|
+
/**
|
|
31
|
+
* The default value for the attribute for the layout table.
|
|
32
|
+
*/
|
|
33
|
+
_defaultLayoutTableValue;
|
|
23
34
|
/**
|
|
24
35
|
* Creates a new `TableCellPropertyCommand` instance.
|
|
25
36
|
*
|
|
@@ -30,15 +41,34 @@ export default class TableCellPropertyCommand extends Command {
|
|
|
30
41
|
constructor(editor, attributeName, defaultValue) {
|
|
31
42
|
super(editor);
|
|
32
43
|
this.attributeName = attributeName;
|
|
33
|
-
this.
|
|
44
|
+
this._defaultContentTableValue = defaultValue;
|
|
45
|
+
// Hardcoded defaults for layout table.
|
|
46
|
+
switch (attributeName) {
|
|
47
|
+
case 'tableCellBorderStyle':
|
|
48
|
+
this._defaultLayoutTableValue = 'none';
|
|
49
|
+
break;
|
|
50
|
+
case 'tableCellHorizontalAlignment':
|
|
51
|
+
this._defaultLayoutTableValue = 'left';
|
|
52
|
+
break;
|
|
53
|
+
case 'tableCellVerticalAlignment':
|
|
54
|
+
this._defaultLayoutTableValue = 'middle';
|
|
55
|
+
break;
|
|
56
|
+
default:
|
|
57
|
+
this._defaultLayoutTableValue = undefined;
|
|
58
|
+
}
|
|
34
59
|
}
|
|
35
60
|
/**
|
|
36
61
|
* @inheritDoc
|
|
37
62
|
*/
|
|
38
63
|
refresh() {
|
|
39
64
|
const editor = this.editor;
|
|
65
|
+
const selection = editor.model.document.selection;
|
|
40
66
|
const tableUtils = this.editor.plugins.get('TableUtils');
|
|
41
|
-
const selectedTableCells = tableUtils.getSelectionAffectedTableCells(
|
|
67
|
+
const selectedTableCells = tableUtils.getSelectionAffectedTableCells(selection);
|
|
68
|
+
const table = getSelectionAffectedTable(selection);
|
|
69
|
+
this._defaultValue = !table || table.getAttribute('tableType') !== 'layout' ?
|
|
70
|
+
this._defaultContentTableValue :
|
|
71
|
+
this._defaultLayoutTableValue;
|
|
42
72
|
this.isEnabled = !!selectedTableCells.length;
|
|
43
73
|
this.value = this._getSingleValue(selectedTableCells);
|
|
44
74
|
}
|
|
@@ -6,8 +6,9 @@
|
|
|
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';
|
|
9
10
|
import { addBorderRules, addPaddingRules, addBackgroundRules } from 'ckeditor5/src/engine.js';
|
|
10
|
-
import { downcastAttributeToStyle, upcastBorderStyles } from '
|
|
11
|
+
import { downcastAttributeToStyle, upcastBorderStyles } from '../converters/tableproperties.js';
|
|
11
12
|
import TableEditing from './../tableediting.js';
|
|
12
13
|
import TableCellWidthEditing from '../tablecellwidth/tablecellwidthediting.js';
|
|
13
14
|
import TableCellPaddingCommand from './commands/tablecellpaddingcommand.js';
|
|
@@ -166,9 +167,19 @@ function enableHorizontalAlignmentProperty(schema, conversion, defaultValue) {
|
|
|
166
167
|
},
|
|
167
168
|
model: {
|
|
168
169
|
key: 'tableCellHorizontalAlignment',
|
|
169
|
-
value: (viewElement) => {
|
|
170
|
+
value: (viewElement, conversionApi, data) => {
|
|
171
|
+
let localDefaultValue = defaultValue;
|
|
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
181
|
const align = viewElement.getStyle('text-align');
|
|
171
|
-
return align ===
|
|
182
|
+
return align === localDefaultValue ? null : align;
|
|
172
183
|
}
|
|
173
184
|
}
|
|
174
185
|
})
|
|
@@ -182,9 +193,19 @@ function enableHorizontalAlignmentProperty(schema, conversion, defaultValue) {
|
|
|
182
193
|
},
|
|
183
194
|
model: {
|
|
184
195
|
key: 'tableCellHorizontalAlignment',
|
|
185
|
-
value: (viewElement) => {
|
|
196
|
+
value: (viewElement, conversionApi, data) => {
|
|
197
|
+
let localDefaultValue = defaultValue;
|
|
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
|
+
}
|
|
186
207
|
const align = viewElement.getAttribute('align');
|
|
187
|
-
return align ===
|
|
208
|
+
return align === localDefaultValue ? null : align;
|
|
188
209
|
}
|
|
189
210
|
}
|
|
190
211
|
});
|
|
@@ -222,9 +243,19 @@ function enableVerticalAlignmentProperty(schema, conversion, defaultValue) {
|
|
|
222
243
|
},
|
|
223
244
|
model: {
|
|
224
245
|
key: 'tableCellVerticalAlignment',
|
|
225
|
-
value: (viewElement) => {
|
|
246
|
+
value: (viewElement, conversionApi, data) => {
|
|
247
|
+
let localDefaultValue = defaultValue;
|
|
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
|
+
}
|
|
226
257
|
const align = viewElement.getStyle('vertical-align');
|
|
227
|
-
return align ===
|
|
258
|
+
return align === localDefaultValue ? null : align;
|
|
228
259
|
}
|
|
229
260
|
}
|
|
230
261
|
})
|
|
@@ -238,9 +269,19 @@ function enableVerticalAlignmentProperty(schema, conversion, defaultValue) {
|
|
|
238
269
|
},
|
|
239
270
|
model: {
|
|
240
271
|
key: 'tableCellVerticalAlignment',
|
|
241
|
-
value: (viewElement) => {
|
|
272
|
+
value: (viewElement, conversionApi, data) => {
|
|
273
|
+
let localDefaultValue = defaultValue;
|
|
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
|
+
}
|
|
242
283
|
const valign = viewElement.getAttribute('valign');
|
|
243
|
-
return valign ===
|
|
284
|
+
return valign === localDefaultValue ? null : valign;
|
|
244
285
|
}
|
|
245
286
|
}
|
|
246
287
|
});
|
|
@@ -18,7 +18,11 @@ export default class TableCellPropertiesUI extends Plugin {
|
|
|
18
18
|
/**
|
|
19
19
|
* The default table cell properties.
|
|
20
20
|
*/
|
|
21
|
-
private
|
|
21
|
+
private _defaultContentTableCellProperties;
|
|
22
|
+
/**
|
|
23
|
+
* The default layout table cell properties.
|
|
24
|
+
*/
|
|
25
|
+
private _defaultLayoutTableCellProperties;
|
|
22
26
|
/**
|
|
23
27
|
* The contextual balloon plugin instance.
|
|
24
28
|
*/
|
|
@@ -27,6 +31,14 @@ export default class TableCellPropertiesUI extends Plugin {
|
|
|
27
31
|
* The cell properties form view displayed inside the balloon.
|
|
28
32
|
*/
|
|
29
33
|
view?: TableCellPropertiesView | null;
|
|
34
|
+
/**
|
|
35
|
+
* The cell properties form view displayed inside the balloon (content table).
|
|
36
|
+
*/
|
|
37
|
+
private _viewWithContentTableDefaults?;
|
|
38
|
+
/**
|
|
39
|
+
* The cell properties form view displayed inside the balloon (layout table).
|
|
40
|
+
*/
|
|
41
|
+
private _viewWithLayoutTableDefaults?;
|
|
30
42
|
/**
|
|
31
43
|
* The batch used to undo all changes made by the form (which are live, as the user types)
|
|
32
44
|
* when "Cancel" was pressed. Each time the view is shown, a new batch is created.
|
|
@@ -11,9 +11,9 @@ import { ButtonView, clickOutsideHandler, ContextualBalloon, getLocalizedColorOp
|
|
|
11
11
|
import TableCellPropertiesView from './ui/tablecellpropertiesview.js';
|
|
12
12
|
import { colorFieldValidator, getLocalizedColorErrorText, getLocalizedLengthErrorText, defaultColors, lengthFieldValidator, lineWidthFieldValidator } from '../utils/ui/table-properties.js';
|
|
13
13
|
import { debounce } from 'es-toolkit/compat';
|
|
14
|
-
import { getTableWidgetAncestor } from '../utils/ui/widget.js';
|
|
14
|
+
import { getSelectionAffectedTableWidget, getTableWidgetAncestor } from '../utils/ui/widget.js';
|
|
15
15
|
import { getBalloonCellPositionData, repositionContextualBalloon } from '../utils/ui/contextualballoon.js';
|
|
16
|
-
import { getNormalizedDefaultCellProperties } from '../utils/table-properties.js';
|
|
16
|
+
import { getNormalizedDefaultCellProperties, getNormalizedDefaultProperties } from '../utils/table-properties.js';
|
|
17
17
|
const ERROR_TEXT_TIMEOUT = 500;
|
|
18
18
|
// Map of view properties and related commands.
|
|
19
19
|
const propertyToCommandMap = {
|
|
@@ -37,7 +37,11 @@ export default class TableCellPropertiesUI extends Plugin {
|
|
|
37
37
|
/**
|
|
38
38
|
* The default table cell properties.
|
|
39
39
|
*/
|
|
40
|
-
|
|
40
|
+
_defaultContentTableCellProperties;
|
|
41
|
+
/**
|
|
42
|
+
* The default layout table cell properties.
|
|
43
|
+
*/
|
|
44
|
+
_defaultLayoutTableCellProperties;
|
|
41
45
|
/**
|
|
42
46
|
* The contextual balloon plugin instance.
|
|
43
47
|
*/
|
|
@@ -46,6 +50,14 @@ export default class TableCellPropertiesUI extends Plugin {
|
|
|
46
50
|
* The cell properties form view displayed inside the balloon.
|
|
47
51
|
*/
|
|
48
52
|
view;
|
|
53
|
+
/**
|
|
54
|
+
* The cell properties form view displayed inside the balloon (content table).
|
|
55
|
+
*/
|
|
56
|
+
_viewWithContentTableDefaults;
|
|
57
|
+
/**
|
|
58
|
+
* The cell properties form view displayed inside the balloon (layout table).
|
|
59
|
+
*/
|
|
60
|
+
_viewWithLayoutTableDefaults;
|
|
49
61
|
/**
|
|
50
62
|
* The batch used to undo all changes made by the form (which are live, as the user types)
|
|
51
63
|
* when "Cancel" was pressed. Each time the view is shown, a new batch is created.
|
|
@@ -90,12 +102,17 @@ export default class TableCellPropertiesUI extends Plugin {
|
|
|
90
102
|
init() {
|
|
91
103
|
const editor = this.editor;
|
|
92
104
|
const t = editor.t;
|
|
93
|
-
this.
|
|
105
|
+
this._defaultContentTableCellProperties = getNormalizedDefaultCellProperties(editor.config.get('table.tableCellProperties.defaultProperties'), {
|
|
94
106
|
includeVerticalAlignmentProperty: true,
|
|
95
107
|
includeHorizontalAlignmentProperty: true,
|
|
96
108
|
includePaddingProperty: true,
|
|
97
109
|
isRightToLeftContent: editor.locale.contentLanguageDirection === 'rtl'
|
|
98
110
|
});
|
|
111
|
+
this._defaultLayoutTableCellProperties = getNormalizedDefaultProperties(undefined, {
|
|
112
|
+
includeVerticalAlignmentProperty: true,
|
|
113
|
+
includeHorizontalAlignmentProperty: true,
|
|
114
|
+
isRightToLeftContent: editor.locale.contentLanguageDirection === 'rtl'
|
|
115
|
+
});
|
|
99
116
|
this._balloon = editor.plugins.get(ContextualBalloon);
|
|
100
117
|
this.view = null;
|
|
101
118
|
this._isReady = false;
|
|
@@ -129,7 +146,7 @@ export default class TableCellPropertiesUI extends Plugin {
|
|
|
129
146
|
*
|
|
130
147
|
* @returns The cell properties form view instance.
|
|
131
148
|
*/
|
|
132
|
-
_createPropertiesView() {
|
|
149
|
+
_createPropertiesView(defaultTableCellProperties) {
|
|
133
150
|
const editor = this.editor;
|
|
134
151
|
const config = editor.config.get('table.tableCellProperties');
|
|
135
152
|
const borderColorsConfig = normalizeColorOptions(config.borderColors);
|
|
@@ -140,7 +157,7 @@ export default class TableCellPropertiesUI extends Plugin {
|
|
|
140
157
|
const view = new TableCellPropertiesView(editor.locale, {
|
|
141
158
|
borderColors: localizedBorderColors,
|
|
142
159
|
backgroundColors: localizedBackgroundColors,
|
|
143
|
-
defaultTableCellProperties
|
|
160
|
+
defaultTableCellProperties,
|
|
144
161
|
colorPickerConfig: hasColorPicker ? (config.colorPicker || {}) : false
|
|
145
162
|
});
|
|
146
163
|
const t = editor.t;
|
|
@@ -229,7 +246,10 @@ export default class TableCellPropertiesUI extends Plugin {
|
|
|
229
246
|
const borderStyleCommand = commands.get('tableCellBorderStyle');
|
|
230
247
|
Object.entries(propertyToCommandMap)
|
|
231
248
|
.map(([property, commandName]) => {
|
|
232
|
-
const
|
|
249
|
+
const propertyKey = property;
|
|
250
|
+
const defaultValue = this.view === this._viewWithContentTableDefaults ?
|
|
251
|
+
this._defaultContentTableCellProperties[propertyKey] || '' :
|
|
252
|
+
this._defaultLayoutTableCellProperties[propertyKey] || '';
|
|
233
253
|
return [
|
|
234
254
|
property,
|
|
235
255
|
commands.get(commandName).value || defaultValue
|
|
@@ -253,9 +273,16 @@ export default class TableCellPropertiesUI extends Plugin {
|
|
|
253
273
|
*/
|
|
254
274
|
_showView() {
|
|
255
275
|
const editor = this.editor;
|
|
256
|
-
|
|
257
|
-
|
|
276
|
+
const viewTable = getSelectionAffectedTableWidget(editor.editing.view.document.selection);
|
|
277
|
+
const modelTable = viewTable && editor.editing.mapper.toModelElement(viewTable);
|
|
278
|
+
const useDefaults = !modelTable || modelTable.getAttribute('tableType') !== 'layout';
|
|
279
|
+
if (useDefaults && !this._viewWithContentTableDefaults) {
|
|
280
|
+
this._viewWithContentTableDefaults = this._createPropertiesView(this._defaultContentTableCellProperties);
|
|
281
|
+
}
|
|
282
|
+
else if (!useDefaults && !this._viewWithLayoutTableDefaults) {
|
|
283
|
+
this._viewWithLayoutTableDefaults = this._createPropertiesView(this._defaultLayoutTableCellProperties);
|
|
258
284
|
}
|
|
285
|
+
this.view = useDefaults ? this._viewWithContentTableDefaults : this._viewWithLayoutTableDefaults;
|
|
259
286
|
this.listenTo(editor.ui, 'update', () => {
|
|
260
287
|
this._updateView();
|
|
261
288
|
});
|
|
@@ -26,8 +26,18 @@ export default class TablePropertyCommand extends Command {
|
|
|
26
26
|
readonly attributeName: string;
|
|
27
27
|
/**
|
|
28
28
|
* The default value for the attribute.
|
|
29
|
+
*
|
|
30
|
+
* @readonly
|
|
31
|
+
*/
|
|
32
|
+
protected _defaultValue: string | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* The default value for the attribute for the content table.
|
|
35
|
+
*/
|
|
36
|
+
private readonly _defaultContentTableValue;
|
|
37
|
+
/**
|
|
38
|
+
* The default value for the attribute for the layout table.
|
|
29
39
|
*/
|
|
30
|
-
|
|
40
|
+
private readonly _defaultLayoutTableValue;
|
|
31
41
|
/**
|
|
32
42
|
* Creates a new `TablePropertyCommand` instance.
|
|
33
43
|
*
|
|
@@ -16,8 +16,18 @@ export default class TablePropertyCommand extends Command {
|
|
|
16
16
|
attributeName;
|
|
17
17
|
/**
|
|
18
18
|
* The default value for the attribute.
|
|
19
|
+
*
|
|
20
|
+
* @readonly
|
|
19
21
|
*/
|
|
20
22
|
_defaultValue;
|
|
23
|
+
/**
|
|
24
|
+
* The default value for the attribute for the content table.
|
|
25
|
+
*/
|
|
26
|
+
_defaultContentTableValue;
|
|
27
|
+
/**
|
|
28
|
+
* The default value for the attribute for the layout table.
|
|
29
|
+
*/
|
|
30
|
+
_defaultLayoutTableValue;
|
|
21
31
|
/**
|
|
22
32
|
* Creates a new `TablePropertyCommand` instance.
|
|
23
33
|
*
|
|
@@ -28,7 +38,8 @@ export default class TablePropertyCommand extends Command {
|
|
|
28
38
|
constructor(editor, attributeName, defaultValue) {
|
|
29
39
|
super(editor);
|
|
30
40
|
this.attributeName = attributeName;
|
|
31
|
-
this.
|
|
41
|
+
this._defaultContentTableValue = defaultValue;
|
|
42
|
+
this._defaultLayoutTableValue = attributeName === 'tableBorderStyle' ? 'none' : undefined;
|
|
32
43
|
}
|
|
33
44
|
/**
|
|
34
45
|
* @inheritDoc
|
|
@@ -37,6 +48,9 @@ export default class TablePropertyCommand extends Command {
|
|
|
37
48
|
const editor = this.editor;
|
|
38
49
|
const selection = editor.model.document.selection;
|
|
39
50
|
const table = getSelectionAffectedTable(selection);
|
|
51
|
+
this._defaultValue = !table || table.getAttribute('tableType') !== 'layout' ?
|
|
52
|
+
this._defaultContentTableValue :
|
|
53
|
+
this._defaultLayoutTableValue;
|
|
40
54
|
this.isEnabled = !!table;
|
|
41
55
|
this.value = this._getValue(table);
|
|
42
56
|
}
|