@ckeditor/ckeditor5-table 38.2.0-alpha.0 → 39.0.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.
@@ -1 +1 @@
1
- !function(t){const e=t.sq=t.sq||{};e.dictionary=Object.assign(e.dictionary||{},{"Align cell text to the bottom":"","Align cell text to the center":"","Align cell text to the left":"","Align cell text to the middle":"","Align cell text to the right":"","Align cell text to the top":"","Align table to the left":"","Align table to the right":"",Alignment:"",Background:"",Border:"","Cell properties":"","Center table":"",Color:"","Color picker":"",Column:"Kolona",Dashed:"","Delete column":"Gris kolonën","Delete row":"Grish rreshtin",Dimensions:"",Dotted:"",Double:"","Enter table caption":"",Groove:"","Header column":"Kolona e kokës","Header row":"Rreshti i kokës",Height:"","Horizontal text alignment toolbar":"","Insert column left":"","Insert column right":"","Insert row above":"Shto rresht sipër","Insert row below":"Shto rresht poshtë","Insert table":"Shto tabelë",Inset:"","Justify cell text":"","Merge cell down":"Bashko kutizat poshtë","Merge cell left":"Bashko kutizat majtas","Merge cell right":"Bashko kutizat djathtas","Merge cell up":"Bashko kutizat sipër","Merge cells":"Bashko kutizat",None:"",Outset:"",Padding:"",Ridge:"",Row:"Rreshti","Select column":"","Select row":"",Solid:"","Split cell horizontally":"Ndaj kutizat horizontalisht","Split cell vertically":"Ndajë kutizat vertikalisht",Style:"","Table alignment toolbar":"","Table cell text alignment":"","Table properties":"","Table toolbar":"",'The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".':"",'The value is invalid. Try "10px" or "2em" or simply "2".':"","Toggle caption off":"","Toggle caption on":"","Vertical text alignment toolbar":"",Width:""})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
1
+ !function(t){const e=t.sq=t.sq||{};e.dictionary=Object.assign(e.dictionary||{},{"Align cell text to the bottom":"Radhite tesktin e qelisë në fund","Align cell text to the center":"Radhite tekstin në mes","Align cell text to the left":"Radhit tekstin e qelisë majtas","Align cell text to the middle":"Radhit tekstin e qelisë në mes","Align cell text to the right":"Radhit tekstin e qelisë në të djathtë","Align cell text to the top":"Radhit tekstin e qelisë sipër","Align table to the left":"Radhit tabelën majtas","Align table to the right":"Radhit tabelën në të djathtë",Alignment:"Radhitja",Background:"Prapavija",Border:"","Cell properties":"Karakteristikat e qelisë","Center table":"",Color:"Ngjyra","Color picker":"",Column:"Kolona",Dashed:"","Delete column":"Gris kolonën","Delete row":"Grish rreshtin",Dimensions:"Dimensionet",Dotted:"Me pika",Double:"Me dy vija","Enter table caption":"",Groove:"","Header column":"Kolona e kokës","Header row":"Rreshti i kokës",Height:"Lartësia","Horizontal text alignment toolbar":"Kokështrirja e rradhitjes së tekstit horizontalisht","Insert column left":"Shto kolonë majtas","Insert column right":"Shto kolonë djathtas","Insert row above":"Shto rresht sipër","Insert row below":"Shto rresht poshtë","Insert table":"Shto tabelë",Inset:"","Justify cell text":"","Merge cell down":"Bashko kutizat poshtë","Merge cell left":"Bashko kutizat majtas","Merge cell right":"Bashko kutizat djathtas","Merge cell up":"Bashko kutizat sipër","Merge cells":"Bashko kutizat",None:"Asnjë",Outset:"",Padding:"",Ridge:"",Row:"Rreshti","Select column":"","Select row":"",Solid:"","Split cell horizontally":"Ndaj kutizat horizontalisht","Split cell vertically":"Ndajë kutizat vertikalisht",Style:"Stili","Table alignment toolbar":"Kokështrirja e radhitjes së tabelës","Table cell text alignment":"Rradhitja e tekstit të qelisë së tabelës","Table properties":"Karakteristikat e tabelës","Table toolbar":"Kokështrirja e tabelës",'The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".':'Kodi është i pavlefshëm. Provo"#FF0000" ose "rgb(255,0,0)" ose "red".','The value is invalid. Try "10px" or "2em" or simply "2".':"","Toggle caption off":"","Toggle caption on":"","Vertical text alignment toolbar":"Kokështrirja e rradhitjes së tekstit vertikalisht",Width:"Gjerësia"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
@@ -26,11 +26,11 @@ msgstr "Kolona e kokës"
26
26
 
27
27
  msgctxt "Label for the insert table column to the left of the current one button."
28
28
  msgid "Insert column left"
29
- msgstr ""
29
+ msgstr "Shto kolonë majtas"
30
30
 
31
31
  msgctxt "Label for the insert table column to the right of the current one button."
32
32
  msgid "Insert column right"
33
- msgstr ""
33
+ msgstr "Shto kolonë djathtas"
34
34
 
35
35
  msgctxt "Label for the delete table column button."
36
36
  msgid "Delete column"
@@ -98,15 +98,15 @@ msgstr "Bashko kutizat"
98
98
 
99
99
  msgctxt "The label used by assistive technologies describing a table toolbar attached to a table widget."
100
100
  msgid "Table toolbar"
101
- msgstr ""
101
+ msgstr "Kokështrirja e tabelës"
102
102
 
103
103
  msgctxt "The label describing the form allowing to specify the properties of a selected table."
104
104
  msgid "Table properties"
105
- msgstr ""
105
+ msgstr "Karakteristikat e tabelës"
106
106
 
107
107
  msgctxt "The label describing the form allowing to specify the properties of a selected table cell."
108
108
  msgid "Cell properties"
109
- msgstr ""
109
+ msgstr "Karakteristikat e qelisë"
110
110
 
111
111
  msgctxt "The label describing a group of border–related form fields (border style, color, etc.)."
112
112
  msgid "Border"
@@ -114,23 +114,23 @@ msgstr ""
114
114
 
115
115
  msgctxt "The label for the dropdown that allows configuring the border style of a table or a table cell."
116
116
  msgid "Style"
117
- msgstr ""
117
+ msgstr "Stili"
118
118
 
119
119
  msgctxt "The label for the input that allows configuring the width of a table or a table cell or the width of a border."
120
120
  msgid "Width"
121
- msgstr ""
121
+ msgstr "Gjerësia"
122
122
 
123
123
  msgctxt "The label for the input that allows configuring the height of a table or a table cell."
124
124
  msgid "Height"
125
- msgstr ""
125
+ msgstr "Lartësia"
126
126
 
127
127
  msgctxt "The label for the input that allows configuring the border color of a table or a table cell."
128
128
  msgid "Color"
129
- msgstr ""
129
+ msgstr "Ngjyra"
130
130
 
131
131
  msgctxt "The label for the input that allows configuring the background color of a table or a table cell."
132
132
  msgid "Background"
133
- msgstr ""
133
+ msgstr "Prapavija"
134
134
 
135
135
  msgctxt "The label for the input that allows configuring the padding of a table cell."
136
136
  msgid "Padding"
@@ -138,31 +138,31 @@ msgstr ""
138
138
 
139
139
  msgctxt "The label describing a group of form fields that allows setting dimensions of a table or a table cell."
140
140
  msgid "Dimensions"
141
- msgstr ""
141
+ msgstr "Dimensionet"
142
142
 
143
143
  msgctxt "The label for the group of toolbars that allows configuring the text alignment in a table cell."
144
144
  msgid "Table cell text alignment"
145
- msgstr ""
145
+ msgstr "Rradhitja e tekstit të qelisë së tabelës"
146
146
 
147
147
  msgctxt "The label for the toolbar that allows configuring the alignment of a table."
148
148
  msgid "Alignment"
149
- msgstr ""
149
+ msgstr "Radhitja"
150
150
 
151
151
  msgctxt "The label used by assistive technologies describing a toolbar that allows configuring the horizontal text alignment in a table cell."
152
152
  msgid "Horizontal text alignment toolbar"
153
- msgstr ""
153
+ msgstr "Kokështrirja e rradhitjes së tekstit horizontalisht"
154
154
 
155
155
  msgctxt "The label used by assistive technologies describing a toolbar that allows configuring the vertical text alignment in a table cell."
156
156
  msgid "Vertical text alignment toolbar"
157
- msgstr ""
157
+ msgstr "Kokështrirja e rradhitjes së tekstit vertikalisht"
158
158
 
159
159
  msgctxt "The label used by assistive technologies describing a toolbar that allows configuring the alignment of a table."
160
160
  msgid "Table alignment toolbar"
161
- msgstr ""
161
+ msgstr "Kokështrirja e radhitjes së tabelës"
162
162
 
163
163
  msgctxt "The label for the border style dropdown when no style is applied to a table or a table cell."
164
164
  msgid "None"
165
- msgstr ""
165
+ msgstr "Asnjë"
166
166
 
167
167
  msgctxt "The label for the border style dropdown when the solid border is applied to a table or a table cell."
168
168
  msgid "Solid"
@@ -170,7 +170,7 @@ msgstr ""
170
170
 
171
171
  msgctxt "The label for the border style dropdown when the dotted border is applied to a table or a table cell."
172
172
  msgid "Dotted"
173
- msgstr ""
173
+ msgstr "Me pika"
174
174
 
175
175
  msgctxt "The label for the border style dropdown when the dashed border is applied to a table or a table cell."
176
176
  msgid "Dashed"
@@ -178,7 +178,7 @@ msgstr ""
178
178
 
179
179
  msgctxt "The label for the border style dropdown when the double border is applied to a table or a table cell."
180
180
  msgid "Double"
181
- msgstr ""
181
+ msgstr "Me dy vija"
182
182
 
183
183
  msgctxt "The label for the border style dropdown when the groove border is applied to a table or a table cell."
184
184
  msgid "Groove"
@@ -198,15 +198,15 @@ msgstr ""
198
198
 
199
199
  msgctxt "The label used by assistive technologies describing a button that aligns the table cell text to the left."
200
200
  msgid "Align cell text to the left"
201
- msgstr ""
201
+ msgstr "Radhit tekstin e qelisë majtas"
202
202
 
203
203
  msgctxt "The label used by assistive technologies describing a button that aligns the table cell text to the center."
204
204
  msgid "Align cell text to the center"
205
- msgstr ""
205
+ msgstr "Radhite tekstin në mes"
206
206
 
207
207
  msgctxt "The label used by assistive technologies describing a button that aligns the table cell text to the right."
208
208
  msgid "Align cell text to the right"
209
- msgstr ""
209
+ msgstr "Radhit tekstin e qelisë në të djathtë"
210
210
 
211
211
  msgctxt "The label used by assistive technologies describing a button that justifies the table cell text."
212
212
  msgid "Justify cell text"
@@ -214,19 +214,19 @@ msgstr ""
214
214
 
215
215
  msgctxt "The label used by assistive technologies describing a button that aligns the table cell text to the top."
216
216
  msgid "Align cell text to the top"
217
- msgstr ""
217
+ msgstr "Radhit tekstin e qelisë sipër"
218
218
 
219
219
  msgctxt "The label used by assistive technologies describing a button that aligns the table cell text to the middle."
220
220
  msgid "Align cell text to the middle"
221
- msgstr ""
221
+ msgstr "Radhit tekstin e qelisë në mes"
222
222
 
223
223
  msgctxt "The label used by assistive technologies describing a button that aligns the table cell text to the bottom."
224
224
  msgid "Align cell text to the bottom"
225
- msgstr ""
225
+ msgstr "Radhite tesktin e qelisë në fund"
226
226
 
227
227
  msgctxt "The label used by assistive technologies describing a button that aligns the table to the left."
228
228
  msgid "Align table to the left"
229
- msgstr ""
229
+ msgstr "Radhit tabelën majtas"
230
230
 
231
231
  msgctxt "The label used by assistive technologies describing a button that centers the table."
232
232
  msgid "Center table"
@@ -234,11 +234,11 @@ msgstr ""
234
234
 
235
235
  msgctxt "The label used by assistive technologies describing a button that aligns the table to the right."
236
236
  msgid "Align table to the right"
237
- msgstr ""
237
+ msgstr "Radhit tabelën në të djathtë"
238
238
 
239
239
  msgctxt "The localized error string that can be displayed next to color (background, border) fields that have an invalid value"
240
240
  msgid "The color is invalid. Try \"#FF0000\" or \"rgb(255,0,0)\" or \"red\"."
241
- msgstr ""
241
+ msgstr "Kodi është i pavlefshëm. Provo\"#FF0000\" ose \"rgb(255,0,0)\" ose \"red\"."
242
242
 
243
243
  msgctxt "The localized error string that can be displayed next to length (padding, border width) fields that have an invalid value."
244
244
  msgid "The value is invalid. Try \"10px\" or \"2em\" or simply \"2\"."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-table",
3
- "version": "38.2.0-alpha.0",
3
+ "version": "39.0.0",
4
4
  "description": "Table feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -11,10 +11,9 @@
11
11
  "ckeditor5-dll"
12
12
  ],
13
13
  "main": "src/index.js",
14
- "type": "module",
15
14
  "dependencies": {
16
- "ckeditor5": "38.2.0-alpha.0",
17
- "lodash-es": "^4.17.15"
15
+ "ckeditor5": "39.0.0",
16
+ "lodash-es": "4.17.21"
18
17
  },
19
18
  "engines": {
20
19
  "node": ">=16.0.0",
@@ -73,10 +73,10 @@ export default class TableCaptionEditing extends Plugin {
73
73
  }
74
74
  const figcaptionElement = writer.createEditableElement('figcaption');
75
75
  writer.setCustomProperty('tableCaption', true, figcaptionElement);
76
+ figcaptionElement.placeholder = t('Enter table caption');
76
77
  enablePlaceholder({
77
78
  view,
78
79
  element: figcaptionElement,
79
- text: t('Enter table caption'),
80
80
  keepOnFocus: true
81
81
  });
82
82
  return toWidgetEditable(figcaptionElement, writer);
@@ -108,10 +108,12 @@ export default class TableCellPropertiesUI extends Plugin {
108
108
  const localizedBorderColors = getLocalizedColorOptions(editor.locale, borderColorsConfig);
109
109
  const backgroundColorsConfig = normalizeColorOptions(config.backgroundColors);
110
110
  const localizedBackgroundColors = getLocalizedColorOptions(editor.locale, backgroundColorsConfig);
111
+ const hasColorPicker = config.colorPicker !== false;
111
112
  const view = new TableCellPropertiesView(editor.locale, {
112
113
  borderColors: localizedBorderColors,
113
114
  backgroundColors: localizedBackgroundColors,
114
- defaultTableCellProperties: this._defaultTableCellProperties
115
+ defaultTableCellProperties: this._defaultTableCellProperties,
116
+ colorPickerConfig: hasColorPicker ? (config.colorPicker || {}) : false
115
117
  });
116
118
  const t = editor.t;
117
119
  // Render the view so its #element is available for the clickOutsideHandler.
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * @module table/tablecellproperties/ui/tablecellpropertiesview
7
7
  */
8
- import { ButtonView, FocusCycler, LabeledFieldView, View, ViewCollection, type FocusableView, type NormalizedColorOption } from 'ckeditor5/src/ui';
8
+ import { ButtonView, FocusCycler, LabeledFieldView, View, ViewCollection, type FocusableView, type NormalizedColorOption, type ColorPickerConfig } from 'ckeditor5/src/ui';
9
9
  import { KeystrokeHandler, FocusTracker, type Locale } from 'ckeditor5/src/utils';
10
10
  import type ColorInputView from '../../ui/colorinputview';
11
11
  import type { TableCellPropertiesOptions } from '../../tableconfig';
@@ -16,6 +16,7 @@ export interface TableCellPropertiesViewOptions {
16
16
  borderColors: Array<NormalizedColorOption>;
17
17
  backgroundColors: Array<NormalizedColorOption>;
18
18
  defaultTableCellProperties: TableCellPropertiesOptions;
19
+ colorPickerConfig: false | ColorPickerConfig;
19
20
  }
20
21
  /**
21
22
  * The class representing a table cell properties form, allowing users to customize
@@ -228,7 +228,8 @@ export default class TableCellPropertiesView extends View {
228
228
  const colorInputCreator = getLabeledColorInputCreator({
229
229
  colorConfig: this.options.borderColors,
230
230
  columns: 5,
231
- defaultColorValue: defaultBorder.color
231
+ defaultColorValue: defaultBorder.color,
232
+ colorPickerConfig: this.options.colorPickerConfig
232
233
  });
233
234
  const locale = this.locale;
234
235
  const t = this.t;
@@ -319,7 +320,8 @@ export default class TableCellPropertiesView extends View {
319
320
  const colorInputCreator = getLabeledColorInputCreator({
320
321
  colorConfig: this.options.backgroundColors,
321
322
  columns: 5,
322
- defaultColorValue: this.options.defaultTableCellProperties.backgroundColor
323
+ defaultColorValue: this.options.defaultTableCellProperties.backgroundColor,
324
+ colorPickerConfig: this.options.colorPickerConfig
323
325
  });
324
326
  const backgroundInput = new LabeledFieldView(locale, colorInputCreator);
325
327
  backgroundInput.set({
@@ -6,7 +6,7 @@
6
6
  * @module table/tableconfig
7
7
  */
8
8
  import type { ToolbarConfigItem } from 'ckeditor5/src/core';
9
- import type { ColorOption } from 'ckeditor5/src/ui';
9
+ import type { ColorOption, ColorPickerConfig } from 'ckeditor5/src/ui';
10
10
  /**
11
11
  * The configuration of the table feature. Used by the table feature in the `@ckeditor/ckeditor5-table` package.
12
12
  *
@@ -208,6 +208,12 @@ export interface TablePropertiesConfig {
208
208
  borderColors?: TableColorConfig;
209
209
  backgroundColors?: TableColorConfig;
210
210
  defaultProperties?: TablePropertiesOptions;
211
+ /**
212
+ * Configuration of the color picker in the table properties balloon.
213
+ *
214
+ * If set to `false` the picker will not appear.
215
+ */
216
+ colorPicker?: false | ColorPickerConfig;
211
217
  }
212
218
  /**
213
219
  * The configuration of the table default properties feature.
@@ -253,6 +259,12 @@ export interface TableCellPropertiesConfig {
253
259
  borderColors?: TableColorConfig;
254
260
  backgroundColors?: TableColorConfig;
255
261
  defaultProperties?: TableCellPropertiesOptions;
262
+ /**
263
+ * Configuration of the color picker in the table cell properties balloon.
264
+ *
265
+ * If set to `false` the picker will not appear.
266
+ */
267
+ colorPicker?: false | ColorPickerConfig;
256
268
  }
257
269
  /**
258
270
  * An array of color definitions (either strings or objects).
@@ -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,7 +5,7 @@
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';
8
+ import { ButtonView, FocusCycler, LabeledFieldView, ToolbarView, View, ViewCollection, type DropdownView, type InputTextView, type NormalizedColorOption, type ColorPickerConfig } from 'ckeditor5/src/ui';
9
9
  import { FocusTracker, KeystrokeHandler, type Locale } from 'ckeditor5/src/utils';
10
10
  import '../../../theme/form.css';
11
11
  import '../../../theme/tableform.css';
@@ -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
@@ -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,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';
8
+ import { View, InputTextView, FocusCycler, ViewCollection, type ColorDefinition, type DropdownView, type ColorPickerConfig } from 'ckeditor5/src/ui';
9
9
  import { FocusTracker, KeystrokeHandler, type Locale } from 'ckeditor5/src/utils';
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,8 +5,7 @@
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';
8
+ import { View, InputTextView, createDropdown, FocusCycler, ViewCollection, ColorSelectorView } from 'ckeditor5/src/ui';
10
9
  import { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils';
11
10
  import '../../theme/colorinput.css';
12
11
  /**
@@ -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,7 +5,7 @@
5
5
  /**
6
6
  * @module table/utils/ui/table-properties
7
7
  */
8
- import { type ColorOption, type LabeledFieldView, type ListDropdownItemDefinition, type NormalizedColorOption, type ToolbarView, type View } from 'ckeditor5/src/ui';
8
+ import { type ColorOption, type LabeledFieldView, type ListDropdownItemDefinition, type NormalizedColorOption, type ToolbarView, type View, type ColorPickerConfig } from 'ckeditor5/src/ui';
9
9
  import { Collection, type LocaleTranslate } from 'ckeditor5/src/utils';
10
10
  import type TableCellPropertiesView from '../../tablecellproperties/ui/tablecellpropertiesview';
11
11
  import type TablePropertiesView from '../../tableproperties/ui/tablepropertiesview';
@@ -185,9 +185,11 @@ export declare const defaultColors: Array<ColorOption>;
185
185
  * @param options.columns The configuration of the number of columns the color palette consists of in the input's dropdown.
186
186
  * @param options.defaultColorValue If specified, the color input view will replace the "Remove color" button with
187
187
  * the "Restore default" button. Instead of clearing the input field, the default color value will be set.
188
+ * @param options.colorPickerConfig The configuration of the color picker. You could disable it or define your output format.
188
189
  */
189
190
  export declare function getLabeledColorInputCreator(options: {
190
191
  colorConfig: Array<NormalizedColorOption>;
191
192
  columns: number;
192
193
  defaultColorValue?: string;
194
+ colorPickerConfig: false | ColorPickerConfig;
193
195
  }): (labeledFieldView: LabeledFieldView, viewUid: string, statusUid: string) => ColorInputView;
@@ -318,13 +318,15 @@ export const defaultColors = [
318
318
  * @param options.columns The configuration of the number of columns the color palette consists of in the input's dropdown.
319
319
  * @param options.defaultColorValue If specified, the color input view will replace the "Remove color" button with
320
320
  * the "Restore default" button. Instead of clearing the input field, the default color value will be set.
321
+ * @param options.colorPickerConfig The configuration of the color picker. You could disable it or define your output format.
321
322
  */
322
323
  export function getLabeledColorInputCreator(options) {
323
324
  return (labeledFieldView, viewUid, statusUid) => {
324
325
  const colorInputView = new ColorInputView(labeledFieldView.locale, {
325
326
  colorDefinitions: colorConfigToColorGridDefinitions(options.colorConfig),
326
327
  columns: options.columns,
327
- defaultColorValue: options.defaultColorValue
328
+ defaultColorValue: options.defaultColorValue,
329
+ colorPickerConfig: options.colorPickerConfig
328
330
  });
329
331
  colorInputView.inputView.set({
330
332
  id: viewUid,
@@ -4,9 +4,9 @@
4
4
  */
5
5
 
6
6
  :root {
7
- --ck-color-table-caption-background: hsl(0, 0%, 97%);
8
- --ck-color-table-caption-text: hsl(0, 0%, 20%);
9
- --ck-color-table-caption-highlighted-background: hsl(52deg 100% 50%);
7
+ --ck-color-selector-caption-background: hsl(0, 0%, 97%);
8
+ --ck-color-selector-caption-text: hsl(0, 0%, 20%);
9
+ --ck-color-selector-caption-highlighted-background: hsl(52deg 100% 50%);
10
10
  }
11
11
 
12
12
  /* Content styles */
@@ -15,8 +15,8 @@
15
15
  caption-side: top;
16
16
  word-break: break-word;
17
17
  text-align: center;
18
- color: var(--ck-color-table-caption-text);
19
- background-color: var(--ck-color-table-caption-background);
18
+ color: var(--ck-color-selector-caption-text);
19
+ background-color: var(--ck-color-selector-caption-background);
20
20
  padding: .6em;
21
21
  font-size: .75em;
22
22
  outline-offset: -1px;
@@ -44,10 +44,10 @@
44
44
 
45
45
  @keyframes ck-table-caption-highlight {
46
46
  0% {
47
- background-color: var(--ck-color-table-caption-highlighted-background);
47
+ background-color: var(--ck-color-selector-caption-highlighted-background);
48
48
  }
49
49
 
50
50
  100% {
51
- background-color: var(--ck-color-table-caption-background);
51
+ background-color: var(--ck-color-selector-caption-background);
52
52
  }
53
53
  }
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  :root {
7
- --ck-color-table-column-resizer-hover: var(--ck-color-base-active);
7
+ --ck-color-selector-column-resizer-hover: var(--ck-color-base-active);
8
8
  --ck-table-column-resizer-width: 7px;
9
9
 
10
10
  /* The offset used for absolute positioning of the resizer element, so that it is placed exactly above the cell border.
@@ -55,7 +55,7 @@
55
55
 
56
56
  .ck.ck-editor__editable .table .ck-table-column-resizer:hover,
57
57
  .ck.ck-editor__editable .table .ck-table-column-resizer__active {
58
- background-color: var(--ck-color-table-column-resizer-hover);
58
+ background-color: var(--ck-color-selector-column-resizer-hover);
59
59
  opacity: 0.25;
60
60
  }
61
61