@ckeditor/ckeditor5-font 36.0.1 → 37.0.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 (56) hide show
  1. package/build/font.js +1 -1
  2. package/package.json +20 -15
  3. package/src/augmentation.d.ts +58 -0
  4. package/src/augmentation.js +5 -0
  5. package/src/documentcolorcollection.d.ts +70 -0
  6. package/src/documentcolorcollection.js +34 -63
  7. package/src/font.d.ts +29 -0
  8. package/src/font.js +12 -19
  9. package/src/fontbackgroundcolor/fontbackgroundcolorcommand.d.ts +26 -0
  10. package/src/fontbackgroundcolor/fontbackgroundcolorcommand.js +9 -15
  11. package/src/fontbackgroundcolor/fontbackgroundcolorediting.d.ts +26 -0
  12. package/src/fontbackgroundcolor/fontbackgroundcolorediting.js +103 -116
  13. package/src/fontbackgroundcolor/fontbackgroundcolorui.d.ts +22 -0
  14. package/src/fontbackgroundcolor/fontbackgroundcolorui.js +18 -25
  15. package/src/fontbackgroundcolor.d.ts +28 -0
  16. package/src/fontbackgroundcolor.js +12 -165
  17. package/src/fontcolor/fontcolorcommand.d.ts +25 -0
  18. package/src/fontcolor/fontcolorcommand.js +9 -15
  19. package/src/fontcolor/fontcolorediting.d.ts +26 -0
  20. package/src/fontcolor/fontcolorediting.js +115 -128
  21. package/src/fontcolor/fontcolorui.d.ts +22 -0
  22. package/src/fontcolor/fontcolorui.js +18 -25
  23. package/src/fontcolor.d.ts +24 -0
  24. package/src/fontcolor.js +12 -168
  25. package/src/fontcommand.d.ts +46 -0
  26. package/src/fontcommand.js +54 -78
  27. package/src/fontconfig.d.ts +367 -0
  28. package/src/fontconfig.js +5 -0
  29. package/src/fontfamily/fontfamilycommand.d.ts +25 -0
  30. package/src/fontfamily/fontfamilycommand.js +9 -15
  31. package/src/fontfamily/fontfamilyediting.d.ts +39 -0
  32. package/src/fontfamily/fontfamilyediting.js +95 -116
  33. package/src/fontfamily/fontfamilyui.d.ts +30 -0
  34. package/src/fontfamily/fontfamilyui.js +90 -122
  35. package/src/fontfamily/utils.d.ts +15 -0
  36. package/src/fontfamily/utils.js +66 -79
  37. package/src/fontfamily.d.ts +24 -0
  38. package/src/fontfamily.js +12 -112
  39. package/src/fontsize/fontsizecommand.d.ts +25 -0
  40. package/src/fontsize/fontsizecommand.js +9 -15
  41. package/src/fontsize/fontsizeediting.d.ts +44 -0
  42. package/src/fontsize/fontsizeediting.js +137 -169
  43. package/src/fontsize/fontsizeui.d.ts +31 -0
  44. package/src/fontsize/fontsizeui.js +98 -130
  45. package/src/fontsize/utils.d.ts +12 -0
  46. package/src/fontsize/utils.js +145 -174
  47. package/src/fontsize.d.ts +35 -0
  48. package/src/fontsize.js +21 -141
  49. package/src/index.d.ts +27 -0
  50. package/src/index.js +1 -2
  51. package/src/ui/colortableview.d.ts +167 -0
  52. package/src/ui/colortableview.js +242 -418
  53. package/src/ui/colorui.d.ts +63 -0
  54. package/src/ui/colorui.js +78 -132
  55. package/src/utils.d.ts +77 -0
  56. package/src/utils.js +42 -72
@@ -0,0 +1,63 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module font/ui/colorui
7
+ */
8
+ import { Plugin, type Editor } from 'ckeditor5/src/core';
9
+ import { type FONT_BACKGROUND_COLOR, type FONT_COLOR } from '../utils';
10
+ import type ColorTableView from './colortableview';
11
+ /**
12
+ * The color UI plugin which isolates the common logic responsible for displaying dropdowns with color grids.
13
+ *
14
+ * It is used to create the `'fontBackgroundColor'` and `'fontColor'` dropdowns, each hosting
15
+ * a {@link module:font/ui/colortableview~ColorTableView}.
16
+ */
17
+ export default class ColorUI extends Plugin {
18
+ /**
19
+ * The name of the command which will be executed when a color tile is clicked.
20
+ */
21
+ commandName: typeof FONT_BACKGROUND_COLOR | typeof FONT_COLOR;
22
+ /**
23
+ * The name of this component in the {@link module:ui/componentfactory~ComponentFactory}.
24
+ * Also the configuration scope name in `editor.config`.
25
+ */
26
+ componentName: typeof FONT_BACKGROUND_COLOR | typeof FONT_COLOR;
27
+ /**
28
+ * The SVG icon used by the dropdown.
29
+ */
30
+ icon: string;
31
+ /**
32
+ * The label used by the dropdown.
33
+ */
34
+ dropdownLabel: string;
35
+ /**
36
+ * The number of columns in the color grid.
37
+ */
38
+ columns: number;
39
+ /**
40
+ * Keeps a reference to {@link module:font/ui/colortableview~ColorTableView}.
41
+ */
42
+ colorTableView: ColorTableView | undefined;
43
+ /**
44
+ * Creates a plugin which introduces a dropdown with a pre–configured {@link module:font/ui/colortableview~ColorTableView}.
45
+ *
46
+ * @param config The configuration object.
47
+ * @param config.commandName The name of the command which will be executed when a color tile is clicked.
48
+ * @param config.componentName The name of the dropdown in the {@link module:ui/componentfactory~ComponentFactory}
49
+ * and the configuration scope name in `editor.config`.
50
+ * @param config.icon The SVG icon used by the dropdown.
51
+ * @param config.dropdownLabel The label used by the dropdown.
52
+ */
53
+ constructor(editor: Editor, { commandName, componentName, icon, dropdownLabel }: {
54
+ commandName: typeof FONT_BACKGROUND_COLOR | typeof FONT_COLOR;
55
+ componentName: typeof FONT_BACKGROUND_COLOR | typeof FONT_COLOR;
56
+ icon: string;
57
+ dropdownLabel: string;
58
+ });
59
+ /**
60
+ * @inheritDoc
61
+ */
62
+ init(): void;
63
+ }
package/src/ui/colorui.js CHANGED
@@ -2,149 +2,95 @@
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
-
6
5
  /**
7
6
  * @module font/ui/colorui
8
7
  */
9
-
10
8
  import { Plugin } from 'ckeditor5/src/core';
11
9
  import { createDropdown, normalizeColorOptions, getLocalizedColorOptions, focusChildOnDropdownOpen } from 'ckeditor5/src/ui';
12
-
13
10
  import { addColorTableToDropdown } from '../utils';
14
-
15
11
  /**
16
12
  * The color UI plugin which isolates the common logic responsible for displaying dropdowns with color grids.
17
13
  *
18
14
  * It is used to create the `'fontBackgroundColor'` and `'fontColor'` dropdowns, each hosting
19
15
  * a {@link module:font/ui/colortableview~ColorTableView}.
20
- *
21
- * @extends module:core/plugin~Plugin
22
16
  */
23
17
  export default class ColorUI extends Plugin {
24
- /**
25
- * Creates a plugin which introduces a dropdown with a pre–configured {@link module:font/ui/colortableview~ColorTableView}.
26
- *
27
- * @param {module:core/editor/editor~Editor} editor
28
- * @param {Object} config The configuration object.
29
- * @param {String} config.commandName The name of the command which will be executed when a color tile is clicked.
30
- * @param {String} config.componentName The name of the dropdown in the {@link module:ui/componentfactory~ComponentFactory}
31
- * and the configuration scope name in `editor.config`.
32
- * @param {String} config.icon The SVG icon used by the dropdown.
33
- * @param {String} config.dropdownLabel The label used by the dropdown.
34
- */
35
- constructor( editor, { commandName, icon, componentName, dropdownLabel } ) {
36
- super( editor );
37
-
38
- /**
39
- * The name of the command which will be executed when a color tile is clicked.
40
- *
41
- * @type {String}
42
- */
43
- this.commandName = commandName;
44
-
45
- /**
46
- * The name of this component in the {@link module:ui/componentfactory~ComponentFactory}.
47
- * Also the configuration scope name in `editor.config`.
48
- *
49
- * @type {String}
50
- */
51
- this.componentName = componentName;
52
-
53
- /**
54
- * The SVG icon used by the dropdown.
55
- * @type {String}
56
- */
57
- this.icon = icon;
58
-
59
- /**
60
- * The label used by the dropdown.
61
- *
62
- * @type {String}
63
- */
64
- this.dropdownLabel = dropdownLabel;
65
-
66
- /**
67
- * The number of columns in the color grid.
68
- *
69
- * @type {Number}
70
- */
71
- this.columns = editor.config.get( `${ this.componentName }.columns` );
72
-
73
- /**
74
- * Keeps a reference to {@link module:font/ui/colortableview~ColorTableView}.
75
- *
76
- * @member {module:font/ui/colortableview~ColorTableView}
77
- */
78
- this.colorTableView = undefined;
79
- }
80
-
81
- /**
82
- * @inheritDoc
83
- */
84
- init() {
85
- const editor = this.editor;
86
- const locale = editor.locale;
87
- const t = locale.t;
88
- const command = editor.commands.get( this.commandName );
89
- const colorsConfig = normalizeColorOptions( editor.config.get( this.componentName ).colors );
90
- const localizedColors = getLocalizedColorOptions( locale, colorsConfig );
91
- const documentColorsCount = editor.config.get( `${ this.componentName }.documentColors` );
92
-
93
- // Register the UI component.
94
- editor.ui.componentFactory.add( this.componentName, locale => {
95
- const dropdownView = createDropdown( locale );
96
- this.colorTableView = addColorTableToDropdown( {
97
- dropdownView,
98
- colors: localizedColors.map( option => ( {
99
- label: option.label,
100
- color: option.model,
101
- options: {
102
- hasBorder: option.hasBorder
103
- }
104
- } ) ),
105
- columns: this.columns,
106
- removeButtonLabel: t( 'Remove color' ),
107
- documentColorsLabel: documentColorsCount !== 0 ? t( 'Document colors' ) : undefined,
108
- documentColorsCount: documentColorsCount === undefined ? this.columns : documentColorsCount
109
- } );
110
-
111
- this.colorTableView.bind( 'selectedColor' ).to( command, 'value' );
112
-
113
- dropdownView.buttonView.set( {
114
- label: this.dropdownLabel,
115
- icon: this.icon,
116
- tooltip: true
117
- } );
118
-
119
- dropdownView.extendTemplate( {
120
- attributes: {
121
- class: 'ck-color-ui-dropdown'
122
- }
123
- } );
124
-
125
- dropdownView.bind( 'isEnabled' ).to( command );
126
-
127
- dropdownView.on( 'execute', ( evt, data ) => {
128
- editor.execute( this.commandName, data );
129
- editor.editing.view.focus();
130
- } );
131
-
132
- dropdownView.on( 'change:isOpen', ( evt, name, isVisible ) => {
133
- // Grids rendering is deferred (#6192).
134
- dropdownView.colorTableView.appendGrids();
135
-
136
- if ( isVisible ) {
137
- if ( documentColorsCount !== 0 ) {
138
- this.colorTableView.updateDocumentColors( editor.model, this.componentName );
139
- }
140
- this.colorTableView.updateSelectedColors();
141
- }
142
- } );
143
-
144
- // Accessibility: focus the first active color when opening the dropdown.
145
- focusChildOnDropdownOpen( dropdownView, () => dropdownView.colorTableView.staticColorsGrid.items.find( item => item.isOn ) );
146
-
147
- return dropdownView;
148
- } );
149
- }
18
+ /**
19
+ * Creates a plugin which introduces a dropdown with a pre–configured {@link module:font/ui/colortableview~ColorTableView}.
20
+ *
21
+ * @param config The configuration object.
22
+ * @param config.commandName The name of the command which will be executed when a color tile is clicked.
23
+ * @param config.componentName The name of the dropdown in the {@link module:ui/componentfactory~ComponentFactory}
24
+ * and the configuration scope name in `editor.config`.
25
+ * @param config.icon The SVG icon used by the dropdown.
26
+ * @param config.dropdownLabel The label used by the dropdown.
27
+ */
28
+ constructor(editor, { commandName, componentName, icon, dropdownLabel }) {
29
+ super(editor);
30
+ this.commandName = commandName;
31
+ this.componentName = componentName;
32
+ this.icon = icon;
33
+ this.dropdownLabel = dropdownLabel;
34
+ this.columns = editor.config.get(`${this.componentName}.columns`);
35
+ this.colorTableView = undefined;
36
+ }
37
+ /**
38
+ * @inheritDoc
39
+ */
40
+ init() {
41
+ const editor = this.editor;
42
+ const locale = editor.locale;
43
+ const t = locale.t;
44
+ const command = editor.commands.get(this.commandName);
45
+ const colorsConfig = normalizeColorOptions((editor.config.get(this.componentName)).colors);
46
+ const localizedColors = getLocalizedColorOptions(locale, colorsConfig);
47
+ const documentColorsCount = editor.config.get(`${this.componentName}.documentColors`);
48
+ // Register the UI component.
49
+ editor.ui.componentFactory.add(this.componentName, locale => {
50
+ const dropdownView = createDropdown(locale);
51
+ this.colorTableView = addColorTableToDropdown({
52
+ dropdownView,
53
+ colors: localizedColors.map(option => ({
54
+ label: option.label,
55
+ color: option.model,
56
+ options: {
57
+ hasBorder: option.hasBorder
58
+ }
59
+ })),
60
+ columns: this.columns,
61
+ removeButtonLabel: t('Remove color'),
62
+ documentColorsLabel: documentColorsCount !== 0 ? t('Document colors') : '',
63
+ documentColorsCount: documentColorsCount === undefined ? this.columns : documentColorsCount
64
+ });
65
+ this.colorTableView.bind('selectedColor').to(command, 'value');
66
+ dropdownView.buttonView.set({
67
+ label: this.dropdownLabel,
68
+ icon: this.icon,
69
+ tooltip: true
70
+ });
71
+ dropdownView.extendTemplate({
72
+ attributes: {
73
+ class: 'ck-color-ui-dropdown'
74
+ }
75
+ });
76
+ dropdownView.bind('isEnabled').to(command);
77
+ dropdownView.on('execute', (evt, data) => {
78
+ editor.execute(this.commandName, data);
79
+ editor.editing.view.focus();
80
+ });
81
+ dropdownView.on('change:isOpen', (evt, name, isVisible) => {
82
+ // Grids rendering is deferred (#6192).
83
+ dropdownView.colorTableView.appendGrids();
84
+ if (isVisible) {
85
+ if (documentColorsCount !== 0) {
86
+ this.colorTableView.updateDocumentColors(editor.model, this.componentName);
87
+ }
88
+ this.colorTableView.updateSelectedColors();
89
+ }
90
+ });
91
+ // Accessibility: focus the first active color when opening the dropdown.
92
+ focusChildOnDropdownOpen(dropdownView, () => dropdownView.colorTableView.staticColorsGrid.items.find((item) => item.isOn));
93
+ return dropdownView;
94
+ });
95
+ }
150
96
  }
package/src/utils.d.ts ADDED
@@ -0,0 +1,77 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module font/utils
7
+ */
8
+ import ColorTableView from './ui/colortableview';
9
+ import type { FontFamilyOption, FontSizeOption } from './fontconfig';
10
+ import type { ColorDefinition, DropdownView } from 'ckeditor5/src/ui';
11
+ import type { ArrayOrItem } from 'ckeditor5/src/utils';
12
+ import type { ViewAttributeElement, ViewElement, MatcherPattern, ViewElementDefinition, DowncastConversionApi } from 'ckeditor5/src/engine';
13
+ /**
14
+ * The name of the font size plugin.
15
+ */
16
+ export declare const FONT_SIZE = "fontSize";
17
+ /**
18
+ * The name of the font family plugin.
19
+ */
20
+ export declare const FONT_FAMILY = "fontFamily";
21
+ /**
22
+ * The name of the font color plugin.
23
+ */
24
+ export declare const FONT_COLOR = "fontColor";
25
+ /**
26
+ * The name of the font background color plugin.
27
+ */
28
+ export declare const FONT_BACKGROUND_COLOR = "fontBackgroundColor";
29
+ /**
30
+ * Builds a proper converter definition out of input data.
31
+ */
32
+ export declare function buildDefinition(modelAttributeKey: string, options: Array<FontFamilyOption> | Array<FontSizeOption>): FontConverterDefinition;
33
+ export type FontConverterDefinition = {
34
+ model: {
35
+ key: string;
36
+ values: Array<string>;
37
+ };
38
+ view: Record<string, ViewElementDefinition>;
39
+ upcastAlso: Record<string, ArrayOrItem<MatcherPattern>>;
40
+ };
41
+ /**
42
+ * A {@link module:font/fontcolor~FontColor font color} and
43
+ * {@link module:font/fontbackgroundcolor~FontBackgroundColor font background color} helper
44
+ * responsible for upcasting data to the model.
45
+ *
46
+ * **Note**: The `styleAttr` parameter should be either `'color'` or `'background-color'`.
47
+ */
48
+ export declare function renderUpcastAttribute(styleAttr: string): (viewElement: ViewElement) => string;
49
+ /**
50
+ * A {@link module:font/fontcolor~FontColor font color} and
51
+ * {@link module:font/fontbackgroundcolor~FontBackgroundColor font background color} helper
52
+ * responsible for downcasting a color attribute to a `<span>` element.
53
+ *
54
+ * **Note**: The `styleAttr` parameter should be either `'color'` or `'background-color'`.
55
+ */
56
+ export declare function renderDowncastElement(styleAttr: string): (modelAttributeValue: string, { writer }: DowncastConversionApi) => ViewAttributeElement;
57
+ /**
58
+ * A helper that adds {@link module:font/ui/colortableview~ColorTableView} to the color dropdown with proper initial values.
59
+ *
60
+ * @param config.dropdownView The dropdown view to which a {@link module:font/ui/colortableview~ColorTableView} will be added.
61
+ * @param config.colors An array with definitions representing colors to be displayed in the color table.
62
+ * @param config.removeButtonLabel The label for the button responsible for removing the color.
63
+ * @param config.documentColorsLabel The label for the section with document colors.
64
+ * @param config.documentColorsCount The number of document colors inside the dropdown.
65
+ * @returns The new color table view.
66
+ */
67
+ export declare function addColorTableToDropdown({ dropdownView, colors, columns, removeButtonLabel, documentColorsLabel, documentColorsCount }: {
68
+ dropdownView: ColorTableDropdownView;
69
+ colors: Array<ColorDefinition>;
70
+ columns: number;
71
+ removeButtonLabel: string;
72
+ documentColorsLabel?: string;
73
+ documentColorsCount?: number;
74
+ }): ColorTableView;
75
+ export type ColorTableDropdownView = DropdownView & {
76
+ colorTableView?: ColorTableView;
77
+ };
package/src/utils.js CHANGED
@@ -2,120 +2,90 @@
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
-
6
5
  /**
7
6
  * @module font/utils
8
7
  */
9
-
10
8
  import ColorTableView from './ui/colortableview';
11
-
12
9
  /**
13
10
  * The name of the font size plugin.
14
11
  */
15
12
  export const FONT_SIZE = 'fontSize';
16
-
17
13
  /**
18
14
  * The name of the font family plugin.
19
15
  */
20
16
  export const FONT_FAMILY = 'fontFamily';
21
-
22
17
  /**
23
18
  * The name of the font color plugin.
24
19
  */
25
20
  export const FONT_COLOR = 'fontColor';
26
-
27
21
  /**
28
22
  * The name of the font background color plugin.
29
23
  */
30
24
  export const FONT_BACKGROUND_COLOR = 'fontBackgroundColor';
31
-
32
25
  /**
33
- * Builds a proper {@link module:engine/conversion/conversion~ConverterDefinition converter definition} out of input data.
34
- *
35
- * @param {String} modelAttributeKey Key
36
- * @param {Array.<module:font/fontfamily~FontFamilyOption>|Array.<module:font/fontsize~FontSizeOption>} options
37
- * @returns {module:engine/conversion/conversion~ConverterDefinition}
26
+ * Builds a proper converter definition out of input data.
38
27
  */
39
- export function buildDefinition( modelAttributeKey, options ) {
40
- const definition = {
41
- model: {
42
- key: modelAttributeKey,
43
- values: []
44
- },
45
- view: {},
46
- upcastAlso: {}
47
- };
48
-
49
- for ( const option of options ) {
50
- definition.model.values.push( option.model );
51
- definition.view[ option.model ] = option.view;
52
-
53
- if ( option.upcastAlso ) {
54
- definition.upcastAlso[ option.model ] = option.upcastAlso;
55
- }
56
- }
57
-
58
- return definition;
28
+ export function buildDefinition(modelAttributeKey, options) {
29
+ const definition = {
30
+ model: {
31
+ key: modelAttributeKey,
32
+ values: []
33
+ },
34
+ view: {},
35
+ upcastAlso: {}
36
+ };
37
+ for (const option of options) {
38
+ definition.model.values.push(option.model);
39
+ definition.view[option.model] = option.view;
40
+ if (option.upcastAlso) {
41
+ definition.upcastAlso[option.model] = option.upcastAlso;
42
+ }
43
+ }
44
+ return definition;
59
45
  }
60
-
61
46
  /**
62
47
  * A {@link module:font/fontcolor~FontColor font color} and
63
48
  * {@link module:font/fontbackgroundcolor~FontBackgroundColor font background color} helper
64
49
  * responsible for upcasting data to the model.
65
50
  *
66
51
  * **Note**: The `styleAttr` parameter should be either `'color'` or `'background-color'`.
67
- *
68
- * @param {String} styleAttr
69
- * @return {String}
70
52
  */
71
- export function renderUpcastAttribute( styleAttr ) {
72
- return viewElement => normalizeColorCode( viewElement.getStyle( styleAttr ) );
53
+ export function renderUpcastAttribute(styleAttr) {
54
+ return (viewElement) => normalizeColorCode(viewElement.getStyle(styleAttr));
73
55
  }
74
-
75
56
  /**
76
57
  * A {@link module:font/fontcolor~FontColor font color} and
77
58
  * {@link module:font/fontbackgroundcolor~FontBackgroundColor font background color} helper
78
59
  * responsible for downcasting a color attribute to a `<span>` element.
79
60
  *
80
61
  * **Note**: The `styleAttr` parameter should be either `'color'` or `'background-color'`.
81
- *
82
- * @param {String} styleAttr
83
62
  */
84
- export function renderDowncastElement( styleAttr ) {
85
- return ( modelAttributeValue, { writer } ) => writer.createAttributeElement( 'span', {
86
- style: `${ styleAttr }:${ modelAttributeValue }`
87
- }, { priority: 7 } );
63
+ export function renderDowncastElement(styleAttr) {
64
+ return (modelAttributeValue, { writer }) => writer.createAttributeElement('span', {
65
+ style: `${styleAttr}:${modelAttributeValue}`
66
+ }, { priority: 7 });
88
67
  }
89
-
90
68
  /**
91
69
  * A helper that adds {@link module:font/ui/colortableview~ColorTableView} to the color dropdown with proper initial values.
92
70
  *
93
- * @param {Object} config The configuration object.
94
- * @param {module:ui/dropdown/dropdownview~DropdownView} config.dropdownView The dropdown view to which
95
- * a {@link module:font/ui/colortableview~ColorTableView} will be added.
96
- * @param {Array.<module:ui/colorgrid/colorgrid~ColorDefinition>} config.colors An array with definitions
97
- * representing colors to be displayed in the color table.
98
- * @param {String} config.removeButtonLabel The label for the button responsible for removing the color.
99
- * @param {String} config.documentColorsLabel The label for the section with document colors.
100
- * @param {String} config.documentColorsCount The number of document colors inside the dropdown.
101
- * @returns {module:font/ui/colortableview~ColorTableView} The new color table view.
71
+ * @param config.dropdownView The dropdown view to which a {@link module:font/ui/colortableview~ColorTableView} will be added.
72
+ * @param config.colors An array with definitions representing colors to be displayed in the color table.
73
+ * @param config.removeButtonLabel The label for the button responsible for removing the color.
74
+ * @param config.documentColorsLabel The label for the section with document colors.
75
+ * @param config.documentColorsCount The number of document colors inside the dropdown.
76
+ * @returns The new color table view.
102
77
  */
103
- export function addColorTableToDropdown( { dropdownView, colors, columns, removeButtonLabel, documentColorsLabel, documentColorsCount } ) {
104
- const locale = dropdownView.locale;
105
- const colorTableView = new ColorTableView( locale, { colors, columns, removeButtonLabel, documentColorsLabel, documentColorsCount } );
106
-
107
- dropdownView.colorTableView = colorTableView;
108
- dropdownView.panelView.children.add( colorTableView );
109
-
110
- colorTableView.delegate( 'execute' ).to( dropdownView, 'execute' );
111
-
112
- return colorTableView;
78
+ export function addColorTableToDropdown({ dropdownView, colors, columns, removeButtonLabel, documentColorsLabel, documentColorsCount }) {
79
+ const locale = dropdownView.locale;
80
+ const colorTableView = new ColorTableView(locale, { colors, columns, removeButtonLabel, documentColorsLabel, documentColorsCount });
81
+ dropdownView.colorTableView = colorTableView;
82
+ dropdownView.panelView.children.add(colorTableView);
83
+ colorTableView.delegate('execute').to(dropdownView, 'execute');
84
+ return colorTableView;
113
85
  }
114
-
115
- // Fixes the color value string.
116
- //
117
- // @param {String} value
118
- // @returns {String}
119
- function normalizeColorCode( value ) {
120
- return value.replace( /\s/g, '' );
86
+ /**
87
+ * Fixes the color value string.
88
+ */
89
+ function normalizeColorCode(value) {
90
+ return value.replace(/\s/g, '');
121
91
  }