@ckeditor/ckeditor5-table 0.0.0-nightly-20251215.0 → 0.0.0-nightly-next-20251215.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 (108) 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 +10 -1
  75. package/dist/index-content.css +30 -30
  76. package/dist/index-editor.css +120 -194
  77. package/dist/index.css +167 -265
  78. package/dist/index.css.map +1 -1
  79. package/dist/index.js +150 -2221
  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 -7
  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/ui/tablecellpropertiesview.d.ts +8 -0
  88. package/src/tablecellproperties/ui/tablecellpropertiesview.js +30 -10
  89. package/src/tableconfig.d.ts +4 -4
  90. package/src/tableproperties/tablepropertiesediting.js +14 -147
  91. package/src/tableproperties/ui/tablepropertiesview.d.ts +8 -0
  92. package/src/tableproperties/ui/tablepropertiesview.js +59 -37
  93. package/theme/formrow.css +2 -0
  94. package/theme/tableform.css +1 -5
  95. package/theme/tableproperties.css +60 -0
  96. package/src/tablecellproperties/tablecellpropertiesuiexperimental.d.ts +0 -128
  97. package/src/tablecellproperties/tablecellpropertiesuiexperimental.js +0 -386
  98. package/src/tablecellproperties/ui/tablecellpropertiesviewexperimental.d.ts +0 -237
  99. package/src/tablecellproperties/ui/tablecellpropertiesviewexperimental.js +0 -633
  100. package/src/tableproperties/tablepropertiesuiexperimental.d.ts +0 -136
  101. package/src/tableproperties/tablepropertiesuiexperimental.js +0 -375
  102. package/src/tableproperties/ui/tablepropertiesviewexperimental.d.ts +0 -216
  103. package/src/tableproperties/ui/tablepropertiesviewexperimental.js +0 -544
  104. package/src/utils/ui/table-propertiesexperimental.d.ts +0 -215
  105. package/src/utils/ui/table-propertiesexperimental.js +0 -391
  106. package/theme/formrow-experimental.css +0 -15
  107. package/theme/tableform-experimental.css +0 -73
  108. package/theme/tableproperties-experimental.css +0 -78
@@ -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) {
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;
@@ -26,15 +26,11 @@
26
26
  flex-grow: 0;
27
27
  }
28
28
  }
29
-
30
- & .ck-table-form__dimension-operator {
31
- flex-grow: 0;
32
- }
33
29
  }
34
30
 
35
31
  /* Ignore labels that work as fieldset legends */
36
32
  /* Fallback for table dimension operator */
37
- & > *:not(.ck-label, .ck-table-form__dimension-operator) {
33
+ &:not(.ck-table-form__action-row) > *:not(.ck-label, .ck-table-form__dimension-operator) {
38
34
  flex-grow: 1;
39
35
  }
40
36
  }
@@ -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
- }