@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.
- package/build/table.js +2 -2
- package/build/translations/af.js +1 -1
- package/build/translations/ar.js +1 -1
- package/build/translations/ast.js +1 -1
- package/build/translations/az.js +1 -1
- package/build/translations/be.js +1 -1
- package/build/translations/bg.js +1 -1
- package/build/translations/bn.js +1 -1
- package/build/translations/bs.js +1 -1
- package/build/translations/ca.js +1 -1
- package/build/translations/cs.js +1 -1
- package/build/translations/da.js +1 -1
- package/build/translations/de-ch.js +1 -1
- package/build/translations/de.js +1 -1
- package/build/translations/el.js +1 -1
- package/build/translations/en-au.js +1 -1
- package/build/translations/en-gb.js +1 -1
- package/build/translations/eo.js +1 -1
- package/build/translations/es-co.js +1 -1
- package/build/translations/es.js +1 -1
- package/build/translations/et.js +1 -1
- package/build/translations/eu.js +1 -1
- package/build/translations/fa.js +1 -1
- package/build/translations/fi.js +1 -1
- package/build/translations/fr.js +1 -1
- package/build/translations/gl.js +1 -1
- package/build/translations/gu.js +1 -1
- package/build/translations/he.js +1 -1
- package/build/translations/hi.js +1 -1
- package/build/translations/hr.js +1 -1
- package/build/translations/hu.js +1 -1
- package/build/translations/hy.js +1 -1
- package/build/translations/id.js +1 -1
- package/build/translations/it.js +1 -1
- package/build/translations/ja.js +1 -1
- package/build/translations/jv.js +1 -1
- package/build/translations/kk.js +1 -1
- package/build/translations/km.js +1 -1
- package/build/translations/kn.js +1 -1
- package/build/translations/ko.js +1 -1
- package/build/translations/ku.js +1 -1
- package/build/translations/lt.js +1 -1
- package/build/translations/lv.js +1 -1
- package/build/translations/ms.js +1 -1
- package/build/translations/nb.js +1 -1
- package/build/translations/ne.js +1 -1
- package/build/translations/nl.js +1 -1
- package/build/translations/no.js +1 -1
- package/build/translations/oc.js +1 -1
- package/build/translations/pl.js +1 -1
- package/build/translations/pt-br.js +1 -1
- package/build/translations/pt.js +1 -1
- package/build/translations/ro.js +1 -1
- package/build/translations/ru.js +1 -1
- package/build/translations/si.js +1 -1
- package/build/translations/sk.js +1 -1
- package/build/translations/sl.js +1 -1
- package/build/translations/sq.js +1 -1
- package/build/translations/sr-latn.js +1 -1
- package/build/translations/sr.js +1 -1
- package/build/translations/sv.js +1 -1
- package/build/translations/th.js +1 -1
- package/build/translations/ti.js +1 -1
- package/build/translations/tk.js +1 -1
- package/build/translations/tr.js +1 -1
- package/build/translations/tt.js +1 -1
- package/build/translations/ug.js +1 -1
- package/build/translations/uk.js +1 -1
- package/build/translations/ur.js +1 -1
- package/build/translations/uz.js +1 -1
- package/build/translations/vi.js +1 -1
- package/build/translations/zh-cn.js +1 -1
- package/build/translations/zh.js +1 -1
- package/ckeditor5-metadata.json +10 -1
- package/dist/index-content.css +30 -30
- package/dist/index-editor.css +120 -194
- package/dist/index.css +167 -265
- package/dist/index.css.map +1 -1
- package/dist/index.js +150 -2221
- package/dist/index.js.map +1 -1
- package/lang/contexts.json +0 -4
- package/package.json +9 -9
- package/src/augmentation.d.ts +0 -7
- package/src/converters/downcast.js +3 -12
- package/src/index.d.ts +0 -4
- package/src/index.js +0 -5
- package/src/tablecellproperties/ui/tablecellpropertiesview.d.ts +8 -0
- package/src/tablecellproperties/ui/tablecellpropertiesview.js +30 -10
- package/src/tableconfig.d.ts +4 -4
- package/src/tableproperties/tablepropertiesediting.js +14 -147
- package/src/tableproperties/ui/tablepropertiesview.d.ts +8 -0
- package/src/tableproperties/ui/tablepropertiesview.js +59 -37
- package/theme/formrow.css +2 -0
- package/theme/tableform.css +1 -5
- package/theme/tableproperties.css +60 -0
- package/src/tablecellproperties/tablecellpropertiesuiexperimental.d.ts +0 -128
- package/src/tablecellproperties/tablecellpropertiesuiexperimental.js +0 -386
- package/src/tablecellproperties/ui/tablecellpropertiesviewexperimental.d.ts +0 -237
- package/src/tablecellproperties/ui/tablecellpropertiesviewexperimental.js +0 -633
- package/src/tableproperties/tablepropertiesuiexperimental.d.ts +0 -136
- package/src/tableproperties/tablepropertiesuiexperimental.js +0 -375
- package/src/tableproperties/ui/tablepropertiesviewexperimental.d.ts +0 -216
- package/src/tableproperties/ui/tablepropertiesviewexperimental.js +0 -544
- package/src/utils/ui/table-propertiesexperimental.d.ts +0 -215
- package/src/utils/ui/table-propertiesexperimental.js +0 -391
- package/theme/formrow-experimental.css +0 -15
- package/theme/tableform-experimental.css +0 -73
- package/theme/tableproperties-experimental.css +0 -78
package/lang/contexts.json
CHANGED
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
"Dimensions": "The label describing a group of form fields that allows setting dimensions of a table or a table cell.",
|
|
34
34
|
"Table cell text alignment": "The label for the group of toolbars that allows configuring the text alignment in a table cell.",
|
|
35
35
|
"Table Alignment": "The label for the toolbar that allows configuring the alignment of a table.",
|
|
36
|
-
"Alignment": "The label for the toolbar that allows configuring the alignment of a table.",
|
|
37
36
|
"Horizontal text alignment toolbar": "The label used by assistive technologies describing a toolbar that allows configuring the horizontal text alignment in a table cell.",
|
|
38
37
|
"Vertical text alignment toolbar": "The label used by assistive technologies describing a toolbar that allows configuring the vertical text alignment in a table cell.",
|
|
39
38
|
"Table alignment toolbar": "The label used by assistive technologies describing a toolbar that allows configuring the alignment of a table.",
|
|
@@ -58,9 +57,6 @@
|
|
|
58
57
|
"Align table to the right with text wrapping": "The label used by assistive technologies describing a button that aligns the table to the right as an inline element, allowing text to wrap around it.",
|
|
59
58
|
"Align table to the left with no text wrapping": "The label used by assistive technologies describing a button that aligns the table to the left as a block element with no text wrapping.",
|
|
60
59
|
"Align table to the right with no text wrapping": "The label used by assistive technologies describing a button that aligns the table to the right as a block element with no text wrapping.",
|
|
61
|
-
"Align table to the left": "The label used by assistive technologies describing a button that aligns the table to the left.",
|
|
62
|
-
"Center table": "The label used by assistive technologies describing a button that centers the table.",
|
|
63
|
-
"Align table to the right": "The label used by assistive technologies describing a button that aligns the table to the right.",
|
|
64
60
|
"The color is invalid. Try \"#FF0000\" or \"rgb(255,0,0)\" or \"red\".": "The localized error string that can be displayed next to color (background, border) fields that have an invalid value",
|
|
65
61
|
"The value is invalid. Try \"10px\" or \"2em\" or simply \"2\".": "The localized error string that can be displayed next to length (padding, border width) fields that have an invalid value.",
|
|
66
62
|
"Enter table caption": "The placeholder text for the table caption displayed when the caption is empty.",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-table",
|
|
3
|
-
"version": "0.0.0-nightly-20251215.0",
|
|
3
|
+
"version": "0.0.0-nightly-next-20251215.0",
|
|
4
4
|
"description": "Table feature for CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
"type": "module",
|
|
14
14
|
"main": "src/index.js",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"ckeditor5": "0.0.0-nightly-20251215.0",
|
|
17
|
-
"@ckeditor/ckeditor5-clipboard": "0.0.0-nightly-20251215.0",
|
|
18
|
-
"@ckeditor/ckeditor5-core": "0.0.0-nightly-20251215.0",
|
|
19
|
-
"@ckeditor/ckeditor5-engine": "0.0.0-nightly-20251215.0",
|
|
20
|
-
"@ckeditor/ckeditor5-icons": "0.0.0-nightly-20251215.0",
|
|
21
|
-
"@ckeditor/ckeditor5-ui": "0.0.0-nightly-20251215.0",
|
|
22
|
-
"@ckeditor/ckeditor5-utils": "0.0.0-nightly-20251215.0",
|
|
23
|
-
"@ckeditor/ckeditor5-widget": "0.0.0-nightly-20251215.0",
|
|
16
|
+
"ckeditor5": "0.0.0-nightly-next-20251215.0",
|
|
17
|
+
"@ckeditor/ckeditor5-clipboard": "0.0.0-nightly-next-20251215.0",
|
|
18
|
+
"@ckeditor/ckeditor5-core": "0.0.0-nightly-next-20251215.0",
|
|
19
|
+
"@ckeditor/ckeditor5-engine": "0.0.0-nightly-next-20251215.0",
|
|
20
|
+
"@ckeditor/ckeditor5-icons": "0.0.0-nightly-next-20251215.0",
|
|
21
|
+
"@ckeditor/ckeditor5-ui": "0.0.0-nightly-next-20251215.0",
|
|
22
|
+
"@ckeditor/ckeditor5-utils": "0.0.0-nightly-next-20251215.0",
|
|
23
|
+
"@ckeditor/ckeditor5-widget": "0.0.0-nightly-next-20251215.0",
|
|
24
24
|
"es-toolkit": "1.39.5"
|
|
25
25
|
},
|
|
26
26
|
"author": "CKSource (http://cksource.com/)",
|
package/src/augmentation.d.ts
CHANGED
|
@@ -15,13 +15,6 @@ declare module '@ckeditor/ckeditor5-engine' {
|
|
|
15
15
|
* This will be enabled by default in the future CKEditor 5 releases.
|
|
16
16
|
*/
|
|
17
17
|
upcastTableBorderZeroAttributes?: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* When enabled, the the {@link module:table/tableproperties/tablepropertiesediting~TablePropertiesEditing table properties feature}
|
|
20
|
-
* will support extended alignment options for tables, i.e. `blockLeft` and `blockRight`, using CSS `margin` property.
|
|
21
|
-
*
|
|
22
|
-
* This will be enabled by default in the future CKEditor 5 releases.
|
|
23
|
-
*/
|
|
24
|
-
useExtendedTableBlockAlignment?: boolean;
|
|
25
18
|
}
|
|
26
19
|
}
|
|
27
20
|
declare module '@ckeditor/ckeditor5-core' {
|
|
@@ -162,10 +162,7 @@ function hasAnyAttribute(element) {
|
|
|
162
162
|
*/
|
|
163
163
|
export function convertPlainTable(editor) {
|
|
164
164
|
return (table, conversionApi) => {
|
|
165
|
-
|
|
166
|
-
const isClipboardPipeline = conversionApi.options.isClipboardPipeline;
|
|
167
|
-
const useExtendedAlignment = editor.config.get('experimentalFlags.useExtendedTableBlockAlignment');
|
|
168
|
-
if (!hasPlainTableOutput && !(useExtendedAlignment && isClipboardPipeline)) {
|
|
165
|
+
if (!conversionApi.options.isClipboardPipeline && !editor.plugins.has('PlainTableOutput')) {
|
|
169
166
|
return null;
|
|
170
167
|
}
|
|
171
168
|
return downcastPlainTable(table, conversionApi, editor);
|
|
@@ -176,10 +173,7 @@ export function convertPlainTable(editor) {
|
|
|
176
173
|
*/
|
|
177
174
|
export function convertPlainTableCaption(editor) {
|
|
178
175
|
return (modelElement, { writer, options }) => {
|
|
179
|
-
|
|
180
|
-
const isClipboardPipeline = options.isClipboardPipeline;
|
|
181
|
-
const useExtendedAlignment = editor.config.get('experimentalFlags.useExtendedTableBlockAlignment');
|
|
182
|
-
if (!hasPlainTableOutput && !(useExtendedAlignment && isClipboardPipeline)) {
|
|
176
|
+
if (!options.isClipboardPipeline && !editor.plugins.has('PlainTableOutput')) {
|
|
183
177
|
return null;
|
|
184
178
|
}
|
|
185
179
|
if (modelElement.parent.name === 'table') {
|
|
@@ -264,10 +258,7 @@ export function downcastTableBorderAndBackgroundAttributes(editor) {
|
|
|
264
258
|
return dispatcher.on(`attribute:${modelAttribute}:table`, (evt, data, conversionApi) => {
|
|
265
259
|
const { item, attributeNewValue } = data;
|
|
266
260
|
const { mapper, writer } = conversionApi;
|
|
267
|
-
|
|
268
|
-
const isClipboardPipeline = conversionApi.options.isClipboardPipeline;
|
|
269
|
-
const useExtendedAlignment = editor.config.get('experimentalFlags.useExtendedTableBlockAlignment');
|
|
270
|
-
if (!hasPlainTableOutput && !(useExtendedAlignment && isClipboardPipeline)) {
|
|
261
|
+
if (!conversionApi.options.isClipboardPipeline && !editor.plugins.has('PlainTableOutput')) {
|
|
271
262
|
return;
|
|
272
263
|
}
|
|
273
264
|
if (!conversionApi.consumable.consume(item, evt.name)) {
|
package/src/index.d.ts
CHANGED
|
@@ -34,10 +34,6 @@ export { TableUtils, type TableIndexesObject } from './tableutils.js';
|
|
|
34
34
|
export { TableColumnResize } from './tablecolumnresize.js';
|
|
35
35
|
export { TableColumnResizeEditing } from './tablecolumnresize/tablecolumnresizeediting.js';
|
|
36
36
|
export { TableWidthsCommand, type TableWidthsCommandOptions } from './tablecolumnresize/tablewidthscommand.js';
|
|
37
|
-
export { TablePropertiesUIExperimental } from './tableproperties/tablepropertiesuiexperimental.js';
|
|
38
|
-
export { TablePropertiesViewExperimental, type TablePropertiesViewOptionsExperimental } from './tableproperties/ui/tablepropertiesviewexperimental.js';
|
|
39
|
-
export { TableCellPropertiesUIExperimental } from './tablecellproperties/tablecellpropertiesuiexperimental.js';
|
|
40
|
-
export { TableCellPropertiesViewExperimental, type TableCellPropertiesViewOptionsExperimental } from './tablecellproperties/ui/tablecellpropertiesviewexperimental.js';
|
|
41
37
|
export { InsertColumnCommand } from './commands/insertcolumncommand.js';
|
|
42
38
|
export { InsertRowCommand } from './commands/insertrowcommand.js';
|
|
43
39
|
export { InsertTableCommand } from './commands/inserttablecommand.js';
|
package/src/index.js
CHANGED
|
@@ -34,11 +34,6 @@ export { TableUtils } from './tableutils.js';
|
|
|
34
34
|
export { TableColumnResize } from './tablecolumnresize.js';
|
|
35
35
|
export { TableColumnResizeEditing } from './tablecolumnresize/tablecolumnresizeediting.js';
|
|
36
36
|
export { TableWidthsCommand } from './tablecolumnresize/tablewidthscommand.js';
|
|
37
|
-
// [experimental] Remove in the v48.
|
|
38
|
-
export { TablePropertiesUIExperimental } from './tableproperties/tablepropertiesuiexperimental.js';
|
|
39
|
-
export { TablePropertiesViewExperimental } from './tableproperties/ui/tablepropertiesviewexperimental.js';
|
|
40
|
-
export { TableCellPropertiesUIExperimental } from './tablecellproperties/tablecellpropertiesuiexperimental.js';
|
|
41
|
-
export { TableCellPropertiesViewExperimental } from './tablecellproperties/ui/tablecellpropertiesviewexperimental.js';
|
|
42
37
|
export { InsertColumnCommand } from './commands/insertcolumncommand.js';
|
|
43
38
|
export { InsertRowCommand } from './commands/insertrowcommand.js';
|
|
44
39
|
export { InsertTableCommand } from './commands/inserttablecommand.js';
|
|
@@ -147,6 +147,10 @@ export declare class TableCellPropertiesView extends View {
|
|
|
147
147
|
* The "Cancel" button view.
|
|
148
148
|
*/
|
|
149
149
|
cancelButtonView: ButtonView;
|
|
150
|
+
/**
|
|
151
|
+
* The "Back" button view.
|
|
152
|
+
*/
|
|
153
|
+
backButtonView: ButtonView;
|
|
150
154
|
/**
|
|
151
155
|
* A collection of views that can be focused in the form.
|
|
152
156
|
*/
|
|
@@ -218,6 +222,10 @@ export declare class TableCellPropertiesView extends View {
|
|
|
218
222
|
* * {@link #cancelButtonView}.
|
|
219
223
|
*/
|
|
220
224
|
private _createActionButtons;
|
|
225
|
+
/**
|
|
226
|
+
* Creates a back button view that cancels the form.
|
|
227
|
+
*/
|
|
228
|
+
private _createBackButton;
|
|
221
229
|
/**
|
|
222
230
|
* Provides localized labels for {@link #horizontalAlignmentToolbar} buttons.
|
|
223
231
|
*/
|
|
@@ -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 { KeystrokeHandler, FocusTracker } from 'ckeditor5/src/utils.js';
|
|
10
|
-
import { IconAlignBottom, IconAlignCenter, IconAlignJustify, IconAlignLeft, IconAlignMiddle, IconAlignRight, IconAlignTop,
|
|
10
|
+
import { IconAlignBottom, IconAlignCenter, IconAlignJustify, IconAlignLeft, IconAlignMiddle, IconAlignRight, IconAlignTop, 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';
|
|
@@ -79,6 +79,10 @@ export class TableCellPropertiesView extends View {
|
|
|
79
79
|
* The "Cancel" button view.
|
|
80
80
|
*/
|
|
81
81
|
cancelButtonView;
|
|
82
|
+
/**
|
|
83
|
+
* The "Back" button view.
|
|
84
|
+
*/
|
|
85
|
+
backButtonView;
|
|
82
86
|
/**
|
|
83
87
|
* A collection of views that can be focused in the form.
|
|
84
88
|
*/
|
|
@@ -132,6 +136,7 @@ export class TableCellPropertiesView extends View {
|
|
|
132
136
|
const { saveButtonView, cancelButtonView } = this._createActionButtons();
|
|
133
137
|
this.saveButtonView = saveButtonView;
|
|
134
138
|
this.cancelButtonView = cancelButtonView;
|
|
139
|
+
this.backButtonView = this._createBackButton();
|
|
135
140
|
this._focusables = new ViewCollection();
|
|
136
141
|
this._focusCycler = new FocusCycler({
|
|
137
142
|
focusables: this._focusables,
|
|
@@ -145,9 +150,11 @@ export class TableCellPropertiesView extends View {
|
|
|
145
150
|
}
|
|
146
151
|
});
|
|
147
152
|
// Form header.
|
|
148
|
-
|
|
153
|
+
const header = new FormHeaderView(locale, {
|
|
149
154
|
label: this.t('Cell properties')
|
|
150
|
-
})
|
|
155
|
+
});
|
|
156
|
+
header.children.add(this.backButtonView, 0);
|
|
157
|
+
this.children.add(header);
|
|
151
158
|
// Border row.
|
|
152
159
|
this.children.add(new FormRowView(locale, {
|
|
153
160
|
labelView: borderRowLabel,
|
|
@@ -204,8 +211,8 @@ export class TableCellPropertiesView extends View {
|
|
|
204
211
|
// Action row.
|
|
205
212
|
this.children.add(new FormRowView(locale, {
|
|
206
213
|
children: [
|
|
207
|
-
this.
|
|
208
|
-
this.
|
|
214
|
+
this.cancelButtonView,
|
|
215
|
+
this.saveButtonView
|
|
209
216
|
],
|
|
210
217
|
class: 'ck-table-form__action-row'
|
|
211
218
|
}));
|
|
@@ -248,8 +255,9 @@ export class TableCellPropertiesView extends View {
|
|
|
248
255
|
this.paddingInput,
|
|
249
256
|
this.horizontalAlignmentToolbar,
|
|
250
257
|
this.verticalAlignmentToolbar,
|
|
258
|
+
this.cancelButtonView,
|
|
251
259
|
this.saveButtonView,
|
|
252
|
-
this.
|
|
260
|
+
this.backButtonView
|
|
253
261
|
].forEach(view => {
|
|
254
262
|
// Register the view as focusable.
|
|
255
263
|
this._focusables.add(view);
|
|
@@ -558,8 +566,7 @@ export class TableCellPropertiesView extends View {
|
|
|
558
566
|
];
|
|
559
567
|
saveButtonView.set({
|
|
560
568
|
label: t('Save'),
|
|
561
|
-
|
|
562
|
-
class: 'ck-button-save',
|
|
569
|
+
class: 'ck-button-action',
|
|
563
570
|
type: 'submit',
|
|
564
571
|
withText: true
|
|
565
572
|
});
|
|
@@ -568,8 +575,6 @@ export class TableCellPropertiesView extends View {
|
|
|
568
575
|
});
|
|
569
576
|
cancelButtonView.set({
|
|
570
577
|
label: t('Cancel'),
|
|
571
|
-
icon: IconCancel,
|
|
572
|
-
class: 'ck-button-cancel',
|
|
573
578
|
withText: true
|
|
574
579
|
});
|
|
575
580
|
cancelButtonView.delegate('execute').to(this, 'cancel');
|
|
@@ -577,6 +582,21 @@ export class TableCellPropertiesView extends View {
|
|
|
577
582
|
saveButtonView, cancelButtonView
|
|
578
583
|
};
|
|
579
584
|
}
|
|
585
|
+
/**
|
|
586
|
+
* Creates a back button view that cancels the form.
|
|
587
|
+
*/
|
|
588
|
+
_createBackButton() {
|
|
589
|
+
const t = this.locale.t;
|
|
590
|
+
const backButton = new ButtonView(this.locale);
|
|
591
|
+
backButton.set({
|
|
592
|
+
class: 'ck-button-back',
|
|
593
|
+
label: t('Back'),
|
|
594
|
+
icon: IconPreviousArrow,
|
|
595
|
+
tooltip: true
|
|
596
|
+
});
|
|
597
|
+
backButton.delegate('execute').to(this, 'cancel');
|
|
598
|
+
return backButton;
|
|
599
|
+
}
|
|
580
600
|
/**
|
|
581
601
|
* Provides localized labels for {@link #horizontalAlignmentToolbar} buttons.
|
|
582
602
|
*/
|
package/src/tableconfig.d.ts
CHANGED
|
@@ -311,7 +311,7 @@ export interface TablePropertiesConfig {
|
|
|
311
311
|
* const tableConfig = {
|
|
312
312
|
* tableProperties: {
|
|
313
313
|
* alignment: {
|
|
314
|
-
* useInlineStyles:
|
|
314
|
+
* useInlineStyles: true // Use inline styles instead of CSS classes
|
|
315
315
|
* }
|
|
316
316
|
* }
|
|
317
317
|
* };
|
|
@@ -603,10 +603,10 @@ export interface TableAlignmentConfig {
|
|
|
603
603
|
/**
|
|
604
604
|
* Whether to use inline styles for table alignment in the editor output.
|
|
605
605
|
*
|
|
606
|
-
* * When `true
|
|
607
|
-
* * When `false
|
|
606
|
+
* * When `true`, the alignment is rendered as inline styles.
|
|
607
|
+
* * When `false` (default), the alignment is rendered as CSS classes.
|
|
608
608
|
*
|
|
609
|
-
* @default
|
|
609
|
+
* @default false
|
|
610
610
|
*/
|
|
611
611
|
useInlineStyles?: boolean;
|
|
612
612
|
}
|
|
@@ -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')
|
|
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
|
-
|
|
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
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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
|
|
190
|
+
* Enables the `'alignment'` attribute for table.
|
|
198
191
|
*
|
|
199
192
|
* @param defaultValue The default alignment value.
|
|
200
193
|
*/
|
|
201
|
-
function
|
|
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
|
*/
|