@ckeditor/ckeditor5-table 0.0.0-nightly-20250407.0 → 0.0.0-nightly-20250409.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (321) hide show
  1. package/build/table.js +2 -2
  2. package/build/translations/af.js +1 -1
  3. package/build/translations/ar.js +1 -1
  4. package/build/translations/ast.js +1 -1
  5. package/build/translations/az.js +1 -1
  6. package/build/translations/be.js +1 -1
  7. package/build/translations/bg.js +1 -1
  8. package/build/translations/bn.js +1 -1
  9. package/build/translations/bs.js +1 -1
  10. package/build/translations/ca.js +1 -1
  11. package/build/translations/cs.js +1 -1
  12. package/build/translations/da.js +1 -1
  13. package/build/translations/de-ch.js +1 -1
  14. package/build/translations/de.js +1 -1
  15. package/build/translations/el.js +1 -1
  16. package/build/translations/en-au.js +1 -1
  17. package/build/translations/en-gb.js +1 -1
  18. package/build/translations/eo.js +1 -1
  19. package/build/translations/es-co.js +1 -1
  20. package/build/translations/es.js +1 -1
  21. package/build/translations/et.js +1 -1
  22. package/build/translations/eu.js +1 -1
  23. package/build/translations/fa.js +1 -1
  24. package/build/translations/fi.js +1 -1
  25. package/build/translations/fr.js +1 -1
  26. package/build/translations/gl.js +1 -1
  27. package/build/translations/gu.js +1 -1
  28. package/build/translations/he.js +1 -1
  29. package/build/translations/hi.js +1 -1
  30. package/build/translations/hr.js +1 -1
  31. package/build/translations/hu.js +1 -1
  32. package/build/translations/hy.js +1 -1
  33. package/build/translations/id.js +1 -1
  34. package/build/translations/it.js +1 -1
  35. package/build/translations/ja.js +1 -1
  36. package/build/translations/jv.js +1 -1
  37. package/build/translations/kk.js +1 -1
  38. package/build/translations/km.js +1 -1
  39. package/build/translations/kn.js +1 -1
  40. package/build/translations/ko.js +1 -1
  41. package/build/translations/ku.js +1 -1
  42. package/build/translations/lt.js +1 -1
  43. package/build/translations/lv.js +1 -1
  44. package/build/translations/ms.js +1 -1
  45. package/build/translations/nb.js +1 -1
  46. package/build/translations/ne.js +1 -1
  47. package/build/translations/nl.js +1 -1
  48. package/build/translations/no.js +1 -1
  49. package/build/translations/oc.js +1 -1
  50. package/build/translations/pl.js +1 -1
  51. package/build/translations/pt-br.js +1 -1
  52. package/build/translations/pt.js +1 -1
  53. package/build/translations/ro.js +1 -1
  54. package/build/translations/ru.js +1 -1
  55. package/build/translations/si.js +1 -1
  56. package/build/translations/sk.js +1 -1
  57. package/build/translations/sl.js +1 -1
  58. package/build/translations/sq.js +1 -1
  59. package/build/translations/sr-latn.js +1 -1
  60. package/build/translations/sr.js +1 -1
  61. package/build/translations/sv.js +1 -1
  62. package/build/translations/th.js +1 -1
  63. package/build/translations/ti.js +1 -1
  64. package/build/translations/tk.js +1 -1
  65. package/build/translations/tr.js +1 -1
  66. package/build/translations/tt.js +1 -1
  67. package/build/translations/ug.js +1 -1
  68. package/build/translations/uk.js +1 -1
  69. package/build/translations/ur.js +1 -1
  70. package/build/translations/uz.js +1 -1
  71. package/build/translations/vi.js +1 -1
  72. package/build/translations/zh-cn.js +1 -1
  73. package/build/translations/zh.js +1 -1
  74. package/ckeditor5-metadata.json +2 -2
  75. package/dist/index-content.css +0 -4
  76. package/dist/index-editor.css +9 -3
  77. package/dist/index.css +13 -11
  78. package/dist/index.css.map +1 -1
  79. package/dist/index.js +278 -50
  80. package/dist/index.js.map +1 -1
  81. package/dist/translations/af.js +1 -1
  82. package/dist/translations/af.umd.js +1 -1
  83. package/dist/translations/ar.js +1 -1
  84. package/dist/translations/ar.umd.js +1 -1
  85. package/dist/translations/ast.js +1 -1
  86. package/dist/translations/ast.umd.js +1 -1
  87. package/dist/translations/az.js +1 -1
  88. package/dist/translations/az.umd.js +1 -1
  89. package/dist/translations/be.js +1 -1
  90. package/dist/translations/be.umd.js +1 -1
  91. package/dist/translations/bg.js +1 -1
  92. package/dist/translations/bg.umd.js +1 -1
  93. package/dist/translations/bn.js +1 -1
  94. package/dist/translations/bn.umd.js +1 -1
  95. package/dist/translations/bs.js +1 -1
  96. package/dist/translations/bs.umd.js +1 -1
  97. package/dist/translations/ca.js +1 -1
  98. package/dist/translations/ca.umd.js +1 -1
  99. package/dist/translations/cs.js +1 -1
  100. package/dist/translations/cs.umd.js +1 -1
  101. package/dist/translations/da.js +1 -1
  102. package/dist/translations/da.umd.js +1 -1
  103. package/dist/translations/de-ch.js +1 -1
  104. package/dist/translations/de-ch.umd.js +1 -1
  105. package/dist/translations/de.js +1 -1
  106. package/dist/translations/de.umd.js +1 -1
  107. package/dist/translations/el.js +1 -1
  108. package/dist/translations/el.umd.js +1 -1
  109. package/dist/translations/en-au.js +1 -1
  110. package/dist/translations/en-au.umd.js +1 -1
  111. package/dist/translations/en-gb.js +1 -1
  112. package/dist/translations/en-gb.umd.js +1 -1
  113. package/dist/translations/en.js +1 -1
  114. package/dist/translations/en.umd.js +1 -1
  115. package/dist/translations/eo.js +1 -1
  116. package/dist/translations/eo.umd.js +1 -1
  117. package/dist/translations/es-co.js +1 -1
  118. package/dist/translations/es-co.umd.js +1 -1
  119. package/dist/translations/es.js +1 -1
  120. package/dist/translations/es.umd.js +1 -1
  121. package/dist/translations/et.js +1 -1
  122. package/dist/translations/et.umd.js +1 -1
  123. package/dist/translations/eu.js +1 -1
  124. package/dist/translations/eu.umd.js +1 -1
  125. package/dist/translations/fa.js +1 -1
  126. package/dist/translations/fa.umd.js +1 -1
  127. package/dist/translations/fi.js +1 -1
  128. package/dist/translations/fi.umd.js +1 -1
  129. package/dist/translations/fr.js +1 -1
  130. package/dist/translations/fr.umd.js +1 -1
  131. package/dist/translations/gl.js +1 -1
  132. package/dist/translations/gl.umd.js +1 -1
  133. package/dist/translations/gu.js +1 -1
  134. package/dist/translations/gu.umd.js +1 -1
  135. package/dist/translations/he.js +1 -1
  136. package/dist/translations/he.umd.js +1 -1
  137. package/dist/translations/hi.js +1 -1
  138. package/dist/translations/hi.umd.js +1 -1
  139. package/dist/translations/hr.js +1 -1
  140. package/dist/translations/hr.umd.js +1 -1
  141. package/dist/translations/hu.js +1 -1
  142. package/dist/translations/hu.umd.js +1 -1
  143. package/dist/translations/hy.js +1 -1
  144. package/dist/translations/hy.umd.js +1 -1
  145. package/dist/translations/id.js +1 -1
  146. package/dist/translations/id.umd.js +1 -1
  147. package/dist/translations/it.js +1 -1
  148. package/dist/translations/it.umd.js +1 -1
  149. package/dist/translations/ja.js +1 -1
  150. package/dist/translations/ja.umd.js +1 -1
  151. package/dist/translations/jv.js +1 -1
  152. package/dist/translations/jv.umd.js +1 -1
  153. package/dist/translations/kk.js +1 -1
  154. package/dist/translations/kk.umd.js +1 -1
  155. package/dist/translations/km.js +1 -1
  156. package/dist/translations/km.umd.js +1 -1
  157. package/dist/translations/kn.js +1 -1
  158. package/dist/translations/kn.umd.js +1 -1
  159. package/dist/translations/ko.js +1 -1
  160. package/dist/translations/ko.umd.js +1 -1
  161. package/dist/translations/ku.js +1 -1
  162. package/dist/translations/ku.umd.js +1 -1
  163. package/dist/translations/lt.js +1 -1
  164. package/dist/translations/lt.umd.js +1 -1
  165. package/dist/translations/lv.js +1 -1
  166. package/dist/translations/lv.umd.js +1 -1
  167. package/dist/translations/ms.js +1 -1
  168. package/dist/translations/ms.umd.js +1 -1
  169. package/dist/translations/nb.js +1 -1
  170. package/dist/translations/nb.umd.js +1 -1
  171. package/dist/translations/ne.js +1 -1
  172. package/dist/translations/ne.umd.js +1 -1
  173. package/dist/translations/nl.js +1 -1
  174. package/dist/translations/nl.umd.js +1 -1
  175. package/dist/translations/no.js +1 -1
  176. package/dist/translations/no.umd.js +1 -1
  177. package/dist/translations/oc.js +1 -1
  178. package/dist/translations/oc.umd.js +1 -1
  179. package/dist/translations/pl.js +1 -1
  180. package/dist/translations/pl.umd.js +1 -1
  181. package/dist/translations/pt-br.js +1 -1
  182. package/dist/translations/pt-br.umd.js +1 -1
  183. package/dist/translations/pt.js +1 -1
  184. package/dist/translations/pt.umd.js +1 -1
  185. package/dist/translations/ro.js +1 -1
  186. package/dist/translations/ro.umd.js +1 -1
  187. package/dist/translations/ru.js +1 -1
  188. package/dist/translations/ru.umd.js +1 -1
  189. package/dist/translations/si.js +1 -1
  190. package/dist/translations/si.umd.js +1 -1
  191. package/dist/translations/sk.js +1 -1
  192. package/dist/translations/sk.umd.js +1 -1
  193. package/dist/translations/sl.js +1 -1
  194. package/dist/translations/sl.umd.js +1 -1
  195. package/dist/translations/sq.js +1 -1
  196. package/dist/translations/sq.umd.js +1 -1
  197. package/dist/translations/sr-latn.js +1 -1
  198. package/dist/translations/sr-latn.umd.js +1 -1
  199. package/dist/translations/sr.js +1 -1
  200. package/dist/translations/sr.umd.js +1 -1
  201. package/dist/translations/sv.js +1 -1
  202. package/dist/translations/sv.umd.js +1 -1
  203. package/dist/translations/th.js +1 -1
  204. package/dist/translations/th.umd.js +1 -1
  205. package/dist/translations/ti.js +1 -1
  206. package/dist/translations/ti.umd.js +1 -1
  207. package/dist/translations/tk.js +1 -1
  208. package/dist/translations/tk.umd.js +1 -1
  209. package/dist/translations/tr.js +1 -1
  210. package/dist/translations/tr.umd.js +1 -1
  211. package/dist/translations/tt.js +1 -1
  212. package/dist/translations/tt.umd.js +1 -1
  213. package/dist/translations/ug.js +1 -1
  214. package/dist/translations/ug.umd.js +1 -1
  215. package/dist/translations/uk.js +1 -1
  216. package/dist/translations/uk.umd.js +1 -1
  217. package/dist/translations/ur.js +1 -1
  218. package/dist/translations/ur.umd.js +1 -1
  219. package/dist/translations/uz.js +1 -1
  220. package/dist/translations/uz.umd.js +1 -1
  221. package/dist/translations/vi.js +1 -1
  222. package/dist/translations/vi.umd.js +1 -1
  223. package/dist/translations/zh-cn.js +1 -1
  224. package/dist/translations/zh-cn.umd.js +1 -1
  225. package/dist/translations/zh.js +1 -1
  226. package/dist/translations/zh.umd.js +1 -1
  227. package/lang/translations/af.po +28 -0
  228. package/lang/translations/ar.po +28 -0
  229. package/lang/translations/ast.po +28 -0
  230. package/lang/translations/az.po +28 -0
  231. package/lang/translations/be.po +28 -0
  232. package/lang/translations/bg.po +28 -0
  233. package/lang/translations/bn.po +28 -0
  234. package/lang/translations/bs.po +28 -0
  235. package/lang/translations/ca.po +28 -0
  236. package/lang/translations/cs.po +28 -0
  237. package/lang/translations/da.po +28 -0
  238. package/lang/translations/de-ch.po +28 -0
  239. package/lang/translations/de.po +28 -0
  240. package/lang/translations/el.po +28 -0
  241. package/lang/translations/en-au.po +28 -0
  242. package/lang/translations/en-gb.po +28 -0
  243. package/lang/translations/en.po +28 -0
  244. package/lang/translations/eo.po +28 -0
  245. package/lang/translations/es-co.po +28 -0
  246. package/lang/translations/es.po +28 -0
  247. package/lang/translations/et.po +28 -0
  248. package/lang/translations/eu.po +28 -0
  249. package/lang/translations/fa.po +28 -0
  250. package/lang/translations/fi.po +28 -0
  251. package/lang/translations/fr.po +28 -0
  252. package/lang/translations/gl.po +28 -0
  253. package/lang/translations/gu.po +28 -0
  254. package/lang/translations/he.po +28 -0
  255. package/lang/translations/hi.po +28 -0
  256. package/lang/translations/hr.po +28 -0
  257. package/lang/translations/hu.po +28 -0
  258. package/lang/translations/hy.po +28 -0
  259. package/lang/translations/id.po +28 -0
  260. package/lang/translations/it.po +28 -0
  261. package/lang/translations/ja.po +28 -0
  262. package/lang/translations/jv.po +28 -0
  263. package/lang/translations/kk.po +28 -0
  264. package/lang/translations/km.po +28 -0
  265. package/lang/translations/kn.po +28 -0
  266. package/lang/translations/ko.po +28 -0
  267. package/lang/translations/ku.po +28 -0
  268. package/lang/translations/lt.po +28 -0
  269. package/lang/translations/lv.po +28 -0
  270. package/lang/translations/ms.po +28 -0
  271. package/lang/translations/nb.po +28 -0
  272. package/lang/translations/ne.po +28 -0
  273. package/lang/translations/nl.po +28 -0
  274. package/lang/translations/no.po +28 -0
  275. package/lang/translations/oc.po +28 -0
  276. package/lang/translations/pl.po +28 -0
  277. package/lang/translations/pt-br.po +28 -0
  278. package/lang/translations/pt.po +28 -0
  279. package/lang/translations/ro.po +28 -0
  280. package/lang/translations/ru.po +28 -0
  281. package/lang/translations/si.po +28 -0
  282. package/lang/translations/sk.po +28 -0
  283. package/lang/translations/sl.po +28 -0
  284. package/lang/translations/sq.po +28 -0
  285. package/lang/translations/sr-latn.po +28 -0
  286. package/lang/translations/sr.po +28 -0
  287. package/lang/translations/sv.po +28 -0
  288. package/lang/translations/th.po +28 -0
  289. package/lang/translations/ti.po +28 -0
  290. package/lang/translations/tk.po +28 -0
  291. package/lang/translations/tr.po +28 -0
  292. package/lang/translations/tt.po +28 -0
  293. package/lang/translations/ug.po +28 -0
  294. package/lang/translations/uk.po +28 -0
  295. package/lang/translations/ur.po +28 -0
  296. package/lang/translations/uz.po +28 -0
  297. package/lang/translations/vi.po +28 -0
  298. package/lang/translations/zh-cn.po +28 -0
  299. package/lang/translations/zh.po +28 -0
  300. package/package.json +9 -9
  301. package/src/converters/tableproperties.d.ts +5 -1
  302. package/src/converters/tableproperties.js +27 -5
  303. package/src/tablecellproperties/commands/tablecellpropertycommand.d.ts +11 -1
  304. package/src/tablecellproperties/commands/tablecellpropertycommand.js +32 -2
  305. package/src/tablecellproperties/tablecellpropertiesediting.js +13 -9
  306. package/src/tablecellproperties/tablecellpropertiesui.d.ts +13 -1
  307. package/src/tablecellproperties/tablecellpropertiesui.js +36 -9
  308. package/src/tablecolumnresize/tablecolumnresizeediting.d.ts +28 -0
  309. package/src/tablecolumnresize/tablecolumnresizeediting.js +81 -2
  310. package/src/tablelayout.d.ts +1 -1
  311. package/src/tablelayout.js +1 -1
  312. package/src/tableproperties/commands/tablepropertycommand.d.ts +11 -1
  313. package/src/tableproperties/commands/tablepropertycommand.js +15 -1
  314. package/src/tableproperties/tablepropertiesediting.js +53 -12
  315. package/src/tableproperties/tablepropertiesui.d.ts +13 -1
  316. package/src/tableproperties/tablepropertiesui.js +30 -8
  317. package/src/tableproperties/ui/tablepropertiesview.d.ts +2 -2
  318. package/src/utils/table-properties.d.ts +3 -3
  319. package/src/utils/ui/table-properties.js +7 -1
  320. package/theme/tablecolumnresize.css +0 -10
  321. package/theme/tablelayout.css +13 -1
@@ -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,
@@ -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
  }
@@ -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-layout Layout table feature documentation}.
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
  /**
@@ -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-layout Layout table feature documentation}.
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
  /**
@@ -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
- protected readonly _defaultValue: string | undefined;
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._defaultValue = defaultValue;
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
  }
@@ -8,7 +8,7 @@
8
8
  import { Plugin } from 'ckeditor5/src/core.js';
9
9
  import { addBackgroundRules, addBorderRules } from 'ckeditor5/src/engine.js';
10
10
  import TableEditing from '../tableediting.js';
11
- import { downcastAttributeToStyle, downcastTableAttribute, upcastBorderStyles, upcastStyleToAttribute } from '../converters/tableproperties.js';
11
+ import { downcastAttributeToStyle, downcastTableAttribute, getDefaultValueAdjusted, upcastBorderStyles, upcastStyleToAttribute } from '../converters/tableproperties.js';
12
12
  import TableBackgroundColorCommand from './commands/tablebackgroundcolorcommand.js';
13
13
  import TableBorderColorCommand from './commands/tablebordercolorcommand.js';
14
14
  import TableBorderStyleCommand from './commands/tableborderstylecommand.js';
@@ -133,15 +133,36 @@ function enableAlignmentProperty(schema, conversion, defaultValue) {
133
133
  .attributeToAttribute({
134
134
  model: {
135
135
  name: 'table',
136
- key: 'tableAlignment'
136
+ key: 'tableAlignment',
137
+ values: ['left', 'center', 'right']
137
138
  },
138
- view: alignment => ({
139
- key: 'style',
140
- value: {
141
- // Model: `alignment:center` => CSS: `float:none`.
142
- float: alignment === 'center' ? 'none' : alignment
139
+ view: {
140
+ left: {
141
+ key: 'style',
142
+ value: {
143
+ float: 'left'
144
+ }
145
+ },
146
+ right: {
147
+ key: 'style',
148
+ value: {
149
+ float: 'right'
150
+ }
151
+ },
152
+ center: (alignment, conversionApi, data) => {
153
+ const value = data.item.getAttribute('tableType') !== 'layout' ? {
154
+ // Model: `alignment:center` => CSS: `float:none`.
155
+ float: 'none'
156
+ } : {
157
+ 'margin-left': 'auto',
158
+ 'margin-right': 'auto'
159
+ };
160
+ return {
161
+ key: 'style',
162
+ value
163
+ };
143
164
  }
144
- }),
165
+ },
145
166
  converterPriority: 'high'
146
167
  });
147
168
  conversion.for('upcast')
@@ -155,13 +176,32 @@ function enableAlignmentProperty(schema, conversion, defaultValue) {
155
176
  },
156
177
  model: {
157
178
  key: 'tableAlignment',
158
- value: (viewElement) => {
179
+ value: (viewElement, conversionApi, data) => {
180
+ const localDefaultValue = getDefaultValueAdjusted(defaultValue, '', data);
159
181
  let align = viewElement.getStyle('float');
160
182
  // CSS: `float:none` => Model: `alignment:center`.
161
183
  if (align === 'none') {
162
184
  align = 'center';
163
185
  }
164
- return align === defaultValue ? null : align;
186
+ return align === localDefaultValue ? null : align;
187
+ }
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;
165
205
  }
166
206
  }
167
207
  })
@@ -175,9 +215,10 @@ function enableAlignmentProperty(schema, conversion, defaultValue) {
175
215
  model: {
176
216
  name: 'table',
177
217
  key: 'tableAlignment',
178
- value: (viewElement) => {
218
+ value: (viewElement, conversionApi, data) => {
219
+ const localDefaultValue = getDefaultValueAdjusted(defaultValue, '', data);
179
220
  const align = viewElement.getAttribute('align');
180
- return align === defaultValue ? null : align;
221
+ return align === localDefaultValue ? null : align;
181
222
  }
182
223
  }
183
224
  });
@@ -18,7 +18,11 @@ export default class TablePropertiesUI extends Plugin {
18
18
  /**
19
19
  * The default table properties.
20
20
  */
21
- private _defaultTableProperties;
21
+ private _defaultContentTableProperties;
22
+ /**
23
+ * The default layout table properties.
24
+ */
25
+ private _defaultLayoutTableProperties;
22
26
  /**
23
27
  * The contextual balloon plugin instance.
24
28
  */
@@ -27,6 +31,14 @@ export default class TablePropertiesUI extends Plugin {
27
31
  * The properties form view displayed inside the balloon.
28
32
  */
29
33
  view: TablePropertiesView | null;
34
+ /**
35
+ * The properties form view displayed inside the balloon (content table).
36
+ */
37
+ private _viewWithContentTableDefaults;
38
+ /**
39
+ * The 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.
@@ -13,7 +13,7 @@ import TablePropertiesView from './ui/tablepropertiesview.js';
13
13
  import { colorFieldValidator, getLocalizedColorErrorText, getLocalizedLengthErrorText, lengthFieldValidator, lineWidthFieldValidator, defaultColors } from '../utils/ui/table-properties.js';
14
14
  import { getSelectionAffectedTableWidget } from '../utils/ui/widget.js';
15
15
  import { getBalloonTablePositionData, repositionContextualBalloon } from '../utils/ui/contextualballoon.js';
16
- import { getNormalizedDefaultTableProperties } from '../utils/table-properties.js';
16
+ import { getNormalizedDefaultProperties, getNormalizedDefaultTableProperties } 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 = {
@@ -35,7 +35,11 @@ export default class TablePropertiesUI extends Plugin {
35
35
  /**
36
36
  * The default table properties.
37
37
  */
38
- _defaultTableProperties;
38
+ _defaultContentTableProperties;
39
+ /**
40
+ * The default layout table properties.
41
+ */
42
+ _defaultLayoutTableProperties;
39
43
  /**
40
44
  * The contextual balloon plugin instance.
41
45
  */
@@ -44,6 +48,14 @@ export default class TablePropertiesUI extends Plugin {
44
48
  * The properties form view displayed inside the balloon.
45
49
  */
46
50
  view = null;
51
+ /**
52
+ * The properties form view displayed inside the balloon (content table).
53
+ */
54
+ _viewWithContentTableDefaults = null;
55
+ /**
56
+ * The properties form view displayed inside the balloon (layout table).
57
+ */
58
+ _viewWithLayoutTableDefaults = null;
47
59
  /**
48
60
  * The batch used to undo all changes made by the form (which are live, as the user types)
49
61
  * when "Cancel" was pressed. Each time the view is shown, a new batch is created.
@@ -87,9 +99,10 @@ export default class TablePropertiesUI extends Plugin {
87
99
  */
88
100
  init() {
89
101
  const editor = this.editor;
90
- this._defaultTableProperties = getNormalizedDefaultTableProperties(editor.config.get('table.tableProperties.defaultProperties'), {
102
+ this._defaultContentTableProperties = getNormalizedDefaultTableProperties(editor.config.get('table.tableProperties.defaultProperties'), {
91
103
  includeAlignmentProperty: true
92
104
  });
105
+ this._defaultLayoutTableProperties = getNormalizedDefaultProperties();
93
106
  this._balloon = editor.plugins.get(ContextualBalloon);
94
107
  editor.ui.componentFactory.add('tableProperties', () => this._createTablePropertiesButton());
95
108
  }
@@ -129,7 +142,7 @@ export default class TablePropertiesUI extends Plugin {
129
142
  *
130
143
  * @returns The table properties form view instance.
131
144
  */
132
- _createPropertiesView() {
145
+ _createPropertiesView(defaultTableProperties) {
133
146
  const editor = this.editor;
134
147
  const config = editor.config.get('table.tableProperties');
135
148
  const borderColorsConfig = normalizeColorOptions(config.borderColors);
@@ -140,7 +153,7 @@ export default class TablePropertiesUI extends Plugin {
140
153
  const view = new TablePropertiesView(editor.locale, {
141
154
  borderColors: localizedBorderColors,
142
155
  backgroundColors: localizedBackgroundColors,
143
- defaultTableProperties: this._defaultTableProperties,
156
+ defaultTableProperties,
144
157
  colorPickerConfig: hasColorPicker ? (config.colorPicker || {}) : false
145
158
  });
146
159
  const t = editor.t;
@@ -223,7 +236,9 @@ export default class TablePropertiesUI extends Plugin {
223
236
  Object.entries(propertyToCommandMap)
224
237
  .map(([property, commandName]) => {
225
238
  const propertyKey = property;
226
- const defaultValue = this._defaultTableProperties[propertyKey] || '';
239
+ const defaultValue = this.view === this._viewWithContentTableDefaults ?
240
+ this._defaultContentTableProperties[propertyKey] || '' :
241
+ this._defaultLayoutTableProperties[propertyKey] || '';
227
242
  return [propertyKey, (commands.get(commandName).value || defaultValue)];
228
243
  })
229
244
  .forEach(([property, value]) => {
@@ -244,9 +259,16 @@ export default class TablePropertiesUI extends Plugin {
244
259
  */
245
260
  _showView() {
246
261
  const editor = this.editor;
247
- if (!this.view) {
248
- this.view = this._createPropertiesView();
262
+ const viewTable = getSelectionAffectedTableWidget(editor.editing.view.document.selection);
263
+ const modelTable = viewTable && editor.editing.mapper.toModelElement(viewTable);
264
+ const useDefaults = !modelTable || modelTable.getAttribute('tableType') !== 'layout';
265
+ if (useDefaults && !this._viewWithContentTableDefaults) {
266
+ this._viewWithContentTableDefaults = this._createPropertiesView(this._defaultContentTableProperties);
267
+ }
268
+ else if (!useDefaults && !this._viewWithLayoutTableDefaults) {
269
+ this._viewWithLayoutTableDefaults = this._createPropertiesView(this._defaultLayoutTableProperties);
249
270
  }
271
+ this.view = useDefaults ? this._viewWithContentTableDefaults : this._viewWithLayoutTableDefaults;
250
272
  this.listenTo(editor.ui, 'update', () => {
251
273
  this._updateView();
252
274
  });