@ckeditor/ckeditor5-table 0.0.0-nightly-20250214.0 → 0.0.0-nightly-next-20250215.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/LICENSE.md +1 -1
- package/build/table.js +1 -1
- package/ckeditor5-metadata.json +6 -6
- package/dist/index.js +25 -34
- package/dist/index.js.map +1 -1
- package/package.json +10 -9
- package/src/commands/insertcolumncommand.js +4 -0
- package/src/commands/insertrowcommand.js +4 -0
- package/src/commands/mergecellcommand.js +8 -0
- package/src/commands/splitcellcommand.js +4 -0
- package/src/tablecaption/tablecaptionediting.js +7 -0
- package/src/tablecaption/tablecaptionui.js +3 -2
- package/src/tablecellproperties/commands/tablecellpropertycommand.js +8 -0
- package/src/tablecellproperties/tablecellpropertiesui.js +25 -3
- package/src/tablecellproperties/ui/tablecellpropertiesview.js +78 -10
- package/src/tablecolumnresize/tablecolumnresizeediting.js +18 -1
- package/src/tableediting.js +4 -0
- package/src/tablemouse/mouseeventsobserver.js +3 -6
- package/src/tableproperties/commands/tablepropertycommand.js +8 -0
- package/src/tableproperties/tablepropertiesui.d.ts +1 -1
- package/src/tableproperties/tablepropertiesui.js +25 -7
- package/src/tableproperties/ui/tablepropertiesview.js +66 -6
- package/src/tableui.js +7 -9
- package/src/tablewalker.js +99 -4
- package/src/ui/colorinputview.js +34 -0
- package/src/ui/formrowview.js +4 -0
- package/src/ui/inserttableview.js +12 -0
- package/src/utils/table-properties.js +1 -1
- package/theme/icons/table-cell-properties.svg +0 -1
- package/theme/icons/table-column.svg +0 -1
- package/theme/icons/table-merge-cell.svg +0 -1
- package/theme/icons/table-properties.svg +0 -1
- package/theme/icons/table-row.svg +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-table",
|
|
3
|
-
"version": "0.0.0-nightly-
|
|
3
|
+
"version": "0.0.0-nightly-next-20250215.0",
|
|
4
4
|
"description": "Table feature for CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -13,14 +13,15 @@
|
|
|
13
13
|
"type": "module",
|
|
14
14
|
"main": "src/index.js",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"ckeditor5": "0.0.0-nightly-
|
|
17
|
-
"@ckeditor/ckeditor5-clipboard": "0.0.0-nightly-
|
|
18
|
-
"@ckeditor/ckeditor5-core": "0.0.0-nightly-
|
|
19
|
-
"@ckeditor/ckeditor5-engine": "0.0.0-nightly-
|
|
20
|
-
"@ckeditor/ckeditor5-
|
|
21
|
-
"@ckeditor/ckeditor5-
|
|
22
|
-
"@ckeditor/ckeditor5-
|
|
23
|
-
"
|
|
16
|
+
"ckeditor5": "0.0.0-nightly-next-20250215.0",
|
|
17
|
+
"@ckeditor/ckeditor5-clipboard": "0.0.0-nightly-next-20250215.0",
|
|
18
|
+
"@ckeditor/ckeditor5-core": "0.0.0-nightly-next-20250215.0",
|
|
19
|
+
"@ckeditor/ckeditor5-engine": "0.0.0-nightly-next-20250215.0",
|
|
20
|
+
"@ckeditor/ckeditor5-icons": "0.0.0-nightly-next-20250215.0",
|
|
21
|
+
"@ckeditor/ckeditor5-ui": "0.0.0-nightly-next-20250215.0",
|
|
22
|
+
"@ckeditor/ckeditor5-utils": "0.0.0-nightly-next-20250215.0",
|
|
23
|
+
"@ckeditor/ckeditor5-widget": "0.0.0-nightly-next-20250215.0",
|
|
24
|
+
"es-toolkit": "1.32.0"
|
|
24
25
|
},
|
|
25
26
|
"author": "CKSource (http://cksource.com/)",
|
|
26
27
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -25,6 +25,10 @@ import { Command } from 'ckeditor5/src/core.js';
|
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
27
|
export default class InsertColumnCommand extends Command {
|
|
28
|
+
/**
|
|
29
|
+
* The order of insertion relative to the column in which the caret is located.
|
|
30
|
+
*/
|
|
31
|
+
order;
|
|
28
32
|
/**
|
|
29
33
|
* Creates a new `InsertColumnCommand` instance.
|
|
30
34
|
*
|
|
@@ -25,6 +25,10 @@ import { Command } from 'ckeditor5/src/core.js';
|
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
27
|
export default class InsertRowCommand extends Command {
|
|
28
|
+
/**
|
|
29
|
+
* The order of insertion relative to the row in which the caret is located.
|
|
30
|
+
*/
|
|
31
|
+
order;
|
|
28
32
|
/**
|
|
29
33
|
* Creates a new `InsertRowCommand` instance.
|
|
30
34
|
*
|
|
@@ -25,6 +25,14 @@ import { removeEmptyRowsColumns } from '../utils/structure.js';
|
|
|
25
25
|
* (for `'mergeTableCellUp'` and `'mergeTableCellDown'`), the command will be disabled.
|
|
26
26
|
*/
|
|
27
27
|
export default class MergeCellCommand extends Command {
|
|
28
|
+
/**
|
|
29
|
+
* The direction that indicates which cell will be merged with the currently selected one.
|
|
30
|
+
*/
|
|
31
|
+
direction;
|
|
32
|
+
/**
|
|
33
|
+
* Whether the merge is horizontal (left/right) or vertical (up/down).
|
|
34
|
+
*/
|
|
35
|
+
isHorizontal;
|
|
28
36
|
/**
|
|
29
37
|
* Creates a new `MergeCellCommand` instance.
|
|
30
38
|
*
|
|
@@ -19,6 +19,10 @@ import { Command } from 'ckeditor5/src/core.js';
|
|
|
19
19
|
* ```
|
|
20
20
|
*/
|
|
21
21
|
export default class SplitCellCommand extends Command {
|
|
22
|
+
/**
|
|
23
|
+
* The direction that indicates which cell will be split.
|
|
24
|
+
*/
|
|
25
|
+
direction;
|
|
22
26
|
/**
|
|
23
27
|
* Creates a new `SplitCellCommand` instance.
|
|
24
28
|
*
|
|
@@ -15,6 +15,13 @@ import { isTable, matchTableCaptionViewElement } from './utils.js';
|
|
|
15
15
|
* The table caption editing plugin.
|
|
16
16
|
*/
|
|
17
17
|
export default class TableCaptionEditing extends Plugin {
|
|
18
|
+
/**
|
|
19
|
+
* A map that keeps saved JSONified table captions and table model elements they are
|
|
20
|
+
* associated with.
|
|
21
|
+
*
|
|
22
|
+
* To learn more about this system, see {@link #_saveCaption}.
|
|
23
|
+
*/
|
|
24
|
+
_savedCaptionsMap;
|
|
18
25
|
/**
|
|
19
26
|
* @inheritDoc
|
|
20
27
|
*/
|
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module table/tablecaption/tablecaptionui
|
|
7
7
|
*/
|
|
8
|
-
import { Plugin
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
9
|
import { ButtonView } from 'ckeditor5/src/ui.js';
|
|
10
|
+
import { IconCaption } from 'ckeditor5/src/icons.js';
|
|
10
11
|
import { getCaptionFromModelSelection } from './utils.js';
|
|
11
12
|
/**
|
|
12
13
|
* The table caption UI plugin. It introduces the `'toggleTableCaption'` UI button.
|
|
@@ -35,7 +36,7 @@ export default class TableCaptionUI extends Plugin {
|
|
|
35
36
|
const command = editor.commands.get('toggleTableCaption');
|
|
36
37
|
const view = new ButtonView(locale);
|
|
37
38
|
view.set({
|
|
38
|
-
icon:
|
|
39
|
+
icon: IconCaption,
|
|
39
40
|
tooltip: true,
|
|
40
41
|
isToggleable: true
|
|
41
42
|
});
|
|
@@ -12,6 +12,14 @@ import { Command } from 'ckeditor5/src/core.js';
|
|
|
12
12
|
* The command is a base command for other table cell property commands.
|
|
13
13
|
*/
|
|
14
14
|
export default class TableCellPropertyCommand extends Command {
|
|
15
|
+
/**
|
|
16
|
+
* The attribute that will be set by the command.
|
|
17
|
+
*/
|
|
18
|
+
attributeName;
|
|
19
|
+
/**
|
|
20
|
+
* The default value for the attribute.
|
|
21
|
+
*/
|
|
22
|
+
_defaultValue;
|
|
15
23
|
/**
|
|
16
24
|
* Creates a new `TableCellPropertyCommand` instance.
|
|
17
25
|
*
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
* @module table/tablecellproperties/tablecellpropertiesui
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import { IconTableCellProperties } from 'ckeditor5/src/icons.js';
|
|
9
10
|
import { ButtonView, clickOutsideHandler, ContextualBalloon, getLocalizedColorOptions, normalizeColorOptions } from 'ckeditor5/src/ui.js';
|
|
10
11
|
import TableCellPropertiesView from './ui/tablecellpropertiesview.js';
|
|
11
12
|
import { colorFieldValidator, getLocalizedColorErrorText, getLocalizedLengthErrorText, defaultColors, lengthFieldValidator, lineWidthFieldValidator } from '../utils/ui/table-properties.js';
|
|
12
|
-
import { debounce } from '
|
|
13
|
+
import { debounce } from 'es-toolkit/compat';
|
|
13
14
|
import { getTableWidgetAncestor } from '../utils/ui/widget.js';
|
|
14
15
|
import { getBalloonCellPositionData, repositionContextualBalloon } from '../utils/ui/contextualballoon.js';
|
|
15
|
-
import tableCellProperties from './../../theme/icons/table-cell-properties.svg';
|
|
16
16
|
import { getNormalizedDefaultCellProperties } from '../utils/table-properties.js';
|
|
17
17
|
const ERROR_TEXT_TIMEOUT = 500;
|
|
18
18
|
// Map of view properties and related commands.
|
|
@@ -34,6 +34,28 @@ const propertyToCommandMap = {
|
|
|
34
34
|
* It uses the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon contextual balloon plugin}.
|
|
35
35
|
*/
|
|
36
36
|
export default class TableCellPropertiesUI extends Plugin {
|
|
37
|
+
/**
|
|
38
|
+
* The default table cell properties.
|
|
39
|
+
*/
|
|
40
|
+
_defaultTableCellProperties;
|
|
41
|
+
/**
|
|
42
|
+
* The contextual balloon plugin instance.
|
|
43
|
+
*/
|
|
44
|
+
_balloon;
|
|
45
|
+
/**
|
|
46
|
+
* The cell properties form view displayed inside the balloon.
|
|
47
|
+
*/
|
|
48
|
+
view;
|
|
49
|
+
/**
|
|
50
|
+
* The batch used to undo all changes made by the form (which are live, as the user types)
|
|
51
|
+
* when "Cancel" was pressed. Each time the view is shown, a new batch is created.
|
|
52
|
+
*/
|
|
53
|
+
_undoStepBatch;
|
|
54
|
+
/**
|
|
55
|
+
* Flag used to indicate whether view is ready to execute update commands
|
|
56
|
+
* (it finished loading initial data).
|
|
57
|
+
*/
|
|
58
|
+
_isReady;
|
|
37
59
|
/**
|
|
38
60
|
* @inheritDoc
|
|
39
61
|
*/
|
|
@@ -81,7 +103,7 @@ export default class TableCellPropertiesUI extends Plugin {
|
|
|
81
103
|
const view = new ButtonView(locale);
|
|
82
104
|
view.set({
|
|
83
105
|
label: t('Cell properties'),
|
|
84
|
-
icon:
|
|
106
|
+
icon: IconTableCellProperties,
|
|
85
107
|
tooltip: true
|
|
86
108
|
});
|
|
87
109
|
this.listenTo(view, 'execute', () => this._showView());
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { addListToDropdown, ButtonView, createLabeledDropdown, createLabeledInputText, FocusCycler, FormHeaderView, LabeledFieldView, LabelView, submitHandler, ToolbarView, View, ViewCollection } from 'ckeditor5/src/ui.js';
|
|
9
9
|
import { KeystrokeHandler, FocusTracker } from 'ckeditor5/src/utils.js';
|
|
10
|
-
import {
|
|
10
|
+
import { IconAlignBottom, IconAlignCenter, IconAlignJustify, IconAlignLeft, IconAlignMiddle, IconAlignRight, IconAlignTop, IconCancel, IconCheck } from 'ckeditor5/src/icons.js';
|
|
11
11
|
import { fillToolbar, getBorderStyleDefinitions, getBorderStyleLabels, getLabeledColorInputCreator } from '../../utils/ui/table-properties.js';
|
|
12
12
|
import FormRowView from '../../ui/formrowview.js';
|
|
13
13
|
import '../../../theme/form.css';
|
|
@@ -18,6 +18,74 @@ import '../../../theme/tablecellproperties.css';
|
|
|
18
18
|
* certain style aspects of a table cell, for instance, border, padding, text alignment, etc..
|
|
19
19
|
*/
|
|
20
20
|
export default class TableCellPropertiesView extends View {
|
|
21
|
+
/**
|
|
22
|
+
* Options passed to the view. See {@link #constructor} to learn more.
|
|
23
|
+
*/
|
|
24
|
+
options;
|
|
25
|
+
/**
|
|
26
|
+
* Tracks information about the DOM focus in the form.
|
|
27
|
+
*/
|
|
28
|
+
focusTracker;
|
|
29
|
+
/**
|
|
30
|
+
* An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
|
31
|
+
*/
|
|
32
|
+
keystrokes;
|
|
33
|
+
/**
|
|
34
|
+
* A collection of child views in the form.
|
|
35
|
+
*/
|
|
36
|
+
children;
|
|
37
|
+
/**
|
|
38
|
+
* A dropdown that allows selecting the style of the table cell border.
|
|
39
|
+
*/
|
|
40
|
+
borderStyleDropdown;
|
|
41
|
+
/**
|
|
42
|
+
* An input that allows specifying the width of the table cell border.
|
|
43
|
+
*/
|
|
44
|
+
borderWidthInput;
|
|
45
|
+
/**
|
|
46
|
+
* An input that allows specifying the color of the table cell border.
|
|
47
|
+
*/
|
|
48
|
+
borderColorInput;
|
|
49
|
+
/**
|
|
50
|
+
* An input that allows specifying the table cell background color.
|
|
51
|
+
*/
|
|
52
|
+
backgroundInput;
|
|
53
|
+
/**
|
|
54
|
+
* An input that allows specifying the table cell padding.
|
|
55
|
+
*/
|
|
56
|
+
paddingInput;
|
|
57
|
+
/**
|
|
58
|
+
* An input that allows specifying the table cell width.
|
|
59
|
+
*/
|
|
60
|
+
widthInput;
|
|
61
|
+
/**
|
|
62
|
+
* An input that allows specifying the table cell height.
|
|
63
|
+
*/
|
|
64
|
+
heightInput;
|
|
65
|
+
/**
|
|
66
|
+
* A toolbar with buttons that allow changing the horizontal text alignment in a table cell.
|
|
67
|
+
*/
|
|
68
|
+
horizontalAlignmentToolbar;
|
|
69
|
+
/**
|
|
70
|
+
* A toolbar with buttons that allow changing the vertical text alignment in a table cell.
|
|
71
|
+
*/
|
|
72
|
+
verticalAlignmentToolbar;
|
|
73
|
+
/**
|
|
74
|
+
* The "Save" button view.
|
|
75
|
+
*/
|
|
76
|
+
saveButtonView;
|
|
77
|
+
/**
|
|
78
|
+
* The "Cancel" button view.
|
|
79
|
+
*/
|
|
80
|
+
cancelButtonView;
|
|
81
|
+
/**
|
|
82
|
+
* A collection of views that can be focused in the form.
|
|
83
|
+
*/
|
|
84
|
+
_focusables;
|
|
85
|
+
/**
|
|
86
|
+
* Helps cycling over {@link #_focusables} in the form.
|
|
87
|
+
*/
|
|
88
|
+
_focusCycler;
|
|
21
89
|
/**
|
|
22
90
|
* @param locale The {@link module:core/editor/editor~Editor#locale} instance.
|
|
23
91
|
* @param options Additional configuration of the view.
|
|
@@ -412,13 +480,13 @@ export default class TableCellPropertiesView extends View {
|
|
|
412
480
|
const t = this.t;
|
|
413
481
|
const alignmentLabel = new LabelView(locale);
|
|
414
482
|
const ALIGNMENT_ICONS = {
|
|
415
|
-
left:
|
|
416
|
-
center:
|
|
417
|
-
right:
|
|
418
|
-
justify:
|
|
419
|
-
top:
|
|
420
|
-
middle:
|
|
421
|
-
bottom:
|
|
483
|
+
left: IconAlignLeft,
|
|
484
|
+
center: IconAlignCenter,
|
|
485
|
+
right: IconAlignRight,
|
|
486
|
+
justify: IconAlignJustify,
|
|
487
|
+
top: IconAlignTop,
|
|
488
|
+
middle: IconAlignMiddle,
|
|
489
|
+
bottom: IconAlignBottom
|
|
422
490
|
};
|
|
423
491
|
alignmentLabel.text = t('Table cell text alignment');
|
|
424
492
|
// -- Horizontal ---------------------------------------------------
|
|
@@ -489,7 +557,7 @@ export default class TableCellPropertiesView extends View {
|
|
|
489
557
|
];
|
|
490
558
|
saveButtonView.set({
|
|
491
559
|
label: t('Save'),
|
|
492
|
-
icon:
|
|
560
|
+
icon: IconCheck,
|
|
493
561
|
class: 'ck-button-save',
|
|
494
562
|
type: 'submit',
|
|
495
563
|
withText: true
|
|
@@ -499,7 +567,7 @@ export default class TableCellPropertiesView extends View {
|
|
|
499
567
|
});
|
|
500
568
|
cancelButtonView.set({
|
|
501
569
|
label: t('Cancel'),
|
|
502
|
-
icon:
|
|
570
|
+
icon: IconCancel,
|
|
503
571
|
class: 'ck-button-cancel',
|
|
504
572
|
withText: true
|
|
505
573
|
});
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module table/tablecolumnresize/tablecolumnresizeediting
|
|
7
7
|
*/
|
|
8
|
-
import { throttle, isEqual } from '
|
|
8
|
+
import { throttle, isEqual } from 'es-toolkit/compat';
|
|
9
9
|
import { global, DomEmitterMixin } from 'ckeditor5/src/utils.js';
|
|
10
10
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
11
11
|
import MouseEventsObserver from '../../src/tablemouse/mouseeventsobserver.js';
|
|
@@ -20,6 +20,23 @@ import { COLUMN_MIN_WIDTH_IN_PIXELS } from './constants.js';
|
|
|
20
20
|
* The table column resize editing plugin.
|
|
21
21
|
*/
|
|
22
22
|
export default class TableColumnResizeEditing extends Plugin {
|
|
23
|
+
/**
|
|
24
|
+
* A flag indicating if the column resizing is in progress.
|
|
25
|
+
*/
|
|
26
|
+
_isResizingActive;
|
|
27
|
+
/**
|
|
28
|
+
* A temporary storage for the required data needed to correctly calculate the widths of the resized columns. This storage is
|
|
29
|
+
* initialized when column resizing begins, and is purged upon completion.
|
|
30
|
+
*/
|
|
31
|
+
_resizingData;
|
|
32
|
+
/**
|
|
33
|
+
* DOM emitter.
|
|
34
|
+
*/
|
|
35
|
+
_domEmitter;
|
|
36
|
+
/**
|
|
37
|
+
* A local reference to the {@link module:table/tableutils~TableUtils} plugin.
|
|
38
|
+
*/
|
|
39
|
+
_tableUtilsPlugin;
|
|
23
40
|
/**
|
|
24
41
|
* @inheritDoc
|
|
25
42
|
*/
|
package/src/tableediting.js
CHANGED
|
@@ -20,12 +20,9 @@ import { DomEventObserver } from 'ckeditor5/src/engine.js';
|
|
|
20
20
|
* The observer is registered by the {@link module:table/tableselection~TableSelection} plugin.
|
|
21
21
|
*/
|
|
22
22
|
export default class MouseEventsObserver extends DomEventObserver {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
'mousemove', 'mouseleave'
|
|
27
|
-
];
|
|
28
|
-
}
|
|
23
|
+
domEventType = [
|
|
24
|
+
'mousemove', 'mouseleave'
|
|
25
|
+
];
|
|
29
26
|
/**
|
|
30
27
|
* @inheritDoc
|
|
31
28
|
*/
|
|
@@ -10,6 +10,14 @@ import { getSelectionAffectedTable } from '../../utils/common.js';
|
|
|
10
10
|
* This command is a base command for other table property commands.
|
|
11
11
|
*/
|
|
12
12
|
export default class TablePropertyCommand extends Command {
|
|
13
|
+
/**
|
|
14
|
+
* The attribute that will be set by the command.
|
|
15
|
+
*/
|
|
16
|
+
attributeName;
|
|
17
|
+
/**
|
|
18
|
+
* The default value for the attribute.
|
|
19
|
+
*/
|
|
20
|
+
_defaultValue;
|
|
13
21
|
/**
|
|
14
22
|
* Creates a new `TablePropertyCommand` instance.
|
|
15
23
|
*
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module table/tableproperties/tablepropertiesui
|
|
7
7
|
*/
|
|
8
|
-
import { type Editor
|
|
8
|
+
import { Plugin, type Editor } from 'ckeditor5/src/core.js';
|
|
9
9
|
import { ContextualBalloon } from 'ckeditor5/src/ui.js';
|
|
10
10
|
import TablePropertiesView from './ui/tablepropertiesview.js';
|
|
11
11
|
/**
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
* @module table/tableproperties/tablepropertiesui
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import { IconTableProperties } from 'ckeditor5/src/icons.js';
|
|
9
10
|
import { ButtonView, ContextualBalloon, clickOutsideHandler, getLocalizedColorOptions, normalizeColorOptions } from 'ckeditor5/src/ui.js';
|
|
10
|
-
import { debounce } from '
|
|
11
|
+
import { debounce } from 'es-toolkit/compat';
|
|
11
12
|
import TablePropertiesView from './ui/tablepropertiesview.js';
|
|
12
|
-
import tableProperties from './../../theme/icons/table-properties.svg';
|
|
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';
|
|
@@ -32,6 +32,28 @@ const propertyToCommandMap = {
|
|
|
32
32
|
* It uses the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon contextual balloon plugin}.
|
|
33
33
|
*/
|
|
34
34
|
export default class TablePropertiesUI extends Plugin {
|
|
35
|
+
/**
|
|
36
|
+
* The default table properties.
|
|
37
|
+
*/
|
|
38
|
+
_defaultTableProperties;
|
|
39
|
+
/**
|
|
40
|
+
* The contextual balloon plugin instance.
|
|
41
|
+
*/
|
|
42
|
+
_balloon;
|
|
43
|
+
/**
|
|
44
|
+
* The properties form view displayed inside the balloon.
|
|
45
|
+
*/
|
|
46
|
+
view = null;
|
|
47
|
+
/**
|
|
48
|
+
* The batch used to undo all changes made by the form (which are live, as the user types)
|
|
49
|
+
* when "Cancel" was pressed. Each time the view is shown, a new batch is created.
|
|
50
|
+
*/
|
|
51
|
+
_undoStepBatch;
|
|
52
|
+
/**
|
|
53
|
+
* Flag used to indicate whether view is ready to execute update commands
|
|
54
|
+
* (it finished loading initial data).
|
|
55
|
+
*/
|
|
56
|
+
_isReady;
|
|
35
57
|
/**
|
|
36
58
|
* @inheritDoc
|
|
37
59
|
*/
|
|
@@ -55,10 +77,6 @@ export default class TablePropertiesUI extends Plugin {
|
|
|
55
77
|
*/
|
|
56
78
|
constructor(editor) {
|
|
57
79
|
super(editor);
|
|
58
|
-
/**
|
|
59
|
-
* The properties form view displayed inside the balloon.
|
|
60
|
-
*/
|
|
61
|
-
this.view = null;
|
|
62
80
|
editor.config.define('table.tableProperties', {
|
|
63
81
|
borderColors: defaultColors,
|
|
64
82
|
backgroundColors: defaultColors
|
|
@@ -78,7 +96,7 @@ export default class TablePropertiesUI extends Plugin {
|
|
|
78
96
|
const view = new ButtonView(locale);
|
|
79
97
|
view.set({
|
|
80
98
|
label: t('Table properties'),
|
|
81
|
-
icon:
|
|
99
|
+
icon: IconTableProperties,
|
|
82
100
|
tooltip: true
|
|
83
101
|
});
|
|
84
102
|
this.listenTo(view, 'execute', () => this._showView());
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { addListToDropdown, ButtonView, createLabeledDropdown, createLabeledInputText, FocusCycler, FormHeaderView, LabeledFieldView, LabelView, submitHandler, ToolbarView, View, ViewCollection } from 'ckeditor5/src/ui.js';
|
|
9
9
|
import { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils.js';
|
|
10
|
-
import {
|
|
10
|
+
import { IconCancel, IconCheck, IconObjectCenter, IconObjectInlineLeft, IconObjectInlineRight } from 'ckeditor5/src/icons.js';
|
|
11
11
|
import { fillToolbar, getBorderStyleDefinitions, getBorderStyleLabels, getLabeledColorInputCreator } from '../../utils/ui/table-properties.js';
|
|
12
12
|
import FormRowView from '../../ui/formrowview.js';
|
|
13
13
|
import '../../../theme/form.css';
|
|
@@ -18,6 +18,66 @@ import '../../../theme/tableproperties.css';
|
|
|
18
18
|
* certain style aspects of a table, for instance, border, background color, alignment, etc..
|
|
19
19
|
*/
|
|
20
20
|
export default class TablePropertiesView extends View {
|
|
21
|
+
/**
|
|
22
|
+
* Options passed to the view. See {@link #constructor} to learn more.
|
|
23
|
+
*/
|
|
24
|
+
options;
|
|
25
|
+
/**
|
|
26
|
+
* Tracks information about the DOM focus in the form.
|
|
27
|
+
*/
|
|
28
|
+
focusTracker;
|
|
29
|
+
/**
|
|
30
|
+
* An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
|
31
|
+
*/
|
|
32
|
+
keystrokes;
|
|
33
|
+
/**
|
|
34
|
+
* A collection of child views in the form.
|
|
35
|
+
*/
|
|
36
|
+
children;
|
|
37
|
+
/**
|
|
38
|
+
* A dropdown that allows selecting the style of the table border.
|
|
39
|
+
*/
|
|
40
|
+
borderStyleDropdown;
|
|
41
|
+
/**
|
|
42
|
+
* An input that allows specifying the width of the table border.
|
|
43
|
+
*/
|
|
44
|
+
borderWidthInput;
|
|
45
|
+
/**
|
|
46
|
+
* An input that allows specifying the color of the table border.
|
|
47
|
+
*/
|
|
48
|
+
borderColorInput;
|
|
49
|
+
/**
|
|
50
|
+
* An input that allows specifying the table background color.
|
|
51
|
+
*/
|
|
52
|
+
backgroundInput;
|
|
53
|
+
/**
|
|
54
|
+
* An input that allows specifying the table width.
|
|
55
|
+
*/
|
|
56
|
+
widthInput;
|
|
57
|
+
/**
|
|
58
|
+
* An input that allows specifying the table height.
|
|
59
|
+
*/
|
|
60
|
+
heightInput;
|
|
61
|
+
/**
|
|
62
|
+
* A toolbar with buttons that allow changing the alignment of an entire table.
|
|
63
|
+
*/
|
|
64
|
+
alignmentToolbar;
|
|
65
|
+
/**
|
|
66
|
+
* The "Save" button view.
|
|
67
|
+
*/
|
|
68
|
+
saveButtonView;
|
|
69
|
+
/**
|
|
70
|
+
* The "Cancel" button view.
|
|
71
|
+
*/
|
|
72
|
+
cancelButtonView;
|
|
73
|
+
/**
|
|
74
|
+
* A collection of views that can be focused in the form.
|
|
75
|
+
*/
|
|
76
|
+
_focusables;
|
|
77
|
+
/**
|
|
78
|
+
* Helps cycling over {@link #_focusables} in the form.
|
|
79
|
+
*/
|
|
80
|
+
_focusCycler;
|
|
21
81
|
/**
|
|
22
82
|
* @param locale The {@link module:core/editor/editor~Editor#locale} instance.
|
|
23
83
|
* @param options Additional configuration of the view.
|
|
@@ -383,9 +443,9 @@ export default class TablePropertiesView extends View {
|
|
|
383
443
|
fillToolbar({
|
|
384
444
|
view: this,
|
|
385
445
|
icons: {
|
|
386
|
-
left:
|
|
387
|
-
center:
|
|
388
|
-
right:
|
|
446
|
+
left: IconObjectInlineLeft,
|
|
447
|
+
center: IconObjectCenter,
|
|
448
|
+
right: IconObjectInlineRight
|
|
389
449
|
},
|
|
390
450
|
toolbar: alignmentToolbar,
|
|
391
451
|
labels: this._alignmentLabels,
|
|
@@ -417,7 +477,7 @@ export default class TablePropertiesView extends View {
|
|
|
417
477
|
];
|
|
418
478
|
saveButtonView.set({
|
|
419
479
|
label: t('Save'),
|
|
420
|
-
icon:
|
|
480
|
+
icon: IconCheck,
|
|
421
481
|
class: 'ck-button-save',
|
|
422
482
|
type: 'submit',
|
|
423
483
|
withText: true
|
|
@@ -427,7 +487,7 @@ export default class TablePropertiesView extends View {
|
|
|
427
487
|
});
|
|
428
488
|
cancelButtonView.set({
|
|
429
489
|
label: t('Cancel'),
|
|
430
|
-
icon:
|
|
490
|
+
icon: IconCancel,
|
|
431
491
|
class: 'ck-button-cancel',
|
|
432
492
|
withText: true
|
|
433
493
|
});
|
package/src/tableui.js
CHANGED
|
@@ -5,13 +5,11 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module table/tableui
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import { IconTable, IconTableColumn, IconTableRow, IconTableMergeCell } from 'ckeditor5/src/icons.js';
|
|
9
10
|
import { addListToDropdown, createDropdown, ViewModel, SplitButtonView, SwitchButtonView, MenuBarMenuView } from 'ckeditor5/src/ui.js';
|
|
10
11
|
import { Collection } from 'ckeditor5/src/utils.js';
|
|
11
12
|
import InsertTableView from './ui/inserttableview.js';
|
|
12
|
-
import tableColumnIcon from './../theme/icons/table-column.svg';
|
|
13
|
-
import tableRowIcon from './../theme/icons/table-row.svg';
|
|
14
|
-
import tableMergeCellIcon from './../theme/icons/table-merge-cell.svg';
|
|
15
13
|
/**
|
|
16
14
|
* The table UI plugin. It introduces:
|
|
17
15
|
*
|
|
@@ -50,7 +48,7 @@ export default class TableUI extends Plugin {
|
|
|
50
48
|
dropdownView.bind('isEnabled').to(command);
|
|
51
49
|
// Decorate dropdown's button.
|
|
52
50
|
dropdownView.buttonView.set({
|
|
53
|
-
icon:
|
|
51
|
+
icon: IconTable,
|
|
54
52
|
label: t('Insert table'),
|
|
55
53
|
tooltip: true
|
|
56
54
|
});
|
|
@@ -86,7 +84,7 @@ export default class TableUI extends Plugin {
|
|
|
86
84
|
});
|
|
87
85
|
menuView.buttonView.set({
|
|
88
86
|
label: t('Table'),
|
|
89
|
-
icon:
|
|
87
|
+
icon: IconTable
|
|
90
88
|
});
|
|
91
89
|
menuView.panelView.children.add(insertTableView);
|
|
92
90
|
menuView.bind('isEnabled').to(command);
|
|
@@ -132,7 +130,7 @@ export default class TableUI extends Plugin {
|
|
|
132
130
|
}
|
|
133
131
|
}
|
|
134
132
|
];
|
|
135
|
-
return this._prepareDropdown(t('Column'),
|
|
133
|
+
return this._prepareDropdown(t('Column'), IconTableColumn, options, locale);
|
|
136
134
|
});
|
|
137
135
|
editor.ui.componentFactory.add('tableRow', locale => {
|
|
138
136
|
const options = [
|
|
@@ -174,7 +172,7 @@ export default class TableUI extends Plugin {
|
|
|
174
172
|
}
|
|
175
173
|
}
|
|
176
174
|
];
|
|
177
|
-
return this._prepareDropdown(t('Row'),
|
|
175
|
+
return this._prepareDropdown(t('Row'), IconTableRow, options, locale);
|
|
178
176
|
});
|
|
179
177
|
editor.ui.componentFactory.add('mergeTableCells', locale => {
|
|
180
178
|
const options = [
|
|
@@ -222,7 +220,7 @@ export default class TableUI extends Plugin {
|
|
|
222
220
|
}
|
|
223
221
|
}
|
|
224
222
|
];
|
|
225
|
-
return this._prepareMergeSplitButtonDropdown(t('Merge cells'),
|
|
223
|
+
return this._prepareMergeSplitButtonDropdown(t('Merge cells'), IconTableMergeCell, options, locale);
|
|
226
224
|
});
|
|
227
225
|
}
|
|
228
226
|
/**
|