@ckeditor/ckeditor5-table 41.2.0 → 41.3.0-alpha.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/dist/content-index.css +55 -0
- package/dist/editor-index.css +150 -0
- package/dist/index.css +362 -0
- package/dist/index.css.map +1 -0
- package/dist/index.js +11660 -0
- package/dist/index.js.map +1 -0
- package/dist/types/augmentation.d.ts +76 -0
- package/dist/types/commands/insertcolumncommand.d.ts +55 -0
- package/dist/types/commands/insertrowcommand.d.ts +54 -0
- package/dist/types/commands/inserttablecommand.d.ts +44 -0
- package/dist/types/commands/mergecellcommand.d.ts +68 -0
- package/dist/types/commands/mergecellscommand.d.ts +28 -0
- package/dist/types/commands/removecolumncommand.d.ts +29 -0
- package/dist/types/commands/removerowcommand.d.ts +29 -0
- package/dist/types/commands/selectcolumncommand.d.ts +33 -0
- package/dist/types/commands/selectrowcommand.d.ts +33 -0
- package/dist/types/commands/setheadercolumncommand.d.ts +50 -0
- package/dist/types/commands/setheaderrowcommand.d.ts +53 -0
- package/dist/types/commands/splitcellcommand.d.ts +43 -0
- package/dist/types/converters/downcast.d.ts +63 -0
- package/dist/types/converters/table-caption-post-fixer.d.ts +20 -0
- package/dist/types/converters/table-cell-paragraph-post-fixer.d.ts +32 -0
- package/dist/types/converters/table-cell-refresh-handler.d.ts +18 -0
- package/dist/types/converters/table-headings-refresh-handler.d.ts +17 -0
- package/dist/types/converters/table-layout-post-fixer.d.ts +226 -0
- package/dist/types/converters/tableproperties.d.ts +54 -0
- package/dist/types/converters/upcasttable.d.ts +49 -0
- package/dist/types/index.d.ts +60 -0
- package/dist/types/plaintableoutput.d.ts +26 -0
- package/dist/types/table.d.ts +40 -0
- package/dist/types/tablecaption/tablecaptionediting.d.ts +63 -0
- package/dist/types/tablecaption/tablecaptionui.d.ts +21 -0
- package/dist/types/tablecaption/toggletablecaptioncommand.d.ts +68 -0
- package/dist/types/tablecaption/utils.d.ts +38 -0
- package/dist/types/tablecaption.d.ts +24 -0
- package/dist/types/tablecellproperties/commands/tablecellbackgroundcolorcommand.d.ts +32 -0
- package/dist/types/tablecellproperties/commands/tablecellbordercolorcommand.d.ts +37 -0
- package/dist/types/tablecellproperties/commands/tablecellborderstylecommand.d.ts +37 -0
- package/dist/types/tablecellproperties/commands/tablecellborderwidthcommand.d.ts +51 -0
- package/dist/types/tablecellproperties/commands/tablecellheightcommand.d.ts +46 -0
- package/dist/types/tablecellproperties/commands/tablecellhorizontalalignmentcommand.d.ts +32 -0
- package/dist/types/tablecellproperties/commands/tablecellpaddingcommand.d.ts +51 -0
- package/dist/types/tablecellproperties/commands/tablecellpropertycommand.d.ts +62 -0
- package/dist/types/tablecellproperties/commands/tablecellverticalalignmentcommand.d.ts +40 -0
- package/dist/types/tablecellproperties/tablecellpropertiesediting.d.ts +43 -0
- package/dist/types/tablecellproperties/tablecellpropertiesui.d.ts +112 -0
- package/dist/types/tablecellproperties/ui/tablecellpropertiesview.d.ts +228 -0
- package/dist/types/tablecellproperties.d.ts +30 -0
- package/dist/types/tablecellwidth/commands/tablecellwidthcommand.d.ts +46 -0
- package/dist/types/tablecellwidth/tablecellwidthediting.d.ts +29 -0
- package/dist/types/tableclipboard.d.ts +70 -0
- package/dist/types/tablecolumnresize/constants.d.ts +20 -0
- package/dist/types/tablecolumnresize/converters.d.ts +18 -0
- package/dist/types/tablecolumnresize/tablecolumnresizeediting.d.ts +139 -0
- package/dist/types/tablecolumnresize/tablewidthscommand.d.ts +38 -0
- package/dist/types/tablecolumnresize/utils.d.ts +148 -0
- package/dist/types/tablecolumnresize.d.ts +26 -0
- package/dist/types/tableconfig.d.ts +343 -0
- package/dist/types/tableediting.d.ts +98 -0
- package/dist/types/tablekeyboard.d.ts +68 -0
- package/dist/types/tablemouse/mouseeventsobserver.d.ts +62 -0
- package/dist/types/tablemouse.d.ts +48 -0
- package/dist/types/tableproperties/commands/tablealignmentcommand.d.ts +32 -0
- package/dist/types/tableproperties/commands/tablebackgroundcolorcommand.d.ts +32 -0
- package/dist/types/tableproperties/commands/tablebordercolorcommand.d.ts +37 -0
- package/dist/types/tableproperties/commands/tableborderstylecommand.d.ts +37 -0
- package/dist/types/tableproperties/commands/tableborderwidthcommand.d.ts +51 -0
- package/dist/types/tableproperties/commands/tableheightcommand.d.ts +46 -0
- package/dist/types/tableproperties/commands/tablepropertycommand.d.ts +61 -0
- package/dist/types/tableproperties/commands/tablewidthcommand.d.ts +46 -0
- package/dist/types/tableproperties/tablepropertiesediting.d.ts +40 -0
- package/dist/types/tableproperties/tablepropertiesui.d.ts +114 -0
- package/dist/types/tableproperties/ui/tablepropertiesview.d.ts +207 -0
- package/dist/types/tableproperties.d.ts +30 -0
- package/dist/types/tableselection.d.ts +107 -0
- package/dist/types/tabletoolbar.d.ts +32 -0
- package/dist/types/tableui.d.ts +53 -0
- package/dist/types/tableutils.d.ts +448 -0
- package/dist/types/tablewalker.d.ts +362 -0
- package/dist/types/ui/colorinputview.d.ts +140 -0
- package/dist/types/ui/formrowview.d.ts +61 -0
- package/dist/types/ui/inserttableview.d.ts +77 -0
- package/dist/types/utils/common.d.ts +46 -0
- package/dist/types/utils/structure.d.ts +245 -0
- package/dist/types/utils/table-properties.d.ts +67 -0
- package/dist/types/utils/ui/contextualballoon.d.ts +34 -0
- package/dist/types/utils/ui/table-properties.d.ts +195 -0
- package/dist/types/utils/ui/widget.d.ts +20 -0
- package/package.json +3 -2
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module table/tableediting
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin, type Editor } from 'ckeditor5/src/core.js';
|
|
9
|
+
import type { PositionOffset, SlotFilter } from 'ckeditor5/src/engine.js';
|
|
10
|
+
import TableUtils from '../src/tableutils.js';
|
|
11
|
+
import '../theme/tableediting.css';
|
|
12
|
+
/**
|
|
13
|
+
* The table editing feature.
|
|
14
|
+
*/
|
|
15
|
+
export default class TableEditing extends Plugin {
|
|
16
|
+
/**
|
|
17
|
+
* Handlers for creating additional slots in the table.
|
|
18
|
+
*/
|
|
19
|
+
private _additionalSlots;
|
|
20
|
+
/**
|
|
21
|
+
* @inheritDoc
|
|
22
|
+
*/
|
|
23
|
+
static get pluginName(): "TableEditing";
|
|
24
|
+
/**
|
|
25
|
+
* @inheritDoc
|
|
26
|
+
*/
|
|
27
|
+
static get requires(): readonly [typeof TableUtils];
|
|
28
|
+
/**
|
|
29
|
+
* @inheritDoc
|
|
30
|
+
*/
|
|
31
|
+
constructor(editor: Editor);
|
|
32
|
+
/**
|
|
33
|
+
* @inheritDoc
|
|
34
|
+
*/
|
|
35
|
+
init(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Registers downcast handler for the additional table slot.
|
|
38
|
+
*/
|
|
39
|
+
registerAdditionalSlot(slotHandler: AdditionalSlot): void;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* By default, only the `tableRow` elements from the `table` model are downcast inside the `<table>` and
|
|
43
|
+
* all other elements are pushed outside the table. This handler allows creating additional slots inside
|
|
44
|
+
* the table for other elements.
|
|
45
|
+
*
|
|
46
|
+
* Take this model as an example:
|
|
47
|
+
*
|
|
48
|
+
* ```xml
|
|
49
|
+
* <table>
|
|
50
|
+
* <tableRow>...</tableRow>
|
|
51
|
+
* <tableRow>...</tableRow>
|
|
52
|
+
* <tableColumnGroup>...</tableColumnGroup>
|
|
53
|
+
* </table>
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* By default, downcasting result will be:
|
|
57
|
+
*
|
|
58
|
+
* ```xml
|
|
59
|
+
* <table>
|
|
60
|
+
* <tbody>
|
|
61
|
+
* <tr>...</tr>
|
|
62
|
+
* <tr>...</tr>
|
|
63
|
+
* </tbody>
|
|
64
|
+
* </table>
|
|
65
|
+
* <colgroup>...</colgroup>
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* To allow the `tableColumnGroup` element at the end of the table, use the following configuration:
|
|
69
|
+
*
|
|
70
|
+
* ```ts
|
|
71
|
+
* const additionalSlot = {
|
|
72
|
+
* filter: element => element.is( 'element', 'tableColumnGroup' ),
|
|
73
|
+
* positionOffset: 'end'
|
|
74
|
+
* }
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* Now, the downcast result will be:
|
|
78
|
+
*
|
|
79
|
+
* ```xml
|
|
80
|
+
* <table>
|
|
81
|
+
* <tbody>
|
|
82
|
+
* <tr>...</tr>
|
|
83
|
+
* <tr>...</tr>
|
|
84
|
+
* </tbody>
|
|
85
|
+
* <colgroup>...</colgroup>
|
|
86
|
+
* </table>
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
export interface AdditionalSlot {
|
|
90
|
+
/**
|
|
91
|
+
* Filter for elements that should be placed inside given slot.
|
|
92
|
+
*/
|
|
93
|
+
filter: SlotFilter;
|
|
94
|
+
/**
|
|
95
|
+
* Position of the slot within the table.
|
|
96
|
+
*/
|
|
97
|
+
positionOffset: PositionOffset;
|
|
98
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module table/tablekeyboard
|
|
7
|
+
*/
|
|
8
|
+
import TableSelection from './tableselection.js';
|
|
9
|
+
import TableUtils from './tableutils.js';
|
|
10
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
11
|
+
import { type ArrowKeyCodeDirection } from 'ckeditor5/src/utils.js';
|
|
12
|
+
import type { Element } from 'ckeditor5/src/engine.js';
|
|
13
|
+
/**
|
|
14
|
+
* This plugin enables keyboard navigation for tables.
|
|
15
|
+
* It is loaded automatically by the {@link module:table/table~Table} plugin.
|
|
16
|
+
*/
|
|
17
|
+
export default class TableKeyboard extends Plugin {
|
|
18
|
+
/**
|
|
19
|
+
* @inheritDoc
|
|
20
|
+
*/
|
|
21
|
+
static get pluginName(): "TableKeyboard";
|
|
22
|
+
/**
|
|
23
|
+
* @inheritDoc
|
|
24
|
+
*/
|
|
25
|
+
static get requires(): readonly [typeof TableSelection, typeof TableUtils];
|
|
26
|
+
/**
|
|
27
|
+
* @inheritDoc
|
|
28
|
+
*/
|
|
29
|
+
init(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Handles {@link module:engine/view/document~Document#event:tab tab} events for the <kbd>Tab</kbd> key executed
|
|
32
|
+
* when the table widget is selected.
|
|
33
|
+
*/
|
|
34
|
+
private _handleTabOnSelectedTable;
|
|
35
|
+
/**
|
|
36
|
+
* Handles {@link module:engine/view/document~Document#event:tab tab} events for the <kbd>Tab</kbd> key executed
|
|
37
|
+
* inside table cells.
|
|
38
|
+
*/
|
|
39
|
+
private _handleTab;
|
|
40
|
+
/**
|
|
41
|
+
* Handles {@link module:engine/view/document~Document#event:keydown keydown} events.
|
|
42
|
+
*/
|
|
43
|
+
private _onArrowKey;
|
|
44
|
+
/**
|
|
45
|
+
* Handles arrow keys to move the selection around the table.
|
|
46
|
+
*
|
|
47
|
+
* @param direction The direction of the arrow key.
|
|
48
|
+
* @param expandSelection If the current selection should be expanded.
|
|
49
|
+
* @returns Returns `true` if key was handled.
|
|
50
|
+
*/
|
|
51
|
+
private _handleArrowKeys;
|
|
52
|
+
/**
|
|
53
|
+
* Returns `true` if the selection is at the boundary of a table cell according to the navigation direction.
|
|
54
|
+
*
|
|
55
|
+
* @param selection The current selection.
|
|
56
|
+
* @param tableCell The current table cell element.
|
|
57
|
+
* @param isForward The expected navigation direction.
|
|
58
|
+
*/
|
|
59
|
+
private _isSelectionAtCellEdge;
|
|
60
|
+
/**
|
|
61
|
+
* Moves the selection from the given table cell in the specified direction.
|
|
62
|
+
*
|
|
63
|
+
* @param focusCell The table cell that is current multi-cell selection focus.
|
|
64
|
+
* @param direction Direction in which selection should move.
|
|
65
|
+
* @param expandSelection If the current selection should be expanded. Default value is false.
|
|
66
|
+
*/
|
|
67
|
+
protected _navigateFromCellInDirection(focusCell: Element, direction: ArrowKeyCodeDirection, expandSelection?: boolean): void;
|
|
68
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module table/tablemouse/mouseeventsobserver
|
|
7
|
+
*/
|
|
8
|
+
import { DomEventObserver, type DomEventData } from 'ckeditor5/src/engine.js';
|
|
9
|
+
/**
|
|
10
|
+
* The mouse selection event observer.
|
|
11
|
+
*
|
|
12
|
+
* It registers listeners for the following DOM events:
|
|
13
|
+
*
|
|
14
|
+
* - `'mousemove'`
|
|
15
|
+
* - `'mouseleave'`
|
|
16
|
+
*
|
|
17
|
+
* Note that this observer is disabled by default. To enable this observer, it needs to be added to
|
|
18
|
+
* {@link module:engine/view/view~View} using the {@link module:engine/view/view~View#addObserver} method.
|
|
19
|
+
*
|
|
20
|
+
* The observer is registered by the {@link module:table/tableselection~TableSelection} plugin.
|
|
21
|
+
*/
|
|
22
|
+
export default class MouseEventsObserver extends DomEventObserver<'mousemove' | 'mouseleave'> {
|
|
23
|
+
readonly domEventType: readonly ["mousemove", "mouseleave"];
|
|
24
|
+
/**
|
|
25
|
+
* @inheritDoc
|
|
26
|
+
*/
|
|
27
|
+
onDomEvent(domEvent: MouseEvent): void;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Fired when the mouse is moved over one of the editables.
|
|
31
|
+
*
|
|
32
|
+
* Introduced by {@link module:table/tablemouse/mouseeventsobserver~MouseEventsObserver}.
|
|
33
|
+
*
|
|
34
|
+
* Note that this event is not available by default. To make it available,
|
|
35
|
+
* {@link module:table/tablemouse/mouseeventsobserver~MouseEventsObserver} needs to be added
|
|
36
|
+
* to {@link module:engine/view/view~View} using the {@link module:engine/view/view~View#addObserver} method.
|
|
37
|
+
*
|
|
38
|
+
* @see module:table/tablemouse/mouseeventsobserver~MouseEventsObserver
|
|
39
|
+
* @eventName module:engine/view/document~Document#mousemove
|
|
40
|
+
* @param data Event data.
|
|
41
|
+
*/
|
|
42
|
+
export type ViewDocumentMouseMoveEvent = {
|
|
43
|
+
name: 'mousemove';
|
|
44
|
+
args: [data: DomEventData<MouseEvent>];
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Fired when the mouse is moved out of one of the editables.
|
|
48
|
+
*
|
|
49
|
+
* Introduced by {@link module:table/tablemouse/mouseeventsobserver~MouseEventsObserver}.
|
|
50
|
+
*
|
|
51
|
+
* Note that this event is not available by default. To make it available,
|
|
52
|
+
* {@link module:table/tablemouse/mouseeventsobserver~MouseEventsObserver} needs to be added
|
|
53
|
+
* to {@link module:engine/view/view~View} using the {@link module:engine/view/view~View#addObserver} method.
|
|
54
|
+
*
|
|
55
|
+
* @see module:table/tablemouse/mouseeventsobserver~MouseEventsObserver
|
|
56
|
+
* @eventName module:engine/view/document~Document#mouseleave
|
|
57
|
+
* @param data Event data.
|
|
58
|
+
*/
|
|
59
|
+
export type ViewDocumentMouseLeaveEvent = {
|
|
60
|
+
name: 'mouseleave';
|
|
61
|
+
args: [data: DomEventData<MouseEvent>];
|
|
62
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module table/tablemouse
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import TableSelection from './tableselection.js';
|
|
10
|
+
import TableUtils from './tableutils.js';
|
|
11
|
+
/**
|
|
12
|
+
* This plugin enables a table cells' selection with the mouse.
|
|
13
|
+
* It is loaded automatically by the {@link module:table/table~Table} plugin.
|
|
14
|
+
*/
|
|
15
|
+
export default class TableMouse extends Plugin {
|
|
16
|
+
/**
|
|
17
|
+
* @inheritDoc
|
|
18
|
+
*/
|
|
19
|
+
static get pluginName(): "TableMouse";
|
|
20
|
+
/**
|
|
21
|
+
* @inheritDoc
|
|
22
|
+
*/
|
|
23
|
+
static get requires(): readonly [typeof TableSelection, typeof TableUtils];
|
|
24
|
+
/**
|
|
25
|
+
* @inheritDoc
|
|
26
|
+
*/
|
|
27
|
+
init(): void;
|
|
28
|
+
/**
|
|
29
|
+
* Enables making cells selection by <kbd>Shift</kbd>+click. Creates a selection from the cell which previously held
|
|
30
|
+
* the selection to the cell which was clicked. It can be the same cell, in which case it selects a single cell.
|
|
31
|
+
*/
|
|
32
|
+
private _enableShiftClickSelection;
|
|
33
|
+
/**
|
|
34
|
+
* Enables making cells selection by dragging.
|
|
35
|
+
*
|
|
36
|
+
* The selection is made only on mousemove. Mouse tracking is started on mousedown.
|
|
37
|
+
* However, the cells selection is enabled only after the mouse cursor left the anchor cell.
|
|
38
|
+
* Thanks to that normal text selection within one cell works just fine. However, you can still select
|
|
39
|
+
* just one cell by leaving the anchor cell and moving back to it.
|
|
40
|
+
*/
|
|
41
|
+
private _enableMouseDragSelection;
|
|
42
|
+
/**
|
|
43
|
+
* Returns the model table cell element based on the target element of the passed DOM event.
|
|
44
|
+
*
|
|
45
|
+
* @returns Returns the table cell or `undefined`.
|
|
46
|
+
*/
|
|
47
|
+
private _getModelTableCellFromDomEvent;
|
|
48
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module table/tableproperties/commands/tablealignmentcommand
|
|
7
|
+
*/
|
|
8
|
+
import type { Editor } from 'ckeditor5/src/core.js';
|
|
9
|
+
import TablePropertyCommand from './tablepropertycommand.js';
|
|
10
|
+
/**
|
|
11
|
+
* The table alignment command.
|
|
12
|
+
*
|
|
13
|
+
* The command is registered by the {@link module:table/tableproperties/tablepropertiesediting~TablePropertiesEditing} as
|
|
14
|
+
* the `'tableAlignment'` editor command.
|
|
15
|
+
*
|
|
16
|
+
* To change the alignment of the selected table, execute the command:
|
|
17
|
+
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* editor.execute( 'tableAlignment', {
|
|
20
|
+
* value: 'right'
|
|
21
|
+
* } );
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export default class TableAlignmentCommand extends TablePropertyCommand {
|
|
25
|
+
/**
|
|
26
|
+
* Creates a new `TableAlignmentCommand` instance.
|
|
27
|
+
*
|
|
28
|
+
* @param editor An editor in which this command will be used.
|
|
29
|
+
* @param defaultValue The default value for the "alignment" attribute.
|
|
30
|
+
*/
|
|
31
|
+
constructor(editor: Editor, defaultValue: string);
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module table/tableproperties/commands/tablebackgroundcolorcommand
|
|
7
|
+
*/
|
|
8
|
+
import type { Editor } from 'ckeditor5/src/core.js';
|
|
9
|
+
import TablePropertyCommand from './tablepropertycommand.js';
|
|
10
|
+
/**
|
|
11
|
+
* The table background color command.
|
|
12
|
+
*
|
|
13
|
+
* The command is registered by the {@link module:table/tableproperties/tablepropertiesediting~TablePropertiesEditing} as
|
|
14
|
+
* the `'tableBackgroundColor'` editor command.
|
|
15
|
+
*
|
|
16
|
+
* To change the background color of the selected table, execute the command:
|
|
17
|
+
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* editor.execute( 'tableBackgroundColor', {
|
|
20
|
+
* value: '#f00'
|
|
21
|
+
* } );
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export default class TableBackgroundColorCommand extends TablePropertyCommand {
|
|
25
|
+
/**
|
|
26
|
+
* Creates a new `TableBackgroundColorCommand` instance.
|
|
27
|
+
*
|
|
28
|
+
* @param editor An editor in which this command will be used.
|
|
29
|
+
* @param defaultValue The default value of the attribute.
|
|
30
|
+
*/
|
|
31
|
+
constructor(editor: Editor, defaultValue: string);
|
|
32
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module table/tableproperties/commands/tablebordercolorcommand
|
|
7
|
+
*/
|
|
8
|
+
import type { Element } from 'ckeditor5/src/engine.js';
|
|
9
|
+
import type { Editor } from 'ckeditor5/src/core.js';
|
|
10
|
+
import TablePropertyCommand from './tablepropertycommand.js';
|
|
11
|
+
/**
|
|
12
|
+
* The table border color command.
|
|
13
|
+
*
|
|
14
|
+
* The command is registered by the {@link module:table/tableproperties/tablepropertiesediting~TablePropertiesEditing} as
|
|
15
|
+
* the `'tableBorderColor'` editor command.
|
|
16
|
+
*
|
|
17
|
+
* To change the border color of the selected table, execute the command:
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* editor.execute( 'tableBorderColor', {
|
|
21
|
+
* value: '#f00'
|
|
22
|
+
* } );
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export default class TableBorderColorCommand extends TablePropertyCommand {
|
|
26
|
+
/**
|
|
27
|
+
* Creates a new `TableBorderColorCommand` instance.
|
|
28
|
+
*
|
|
29
|
+
* @param editor An editor in which this command will be used.
|
|
30
|
+
* @param defaultValue The default value of the attribute.
|
|
31
|
+
*/
|
|
32
|
+
constructor(editor: Editor, defaultValue: string);
|
|
33
|
+
/**
|
|
34
|
+
* @inheritDoc
|
|
35
|
+
*/
|
|
36
|
+
protected _getValue(table: Element): unknown;
|
|
37
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module table/tableproperties/commands/tableborderstylecommand
|
|
7
|
+
*/
|
|
8
|
+
import type { Element } from 'ckeditor5/src/engine.js';
|
|
9
|
+
import TablePropertyCommand from './tablepropertycommand.js';
|
|
10
|
+
import type { Editor } from 'ckeditor5/src/core.js';
|
|
11
|
+
/**
|
|
12
|
+
* The table style border command.
|
|
13
|
+
*
|
|
14
|
+
* The command is registered by the {@link module:table/tableproperties/tablepropertiesediting~TablePropertiesEditing} as
|
|
15
|
+
* the `'tableBorderStyle'` editor command.
|
|
16
|
+
*
|
|
17
|
+
* To change the border style of the selected table, execute the command:
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* editor.execute( 'tableBorderStyle', {
|
|
21
|
+
* value: 'dashed'
|
|
22
|
+
* } );
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export default class TableBorderStyleCommand extends TablePropertyCommand {
|
|
26
|
+
/**
|
|
27
|
+
* Creates a new `TableBorderStyleCommand` instance.
|
|
28
|
+
*
|
|
29
|
+
* @param editor An editor in which this command will be used.
|
|
30
|
+
* @param defaultValue The default value of the attribute.
|
|
31
|
+
*/
|
|
32
|
+
constructor(editor: Editor, defaultValue: string);
|
|
33
|
+
/**
|
|
34
|
+
* @inheritDoc
|
|
35
|
+
*/
|
|
36
|
+
protected _getValue(table: Element): unknown;
|
|
37
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module table/tableproperties/commands/tableborderwidthcommand
|
|
7
|
+
*/
|
|
8
|
+
import type { Element } from 'ckeditor5/src/engine.js';
|
|
9
|
+
import type { Editor } from 'ckeditor5/src/core.js';
|
|
10
|
+
import TablePropertyCommand from './tablepropertycommand.js';
|
|
11
|
+
/**
|
|
12
|
+
* The table width border command.
|
|
13
|
+
*
|
|
14
|
+
* The command is registered by the {@link module:table/tableproperties/tablepropertiesediting~TablePropertiesEditing} as
|
|
15
|
+
* the `'tableBorderWidth'` editor command.
|
|
16
|
+
*
|
|
17
|
+
* To change the border width of the selected table, execute the command:
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* editor.execute( 'tableBorderWidth', {
|
|
21
|
+
* value: '5px'
|
|
22
|
+
* } );
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* **Note**: This command adds the default `'px'` unit to numeric values. Executing:
|
|
26
|
+
*
|
|
27
|
+
* ```ts
|
|
28
|
+
* editor.execute( 'tableBorderWidth', {
|
|
29
|
+
* value: '5'
|
|
30
|
+
* } );
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* will set the `borderWidth` attribute to `'5px'` in the model.
|
|
34
|
+
*/
|
|
35
|
+
export default class TableBorderWidthCommand extends TablePropertyCommand {
|
|
36
|
+
/**
|
|
37
|
+
* Creates a new `TableBorderWidthCommand` instance.
|
|
38
|
+
*
|
|
39
|
+
* @param editor An editor in which this command will be used.
|
|
40
|
+
* @param defaultValue The default value of the attribute.
|
|
41
|
+
*/
|
|
42
|
+
constructor(editor: Editor, defaultValue: string);
|
|
43
|
+
/**
|
|
44
|
+
* @inheritDoc
|
|
45
|
+
*/
|
|
46
|
+
protected _getValue(table: Element): string | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* @inheritDoc
|
|
49
|
+
*/
|
|
50
|
+
protected _getValueToSet(value: string | number | undefined): unknown;
|
|
51
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module table/tableproperties/commands/tableheightcommand
|
|
7
|
+
*/
|
|
8
|
+
import TablePropertyCommand from './tablepropertycommand.js';
|
|
9
|
+
import type { Editor } from 'ckeditor5/src/core.js';
|
|
10
|
+
/**
|
|
11
|
+
* The table height command.
|
|
12
|
+
*
|
|
13
|
+
* The command is registered by the {@link module:table/tableproperties/tablepropertiesediting~TablePropertiesEditing} as
|
|
14
|
+
* the `'tableHeight'` editor command.
|
|
15
|
+
*
|
|
16
|
+
* To change the height of the selected table, execute the command:
|
|
17
|
+
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* editor.execute( 'tableHeight', {
|
|
20
|
+
* value: '500px'
|
|
21
|
+
* } );
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* **Note**: This command adds the default `'px'` unit to numeric values. Executing:
|
|
25
|
+
*
|
|
26
|
+
* ```ts
|
|
27
|
+
* editor.execute( 'tableHeight', {
|
|
28
|
+
* value: '50'
|
|
29
|
+
* } );
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* will set the `height` attribute to `'50px'` in the model.
|
|
33
|
+
*/
|
|
34
|
+
export default class TableHeightCommand extends TablePropertyCommand {
|
|
35
|
+
/**
|
|
36
|
+
* Creates a new `TableHeightCommand` instance.
|
|
37
|
+
*
|
|
38
|
+
* @param editor An editor in which this command will be used.
|
|
39
|
+
* @param defaultValue The default value of the attribute.
|
|
40
|
+
*/
|
|
41
|
+
constructor(editor: Editor, defaultValue: string);
|
|
42
|
+
/**
|
|
43
|
+
* @inheritDoc
|
|
44
|
+
*/
|
|
45
|
+
protected _getValueToSet(value: string | number | undefined): unknown;
|
|
46
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module table/tableproperties/commands/tablepropertycommand
|
|
7
|
+
*/
|
|
8
|
+
import type { Batch, Element } from 'ckeditor5/src/engine.js';
|
|
9
|
+
import { Command, type Editor } from 'ckeditor5/src/core.js';
|
|
10
|
+
export interface TablePropertyCommandExecuteOptions {
|
|
11
|
+
batch?: Batch;
|
|
12
|
+
columnWidths?: string;
|
|
13
|
+
table?: Element;
|
|
14
|
+
tableWidth?: string;
|
|
15
|
+
value?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The table cell attribute command.
|
|
19
|
+
*
|
|
20
|
+
* This command is a base command for other table property commands.
|
|
21
|
+
*/
|
|
22
|
+
export default class TablePropertyCommand extends Command {
|
|
23
|
+
/**
|
|
24
|
+
* The attribute that will be set by the command.
|
|
25
|
+
*/
|
|
26
|
+
readonly attributeName: string;
|
|
27
|
+
/**
|
|
28
|
+
* The default value for the attribute.
|
|
29
|
+
*/
|
|
30
|
+
protected readonly _defaultValue: string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Creates a new `TablePropertyCommand` instance.
|
|
33
|
+
*
|
|
34
|
+
* @param editor An editor in which this command will be used.
|
|
35
|
+
* @param attributeName Table cell attribute name.
|
|
36
|
+
* @param defaultValue The default value of the attribute.
|
|
37
|
+
*/
|
|
38
|
+
constructor(editor: Editor, attributeName: string, defaultValue?: string);
|
|
39
|
+
/**
|
|
40
|
+
* @inheritDoc
|
|
41
|
+
*/
|
|
42
|
+
refresh(): void;
|
|
43
|
+
/**
|
|
44
|
+
* Executes the command.
|
|
45
|
+
*
|
|
46
|
+
* @fires execute
|
|
47
|
+
* @param options.value If set, the command will set the attribute on the selected table.
|
|
48
|
+
* If not set, the command will remove the attribute from the selected table.
|
|
49
|
+
* @param options.batch Pass the model batch instance to the command to aggregate changes,
|
|
50
|
+
* for example, to allow a single undo step for multiple executions.
|
|
51
|
+
*/
|
|
52
|
+
execute(options?: TablePropertyCommandExecuteOptions): void;
|
|
53
|
+
/**
|
|
54
|
+
* Returns the attribute value for a table.
|
|
55
|
+
*/
|
|
56
|
+
protected _getValue(table: Element): unknown;
|
|
57
|
+
/**
|
|
58
|
+
* Returns the proper model value. It can be used to add a default unit to numeric values.
|
|
59
|
+
*/
|
|
60
|
+
protected _getValueToSet(value: string | number | undefined): unknown;
|
|
61
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module table/tableproperties/commands/tablewidthcommand
|
|
7
|
+
*/
|
|
8
|
+
import TablePropertyCommand from './tablepropertycommand.js';
|
|
9
|
+
import type { Editor } from 'ckeditor5/src/core.js';
|
|
10
|
+
/**
|
|
11
|
+
* The table width command.
|
|
12
|
+
*
|
|
13
|
+
* The command is registered by the {@link module:table/tableproperties/tablepropertiesediting~TablePropertiesEditing} as
|
|
14
|
+
* the `'tableWidth'` editor command.
|
|
15
|
+
*
|
|
16
|
+
* To change the width of the selected table, execute the command:
|
|
17
|
+
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* editor.execute( 'tableWidth', {
|
|
20
|
+
* value: '400px'
|
|
21
|
+
* } );
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* **Note**: This command adds the default `'px'` unit to numeric values. Executing:
|
|
25
|
+
*
|
|
26
|
+
* ```ts
|
|
27
|
+
* editor.execute( 'tableWidth', {
|
|
28
|
+
* value: '50'
|
|
29
|
+
* } );
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* will set the `width` attribute to `'50px'` in the model.
|
|
33
|
+
*/
|
|
34
|
+
export default class TableWidthCommand extends TablePropertyCommand {
|
|
35
|
+
/**
|
|
36
|
+
* Creates a new `TableWidthCommand` instance.
|
|
37
|
+
*
|
|
38
|
+
* @param editor An editor in which this command will be used.
|
|
39
|
+
* @param defaultValue The default value of the attribute.
|
|
40
|
+
*/
|
|
41
|
+
constructor(editor: Editor, defaultValue: string);
|
|
42
|
+
/**
|
|
43
|
+
* @inheritDoc
|
|
44
|
+
*/
|
|
45
|
+
_getValueToSet(value: string | number | undefined): unknown;
|
|
46
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module table/tableproperties/tablepropertiesediting
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import TableEditing from '../tableediting.js';
|
|
10
|
+
/**
|
|
11
|
+
* The table properties editing feature.
|
|
12
|
+
*
|
|
13
|
+
* Introduces table's model attributes and their conversion:
|
|
14
|
+
*
|
|
15
|
+
* - border: `tableBorderStyle`, `tableBorderColor` and `tableBorderWidth`
|
|
16
|
+
* - background color: `tableBackgroundColor`
|
|
17
|
+
* - horizontal alignment: `tableAlignment`
|
|
18
|
+
* - width & height: `tableWidth` & `tableHeight`
|
|
19
|
+
*
|
|
20
|
+
* It also registers commands used to manipulate the above attributes:
|
|
21
|
+
*
|
|
22
|
+
* - border: `'tableBorderStyle'`, `'tableBorderColor'` and `'tableBorderWidth'` commands
|
|
23
|
+
* - background color: `'tableBackgroundColor'`
|
|
24
|
+
* - horizontal alignment: `'tableAlignment'`
|
|
25
|
+
* - width & height: `'tableWidth'` & `'tableHeight'`
|
|
26
|
+
*/
|
|
27
|
+
export default class TablePropertiesEditing extends Plugin {
|
|
28
|
+
/**
|
|
29
|
+
* @inheritDoc
|
|
30
|
+
*/
|
|
31
|
+
static get pluginName(): "TablePropertiesEditing";
|
|
32
|
+
/**
|
|
33
|
+
* @inheritDoc
|
|
34
|
+
*/
|
|
35
|
+
static get requires(): readonly [typeof TableEditing];
|
|
36
|
+
/**
|
|
37
|
+
* @inheritDoc
|
|
38
|
+
*/
|
|
39
|
+
init(): void;
|
|
40
|
+
}
|