@ckeditor/ckeditor5-table 0.0.0-nightly-20251218.0 → 0.0.0-nightly-next-20251218.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 (112) 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 +11 -2
  75. package/dist/index-content.css +30 -30
  76. package/dist/index-editor.css +104 -170
  77. package/dist/index.css +147 -237
  78. package/dist/index.css.map +1 -1
  79. package/dist/index.js +303 -2395
  80. package/dist/index.js.map +1 -1
  81. package/lang/contexts.json +0 -4
  82. package/package.json +9 -9
  83. package/src/augmentation.d.ts +0 -15
  84. package/src/converters/downcast.js +3 -12
  85. package/src/index.d.ts +0 -4
  86. package/src/index.js +0 -5
  87. package/src/tablecellproperties/tablecellpropertiesediting.js +2 -4
  88. package/src/tablecellproperties/tablecellpropertiesui.js +30 -10
  89. package/src/tablecellproperties/ui/tablecellpropertiesview.d.ts +35 -0
  90. package/src/tablecellproperties/ui/tablecellpropertiesview.js +137 -23
  91. package/src/tableconfig.d.ts +4 -4
  92. package/src/tableproperties/tablepropertiesediting.js +14 -147
  93. package/src/tableproperties/ui/tablepropertiesview.d.ts +8 -0
  94. package/src/tableproperties/ui/tablepropertiesview.js +59 -37
  95. package/src/utils/common.js +2 -3
  96. package/theme/formrow.css +2 -0
  97. package/theme/tableform.css +1 -5
  98. package/theme/tableproperties.css +60 -0
  99. package/src/tablecellproperties/tablecellpropertiesuiexperimental.d.ts +0 -128
  100. package/src/tablecellproperties/tablecellpropertiesuiexperimental.js +0 -408
  101. package/src/tablecellproperties/ui/tablecellpropertiesviewexperimental.d.ts +0 -266
  102. package/src/tablecellproperties/ui/tablecellpropertiesviewexperimental.js +0 -744
  103. package/src/tableproperties/tablepropertiesuiexperimental.d.ts +0 -136
  104. package/src/tableproperties/tablepropertiesuiexperimental.js +0 -375
  105. package/src/tableproperties/ui/tablepropertiesviewexperimental.d.ts +0 -216
  106. package/src/tableproperties/ui/tablepropertiesviewexperimental.js +0 -544
  107. package/src/utils/ui/table-propertiesexperimental.d.ts +0 -215
  108. package/src/utils/ui/table-propertiesexperimental.js +0 -391
  109. package/theme/formrow-experimental.css +0 -15
  110. package/theme/tablecellproperties-experimental.css +0 -4
  111. package/theme/tableform-experimental.css +0 -61
  112. package/theme/tableproperties-experimental.css +0 -78
@@ -79,7 +79,7 @@ export class TablePropertiesEditing extends Plugin {
79
79
  const defaultTableProperties = getNormalizedDefaultTableProperties(editor.config.get('table.tableProperties.defaultProperties'), {
80
80
  includeAlignmentProperty: true
81
81
  });
82
- const useInlineStyles = editor.config.get('table.tableProperties.alignment.useInlineStyles') !== false;
82
+ const useInlineStyles = editor.config.get('table.tableProperties.alignment.useInlineStyles') === true;
83
83
  editor.data.addStyleProcessorRules(addMarginStylesRules);
84
84
  editor.data.addStyleProcessorRules(addBorderStylesRules);
85
85
  enableBorderProperties(editor, {
@@ -90,12 +90,7 @@ export class TablePropertiesEditing extends Plugin {
90
90
  editor.commands.add('tableBorderColor', new TableBorderColorCommand(editor, defaultTableProperties.borderColor));
91
91
  editor.commands.add('tableBorderStyle', new TableBorderStyleCommand(editor, defaultTableProperties.borderStyle));
92
92
  editor.commands.add('tableBorderWidth', new TableBorderWidthCommand(editor, defaultTableProperties.borderWidth));
93
- if (editor.config.get('experimentalFlags.useExtendedTableBlockAlignment')) {
94
- enableExtendedAlignmentProperty(schema, conversion, defaultTableProperties.alignment, useInlineStyles);
95
- }
96
- else {
97
- enableAlignmentProperty(schema, conversion, defaultTableProperties.alignment);
98
- }
93
+ enableAlignmentProperty(schema, conversion, defaultTableProperties.alignment, useInlineStyles);
99
94
  editor.commands.add('tableAlignment', new TableAlignmentCommand(editor, defaultTableProperties.alignment));
100
95
  enableTableToFigureProperty(schema, conversion, {
101
96
  modelAttribute: 'tableWidth',
@@ -122,18 +117,16 @@ export class TablePropertiesEditing extends Plugin {
122
117
  defaultValue: defaultTableProperties.backgroundColor
123
118
  });
124
119
  editor.commands.add('tableBackgroundColor', new TableBackgroundColorCommand(editor, defaultTableProperties.backgroundColor));
125
- if (editor.config.get('experimentalFlags.useExtendedTableBlockAlignment')) {
126
- const viewDoc = editor.editing.view.document;
127
- // Adjust clipboard output to wrap tables in divs if needed (for alignment).
128
- this.listenTo(viewDoc, 'clipboardOutput', (evt, data) => {
129
- editor.editing.view.change(writer => {
130
- for (const { item } of writer.createRangeIn(data.content)) {
131
- wrapInDivIfNeeded(item, writer);
132
- }
133
- data.dataTransfer.setData('text/html', this.editor.data.htmlProcessor.toData(data.content));
134
- });
135
- }, { priority: 'lowest' });
136
- }
120
+ const viewDoc = editor.editing.view.document;
121
+ // Adjust clipboard output to wrap tables in divs if needed (for alignment).
122
+ this.listenTo(viewDoc, 'clipboardOutput', (evt, data) => {
123
+ editor.editing.view.change(writer => {
124
+ for (const { item } of writer.createRangeIn(data.content)) {
125
+ wrapInDivIfNeeded(item, writer);
126
+ }
127
+ data.dataTransfer.setData('text/html', this.editor.data.htmlProcessor.toData(data.content));
128
+ });
129
+ }, { priority: 'lowest' });
137
130
  }
138
131
  }
139
132
  /**
@@ -194,11 +187,11 @@ function enableBorderProperties(editor, defaultBorder) {
194
187
  downcastTableAttribute(conversion, { modelAttribute: modelAttributes.width, styleName: 'border-width' });
195
188
  }
196
189
  /**
197
- * Enables the extended block`'alignment'` attribute for table.
190
+ * Enables the `'alignment'` attribute for table.
198
191
  *
199
192
  * @param defaultValue The default alignment value.
200
193
  */
201
- function enableExtendedAlignmentProperty(schema, conversion, defaultValue, useInlineStyles) {
194
+ function enableAlignmentProperty(schema, conversion, defaultValue, useInlineStyles) {
202
195
  schema.extend('table', {
203
196
  allowAttributes: ['tableAlignment']
204
197
  });
@@ -289,132 +282,6 @@ function enableExtendedAlignmentProperty(schema, conversion, defaultValue, useIn
289
282
  });
290
283
  conversion.for('upcast').add(upcastTableAlignedDiv(defaultValue));
291
284
  }
292
- /**
293
- * Enables the `'alignment'` attribute for table.
294
- *
295
- * @param defaultValue The default alignment value.
296
- */
297
- function enableAlignmentProperty(schema, conversion, defaultValue) {
298
- const ALIGN_VALUES_REG_EXP = /^(left|center|right)$/;
299
- const FLOAT_VALUES_REG_EXP = /^(left|none|right)$/;
300
- schema.extend('table', {
301
- allowAttributes: ['tableAlignment']
302
- });
303
- schema.setAttributeProperties('tableAlignment', { isFormatting: true });
304
- conversion.for('downcast')
305
- .attributeToAttribute({
306
- model: {
307
- name: 'table',
308
- key: 'tableAlignment',
309
- values: ['left', 'center', 'right']
310
- },
311
- view: {
312
- left: {
313
- key: 'style',
314
- value: {
315
- float: 'left'
316
- }
317
- },
318
- right: {
319
- key: 'style',
320
- value: {
321
- float: 'right'
322
- }
323
- },
324
- center: (alignment, conversionApi, data) => {
325
- const value = data.item.getAttribute('tableType') !== 'layout' ? {
326
- // Model: `alignment:center` => CSS: `float:none`.
327
- float: 'none'
328
- } : {
329
- 'margin-left': 'auto',
330
- 'margin-right': 'auto'
331
- };
332
- return {
333
- key: 'style',
334
- value
335
- };
336
- }
337
- },
338
- converterPriority: 'high'
339
- });
340
- conversion.for('upcast')
341
- // Support for the `float:*;` CSS definition for the table alignment.
342
- .attributeToAttribute({
343
- view: {
344
- name: /^(table|figure)$/,
345
- styles: {
346
- float: FLOAT_VALUES_REG_EXP
347
- }
348
- },
349
- model: {
350
- key: 'tableAlignment',
351
- value: (viewElement, conversionApi, data) => {
352
- // Ignore other figure elements.
353
- if (viewElement.name == 'figure' && !viewElement.hasClass('table')) {
354
- return;
355
- }
356
- const localDefaultValue = getDefaultValueAdjusted(defaultValue, '', data);
357
- let align = viewElement.getStyle('float');
358
- // CSS: `float:none` => Model: `alignment:center`.
359
- if (align === 'none') {
360
- align = 'center';
361
- }
362
- if (align !== localDefaultValue) {
363
- return align;
364
- }
365
- // Consume the style even if not applied to the element so it won't be processed by other converters.
366
- conversionApi.consumable.consume(viewElement, { styles: 'float' });
367
- }
368
- }
369
- })
370
- // Support for the `margin-left:auto; margin-right:auto;` CSS definition for the table alignment.
371
- .attributeToAttribute({
372
- view: {
373
- name: /^(table|figure)$/,
374
- styles: {
375
- 'margin-left': 'auto',
376
- 'margin-right': 'auto'
377
- }
378
- },
379
- model: {
380
- key: 'tableAlignment',
381
- value: (viewElement, conversionApi, data) => {
382
- // Ignore other figure elements.
383
- if (viewElement.name == 'figure' && !viewElement.hasClass('table')) {
384
- return;
385
- }
386
- const localDefaultValue = getDefaultValueAdjusted(defaultValue, '', data);
387
- const align = 'center';
388
- if (align !== localDefaultValue) {
389
- return align;
390
- }
391
- // Consume the styles even if not applied to the element so it won't be processed by other converters.
392
- conversionApi.consumable.consume(viewElement, { styles: ['margin-left', 'margin-right'] });
393
- }
394
- }
395
- })
396
- // Support for the `align` attribute as the backward compatibility while pasting from other sources.
397
- .attributeToAttribute({
398
- view: {
399
- name: 'table',
400
- attributes: {
401
- align: ALIGN_VALUES_REG_EXP
402
- }
403
- },
404
- model: {
405
- key: 'tableAlignment',
406
- value: (viewElement, conversionApi, data) => {
407
- const localDefaultValue = getDefaultValueAdjusted(defaultValue, '', data);
408
- const align = viewElement.getAttribute('align');
409
- if (align !== localDefaultValue) {
410
- return align;
411
- }
412
- // Consume the attribute even if not applied to the element so it won't be processed by other converters.
413
- conversionApi.consumable.consume(viewElement, { attributes: 'align' });
414
- }
415
- }
416
- });
417
- }
418
285
  /**
419
286
  * Returns a function that converts the table view representation:
420
287
  *
@@ -142,6 +142,10 @@ export declare class TablePropertiesView extends View {
142
142
  * The "Cancel" button view.
143
143
  */
144
144
  cancelButtonView: ButtonView;
145
+ /**
146
+ * The Back button view displayed in the header.
147
+ */
148
+ backButtonView: ButtonView;
145
149
  /**
146
150
  * A collection of views that can be focused in the form.
147
151
  */
@@ -201,6 +205,10 @@ export declare class TablePropertiesView extends View {
201
205
  * * {@link #cancelButtonView}.
202
206
  */
203
207
  private _createActionButtons;
208
+ /**
209
+ * Creates a back button view that cancels the form.
210
+ */
211
+ private _createBackButton;
204
212
  /**
205
213
  * Provides localized labels for {@link #alignmentToolbar} buttons.
206
214
  */
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { addListToDropdown, ButtonView, createLabeledDropdown, createLabeledInputText, FocusCycler, FormRowView, FormHeaderView, LabeledFieldView, LabelView, submitHandler, ToolbarView, View, ViewCollection } from 'ckeditor5/src/ui.js';
9
9
  import { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils.js';
10
- import { IconCancel, IconCheck, IconObjectCenter, IconObjectInlineLeft, IconObjectInlineRight } from 'ckeditor5/src/icons.js';
10
+ import { IconObjectCenter, IconObjectInlineLeft, IconObjectInlineRight, IconObjectLeft, IconObjectRight, IconPreviousArrow } from 'ckeditor5/src/icons.js';
11
11
  import { fillToolbar, getBorderStyleDefinitions, getBorderStyleLabels, getLabeledColorInputCreator } from '../../utils/ui/table-properties.js';
12
12
  // eslint-disable-next-line ckeditor5-rules/ckeditor-imports
13
13
  import '@ckeditor/ckeditor5-ui/theme/components/form/form.css';
@@ -71,6 +71,10 @@ export class TablePropertiesView extends View {
71
71
  * The "Cancel" button view.
72
72
  */
73
73
  cancelButtonView;
74
+ /**
75
+ * The Back button view displayed in the header.
76
+ */
77
+ backButtonView;
74
78
  /**
75
79
  * A collection of views that can be focused in the form.
76
80
  */
@@ -115,6 +119,7 @@ export class TablePropertiesView extends View {
115
119
  const { saveButtonView, cancelButtonView } = this._createActionButtons();
116
120
  this.saveButtonView = saveButtonView;
117
121
  this.cancelButtonView = cancelButtonView;
122
+ this.backButtonView = this._createBackButton();
118
123
  this._focusables = new ViewCollection();
119
124
  this._focusCycler = new FocusCycler({
120
125
  focusables: this._focusables,
@@ -128,29 +133,22 @@ export class TablePropertiesView extends View {
128
133
  }
129
134
  });
130
135
  // Form header.
131
- this.children.add(new FormHeaderView(locale, {
136
+ const headerView = new FormHeaderView(locale, {
132
137
  label: this.t('Table properties')
133
- }));
138
+ });
139
+ headerView.children.add(this.backButtonView, 0);
140
+ this.children.add(headerView);
134
141
  // Border row.
135
142
  this.children.add(new FormRowView(locale, {
136
143
  labelView: borderRowLabel,
137
144
  children: [
138
145
  borderRowLabel,
139
146
  borderStyleDropdown,
140
- borderColorInput,
141
- borderWidthInput
147
+ borderWidthInput,
148
+ borderColorInput
142
149
  ],
143
150
  class: 'ck-table-form__border-row'
144
151
  }));
145
- // Background row.
146
- this.children.add(new FormRowView(locale, {
147
- labelView: backgroundRowLabel,
148
- children: [
149
- backgroundRowLabel,
150
- backgroundInput
151
- ],
152
- class: 'ck-table-form__background-row'
153
- }));
154
152
  this.children.add(new FormRowView(locale, {
155
153
  children: [
156
154
  // Dimensions row.
@@ -164,22 +162,31 @@ export class TablePropertiesView extends View {
164
162
  ],
165
163
  class: 'ck-table-form__dimensions-row'
166
164
  }),
167
- // Alignment row.
165
+ // Background row.
168
166
  new FormRowView(locale, {
169
- labelView: alignmentLabel,
167
+ labelView: backgroundRowLabel,
170
168
  children: [
171
- alignmentLabel,
172
- alignmentToolbar
169
+ backgroundRowLabel,
170
+ backgroundInput
173
171
  ],
174
- class: 'ck-table-properties-form__alignment-row'
172
+ class: 'ck-table-form__background-row'
175
173
  })
176
174
  ]
177
175
  }));
176
+ // Alignment row.
177
+ this.children.add(new FormRowView(locale, {
178
+ labelView: alignmentLabel,
179
+ children: [
180
+ alignmentLabel,
181
+ alignmentToolbar
182
+ ],
183
+ class: 'ck-table-properties-form__alignment-row'
184
+ }));
178
185
  // Action row.
179
186
  this.children.add(new FormRowView(locale, {
180
187
  children: [
181
- this.saveButtonView,
182
- this.cancelButtonView
188
+ this.cancelButtonView,
189
+ this.saveButtonView
183
190
  ],
184
191
  class: 'ck-table-form__action-row'
185
192
  }));
@@ -214,14 +221,15 @@ export class TablePropertiesView extends View {
214
221
  });
215
222
  [
216
223
  this.borderStyleDropdown,
217
- this.borderColorInput,
218
224
  this.borderWidthInput,
219
- this.backgroundInput,
225
+ this.borderColorInput,
220
226
  this.widthInput,
221
227
  this.heightInput,
228
+ this.backgroundInput,
222
229
  this.alignmentToolbar,
230
+ this.cancelButtonView,
223
231
  this.saveButtonView,
224
- this.cancelButtonView
232
+ this.backButtonView
225
233
  ].forEach(view => {
226
234
  // Register the view as focusable.
227
235
  this._focusables.add(view);
@@ -433,7 +441,7 @@ export class TablePropertiesView extends View {
433
441
  const t = this.t;
434
442
  // -- Label ---------------------------------------------------
435
443
  const alignmentLabel = new LabelView(locale);
436
- alignmentLabel.text = t('Alignment');
444
+ alignmentLabel.text = t('Table Alignment');
437
445
  // -- Toolbar ---------------------------------------------------
438
446
  const alignmentToolbar = new ToolbarView(locale);
439
447
  alignmentToolbar.set({
@@ -446,7 +454,9 @@ export class TablePropertiesView extends View {
446
454
  icons: {
447
455
  left: IconObjectInlineLeft,
448
456
  center: IconObjectCenter,
449
- right: IconObjectInlineRight
457
+ right: IconObjectInlineRight,
458
+ blockLeft: IconObjectLeft,
459
+ blockRight: IconObjectRight
450
460
  },
451
461
  toolbar: alignmentToolbar,
452
462
  labels: this._alignmentLabels,
@@ -478,8 +488,7 @@ export class TablePropertiesView extends View {
478
488
  ];
479
489
  saveButtonView.set({
480
490
  label: t('Save'),
481
- icon: IconCheck,
482
- class: 'ck-button-save',
491
+ class: 'ck-button-action',
483
492
  type: 'submit',
484
493
  withText: true
485
494
  });
@@ -488,8 +497,6 @@ export class TablePropertiesView extends View {
488
497
  });
489
498
  cancelButtonView.set({
490
499
  label: t('Cancel'),
491
- icon: IconCancel,
492
- class: 'ck-button-cancel',
493
500
  withText: true
494
501
  });
495
502
  cancelButtonView.delegate('execute').to(this, 'cancel');
@@ -497,22 +504,37 @@ export class TablePropertiesView extends View {
497
504
  saveButtonView, cancelButtonView
498
505
  };
499
506
  }
507
+ /**
508
+ * Creates a back button view that cancels the form.
509
+ */
510
+ _createBackButton() {
511
+ const t = this.locale.t;
512
+ const backButton = new ButtonView(this.locale);
513
+ backButton.set({
514
+ class: 'ck-button-back',
515
+ label: t('Back'),
516
+ icon: IconPreviousArrow,
517
+ tooltip: true
518
+ });
519
+ backButton.delegate('execute').to(this, 'cancel');
520
+ return backButton;
521
+ }
500
522
  /**
501
523
  * Provides localized labels for {@link #alignmentToolbar} buttons.
502
524
  */
503
525
  get _alignmentLabels() {
504
526
  const locale = this.locale;
505
527
  const t = this.t;
506
- const left = t('Align table to the left');
507
- const center = t('Center table');
508
- const right = t('Align table to the right');
528
+ const blockLeft = t('Align table to the left with no text wrapping');
529
+ const blockRight = t('Align table to the right with no text wrapping');
530
+ const left = t('Align table to the left with text wrapping');
531
+ const center = t('Center table with no text wrapping');
532
+ const right = t('Align table to the right with text wrapping');
509
533
  // Returns object with a proper order of labels.
510
534
  if (locale.uiLanguageDirection === 'rtl') {
511
- return { right, center, left };
512
- }
513
- else {
514
- return { left, center, right };
535
+ return { right, left, blockRight, center, blockLeft };
515
536
  }
537
+ return { blockLeft, center, blockRight, left, right };
516
538
  }
517
539
  }
518
540
  function isBorderStyleSet(value) {
@@ -112,7 +112,6 @@ export function isEntireCellsLineHeader({ table, row, column }) {
112
112
  * @internal
113
113
  */
114
114
  export function isTableCellTypeEnabled(editor) {
115
- const { model, config } = editor;
116
- return (model.schema.checkAttribute('tableCell', 'tableCellType') &&
117
- config.get('experimentalFlags.tableCellTypeSupport') === true);
115
+ const { model } = editor;
116
+ return model.schema.checkAttribute('tableCell', 'tableCellType');
118
117
  }
package/theme/formrow.css CHANGED
@@ -5,6 +5,8 @@
5
5
 
6
6
  .ck.ck-form__row {
7
7
  &.ck-table-form__action-row {
8
+ justify-content: flex-end;
9
+
8
10
  & .ck-button-save,
9
11
  & .ck-button-cancel {
10
12
  justify-content: center;
@@ -25,15 +25,11 @@
25
25
  flex-grow: 0;
26
26
  }
27
27
  }
28
-
29
- & .ck-table-form__dimension-operator {
30
- flex-grow: 0;
31
- }
32
28
  }
33
29
 
34
30
  /* Ignore labels that work as fieldset legends */
35
31
  /* Fallback for table dimension operator */
36
- & > *:not(.ck-label, .ck-table-form__dimension-operator) {
32
+ &:not(.ck-table-form__action-row) > *:not(.ck-label, .ck-table-form__dimension-operator) {
37
33
  flex-grow: 1;
38
34
  }
39
35
  }
@@ -3,6 +3,10 @@
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
 
6
+ :root {
7
+ --ck-content-table-style-spacing: 1.5em;
8
+ }
9
+
6
10
  .ck.ck-table-properties-form {
7
11
  & .ck-form__row {
8
12
  &.ck-table-properties-form__alignment-row {
@@ -16,3 +20,59 @@
16
20
  }
17
21
  }
18
22
  }
23
+
24
+ .ck-content {
25
+ & .table {
26
+ &.table-style-align-left {
27
+ float: left;
28
+ margin-right: var(--ck-content-table-style-spacing);
29
+ }
30
+
31
+ &.table-style-align-right {
32
+ float: right;
33
+ margin-left: var(--ck-content-table-style-spacing);
34
+ }
35
+
36
+ &.table-style-align-center {
37
+ margin-left: auto;
38
+ margin-right: auto;
39
+ }
40
+
41
+ &.table-style-block-align-left {
42
+ margin-left: 0;
43
+ margin-right: auto;
44
+ }
45
+
46
+ &.table-style-block-align-right {
47
+ margin-left: auto;
48
+ margin-right: 0;
49
+ }
50
+ }
51
+ }
52
+
53
+ .ck-editor__editable {
54
+ & .table.layout-table {
55
+ &.table-style-align-center {
56
+ margin-left: auto;
57
+ margin-right: auto;
58
+ }
59
+
60
+ &.table-style-align-left {
61
+ margin-right: var(--ck-content-table-style-spacing);
62
+ }
63
+
64
+ &.table-style-align-right {
65
+ margin-left: var(--ck-content-table-style-spacing);
66
+ }
67
+
68
+ &.table-style-block-align-left {
69
+ margin-left: 0;
70
+ margin-right: auto;
71
+ }
72
+
73
+ &.table-style-block-align-right {
74
+ margin-left: auto;
75
+ margin-right: 0;
76
+ }
77
+ }
78
+ }
@@ -1,128 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- /**
6
- * @module table/tablecellproperties/tablecellpropertiesuiexperimental
7
- */
8
- import { Plugin, type Editor } from 'ckeditor5/src/core.js';
9
- import { ContextualBalloon } from 'ckeditor5/src/ui.js';
10
- import { TableCellPropertiesViewExperimental } from './ui/tablecellpropertiesviewexperimental.js';
11
- /**
12
- * The table cell properties UI plugin. It introduces the `'tableCellProperties'` button
13
- * that opens a form allowing to specify the visual styling of a table cell.
14
- *
15
- * It uses the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon contextual balloon plugin}.
16
- */
17
- export declare class TableCellPropertiesUIExperimental extends Plugin {
18
- /**
19
- * The default table cell properties.
20
- */
21
- private _defaultContentTableCellProperties;
22
- /**
23
- * The default layout table cell properties.
24
- */
25
- private _defaultLayoutTableCellProperties;
26
- /**
27
- * The contextual balloon plugin instance.
28
- */
29
- private _balloon?;
30
- /**
31
- * The cell properties form view displayed inside the balloon.
32
- */
33
- view?: TableCellPropertiesViewExperimental | 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?;
42
- /**
43
- * The batch used to undo all changes made by the form (which are live, as the user types)
44
- * when "Cancel" was pressed. Each time the view is shown, a new batch is created.
45
- */
46
- private _undoStepBatch?;
47
- /**
48
- * Flag used to indicate whether view is ready to execute update commands
49
- * (it finished loading initial data).
50
- */
51
- private _isReady?;
52
- /**
53
- * @inheritDoc
54
- */
55
- static get requires(): readonly [typeof ContextualBalloon];
56
- /**
57
- * @inheritDoc
58
- */
59
- static get pluginName(): "TableCellPropertiesUIExperimental";
60
- /**
61
- * @inheritDoc
62
- */
63
- static get isOfficialPlugin(): true;
64
- /**
65
- * @inheritDoc
66
- */
67
- constructor(editor: Editor);
68
- /**
69
- * @inheritDoc
70
- */
71
- init(): void;
72
- /**
73
- * @inheritDoc
74
- */
75
- destroy(): void;
76
- /**
77
- * Creates the {@link module:table/tablecellproperties/ui/tablecellpropertiesview~TableCellPropertiesView} instance.
78
- *
79
- * @returns The cell properties form view instance.
80
- */
81
- private _createPropertiesView;
82
- /**
83
- * In this method the "editor data -> UI" binding is happening.
84
- *
85
- * When executed, this method obtains selected cell property values from various table commands
86
- * and passes them to the {@link #view}.
87
- *
88
- * This way, the UI stays up–to–date with the editor data.
89
- */
90
- private _fillViewFormFromCommandValues;
91
- /**
92
- * Shows the {@link #view} in the {@link #_balloon}.
93
- *
94
- * **Note**: Each time a view is shown, a new {@link #_undoStepBatch} is created. It contains
95
- * all changes made to the document when the view is visible, allowing a single undo step
96
- * for all of them.
97
- */
98
- protected _showView(): void;
99
- /**
100
- * Removes the {@link #view} from the {@link #_balloon}.
101
- */
102
- protected _hideView(): void;
103
- /**
104
- * Repositions the {@link #_balloon} or hides the {@link #view} if a table cell is no longer selected.
105
- */
106
- protected _updateView(): void;
107
- /**
108
- * Returns `true` when the {@link #view} is visible in the {@link #_balloon}.
109
- */
110
- private get _isViewVisible();
111
- /**
112
- * Returns `true` when the {@link #view} is in the {@link #_balloon}.
113
- */
114
- private get _isViewInBalloon();
115
- /**
116
- * Creates a callback that when executed upon the {@link #view view's} property change
117
- * executes a related editor command with the new property value.
118
- *
119
- * @param commandName The default value of the command.
120
- */
121
- private _getPropertyChangeCallback;
122
- /**
123
- * Creates a callback that when executed upon the {@link #view view's} property change:
124
- * * Executes a related editor command with the new property value if the value is valid,
125
- * * Or sets the error text next to the invalid field, if the value did not pass the validation.
126
- */
127
- private _getValidatedPropertyChangeCallback;
128
- }