@ckeditor/ckeditor5-table 38.2.0-alpha.0 → 38.2.0-alpha.1
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 +1 -1
- package/package.json +2 -2
- package/src/augmentation.d.ts +1 -1
- package/src/commands/insertcolumncommand.d.ts +1 -1
- package/src/commands/insertcolumncommand.js +1 -1
- package/src/commands/insertrowcommand.d.ts +1 -1
- package/src/commands/insertrowcommand.js +1 -1
- package/src/commands/inserttablecommand.d.ts +1 -1
- package/src/commands/inserttablecommand.js +1 -1
- package/src/commands/mergecellcommand.d.ts +3 -3
- package/src/commands/mergecellcommand.js +4 -4
- package/src/commands/mergecellscommand.d.ts +1 -1
- package/src/commands/mergecellscommand.js +4 -4
- package/src/commands/removecolumncommand.d.ts +1 -1
- package/src/commands/removecolumncommand.js +2 -2
- package/src/commands/removerowcommand.d.ts +1 -1
- package/src/commands/removerowcommand.js +1 -1
- package/src/commands/selectcolumncommand.d.ts +1 -1
- package/src/commands/selectcolumncommand.js +2 -2
- package/src/commands/selectrowcommand.d.ts +1 -1
- package/src/commands/selectrowcommand.js +1 -1
- package/src/commands/setheadercolumncommand.d.ts +1 -1
- package/src/commands/setheadercolumncommand.js +3 -3
- package/src/commands/setheaderrowcommand.d.ts +1 -1
- package/src/commands/setheaderrowcommand.js +3 -3
- package/src/commands/splitcellcommand.d.ts +1 -1
- package/src/commands/splitcellcommand.js +1 -1
- package/src/converters/downcast.d.ts +3 -3
- package/src/converters/downcast.js +2 -2
- package/src/converters/table-caption-post-fixer.d.ts +1 -1
- package/src/converters/table-cell-paragraph-post-fixer.d.ts +1 -1
- package/src/converters/table-cell-refresh-handler.d.ts +1 -1
- package/src/converters/table-cell-refresh-handler.js +1 -1
- package/src/converters/table-headings-refresh-handler.d.ts +1 -1
- package/src/converters/table-headings-refresh-handler.js +1 -1
- package/src/converters/table-layout-post-fixer.d.ts +1 -1
- package/src/converters/table-layout-post-fixer.js +2 -2
- package/src/converters/tableproperties.d.ts +1 -1
- package/src/converters/upcasttable.d.ts +1 -1
- package/src/converters/upcasttable.js +2 -2
- package/src/index.d.ts +53 -53
- package/src/index.js +23 -23
- package/src/plaintableoutput.d.ts +2 -2
- package/src/plaintableoutput.js +2 -2
- package/src/table.d.ts +8 -8
- package/src/table.js +8 -8
- package/src/tablecaption/tablecaptionediting.d.ts +2 -2
- package/src/tablecaption/tablecaptionediting.js +6 -6
- package/src/tablecaption/tablecaptionui.d.ts +1 -1
- package/src/tablecaption/tablecaptionui.js +3 -3
- package/src/tablecaption/toggletablecaptioncommand.d.ts +1 -1
- package/src/tablecaption/toggletablecaptioncommand.js +2 -2
- package/src/tablecaption/utils.d.ts +1 -1
- package/src/tablecaption.d.ts +3 -3
- package/src/tablecaption.js +3 -3
- package/src/tablecellproperties/commands/tablecellbackgroundcolorcommand.d.ts +2 -2
- package/src/tablecellproperties/commands/tablecellbackgroundcolorcommand.js +1 -1
- package/src/tablecellproperties/commands/tablecellbordercolorcommand.d.ts +3 -3
- package/src/tablecellproperties/commands/tablecellbordercolorcommand.js +2 -2
- package/src/tablecellproperties/commands/tablecellborderstylecommand.d.ts +3 -3
- package/src/tablecellproperties/commands/tablecellborderstylecommand.js +2 -2
- package/src/tablecellproperties/commands/tablecellborderwidthcommand.d.ts +3 -3
- package/src/tablecellproperties/commands/tablecellborderwidthcommand.js +2 -2
- package/src/tablecellproperties/commands/tablecellheightcommand.d.ts +2 -2
- package/src/tablecellproperties/commands/tablecellheightcommand.js +2 -2
- package/src/tablecellproperties/commands/tablecellhorizontalalignmentcommand.d.ts +2 -2
- package/src/tablecellproperties/commands/tablecellhorizontalalignmentcommand.js +1 -1
- package/src/tablecellproperties/commands/tablecellpaddingcommand.d.ts +3 -3
- package/src/tablecellproperties/commands/tablecellpaddingcommand.js +2 -2
- package/src/tablecellproperties/commands/tablecellpropertycommand.d.ts +2 -2
- package/src/tablecellproperties/commands/tablecellpropertycommand.js +1 -1
- package/src/tablecellproperties/commands/tablecellverticalalignmentcommand.d.ts +2 -2
- package/src/tablecellproperties/commands/tablecellverticalalignmentcommand.js +1 -1
- package/src/tablecellproperties/tablecellpropertiesediting.d.ts +3 -3
- package/src/tablecellproperties/tablecellpropertiesediting.js +15 -15
- package/src/tablecellproperties/tablecellpropertiesui.d.ts +3 -3
- package/src/tablecellproperties/tablecellpropertiesui.js +10 -8
- package/src/tablecellproperties/ui/tablecellpropertiesview.d.ts +5 -4
- package/src/tablecellproperties/ui/tablecellpropertiesview.js +9 -7
- package/src/tablecellproperties.d.ts +3 -3
- package/src/tablecellproperties.js +3 -3
- package/src/tablecellwidth/commands/tablecellwidthcommand.d.ts +2 -2
- package/src/tablecellwidth/commands/tablecellwidthcommand.js +2 -2
- package/src/tablecellwidth/tablecellwidthediting.d.ts +2 -2
- package/src/tablecellwidth/tablecellwidthediting.js +5 -5
- package/src/tableclipboard.d.ts +5 -5
- package/src/tableclipboard.js +5 -5
- package/src/tablecolumnresize/converters.d.ts +2 -2
- package/src/tablecolumnresize/converters.js +1 -1
- package/src/tablecolumnresize/tablecolumnresizeediting.d.ts +4 -4
- package/src/tablecolumnresize/tablecolumnresizeediting.js +10 -10
- package/src/tablecolumnresize/tablewidthscommand.d.ts +2 -2
- package/src/tablecolumnresize/tablewidthscommand.js +2 -2
- package/src/tablecolumnresize/utils.d.ts +3 -3
- package/src/tablecolumnresize/utils.js +2 -2
- package/src/tablecolumnresize.d.ts +3 -3
- package/src/tablecolumnresize.js +3 -3
- package/src/tableconfig.d.ts +14 -2
- package/src/tableediting.d.ts +3 -3
- package/src/tableediting.js +20 -20
- package/src/tablekeyboard.d.ts +5 -5
- package/src/tablekeyboard.js +5 -5
- package/src/tablemouse/mouseeventsobserver.d.ts +1 -1
- package/src/tablemouse/mouseeventsobserver.js +1 -1
- package/src/tablemouse.d.ts +3 -3
- package/src/tablemouse.js +4 -4
- package/src/tableproperties/commands/tablealignmentcommand.d.ts +2 -2
- package/src/tableproperties/commands/tablealignmentcommand.js +1 -1
- package/src/tableproperties/commands/tablebackgroundcolorcommand.d.ts +2 -2
- package/src/tableproperties/commands/tablebackgroundcolorcommand.js +1 -1
- package/src/tableproperties/commands/tablebordercolorcommand.d.ts +3 -3
- package/src/tableproperties/commands/tablebordercolorcommand.js +2 -2
- package/src/tableproperties/commands/tableborderstylecommand.d.ts +3 -3
- package/src/tableproperties/commands/tableborderstylecommand.js +2 -2
- package/src/tableproperties/commands/tableborderwidthcommand.d.ts +3 -3
- package/src/tableproperties/commands/tableborderwidthcommand.js +2 -2
- package/src/tableproperties/commands/tableheightcommand.d.ts +2 -2
- package/src/tableproperties/commands/tableheightcommand.js +2 -2
- package/src/tableproperties/commands/tablepropertycommand.d.ts +2 -2
- package/src/tableproperties/commands/tablepropertycommand.js +1 -1
- package/src/tableproperties/commands/tablewidthcommand.d.ts +2 -2
- package/src/tableproperties/commands/tablewidthcommand.js +2 -2
- package/src/tableproperties/tablepropertiesediting.d.ts +2 -2
- package/src/tableproperties/tablepropertiesediting.js +12 -12
- package/src/tableproperties/tablepropertiesui.d.ts +3 -3
- package/src/tableproperties/tablepropertiesui.js +10 -8
- package/src/tableproperties/ui/tablepropertiesview.d.ts +8 -4
- package/src/tableproperties/ui/tablepropertiesview.js +9 -7
- package/src/tableproperties.d.ts +3 -3
- package/src/tableproperties.js +3 -3
- package/src/tableselection.d.ts +3 -3
- package/src/tableselection.js +5 -5
- package/src/tabletoolbar.d.ts +2 -2
- package/src/tabletoolbar.js +3 -3
- package/src/tableui.d.ts +1 -1
- package/src/tableui.js +4 -4
- package/src/tableutils.d.ts +3 -3
- package/src/tableutils.js +5 -5
- package/src/tablewalker.d.ts +1 -1
- package/src/ui/colorinputview.d.ts +5 -8
- package/src/ui/colorinputview.js +54 -37
- package/src/ui/formrowview.d.ts +2 -2
- package/src/ui/formrowview.js +1 -1
- package/src/ui/inserttableview.d.ts +2 -2
- package/src/ui/inserttableview.js +2 -2
- package/src/utils/common.d.ts +2 -2
- package/src/utils/common.js +1 -1
- package/src/utils/structure.d.ts +3 -3
- package/src/utils/structure.js +2 -2
- package/src/utils/table-properties.d.ts +1 -1
- package/src/utils/ui/contextualballoon.d.ts +2 -2
- package/src/utils/ui/contextualballoon.js +3 -3
- package/src/utils/ui/table-properties.d.ts +7 -5
- package/src/utils/ui/table-properties.js +7 -5
- package/src/utils/ui/widget.d.ts +1 -1
- package/src/utils/ui/widget.js +1 -1
- package/theme/tablecaption.css +7 -7
- package/theme/tablecolumnresize.css +2 -2
|
@@ -5,18 +5,18 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module table/tableproperties/tablepropertiesediting
|
|
7
7
|
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
-
import { addBackgroundRules, addBorderRules } from 'ckeditor5/src/engine';
|
|
10
|
-
import TableEditing from '../tableediting';
|
|
11
|
-
import { downcastAttributeToStyle, downcastTableAttribute, upcastBorderStyles, upcastStyleToAttribute } from '../converters/tableproperties';
|
|
12
|
-
import TableBackgroundColorCommand from './commands/tablebackgroundcolorcommand';
|
|
13
|
-
import TableBorderColorCommand from './commands/tablebordercolorcommand';
|
|
14
|
-
import TableBorderStyleCommand from './commands/tableborderstylecommand';
|
|
15
|
-
import TableBorderWidthCommand from './commands/tableborderwidthcommand';
|
|
16
|
-
import TableWidthCommand from './commands/tablewidthcommand';
|
|
17
|
-
import TableHeightCommand from './commands/tableheightcommand';
|
|
18
|
-
import TableAlignmentCommand from './commands/tablealignmentcommand';
|
|
19
|
-
import { getNormalizedDefaultProperties } from '../utils/table-properties';
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import { addBackgroundRules, addBorderRules } from 'ckeditor5/src/engine.js';
|
|
10
|
+
import TableEditing from '../tableediting.js';
|
|
11
|
+
import { downcastAttributeToStyle, downcastTableAttribute, upcastBorderStyles, upcastStyleToAttribute } from '../converters/tableproperties.js';
|
|
12
|
+
import TableBackgroundColorCommand from './commands/tablebackgroundcolorcommand.js';
|
|
13
|
+
import TableBorderColorCommand from './commands/tablebordercolorcommand.js';
|
|
14
|
+
import TableBorderStyleCommand from './commands/tableborderstylecommand.js';
|
|
15
|
+
import TableBorderWidthCommand from './commands/tableborderwidthcommand.js';
|
|
16
|
+
import TableWidthCommand from './commands/tablewidthcommand.js';
|
|
17
|
+
import TableHeightCommand from './commands/tableheightcommand.js';
|
|
18
|
+
import TableAlignmentCommand from './commands/tablealignmentcommand.js';
|
|
19
|
+
import { getNormalizedDefaultProperties } from '../utils/table-properties.js';
|
|
20
20
|
const ALIGN_VALUES_REG_EXP = /^(left|center|right)$/;
|
|
21
21
|
const FLOAT_VALUES_REG_EXP = /^(left|none|right)$/;
|
|
22
22
|
/**
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module table/tableproperties/tablepropertiesui
|
|
7
7
|
*/
|
|
8
|
-
import { type Editor, Plugin } from 'ckeditor5/src/core';
|
|
9
|
-
import { ContextualBalloon } from 'ckeditor5/src/ui';
|
|
10
|
-
import TablePropertiesView from './ui/tablepropertiesview';
|
|
8
|
+
import { type Editor, Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import { ContextualBalloon } from 'ckeditor5/src/ui.js';
|
|
10
|
+
import TablePropertiesView from './ui/tablepropertiesview.js';
|
|
11
11
|
/**
|
|
12
12
|
* The table properties UI plugin. It introduces the `'tableProperties'` button
|
|
13
13
|
* that opens a form allowing to specify visual styling of an entire table.
|
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module table/tableproperties/tablepropertiesui
|
|
7
7
|
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
-
import { ButtonView, ContextualBalloon, clickOutsideHandler, getLocalizedColorOptions, normalizeColorOptions } from 'ckeditor5/src/ui';
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import { ButtonView, ContextualBalloon, clickOutsideHandler, getLocalizedColorOptions, normalizeColorOptions } from 'ckeditor5/src/ui.js';
|
|
10
10
|
import { debounce } from 'lodash-es';
|
|
11
|
-
import TablePropertiesView from './ui/tablepropertiesview';
|
|
11
|
+
import TablePropertiesView from './ui/tablepropertiesview.js';
|
|
12
12
|
import tableProperties from './../../theme/icons/table-properties.svg';
|
|
13
|
-
import { colorFieldValidator, getLocalizedColorErrorText, getLocalizedLengthErrorText, lengthFieldValidator, lineWidthFieldValidator, defaultColors } from '../utils/ui/table-properties';
|
|
14
|
-
import { getTableWidgetAncestor } from '../utils/ui/widget';
|
|
15
|
-
import { getBalloonTablePositionData, repositionContextualBalloon } from '../utils/ui/contextualballoon';
|
|
16
|
-
import { getNormalizedDefaultProperties } from '../utils/table-properties';
|
|
13
|
+
import { colorFieldValidator, getLocalizedColorErrorText, getLocalizedLengthErrorText, lengthFieldValidator, lineWidthFieldValidator, defaultColors } from '../utils/ui/table-properties.js';
|
|
14
|
+
import { getTableWidgetAncestor } from '../utils/ui/widget.js';
|
|
15
|
+
import { getBalloonTablePositionData, repositionContextualBalloon } from '../utils/ui/contextualballoon.js';
|
|
16
|
+
import { getNormalizedDefaultProperties } from '../utils/table-properties.js';
|
|
17
17
|
const ERROR_TEXT_TIMEOUT = 500;
|
|
18
18
|
// Map of view properties and related commands.
|
|
19
19
|
const propertyToCommandMap = {
|
|
@@ -105,10 +105,12 @@ export default class TablePropertiesUI extends Plugin {
|
|
|
105
105
|
const localizedBorderColors = getLocalizedColorOptions(editor.locale, borderColorsConfig);
|
|
106
106
|
const backgroundColorsConfig = normalizeColorOptions(config.backgroundColors);
|
|
107
107
|
const localizedBackgroundColors = getLocalizedColorOptions(editor.locale, backgroundColorsConfig);
|
|
108
|
+
const hasColorPicker = config.colorPicker !== false;
|
|
108
109
|
const view = new TablePropertiesView(editor.locale, {
|
|
109
110
|
borderColors: localizedBorderColors,
|
|
110
111
|
backgroundColors: localizedBackgroundColors,
|
|
111
|
-
defaultTableProperties: this._defaultTableProperties
|
|
112
|
+
defaultTableProperties: this._defaultTableProperties,
|
|
113
|
+
colorPickerConfig: hasColorPicker ? (config.colorPicker || {}) : false
|
|
112
114
|
});
|
|
113
115
|
const t = editor.t;
|
|
114
116
|
// Render the view so its #element is available for the clickOutsideHandler.
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module table/tableproperties/ui/tablepropertiesview
|
|
7
7
|
*/
|
|
8
|
-
import { ButtonView, FocusCycler, LabeledFieldView, ToolbarView, View, ViewCollection, type DropdownView, type InputTextView, type NormalizedColorOption } from 'ckeditor5/src/ui';
|
|
9
|
-
import { FocusTracker, KeystrokeHandler, type Locale } from 'ckeditor5/src/utils';
|
|
8
|
+
import { ButtonView, FocusCycler, LabeledFieldView, ToolbarView, View, ViewCollection, type DropdownView, type InputTextView, type NormalizedColorOption, type ColorPickerConfig } from 'ckeditor5/src/ui.js';
|
|
9
|
+
import { FocusTracker, KeystrokeHandler, type Locale } from 'ckeditor5/src/utils.js';
|
|
10
10
|
import '../../../theme/form.css';
|
|
11
11
|
import '../../../theme/tableform.css';
|
|
12
12
|
import '../../../theme/tableproperties.css';
|
|
13
|
-
import type ColorInputView from '../../ui/colorinputview';
|
|
14
|
-
import type { TablePropertiesOptions } from '../../tableconfig';
|
|
13
|
+
import type ColorInputView from '../../ui/colorinputview.js';
|
|
14
|
+
import type { TablePropertiesOptions } from '../../tableconfig.js';
|
|
15
15
|
/**
|
|
16
16
|
* Additional configuration of the view.
|
|
17
17
|
*/
|
|
@@ -30,6 +30,10 @@ export interface TablePropertiesViewOptions {
|
|
|
30
30
|
* The default table properties.
|
|
31
31
|
*/
|
|
32
32
|
defaultTableProperties: TablePropertiesOptions;
|
|
33
|
+
/**
|
|
34
|
+
* The default color picker config.
|
|
35
|
+
*/
|
|
36
|
+
colorPickerConfig: false | ColorPickerConfig;
|
|
33
37
|
}
|
|
34
38
|
/**
|
|
35
39
|
* The class representing a table properties form, allowing users to customize
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module table/tableproperties/ui/tablepropertiesview
|
|
7
7
|
*/
|
|
8
|
-
import { addListToDropdown, ButtonView, createLabeledDropdown, createLabeledInputText, FocusCycler, FormHeaderView, LabeledFieldView, LabelView, submitHandler, ToolbarView, View, ViewCollection } from 'ckeditor5/src/ui';
|
|
9
|
-
import { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils';
|
|
10
|
-
import { icons } from 'ckeditor5/src/core';
|
|
11
|
-
import { fillToolbar, getBorderStyleDefinitions, getBorderStyleLabels, getLabeledColorInputCreator } from '../../utils/ui/table-properties';
|
|
12
|
-
import FormRowView from '../../ui/formrowview';
|
|
8
|
+
import { addListToDropdown, ButtonView, createLabeledDropdown, createLabeledInputText, FocusCycler, FormHeaderView, LabeledFieldView, LabelView, submitHandler, ToolbarView, View, ViewCollection } from 'ckeditor5/src/ui.js';
|
|
9
|
+
import { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils.js';
|
|
10
|
+
import { icons } from 'ckeditor5/src/core.js';
|
|
11
|
+
import { fillToolbar, getBorderStyleDefinitions, getBorderStyleLabels, getLabeledColorInputCreator } from '../../utils/ui/table-properties.js';
|
|
12
|
+
import FormRowView from '../../ui/formrowview.js';
|
|
13
13
|
import '../../../theme/form.css';
|
|
14
14
|
import '../../../theme/tableform.css';
|
|
15
15
|
import '../../../theme/tableproperties.css';
|
|
@@ -204,7 +204,8 @@ export default class TablePropertiesView extends View {
|
|
|
204
204
|
const colorInputCreator = getLabeledColorInputCreator({
|
|
205
205
|
colorConfig: this.options.borderColors,
|
|
206
206
|
columns: 5,
|
|
207
|
-
defaultColorValue: defaultBorder.color
|
|
207
|
+
defaultColorValue: defaultBorder.color,
|
|
208
|
+
colorPickerConfig: this.options.colorPickerConfig
|
|
208
209
|
});
|
|
209
210
|
const locale = this.locale;
|
|
210
211
|
const t = this.t;
|
|
@@ -295,7 +296,8 @@ export default class TablePropertiesView extends View {
|
|
|
295
296
|
const backgroundInputCreator = getLabeledColorInputCreator({
|
|
296
297
|
colorConfig: this.options.backgroundColors,
|
|
297
298
|
columns: 5,
|
|
298
|
-
defaultColorValue: this.options.defaultTableProperties.backgroundColor
|
|
299
|
+
defaultColorValue: this.options.defaultTableProperties.backgroundColor,
|
|
300
|
+
colorPickerConfig: this.options.colorPickerConfig
|
|
299
301
|
});
|
|
300
302
|
const backgroundInput = new LabeledFieldView(locale, backgroundInputCreator);
|
|
301
303
|
backgroundInput.set({
|
package/src/tableproperties.d.ts
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module table/tableproperties
|
|
7
7
|
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
-
import TablePropertiesEditing from './tableproperties/tablepropertiesediting';
|
|
10
|
-
import TablePropertiesUI from './tableproperties/tablepropertiesui';
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import TablePropertiesEditing from './tableproperties/tablepropertiesediting.js';
|
|
10
|
+
import TablePropertiesUI from './tableproperties/tablepropertiesui.js';
|
|
11
11
|
/**
|
|
12
12
|
* The table properties feature. Enables support for setting properties of tables (size, border, background, etc.).
|
|
13
13
|
*
|
package/src/tableproperties.js
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module table/tableproperties
|
|
7
7
|
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
-
import TablePropertiesEditing from './tableproperties/tablepropertiesediting';
|
|
10
|
-
import TablePropertiesUI from './tableproperties/tablepropertiesui';
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import TablePropertiesEditing from './tableproperties/tablepropertiesediting.js';
|
|
10
|
+
import TablePropertiesUI from './tableproperties/tablepropertiesui.js';
|
|
11
11
|
/**
|
|
12
12
|
* The table properties feature. Enables support for setting properties of tables (size, border, background, etc.).
|
|
13
13
|
*
|
package/src/tableselection.d.ts
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module table/tableselection
|
|
7
7
|
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
-
import type { Element, DocumentFragment } from 'ckeditor5/src/engine';
|
|
10
|
-
import TableUtils from './tableutils';
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import type { Element, DocumentFragment } from 'ckeditor5/src/engine.js';
|
|
10
|
+
import TableUtils from './tableutils.js';
|
|
11
11
|
import '../theme/tableselection.css';
|
|
12
12
|
/**
|
|
13
13
|
* This plugin enables the advanced table cells, rows and columns selection.
|
package/src/tableselection.js
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module table/tableselection
|
|
7
7
|
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
-
import { first } from 'ckeditor5/src/utils';
|
|
10
|
-
import TableWalker from './tablewalker';
|
|
11
|
-
import TableUtils from './tableutils';
|
|
12
|
-
import { cropTableToDimensions, adjustLastRowIndex, adjustLastColumnIndex } from './utils/structure';
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import { first } from 'ckeditor5/src/utils.js';
|
|
10
|
+
import TableWalker from './tablewalker.js';
|
|
11
|
+
import TableUtils from './tableutils.js';
|
|
12
|
+
import { cropTableToDimensions, adjustLastRowIndex, adjustLastColumnIndex } from './utils/structure.js';
|
|
13
13
|
import '../theme/tableselection.css';
|
|
14
14
|
/**
|
|
15
15
|
* This plugin enables the advanced table cells, rows and columns selection.
|
package/src/tabletoolbar.d.ts
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module table/tabletoolbar
|
|
7
7
|
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
-
import { WidgetToolbarRepository } from 'ckeditor5/src/widget';
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import { WidgetToolbarRepository } from 'ckeditor5/src/widget.js';
|
|
10
10
|
/**
|
|
11
11
|
* The table toolbar class. It creates toolbars for the table feature and its content (for now only for the table cell content).
|
|
12
12
|
*
|
package/src/tabletoolbar.js
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module table/tabletoolbar
|
|
7
7
|
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
-
import { WidgetToolbarRepository } from 'ckeditor5/src/widget';
|
|
10
|
-
import { getSelectedTableWidget, getTableWidgetAncestor } from './utils/ui/widget';
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import { WidgetToolbarRepository } from 'ckeditor5/src/widget.js';
|
|
10
|
+
import { getSelectedTableWidget, getTableWidgetAncestor } from './utils/ui/widget.js';
|
|
11
11
|
/**
|
|
12
12
|
* The table toolbar class. It creates toolbars for the table feature and its content (for now only for the table cell content).
|
|
13
13
|
*
|
package/src/tableui.d.ts
CHANGED
package/src/tableui.js
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module table/tableui
|
|
7
7
|
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
-
import { addListToDropdown, createDropdown, Model, SplitButtonView, SwitchButtonView } from 'ckeditor5/src/ui';
|
|
10
|
-
import { Collection } from 'ckeditor5/src/utils';
|
|
11
|
-
import InsertTableView from './ui/inserttableview';
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import { addListToDropdown, createDropdown, Model, SplitButtonView, SwitchButtonView } from 'ckeditor5/src/ui.js';
|
|
10
|
+
import { Collection } from 'ckeditor5/src/utils.js';
|
|
11
|
+
import InsertTableView from './ui/inserttableview.js';
|
|
12
12
|
import tableIcon from './../theme/icons/table.svg';
|
|
13
13
|
import tableColumnIcon from './../theme/icons/table-column.svg';
|
|
14
14
|
import tableRowIcon from './../theme/icons/table-row.svg';
|
package/src/tableutils.d.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
import { Plugin } from 'ckeditor5/src/core';
|
|
6
|
-
import type { DocumentSelection, Element, Range, Selection, Writer } from 'ckeditor5/src/engine';
|
|
7
|
-
import TableWalker, { type TableWalkerOptions } from './tablewalker';
|
|
5
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
6
|
+
import type { DocumentSelection, Element, Range, Selection, Writer } from 'ckeditor5/src/engine.js';
|
|
7
|
+
import TableWalker, { type TableWalkerOptions } from './tablewalker.js';
|
|
8
8
|
type IndexesObject = {
|
|
9
9
|
first: number;
|
|
10
10
|
last: number;
|
package/src/tableutils.js
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module table/tableutils
|
|
7
7
|
*/
|
|
8
|
-
import { CKEditorError } from 'ckeditor5/src/utils';
|
|
9
|
-
import { Plugin } from 'ckeditor5/src/core';
|
|
10
|
-
import TableWalker from './tablewalker';
|
|
11
|
-
import { createEmptyTableCell, updateNumericAttribute } from './utils/common';
|
|
12
|
-
import { removeEmptyColumns, removeEmptyRows } from './utils/structure';
|
|
8
|
+
import { CKEditorError } from 'ckeditor5/src/utils.js';
|
|
9
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
10
|
+
import TableWalker from './tablewalker.js';
|
|
11
|
+
import { createEmptyTableCell, updateNumericAttribute } from './utils/common.js';
|
|
12
|
+
import { removeEmptyColumns, removeEmptyRows } from './utils/structure.js';
|
|
13
13
|
/**
|
|
14
14
|
* The table utilities plugin.
|
|
15
15
|
*/
|
package/src/tablewalker.d.ts
CHANGED
|
@@ -5,13 +5,14 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module table/ui/colorinputview
|
|
7
7
|
*/
|
|
8
|
-
import { View, InputTextView, FocusCycler, ViewCollection, type ColorDefinition, type DropdownView } from 'ckeditor5/src/ui';
|
|
9
|
-
import { FocusTracker, KeystrokeHandler, type Locale } from 'ckeditor5/src/utils';
|
|
8
|
+
import { View, InputTextView, FocusCycler, ViewCollection, type ColorDefinition, type DropdownView, type ColorPickerConfig } from 'ckeditor5/src/ui.js';
|
|
9
|
+
import { FocusTracker, KeystrokeHandler, type Locale } from 'ckeditor5/src/utils.js';
|
|
10
10
|
import '../../theme/colorinput.css';
|
|
11
11
|
export type ColorInputViewOptions = {
|
|
12
12
|
colorDefinitions: Array<ColorDefinition>;
|
|
13
13
|
columns: number;
|
|
14
14
|
defaultColorValue?: string;
|
|
15
|
+
colorPickerConfig: false | ColorPickerConfig;
|
|
15
16
|
};
|
|
16
17
|
/**
|
|
17
18
|
* The color input view class. It allows the user to type in a color (hex, rgb, etc.)
|
|
@@ -121,13 +122,9 @@ export default class ColorInputView extends View {
|
|
|
121
122
|
*/
|
|
122
123
|
private _createInputTextView;
|
|
123
124
|
/**
|
|
124
|
-
* Creates and configures the
|
|
125
|
+
* Creates and configures the panel with "color grid" and "color picker" inside the {@link #dropdownView}.
|
|
125
126
|
*/
|
|
126
|
-
private
|
|
127
|
-
/**
|
|
128
|
-
* Creates and configures the color grid inside the {@link #dropdownView}.
|
|
129
|
-
*/
|
|
130
|
-
private _createColorGrid;
|
|
127
|
+
private _createColorSelector;
|
|
131
128
|
/**
|
|
132
129
|
* Sets {@link #inputView}'s value property to the color value or color label,
|
|
133
130
|
* if there is one and the user is not typing.
|
package/src/ui/colorinputview.js
CHANGED
|
@@ -5,9 +5,8 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module table/ui/colorinputview
|
|
7
7
|
*/
|
|
8
|
-
import { View, InputTextView,
|
|
9
|
-
import {
|
|
10
|
-
import { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils';
|
|
8
|
+
import { View, InputTextView, createDropdown, FocusCycler, ViewCollection, ColorSelectorView } from 'ckeditor5/src/ui.js';
|
|
9
|
+
import { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils.js';
|
|
11
10
|
import '../../theme/colorinput.css';
|
|
12
11
|
/**
|
|
13
12
|
* The color input view class. It allows the user to type in a color (hex, rgb, etc.)
|
|
@@ -94,10 +93,9 @@ export default class ColorInputView extends View {
|
|
|
94
93
|
const locale = this.locale;
|
|
95
94
|
const t = locale.t;
|
|
96
95
|
const bind = this.bindTemplate;
|
|
97
|
-
const
|
|
96
|
+
const colorSelector = this._createColorSelector(locale);
|
|
98
97
|
const dropdown = createDropdown(locale);
|
|
99
98
|
const colorPreview = new View();
|
|
100
|
-
const removeColorButton = this._createRemoveColorButton();
|
|
101
99
|
colorPreview.setTemplate({
|
|
102
100
|
tag: 'span',
|
|
103
101
|
attributes: {
|
|
@@ -129,13 +127,16 @@ export default class ColorInputView extends View {
|
|
|
129
127
|
dropdown.buttonView.label = t('Color picker');
|
|
130
128
|
dropdown.buttonView.tooltip = true;
|
|
131
129
|
dropdown.panelPosition = locale.uiLanguageDirection === 'rtl' ? 'se' : 'sw';
|
|
132
|
-
dropdown.panelView.children.add(
|
|
133
|
-
dropdown.panelView.children.add(colorGrid);
|
|
130
|
+
dropdown.panelView.children.add(colorSelector);
|
|
134
131
|
dropdown.bind('isEnabled').to(this, 'isReadOnly', value => !value);
|
|
135
|
-
this._focusables.add(
|
|
136
|
-
this.
|
|
137
|
-
|
|
138
|
-
|
|
132
|
+
this._focusables.add(colorSelector);
|
|
133
|
+
this.focusTracker.add(colorSelector.element);
|
|
134
|
+
dropdown.on('change:isOpen', (evt, name, isVisible) => {
|
|
135
|
+
if (isVisible) {
|
|
136
|
+
colorSelector.updateSelectedColors();
|
|
137
|
+
colorSelector.showColorGridsFragment();
|
|
138
|
+
}
|
|
139
|
+
});
|
|
139
140
|
return dropdown;
|
|
140
141
|
}
|
|
141
142
|
/**
|
|
@@ -169,40 +170,56 @@ export default class ColorInputView extends View {
|
|
|
169
170
|
return inputView;
|
|
170
171
|
}
|
|
171
172
|
/**
|
|
172
|
-
* Creates and configures the
|
|
173
|
+
* Creates and configures the panel with "color grid" and "color picker" inside the {@link #dropdownView}.
|
|
173
174
|
*/
|
|
174
|
-
|
|
175
|
-
const locale = this.locale;
|
|
175
|
+
_createColorSelector(locale) {
|
|
176
176
|
const t = locale.t;
|
|
177
|
-
const removeColorButton = new ButtonView(locale);
|
|
178
177
|
const defaultColor = this.options.defaultColorValue || '';
|
|
179
178
|
const removeColorButtonLabel = defaultColor ? t('Restore default') : t('Remove color');
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
this.
|
|
186
|
-
|
|
187
|
-
|
|
179
|
+
const colorSelector = new ColorSelectorView(locale, {
|
|
180
|
+
colors: this.options.colorDefinitions,
|
|
181
|
+
columns: this.options.columns,
|
|
182
|
+
removeButtonLabel: removeColorButtonLabel,
|
|
183
|
+
colorPickerLabel: t('Color picker'),
|
|
184
|
+
colorPickerViewConfig: this.options.colorPickerConfig === false ? false : {
|
|
185
|
+
...this.options.colorPickerConfig,
|
|
186
|
+
hideInput: true
|
|
187
|
+
}
|
|
188
188
|
});
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
189
|
+
colorSelector.appendUI();
|
|
190
|
+
colorSelector.on('execute', (evt, data) => {
|
|
191
|
+
if (data.source === 'colorPickerSaveButton') {
|
|
192
|
+
this.dropdownView.isOpen = false;
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
this.value = data.value || defaultColor;
|
|
196
|
+
// Trigger the listener that actually applies the set value.
|
|
197
|
+
this.fire('input');
|
|
198
|
+
if (data.source !== 'colorPicker') {
|
|
199
|
+
this.dropdownView.isOpen = false;
|
|
200
|
+
}
|
|
198
201
|
});
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
+
/**
|
|
203
|
+
* Color is saved before changes in color picker. In case "cancel button" is pressed
|
|
204
|
+
* this color will be applied.
|
|
205
|
+
*/
|
|
206
|
+
let backupColor = this.value;
|
|
207
|
+
colorSelector.on('colorPicker:cancel', () => {
|
|
208
|
+
/**
|
|
209
|
+
* Revert color to previous value before changes in color picker.
|
|
210
|
+
*/
|
|
211
|
+
this.value = backupColor;
|
|
202
212
|
this.fire('input');
|
|
213
|
+
this.dropdownView.isOpen = false;
|
|
214
|
+
});
|
|
215
|
+
colorSelector.colorGridsFragmentView.colorPickerButtonView.on('execute', () => {
|
|
216
|
+
/**
|
|
217
|
+
* Save color value before changes in color picker.
|
|
218
|
+
*/
|
|
219
|
+
backupColor = this.value;
|
|
203
220
|
});
|
|
204
|
-
|
|
205
|
-
return
|
|
221
|
+
colorSelector.bind('selectedColor').to(this, 'value');
|
|
222
|
+
return colorSelector;
|
|
206
223
|
}
|
|
207
224
|
/**
|
|
208
225
|
* Sets {@link #inputView}'s value property to the color value or color label,
|
package/src/ui/formrowview.d.ts
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module table/ui/formrowview
|
|
7
7
|
*/
|
|
8
|
-
import { View, type LabelView, type ViewCollection } from 'ckeditor5/src/ui';
|
|
9
|
-
import type { Locale } from 'ckeditor5/src/utils';
|
|
8
|
+
import { View, type LabelView, type ViewCollection } from 'ckeditor5/src/ui.js';
|
|
9
|
+
import type { Locale } from 'ckeditor5/src/utils.js';
|
|
10
10
|
import '../../theme/formrow.css';
|
|
11
11
|
/**
|
|
12
12
|
* The class representing a single row in a complex form,
|
package/src/ui/formrowview.js
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module table/ui/inserttableview
|
|
7
7
|
*/
|
|
8
|
-
import { View, ButtonView, type ViewCollection } from 'ckeditor5/src/ui';
|
|
9
|
-
import { KeystrokeHandler, FocusTracker, type Locale } from 'ckeditor5/src/utils';
|
|
8
|
+
import { View, ButtonView, type ViewCollection } from 'ckeditor5/src/ui.js';
|
|
9
|
+
import { KeystrokeHandler, FocusTracker, type Locale } from 'ckeditor5/src/utils.js';
|
|
10
10
|
import './../../theme/inserttable.css';
|
|
11
11
|
/**
|
|
12
12
|
* The table size view.
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module table/ui/inserttableview
|
|
7
7
|
*/
|
|
8
|
-
import { View, ButtonView, addKeyboardHandlingForGrid } from 'ckeditor5/src/ui';
|
|
9
|
-
import { KeystrokeHandler, FocusTracker } from 'ckeditor5/src/utils';
|
|
8
|
+
import { View, ButtonView, addKeyboardHandlingForGrid } from 'ckeditor5/src/ui.js';
|
|
9
|
+
import { KeystrokeHandler, FocusTracker } from 'ckeditor5/src/utils.js';
|
|
10
10
|
import './../../theme/inserttable.css';
|
|
11
11
|
/**
|
|
12
12
|
* The table size view.
|
package/src/utils/common.d.ts
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module table/utils/common
|
|
7
7
|
*/
|
|
8
|
-
import type { Conversion, Element, Item, Position, Schema, Writer } from 'ckeditor5/src/engine';
|
|
9
|
-
import type TableUtils from '../tableutils';
|
|
8
|
+
import type { Conversion, Element, Item, Position, Schema, Writer } from 'ckeditor5/src/engine.js';
|
|
9
|
+
import type TableUtils from '../tableutils.js';
|
|
10
10
|
/**
|
|
11
11
|
* A common method to update the numeric value. If a value is the default one, it will be unset.
|
|
12
12
|
*
|
package/src/utils/common.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
import { downcastAttributeToStyle, upcastStyleToAttribute } from './../converters/tableproperties';
|
|
5
|
+
import { downcastAttributeToStyle, upcastStyleToAttribute } from './../converters/tableproperties.js';
|
|
6
6
|
/**
|
|
7
7
|
* A common method to update the numeric value. If a value is the default one, it will be unset.
|
|
8
8
|
*
|
package/src/utils/structure.d.ts
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module table/utils/structure
|
|
7
7
|
*/
|
|
8
|
-
import type { Element, Writer } from 'ckeditor5/src/engine';
|
|
9
|
-
import { type TableSlot } from '../tablewalker';
|
|
10
|
-
import type TableUtils from '../tableutils';
|
|
8
|
+
import type { Element, Writer } from 'ckeditor5/src/engine.js';
|
|
9
|
+
import { type TableSlot } from '../tablewalker.js';
|
|
10
|
+
import type TableUtils from '../tableutils.js';
|
|
11
11
|
/**
|
|
12
12
|
* Returns a cropped table according to given dimensions.
|
|
13
13
|
|
package/src/utils/structure.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
import { default as TableWalker } from '../tablewalker';
|
|
6
|
-
import { createEmptyTableCell, updateNumericAttribute } from './common';
|
|
5
|
+
import { default as TableWalker } from '../tablewalker.js';
|
|
6
|
+
import { createEmptyTableCell, updateNumericAttribute } from './common.js';
|
|
7
7
|
/**
|
|
8
8
|
* Returns a cropped table according to given dimensions.
|
|
9
9
|
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module table/utils/ui/contextualballoon
|
|
7
7
|
*/
|
|
8
|
-
import { type PositionOptions } from 'ckeditor5/src/utils';
|
|
9
|
-
import type { Editor } from 'ckeditor5/src/core';
|
|
8
|
+
import { type PositionOptions } from 'ckeditor5/src/utils.js';
|
|
9
|
+
import type { Editor } from 'ckeditor5/src/core.js';
|
|
10
10
|
/**
|
|
11
11
|
* A helper utility that positions the
|
|
12
12
|
* {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon contextual balloon} instance
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module table/utils/ui/contextualballoon
|
|
7
7
|
*/
|
|
8
|
-
import { Rect } from 'ckeditor5/src/utils';
|
|
9
|
-
import { BalloonPanelView } from 'ckeditor5/src/ui';
|
|
10
|
-
import { getTableWidgetAncestor } from './widget';
|
|
8
|
+
import { Rect } from 'ckeditor5/src/utils.js';
|
|
9
|
+
import { BalloonPanelView } from 'ckeditor5/src/ui.js';
|
|
10
|
+
import { getTableWidgetAncestor } from './widget.js';
|
|
11
11
|
const DEFAULT_BALLOON_POSITIONS = BalloonPanelView.defaultPositions;
|
|
12
12
|
const BALLOON_POSITIONS = [
|
|
13
13
|
DEFAULT_BALLOON_POSITIONS.northArrowSouth,
|