@ckeditor/ckeditor5-font 38.0.1 → 38.1.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 (59) hide show
  1. package/build/font.js +1 -1
  2. package/build/font.js.map +1 -0
  3. package/build/translations/it.js +1 -1
  4. package/lang/translations/it.po +1 -1
  5. package/package.json +3 -23
  6. package/src/augmentation.d.ts +58 -58
  7. package/src/augmentation.js +5 -5
  8. package/src/documentcolorcollection.d.ts +70 -70
  9. package/src/documentcolorcollection.js +42 -42
  10. package/src/font.d.ts +33 -33
  11. package/src/font.js +37 -37
  12. package/src/fontbackgroundcolor/fontbackgroundcolorcommand.d.ts +26 -26
  13. package/src/fontbackgroundcolor/fontbackgroundcolorcommand.js +25 -25
  14. package/src/fontbackgroundcolor/fontbackgroundcolorediting.d.ts +26 -26
  15. package/src/fontbackgroundcolor/fontbackgroundcolorediting.js +123 -123
  16. package/src/fontbackgroundcolor/fontbackgroundcolorui.d.ts +22 -22
  17. package/src/fontbackgroundcolor/fontbackgroundcolorui.js +33 -33
  18. package/src/fontbackgroundcolor.d.ts +30 -30
  19. package/src/fontbackgroundcolor.js +34 -34
  20. package/src/fontcolor/fontcolorcommand.d.ts +25 -25
  21. package/src/fontcolor/fontcolorcommand.js +24 -24
  22. package/src/fontcolor/fontcolorediting.d.ts +26 -26
  23. package/src/fontcolor/fontcolorediting.js +134 -134
  24. package/src/fontcolor/fontcolorui.d.ts +22 -22
  25. package/src/fontcolor/fontcolorui.js +33 -33
  26. package/src/fontcolor.d.ts +29 -29
  27. package/src/fontcolor.js +33 -33
  28. package/src/fontcommand.d.ts +48 -48
  29. package/src/fontcommand.js +79 -79
  30. package/src/fontconfig.d.ts +373 -373
  31. package/src/fontconfig.js +5 -5
  32. package/src/fontfamily/fontfamilycommand.d.ts +25 -25
  33. package/src/fontfamily/fontfamilycommand.js +24 -24
  34. package/src/fontfamily/fontfamilyediting.d.ts +39 -39
  35. package/src/fontfamily/fontfamilyediting.js +115 -115
  36. package/src/fontfamily/fontfamilyui.d.ts +30 -30
  37. package/src/fontfamily/fontfamilyui.js +114 -114
  38. package/src/fontfamily/utils.d.ts +15 -15
  39. package/src/fontfamily/utils.js +80 -80
  40. package/src/fontfamily.d.ts +29 -29
  41. package/src/fontfamily.js +33 -33
  42. package/src/fontsize/fontsizecommand.d.ts +25 -25
  43. package/src/fontsize/fontsizecommand.js +24 -24
  44. package/src/fontsize/fontsizeediting.d.ts +44 -44
  45. package/src/fontsize/fontsizeediting.js +165 -165
  46. package/src/fontsize/fontsizeui.d.ts +31 -31
  47. package/src/fontsize/fontsizeui.js +122 -122
  48. package/src/fontsize/utils.d.ts +12 -12
  49. package/src/fontsize/utils.js +166 -166
  50. package/src/fontsize.d.ts +37 -37
  51. package/src/fontsize.js +43 -43
  52. package/src/index.d.ts +27 -27
  53. package/src/index.js +21 -21
  54. package/src/ui/colortableview.d.ts +459 -459
  55. package/src/ui/colortableview.js +645 -645
  56. package/src/ui/colorui.d.ts +67 -67
  57. package/src/ui/colorui.js +128 -128
  58. package/src/utils.d.ts +79 -79
  59. package/src/utils.js +98 -98
package/src/utils.js CHANGED
@@ -1,98 +1,98 @@
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
- /**
10
- * The name of the font size plugin.
11
- */
12
- export const FONT_SIZE = 'fontSize';
13
- /**
14
- * The name of the font family plugin.
15
- */
16
- export const FONT_FAMILY = 'fontFamily';
17
- /**
18
- * The name of the font color plugin.
19
- */
20
- export const FONT_COLOR = 'fontColor';
21
- /**
22
- * The name of the font background color plugin.
23
- */
24
- export const FONT_BACKGROUND_COLOR = 'fontBackgroundColor';
25
- /**
26
- * Builds a proper converter definition out of input data.
27
- */
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;
45
- }
46
- /**
47
- * A {@link module:font/fontcolor~FontColor font color} and
48
- * {@link module:font/fontbackgroundcolor~FontBackgroundColor font background color} helper
49
- * responsible for upcasting data to the model.
50
- *
51
- * **Note**: The `styleAttr` parameter should be either `'color'` or `'background-color'`.
52
- */
53
- export function renderUpcastAttribute(styleAttr) {
54
- return (viewElement) => normalizeColorCode(viewElement.getStyle(styleAttr));
55
- }
56
- /**
57
- * A {@link module:font/fontcolor~FontColor font color} and
58
- * {@link module:font/fontbackgroundcolor~FontBackgroundColor font background color} helper
59
- * responsible for downcasting a color attribute to a `<span>` element.
60
- *
61
- * **Note**: The `styleAttr` parameter should be either `'color'` or `'background-color'`.
62
- */
63
- export function renderDowncastElement(styleAttr) {
64
- return (modelAttributeValue, { writer }) => writer.createAttributeElement('span', {
65
- style: `${styleAttr}:${modelAttributeValue}`
66
- }, { priority: 7 });
67
- }
68
- /**
69
- * A helper that adds {@link module:font/ui/colortableview~ColorTableView} to the color dropdown with proper initial values.
70
- *
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.
77
- */
78
- export function addColorTableToDropdown({ dropdownView, colors, columns, removeButtonLabel, colorPickerLabel, documentColorsLabel, documentColorsCount, colorPickerConfig }) {
79
- const locale = dropdownView.locale;
80
- const colorTableView = new ColorTableView(locale, {
81
- colors,
82
- columns,
83
- removeButtonLabel,
84
- colorPickerLabel,
85
- documentColorsLabel,
86
- documentColorsCount,
87
- colorPickerConfig
88
- });
89
- dropdownView.colorTableView = colorTableView;
90
- dropdownView.panelView.children.add(colorTableView);
91
- return colorTableView;
92
- }
93
- /**
94
- * Fixes the color value string.
95
- */
96
- function normalizeColorCode(value) {
97
- return value.replace(/\s/g, '');
98
- }
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
+ /**
10
+ * The name of the font size plugin.
11
+ */
12
+ export const FONT_SIZE = 'fontSize';
13
+ /**
14
+ * The name of the font family plugin.
15
+ */
16
+ export const FONT_FAMILY = 'fontFamily';
17
+ /**
18
+ * The name of the font color plugin.
19
+ */
20
+ export const FONT_COLOR = 'fontColor';
21
+ /**
22
+ * The name of the font background color plugin.
23
+ */
24
+ export const FONT_BACKGROUND_COLOR = 'fontBackgroundColor';
25
+ /**
26
+ * Builds a proper converter definition out of input data.
27
+ */
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;
45
+ }
46
+ /**
47
+ * A {@link module:font/fontcolor~FontColor font color} and
48
+ * {@link module:font/fontbackgroundcolor~FontBackgroundColor font background color} helper
49
+ * responsible for upcasting data to the model.
50
+ *
51
+ * **Note**: The `styleAttr` parameter should be either `'color'` or `'background-color'`.
52
+ */
53
+ export function renderUpcastAttribute(styleAttr) {
54
+ return (viewElement) => normalizeColorCode(viewElement.getStyle(styleAttr));
55
+ }
56
+ /**
57
+ * A {@link module:font/fontcolor~FontColor font color} and
58
+ * {@link module:font/fontbackgroundcolor~FontBackgroundColor font background color} helper
59
+ * responsible for downcasting a color attribute to a `<span>` element.
60
+ *
61
+ * **Note**: The `styleAttr` parameter should be either `'color'` or `'background-color'`.
62
+ */
63
+ export function renderDowncastElement(styleAttr) {
64
+ return (modelAttributeValue, { writer }) => writer.createAttributeElement('span', {
65
+ style: `${styleAttr}:${modelAttributeValue}`
66
+ }, { priority: 7 });
67
+ }
68
+ /**
69
+ * A helper that adds {@link module:font/ui/colortableview~ColorTableView} to the color dropdown with proper initial values.
70
+ *
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.
77
+ */
78
+ export function addColorTableToDropdown({ dropdownView, colors, columns, removeButtonLabel, colorPickerLabel, documentColorsLabel, documentColorsCount, colorPickerConfig }) {
79
+ const locale = dropdownView.locale;
80
+ const colorTableView = new ColorTableView(locale, {
81
+ colors,
82
+ columns,
83
+ removeButtonLabel,
84
+ colorPickerLabel,
85
+ documentColorsLabel,
86
+ documentColorsCount,
87
+ colorPickerConfig
88
+ });
89
+ dropdownView.colorTableView = colorTableView;
90
+ dropdownView.panelView.children.add(colorTableView);
91
+ return colorTableView;
92
+ }
93
+ /**
94
+ * Fixes the color value string.
95
+ */
96
+ function normalizeColorCode(value) {
97
+ return value.replace(/\s/g, '');
98
+ }