@ckeditor/ckeditor5-table 45.0.0-alpha.0 → 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.
Files changed (182) hide show
  1. package/build/table.js +1 -1
  2. package/build/translations/ar.js +1 -1
  3. package/build/translations/bg.js +1 -1
  4. package/build/translations/bn.js +1 -1
  5. package/build/translations/ca.js +1 -1
  6. package/build/translations/cs.js +1 -1
  7. package/build/translations/da.js +1 -1
  8. package/build/translations/de.js +1 -1
  9. package/build/translations/el.js +1 -1
  10. package/build/translations/es.js +1 -1
  11. package/build/translations/et.js +1 -1
  12. package/build/translations/fi.js +1 -1
  13. package/build/translations/fr.js +1 -1
  14. package/build/translations/he.js +1 -1
  15. package/build/translations/hi.js +1 -1
  16. package/build/translations/hu.js +1 -1
  17. package/build/translations/id.js +1 -1
  18. package/build/translations/it.js +1 -1
  19. package/build/translations/ja.js +1 -1
  20. package/build/translations/ko.js +1 -1
  21. package/build/translations/lt.js +1 -1
  22. package/build/translations/lv.js +1 -1
  23. package/build/translations/ms.js +1 -1
  24. package/build/translations/nl.js +1 -1
  25. package/build/translations/no.js +1 -1
  26. package/build/translations/pl.js +1 -1
  27. package/build/translations/pt-br.js +1 -1
  28. package/build/translations/pt.js +1 -1
  29. package/build/translations/ro.js +1 -1
  30. package/build/translations/ru.js +1 -1
  31. package/build/translations/sk.js +1 -1
  32. package/build/translations/sr.js +1 -1
  33. package/build/translations/sv.js +1 -1
  34. package/build/translations/th.js +1 -1
  35. package/build/translations/tr.js +1 -1
  36. package/build/translations/uk.js +1 -1
  37. package/build/translations/vi.js +1 -1
  38. package/build/translations/zh-cn.js +1 -1
  39. package/build/translations/zh.js +1 -1
  40. package/ckeditor5-metadata.json +2 -2
  41. package/dist/index-content.css +0 -4
  42. package/dist/index-editor.css +9 -3
  43. package/dist/index.css +13 -11
  44. package/dist/index.css.map +1 -1
  45. package/dist/index.js +278 -50
  46. package/dist/index.js.map +1 -1
  47. package/dist/translations/ar.js +1 -1
  48. package/dist/translations/ar.umd.js +1 -1
  49. package/dist/translations/bg.js +1 -1
  50. package/dist/translations/bg.umd.js +1 -1
  51. package/dist/translations/bn.js +1 -1
  52. package/dist/translations/bn.umd.js +1 -1
  53. package/dist/translations/ca.js +1 -1
  54. package/dist/translations/ca.umd.js +1 -1
  55. package/dist/translations/cs.js +1 -1
  56. package/dist/translations/cs.umd.js +1 -1
  57. package/dist/translations/da.js +1 -1
  58. package/dist/translations/da.umd.js +1 -1
  59. package/dist/translations/de.js +1 -1
  60. package/dist/translations/de.umd.js +1 -1
  61. package/dist/translations/el.js +1 -1
  62. package/dist/translations/el.umd.js +1 -1
  63. package/dist/translations/es.js +1 -1
  64. package/dist/translations/es.umd.js +1 -1
  65. package/dist/translations/et.js +1 -1
  66. package/dist/translations/et.umd.js +1 -1
  67. package/dist/translations/fi.js +1 -1
  68. package/dist/translations/fi.umd.js +1 -1
  69. package/dist/translations/fr.js +1 -1
  70. package/dist/translations/fr.umd.js +1 -1
  71. package/dist/translations/he.js +1 -1
  72. package/dist/translations/he.umd.js +1 -1
  73. package/dist/translations/hi.js +1 -1
  74. package/dist/translations/hi.umd.js +1 -1
  75. package/dist/translations/hu.js +1 -1
  76. package/dist/translations/hu.umd.js +1 -1
  77. package/dist/translations/id.js +1 -1
  78. package/dist/translations/id.umd.js +1 -1
  79. package/dist/translations/it.js +1 -1
  80. package/dist/translations/it.umd.js +1 -1
  81. package/dist/translations/ja.js +1 -1
  82. package/dist/translations/ja.umd.js +1 -1
  83. package/dist/translations/ko.js +1 -1
  84. package/dist/translations/ko.umd.js +1 -1
  85. package/dist/translations/lt.js +1 -1
  86. package/dist/translations/lt.umd.js +1 -1
  87. package/dist/translations/lv.js +1 -1
  88. package/dist/translations/lv.umd.js +1 -1
  89. package/dist/translations/ms.js +1 -1
  90. package/dist/translations/ms.umd.js +1 -1
  91. package/dist/translations/nl.js +1 -1
  92. package/dist/translations/nl.umd.js +1 -1
  93. package/dist/translations/no.js +1 -1
  94. package/dist/translations/no.umd.js +1 -1
  95. package/dist/translations/pl.js +1 -1
  96. package/dist/translations/pl.umd.js +1 -1
  97. package/dist/translations/pt-br.js +1 -1
  98. package/dist/translations/pt-br.umd.js +1 -1
  99. package/dist/translations/pt.js +1 -1
  100. package/dist/translations/pt.umd.js +1 -1
  101. package/dist/translations/ro.js +1 -1
  102. package/dist/translations/ro.umd.js +1 -1
  103. package/dist/translations/ru.js +1 -1
  104. package/dist/translations/ru.umd.js +1 -1
  105. package/dist/translations/sk.js +1 -1
  106. package/dist/translations/sk.umd.js +1 -1
  107. package/dist/translations/sr.js +1 -1
  108. package/dist/translations/sr.umd.js +1 -1
  109. package/dist/translations/sv.js +1 -1
  110. package/dist/translations/sv.umd.js +1 -1
  111. package/dist/translations/th.js +1 -1
  112. package/dist/translations/th.umd.js +1 -1
  113. package/dist/translations/tr.js +1 -1
  114. package/dist/translations/tr.umd.js +1 -1
  115. package/dist/translations/uk.js +1 -1
  116. package/dist/translations/uk.umd.js +1 -1
  117. package/dist/translations/vi.js +1 -1
  118. package/dist/translations/vi.umd.js +1 -1
  119. package/dist/translations/zh-cn.js +1 -1
  120. package/dist/translations/zh-cn.umd.js +1 -1
  121. package/dist/translations/zh.js +1 -1
  122. package/dist/translations/zh.umd.js +1 -1
  123. package/lang/translations/ar.po +7 -7
  124. package/lang/translations/bg.po +7 -7
  125. package/lang/translations/bn.po +7 -7
  126. package/lang/translations/ca.po +7 -7
  127. package/lang/translations/cs.po +7 -7
  128. package/lang/translations/da.po +7 -7
  129. package/lang/translations/de.po +7 -7
  130. package/lang/translations/el.po +7 -7
  131. package/lang/translations/es.po +7 -7
  132. package/lang/translations/et.po +7 -7
  133. package/lang/translations/fi.po +7 -7
  134. package/lang/translations/fr.po +7 -7
  135. package/lang/translations/he.po +7 -7
  136. package/lang/translations/hi.po +7 -7
  137. package/lang/translations/hu.po +7 -7
  138. package/lang/translations/id.po +7 -7
  139. package/lang/translations/it.po +7 -7
  140. package/lang/translations/ja.po +7 -7
  141. package/lang/translations/ko.po +7 -7
  142. package/lang/translations/lt.po +7 -7
  143. package/lang/translations/lv.po +7 -7
  144. package/lang/translations/ms.po +7 -7
  145. package/lang/translations/nl.po +7 -7
  146. package/lang/translations/no.po +7 -7
  147. package/lang/translations/pl.po +7 -7
  148. package/lang/translations/pt-br.po +7 -7
  149. package/lang/translations/pt.po +7 -7
  150. package/lang/translations/ro.po +7 -7
  151. package/lang/translations/ru.po +7 -7
  152. package/lang/translations/sk.po +7 -7
  153. package/lang/translations/sr.po +7 -7
  154. package/lang/translations/sv.po +7 -7
  155. package/lang/translations/th.po +7 -7
  156. package/lang/translations/tr.po +7 -7
  157. package/lang/translations/uk.po +7 -7
  158. package/lang/translations/vi.po +7 -7
  159. package/lang/translations/zh-cn.po +7 -7
  160. package/lang/translations/zh.po +7 -7
  161. package/package.json +9 -9
  162. package/src/converters/tableproperties.d.ts +5 -1
  163. package/src/converters/tableproperties.js +27 -5
  164. package/src/tablecellproperties/commands/tablecellpropertycommand.d.ts +11 -1
  165. package/src/tablecellproperties/commands/tablecellpropertycommand.js +32 -2
  166. package/src/tablecellproperties/tablecellpropertiesediting.js +13 -9
  167. package/src/tablecellproperties/tablecellpropertiesui.d.ts +13 -1
  168. package/src/tablecellproperties/tablecellpropertiesui.js +36 -9
  169. package/src/tablecolumnresize/tablecolumnresizeediting.d.ts +28 -0
  170. package/src/tablecolumnresize/tablecolumnresizeediting.js +81 -2
  171. package/src/tablelayout.d.ts +1 -1
  172. package/src/tablelayout.js +1 -1
  173. package/src/tableproperties/commands/tablepropertycommand.d.ts +11 -1
  174. package/src/tableproperties/commands/tablepropertycommand.js +15 -1
  175. package/src/tableproperties/tablepropertiesediting.js +53 -12
  176. package/src/tableproperties/tablepropertiesui.d.ts +13 -1
  177. package/src/tableproperties/tablepropertiesui.js +30 -8
  178. package/src/tableproperties/ui/tablepropertiesview.d.ts +2 -2
  179. package/src/utils/table-properties.d.ts +3 -3
  180. package/src/utils/ui/table-properties.js +7 -1
  181. package/theme/tablecolumnresize.css +0 -10
  182. package/theme/tablelayout.css +13 -1
@@ -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"
@@ -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 "Опції типу таблиці"
@@ -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 "表格类型选项"
@@ -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.0",
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.0",
17
- "@ckeditor/ckeditor5-clipboard": "45.0.0-alpha.0",
18
- "@ckeditor/ckeditor5-core": "45.0.0-alpha.0",
19
- "@ckeditor/ckeditor5-engine": "45.0.0-alpha.0",
20
- "@ckeditor/ckeditor5-icons": "45.0.0-alpha.0",
21
- "@ckeditor/ckeditor5-ui": "45.0.0-alpha.0",
22
- "@ckeditor/ckeditor5-utils": "45.0.0-alpha.0",
23
- "@ckeditor/ckeditor5-widget": "45.0.0-alpha.0",
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;
@@ -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,14 @@ 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
+ const localDefaultValue = getDefaultValueAdjusted(defaultValue, '', data);
29
31
  const normalized = viewElement.getNormalizedStyle(styleName);
30
32
  const value = reduceBoxSides ? reduceBoxSidesValue(normalized) : normalized;
31
- if (defaultValue !== value) {
33
+ if (localDefaultValue !== value) {
32
34
  return value;
33
35
  }
34
36
  }
@@ -77,6 +79,15 @@ export function upcastBorderStyles(conversion, viewElementName, modelAttributes,
77
79
  return;
78
80
  }
79
81
  const modelElement = [...data.modelRange.getItems({ shallow: true })].pop();
82
+ const tableElement = modelElement.findAncestor('table', { includeSelf: true });
83
+ let localDefaultBorder = defaultBorder;
84
+ if (tableElement && tableElement.getAttribute('tableType') == 'layout') {
85
+ localDefaultBorder = {
86
+ style: 'none',
87
+ color: '',
88
+ width: ''
89
+ };
90
+ }
80
91
  conversionApi.consumable.consume(data.viewItem, matcherPattern);
81
92
  const normalizedBorder = {
82
93
  style: data.viewItem.getNormalizedStyle('border-style'),
@@ -88,13 +99,13 @@ export function upcastBorderStyles(conversion, viewElementName, modelAttributes,
88
99
  color: reduceBoxSidesValue(normalizedBorder.color),
89
100
  width: reduceBoxSidesValue(normalizedBorder.width)
90
101
  };
91
- if (reducedBorder.style !== defaultBorder.style) {
102
+ if (reducedBorder.style !== localDefaultBorder.style) {
92
103
  conversionApi.writer.setAttribute(modelAttributes.style, reducedBorder.style, modelElement);
93
104
  }
94
- if (reducedBorder.color !== defaultBorder.color) {
105
+ if (reducedBorder.color !== localDefaultBorder.color) {
95
106
  conversionApi.writer.setAttribute(modelAttributes.color, reducedBorder.color, modelElement);
96
107
  }
97
- if (reducedBorder.width !== defaultBorder.width) {
108
+ if (reducedBorder.width !== localDefaultBorder.width) {
98
109
  conversionApi.writer.setAttribute(modelAttributes.width, reducedBorder.width, modelElement);
99
110
  }
100
111
  }));
@@ -137,6 +148,17 @@ export function downcastTableAttribute(conversion, options) {
137
148
  }
138
149
  }));
139
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
+ }
140
162
  /**
141
163
  * Reduces the full top, right, bottom, left object to a single string if all sides are equal.
142
164
  * Returns original style otherwise.
@@ -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
- protected readonly _defaultValue: string;
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._defaultValue = defaultValue;
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(editor.model.document.selection);
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
  }
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { Plugin } from 'ckeditor5/src/core.js';
9
9
  import { addBorderRules, addPaddingRules, addBackgroundRules } from 'ckeditor5/src/engine.js';
10
- import { downcastAttributeToStyle, upcastBorderStyles } from './../converters/tableproperties.js';
10
+ import { downcastAttributeToStyle, getDefaultValueAdjusted, upcastBorderStyles } from '../converters/tableproperties.js';
11
11
  import TableEditing from './../tableediting.js';
12
12
  import TableCellWidthEditing from '../tablecellwidth/tablecellwidthediting.js';
13
13
  import TableCellPaddingCommand from './commands/tablecellpaddingcommand.js';
@@ -166,9 +166,10 @@ function enableHorizontalAlignmentProperty(schema, conversion, defaultValue) {
166
166
  },
167
167
  model: {
168
168
  key: 'tableCellHorizontalAlignment',
169
- value: (viewElement) => {
169
+ value: (viewElement, conversionApi, data) => {
170
+ const localDefaultValue = getDefaultValueAdjusted(defaultValue, 'left', data);
170
171
  const align = viewElement.getStyle('text-align');
171
- return align === defaultValue ? null : align;
172
+ return align === localDefaultValue ? null : align;
172
173
  }
173
174
  }
174
175
  })
@@ -182,9 +183,10 @@ function enableHorizontalAlignmentProperty(schema, conversion, defaultValue) {
182
183
  },
183
184
  model: {
184
185
  key: 'tableCellHorizontalAlignment',
185
- value: (viewElement) => {
186
+ value: (viewElement, conversionApi, data) => {
187
+ const localDefaultValue = getDefaultValueAdjusted(defaultValue, 'left', data);
186
188
  const align = viewElement.getAttribute('align');
187
- return align === defaultValue ? null : align;
189
+ return align === localDefaultValue ? null : align;
188
190
  }
189
191
  }
190
192
  });
@@ -222,9 +224,10 @@ function enableVerticalAlignmentProperty(schema, conversion, defaultValue) {
222
224
  },
223
225
  model: {
224
226
  key: 'tableCellVerticalAlignment',
225
- value: (viewElement) => {
227
+ value: (viewElement, conversionApi, data) => {
228
+ const localDefaultValue = getDefaultValueAdjusted(defaultValue, 'middle', data);
226
229
  const align = viewElement.getStyle('vertical-align');
227
- return align === defaultValue ? null : align;
230
+ return align === localDefaultValue ? null : align;
228
231
  }
229
232
  }
230
233
  })
@@ -238,9 +241,10 @@ function enableVerticalAlignmentProperty(schema, conversion, defaultValue) {
238
241
  },
239
242
  model: {
240
243
  key: 'tableCellVerticalAlignment',
241
- value: (viewElement) => {
244
+ value: (viewElement, conversionApi, data) => {
245
+ const localDefaultValue = getDefaultValueAdjusted(defaultValue, 'middle', data);
242
246
  const valign = viewElement.getAttribute('valign');
243
- return valign === defaultValue ? null : valign;
247
+ return valign === localDefaultValue ? null : valign;
244
248
  }
245
249
  }
246
250
  });
@@ -18,7 +18,11 @@ export default class TableCellPropertiesUI extends Plugin {
18
18
  /**
19
19
  * The default table cell properties.
20
20
  */
21
- private _defaultTableCellProperties;
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
- _defaultTableCellProperties;
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._defaultTableCellProperties = getNormalizedDefaultCellProperties(editor.config.get('table.tableCellProperties.defaultProperties'), {
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: this._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 defaultValue = this._defaultTableCellProperties[property] || '';
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
- if (!this.view) {
257
- this.view = this._createPropertiesView();
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
  });
@@ -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,