@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.
Files changed (158) hide show
  1. package/build/table.js +1 -1
  2. package/package.json +2 -2
  3. package/src/augmentation.d.ts +1 -1
  4. package/src/commands/insertcolumncommand.d.ts +1 -1
  5. package/src/commands/insertcolumncommand.js +1 -1
  6. package/src/commands/insertrowcommand.d.ts +1 -1
  7. package/src/commands/insertrowcommand.js +1 -1
  8. package/src/commands/inserttablecommand.d.ts +1 -1
  9. package/src/commands/inserttablecommand.js +1 -1
  10. package/src/commands/mergecellcommand.d.ts +3 -3
  11. package/src/commands/mergecellcommand.js +4 -4
  12. package/src/commands/mergecellscommand.d.ts +1 -1
  13. package/src/commands/mergecellscommand.js +4 -4
  14. package/src/commands/removecolumncommand.d.ts +1 -1
  15. package/src/commands/removecolumncommand.js +2 -2
  16. package/src/commands/removerowcommand.d.ts +1 -1
  17. package/src/commands/removerowcommand.js +1 -1
  18. package/src/commands/selectcolumncommand.d.ts +1 -1
  19. package/src/commands/selectcolumncommand.js +2 -2
  20. package/src/commands/selectrowcommand.d.ts +1 -1
  21. package/src/commands/selectrowcommand.js +1 -1
  22. package/src/commands/setheadercolumncommand.d.ts +1 -1
  23. package/src/commands/setheadercolumncommand.js +3 -3
  24. package/src/commands/setheaderrowcommand.d.ts +1 -1
  25. package/src/commands/setheaderrowcommand.js +3 -3
  26. package/src/commands/splitcellcommand.d.ts +1 -1
  27. package/src/commands/splitcellcommand.js +1 -1
  28. package/src/converters/downcast.d.ts +3 -3
  29. package/src/converters/downcast.js +2 -2
  30. package/src/converters/table-caption-post-fixer.d.ts +1 -1
  31. package/src/converters/table-cell-paragraph-post-fixer.d.ts +1 -1
  32. package/src/converters/table-cell-refresh-handler.d.ts +1 -1
  33. package/src/converters/table-cell-refresh-handler.js +1 -1
  34. package/src/converters/table-headings-refresh-handler.d.ts +1 -1
  35. package/src/converters/table-headings-refresh-handler.js +1 -1
  36. package/src/converters/table-layout-post-fixer.d.ts +1 -1
  37. package/src/converters/table-layout-post-fixer.js +2 -2
  38. package/src/converters/tableproperties.d.ts +1 -1
  39. package/src/converters/upcasttable.d.ts +1 -1
  40. package/src/converters/upcasttable.js +2 -2
  41. package/src/index.d.ts +53 -53
  42. package/src/index.js +23 -23
  43. package/src/plaintableoutput.d.ts +2 -2
  44. package/src/plaintableoutput.js +2 -2
  45. package/src/table.d.ts +8 -8
  46. package/src/table.js +8 -8
  47. package/src/tablecaption/tablecaptionediting.d.ts +2 -2
  48. package/src/tablecaption/tablecaptionediting.js +6 -6
  49. package/src/tablecaption/tablecaptionui.d.ts +1 -1
  50. package/src/tablecaption/tablecaptionui.js +3 -3
  51. package/src/tablecaption/toggletablecaptioncommand.d.ts +1 -1
  52. package/src/tablecaption/toggletablecaptioncommand.js +2 -2
  53. package/src/tablecaption/utils.d.ts +1 -1
  54. package/src/tablecaption.d.ts +3 -3
  55. package/src/tablecaption.js +3 -3
  56. package/src/tablecellproperties/commands/tablecellbackgroundcolorcommand.d.ts +2 -2
  57. package/src/tablecellproperties/commands/tablecellbackgroundcolorcommand.js +1 -1
  58. package/src/tablecellproperties/commands/tablecellbordercolorcommand.d.ts +3 -3
  59. package/src/tablecellproperties/commands/tablecellbordercolorcommand.js +2 -2
  60. package/src/tablecellproperties/commands/tablecellborderstylecommand.d.ts +3 -3
  61. package/src/tablecellproperties/commands/tablecellborderstylecommand.js +2 -2
  62. package/src/tablecellproperties/commands/tablecellborderwidthcommand.d.ts +3 -3
  63. package/src/tablecellproperties/commands/tablecellborderwidthcommand.js +2 -2
  64. package/src/tablecellproperties/commands/tablecellheightcommand.d.ts +2 -2
  65. package/src/tablecellproperties/commands/tablecellheightcommand.js +2 -2
  66. package/src/tablecellproperties/commands/tablecellhorizontalalignmentcommand.d.ts +2 -2
  67. package/src/tablecellproperties/commands/tablecellhorizontalalignmentcommand.js +1 -1
  68. package/src/tablecellproperties/commands/tablecellpaddingcommand.d.ts +3 -3
  69. package/src/tablecellproperties/commands/tablecellpaddingcommand.js +2 -2
  70. package/src/tablecellproperties/commands/tablecellpropertycommand.d.ts +2 -2
  71. package/src/tablecellproperties/commands/tablecellpropertycommand.js +1 -1
  72. package/src/tablecellproperties/commands/tablecellverticalalignmentcommand.d.ts +2 -2
  73. package/src/tablecellproperties/commands/tablecellverticalalignmentcommand.js +1 -1
  74. package/src/tablecellproperties/tablecellpropertiesediting.d.ts +3 -3
  75. package/src/tablecellproperties/tablecellpropertiesediting.js +15 -15
  76. package/src/tablecellproperties/tablecellpropertiesui.d.ts +3 -3
  77. package/src/tablecellproperties/tablecellpropertiesui.js +10 -8
  78. package/src/tablecellproperties/ui/tablecellpropertiesview.d.ts +5 -4
  79. package/src/tablecellproperties/ui/tablecellpropertiesview.js +9 -7
  80. package/src/tablecellproperties.d.ts +3 -3
  81. package/src/tablecellproperties.js +3 -3
  82. package/src/tablecellwidth/commands/tablecellwidthcommand.d.ts +2 -2
  83. package/src/tablecellwidth/commands/tablecellwidthcommand.js +2 -2
  84. package/src/tablecellwidth/tablecellwidthediting.d.ts +2 -2
  85. package/src/tablecellwidth/tablecellwidthediting.js +5 -5
  86. package/src/tableclipboard.d.ts +5 -5
  87. package/src/tableclipboard.js +5 -5
  88. package/src/tablecolumnresize/converters.d.ts +2 -2
  89. package/src/tablecolumnresize/converters.js +1 -1
  90. package/src/tablecolumnresize/tablecolumnresizeediting.d.ts +4 -4
  91. package/src/tablecolumnresize/tablecolumnresizeediting.js +10 -10
  92. package/src/tablecolumnresize/tablewidthscommand.d.ts +2 -2
  93. package/src/tablecolumnresize/tablewidthscommand.js +2 -2
  94. package/src/tablecolumnresize/utils.d.ts +3 -3
  95. package/src/tablecolumnresize/utils.js +2 -2
  96. package/src/tablecolumnresize.d.ts +3 -3
  97. package/src/tablecolumnresize.js +3 -3
  98. package/src/tableconfig.d.ts +14 -2
  99. package/src/tableediting.d.ts +3 -3
  100. package/src/tableediting.js +20 -20
  101. package/src/tablekeyboard.d.ts +5 -5
  102. package/src/tablekeyboard.js +5 -5
  103. package/src/tablemouse/mouseeventsobserver.d.ts +1 -1
  104. package/src/tablemouse/mouseeventsobserver.js +1 -1
  105. package/src/tablemouse.d.ts +3 -3
  106. package/src/tablemouse.js +4 -4
  107. package/src/tableproperties/commands/tablealignmentcommand.d.ts +2 -2
  108. package/src/tableproperties/commands/tablealignmentcommand.js +1 -1
  109. package/src/tableproperties/commands/tablebackgroundcolorcommand.d.ts +2 -2
  110. package/src/tableproperties/commands/tablebackgroundcolorcommand.js +1 -1
  111. package/src/tableproperties/commands/tablebordercolorcommand.d.ts +3 -3
  112. package/src/tableproperties/commands/tablebordercolorcommand.js +2 -2
  113. package/src/tableproperties/commands/tableborderstylecommand.d.ts +3 -3
  114. package/src/tableproperties/commands/tableborderstylecommand.js +2 -2
  115. package/src/tableproperties/commands/tableborderwidthcommand.d.ts +3 -3
  116. package/src/tableproperties/commands/tableborderwidthcommand.js +2 -2
  117. package/src/tableproperties/commands/tableheightcommand.d.ts +2 -2
  118. package/src/tableproperties/commands/tableheightcommand.js +2 -2
  119. package/src/tableproperties/commands/tablepropertycommand.d.ts +2 -2
  120. package/src/tableproperties/commands/tablepropertycommand.js +1 -1
  121. package/src/tableproperties/commands/tablewidthcommand.d.ts +2 -2
  122. package/src/tableproperties/commands/tablewidthcommand.js +2 -2
  123. package/src/tableproperties/tablepropertiesediting.d.ts +2 -2
  124. package/src/tableproperties/tablepropertiesediting.js +12 -12
  125. package/src/tableproperties/tablepropertiesui.d.ts +3 -3
  126. package/src/tableproperties/tablepropertiesui.js +10 -8
  127. package/src/tableproperties/ui/tablepropertiesview.d.ts +8 -4
  128. package/src/tableproperties/ui/tablepropertiesview.js +9 -7
  129. package/src/tableproperties.d.ts +3 -3
  130. package/src/tableproperties.js +3 -3
  131. package/src/tableselection.d.ts +3 -3
  132. package/src/tableselection.js +5 -5
  133. package/src/tabletoolbar.d.ts +2 -2
  134. package/src/tabletoolbar.js +3 -3
  135. package/src/tableui.d.ts +1 -1
  136. package/src/tableui.js +4 -4
  137. package/src/tableutils.d.ts +3 -3
  138. package/src/tableutils.js +5 -5
  139. package/src/tablewalker.d.ts +1 -1
  140. package/src/ui/colorinputview.d.ts +5 -8
  141. package/src/ui/colorinputview.js +54 -37
  142. package/src/ui/formrowview.d.ts +2 -2
  143. package/src/ui/formrowview.js +1 -1
  144. package/src/ui/inserttableview.d.ts +2 -2
  145. package/src/ui/inserttableview.js +2 -2
  146. package/src/utils/common.d.ts +2 -2
  147. package/src/utils/common.js +1 -1
  148. package/src/utils/structure.d.ts +3 -3
  149. package/src/utils/structure.js +2 -2
  150. package/src/utils/table-properties.d.ts +1 -1
  151. package/src/utils/ui/contextualballoon.d.ts +2 -2
  152. package/src/utils/ui/contextualballoon.js +3 -3
  153. package/src/utils/ui/table-properties.d.ts +7 -5
  154. package/src/utils/ui/table-properties.js +7 -5
  155. package/src/utils/ui/widget.d.ts +1 -1
  156. package/src/utils/ui/widget.js +1 -1
  157. package/theme/tablecaption.css +7 -7
  158. 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({
@@ -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
  *
@@ -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
  *
@@ -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.
@@ -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.
@@ -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
  *
@@ -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
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * @module table/tableui
7
7
  */
8
- import { Plugin } from 'ckeditor5/src/core';
8
+ import { Plugin } from 'ckeditor5/src/core.js';
9
9
  /**
10
10
  * The table UI plugin. It introduces:
11
11
  *
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';
@@ -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
  */
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * @module table/tablewalker
7
7
  */
8
- import type { Element, Position } from 'ckeditor5/src/engine';
8
+ import type { Element, Position } from 'ckeditor5/src/engine.js';
9
9
  /**
10
10
  * An object with configuration for `TableWalker`.
11
11
  */
@@ -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 button that clears the color.
125
+ * Creates and configures the panel with "color grid" and "color picker" inside the {@link #dropdownView}.
125
126
  */
126
- private _createRemoveColorButton;
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.
@@ -5,9 +5,8 @@
5
5
  /**
6
6
  * @module table/ui/colorinputview
7
7
  */
8
- import { View, InputTextView, ButtonView, createDropdown, ColorGridView, FocusCycler, ViewCollection } from 'ckeditor5/src/ui';
9
- import { icons } from 'ckeditor5/src/core';
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 colorGrid = this._createColorGrid(locale);
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(removeColorButton);
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(removeColorButton);
136
- this._focusables.add(colorGrid);
137
- this.focusTracker.add(removeColorButton.element);
138
- this.focusTracker.add(colorGrid.element);
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 button that clears the color.
173
+ * Creates and configures the panel with "color grid" and "color picker" inside the {@link #dropdownView}.
173
174
  */
174
- _createRemoveColorButton() {
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
- removeColorButton.class = 'ck-input-color__remove-color';
181
- removeColorButton.withText = true;
182
- removeColorButton.icon = icons.eraser;
183
- removeColorButton.label = removeColorButtonLabel;
184
- removeColorButton.on('execute', () => {
185
- this.value = defaultColor;
186
- this.dropdownView.isOpen = false;
187
- this.fire('input');
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
- return removeColorButton;
190
- }
191
- /**
192
- * Creates and configures the color grid inside the {@link #dropdownView}.
193
- */
194
- _createColorGrid(locale) {
195
- const colorGrid = new ColorGridView(locale, {
196
- colorDefinitions: this.options.colorDefinitions,
197
- columns: this.options.columns
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
- colorGrid.on('execute', (evtData, data) => {
200
- this.value = data.value;
201
- this.dropdownView.isOpen = false;
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
- colorGrid.bind('selectedColor').to(this, 'value');
205
- return colorGrid;
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,
@@ -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,
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * @module table/ui/formrowview
7
7
  */
8
- import { View } from 'ckeditor5/src/ui';
8
+ import { View } from 'ckeditor5/src/ui.js';
9
9
  import '../../theme/formrow.css';
10
10
  /**
11
11
  * The class representing a single row in a complex form,
@@ -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.
@@ -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
  *
@@ -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
  *
@@ -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
 
@@ -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,7 +5,7 @@
5
5
  /**
6
6
  * @module table/utils/table-properties
7
7
  */
8
- import type { BoxSides } from 'ckeditor5/src/engine';
8
+ import type { BoxSides } from 'ckeditor5/src/engine.js';
9
9
  /**
10
10
  * Returns a string if all four values of box sides are equal.
11
11
  *
@@ -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,