@ckeditor/ckeditor5-font 47.6.1 → 48.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 (205) hide show
  1. package/ckeditor5-metadata.json +8 -8
  2. package/{src → dist}/font.d.ts +1 -1
  3. package/{src → dist}/fontbackgroundcolor/fontbackgroundcolorcommand.d.ts +1 -1
  4. package/{src → dist}/fontbackgroundcolor/fontbackgroundcolorediting.d.ts +1 -1
  5. package/{src → dist}/fontbackgroundcolor/fontbackgroundcolorui.d.ts +1 -1
  6. package/{src → dist}/fontbackgroundcolor.d.ts +1 -1
  7. package/{src → dist}/fontcolor/fontcolorcommand.d.ts +1 -1
  8. package/{src → dist}/fontcolor/fontcolorediting.d.ts +1 -1
  9. package/{src → dist}/fontcolor/fontcolorui.d.ts +1 -1
  10. package/{src → dist}/fontcolor.d.ts +1 -1
  11. package/{src → dist}/fontcommand.d.ts +2 -2
  12. package/{src → dist}/fontconfig.d.ts +2 -2
  13. package/{src → dist}/fontfamily/fontfamilycommand.d.ts +1 -1
  14. package/{src → dist}/fontfamily/fontfamilyediting.d.ts +1 -1
  15. package/{src → dist}/fontfamily/fontfamilyui.d.ts +1 -1
  16. package/{src → dist}/fontfamily.d.ts +1 -1
  17. package/{src → dist}/fontsize/fontsizecommand.d.ts +1 -1
  18. package/{src → dist}/fontsize/fontsizeediting.d.ts +1 -1
  19. package/{src → dist}/fontsize/fontsizeui.d.ts +1 -1
  20. package/{src → dist}/fontsize.d.ts +1 -1
  21. package/dist/index-content.css +16 -12
  22. package/dist/index-editor.css +4 -4
  23. package/dist/index.css +15 -21
  24. package/dist/index.css.map +1 -1
  25. package/dist/index.js.map +1 -1
  26. package/{src → dist}/ui/colorui.d.ts +1 -1
  27. package/{src → dist}/utils.d.ts +3 -3
  28. package/package.json +23 -47
  29. package/build/font.js +0 -5
  30. package/build/translations/af.js +0 -1
  31. package/build/translations/ar.js +0 -1
  32. package/build/translations/ast.js +0 -1
  33. package/build/translations/az.js +0 -1
  34. package/build/translations/be.js +0 -1
  35. package/build/translations/bg.js +0 -1
  36. package/build/translations/bn.js +0 -1
  37. package/build/translations/bs.js +0 -1
  38. package/build/translations/ca.js +0 -1
  39. package/build/translations/cs.js +0 -1
  40. package/build/translations/da.js +0 -1
  41. package/build/translations/de-ch.js +0 -1
  42. package/build/translations/de.js +0 -1
  43. package/build/translations/el.js +0 -1
  44. package/build/translations/en-au.js +0 -1
  45. package/build/translations/en-gb.js +0 -1
  46. package/build/translations/eo.js +0 -1
  47. package/build/translations/es-co.js +0 -1
  48. package/build/translations/es.js +0 -1
  49. package/build/translations/et.js +0 -1
  50. package/build/translations/eu.js +0 -1
  51. package/build/translations/fa.js +0 -1
  52. package/build/translations/fi.js +0 -1
  53. package/build/translations/fr.js +0 -1
  54. package/build/translations/gl.js +0 -1
  55. package/build/translations/gu.js +0 -1
  56. package/build/translations/he.js +0 -1
  57. package/build/translations/hi.js +0 -1
  58. package/build/translations/hr.js +0 -1
  59. package/build/translations/hu.js +0 -1
  60. package/build/translations/hy.js +0 -1
  61. package/build/translations/id.js +0 -1
  62. package/build/translations/it.js +0 -1
  63. package/build/translations/ja.js +0 -1
  64. package/build/translations/jv.js +0 -1
  65. package/build/translations/kk.js +0 -1
  66. package/build/translations/km.js +0 -1
  67. package/build/translations/kn.js +0 -1
  68. package/build/translations/ko.js +0 -1
  69. package/build/translations/ku.js +0 -1
  70. package/build/translations/lt.js +0 -1
  71. package/build/translations/lv.js +0 -1
  72. package/build/translations/ms.js +0 -1
  73. package/build/translations/nb.js +0 -1
  74. package/build/translations/ne.js +0 -1
  75. package/build/translations/nl.js +0 -1
  76. package/build/translations/no.js +0 -1
  77. package/build/translations/oc.js +0 -1
  78. package/build/translations/pl.js +0 -1
  79. package/build/translations/pt-br.js +0 -1
  80. package/build/translations/pt.js +0 -1
  81. package/build/translations/ro.js +0 -1
  82. package/build/translations/ru.js +0 -1
  83. package/build/translations/si.js +0 -1
  84. package/build/translations/sk.js +0 -1
  85. package/build/translations/sl.js +0 -1
  86. package/build/translations/sq.js +0 -1
  87. package/build/translations/sr-latn.js +0 -1
  88. package/build/translations/sr.js +0 -1
  89. package/build/translations/sv.js +0 -1
  90. package/build/translations/th.js +0 -1
  91. package/build/translations/ti.js +0 -1
  92. package/build/translations/tk.js +0 -1
  93. package/build/translations/tr.js +0 -1
  94. package/build/translations/tt.js +0 -1
  95. package/build/translations/ug.js +0 -1
  96. package/build/translations/uk.js +0 -1
  97. package/build/translations/ur.js +0 -1
  98. package/build/translations/uz.js +0 -1
  99. package/build/translations/vi.js +0 -1
  100. package/build/translations/zh-cn.js +0 -1
  101. package/build/translations/zh.js +0 -1
  102. package/lang/contexts.json +0 -12
  103. package/lang/translations/af.po +0 -52
  104. package/lang/translations/ar.po +0 -52
  105. package/lang/translations/ast.po +0 -52
  106. package/lang/translations/az.po +0 -52
  107. package/lang/translations/be.po +0 -52
  108. package/lang/translations/bg.po +0 -52
  109. package/lang/translations/bn.po +0 -52
  110. package/lang/translations/bs.po +0 -52
  111. package/lang/translations/ca.po +0 -52
  112. package/lang/translations/cs.po +0 -52
  113. package/lang/translations/da.po +0 -52
  114. package/lang/translations/de-ch.po +0 -52
  115. package/lang/translations/de.po +0 -52
  116. package/lang/translations/el.po +0 -52
  117. package/lang/translations/en-au.po +0 -52
  118. package/lang/translations/en-gb.po +0 -52
  119. package/lang/translations/en.po +0 -52
  120. package/lang/translations/eo.po +0 -52
  121. package/lang/translations/es-co.po +0 -52
  122. package/lang/translations/es.po +0 -52
  123. package/lang/translations/et.po +0 -52
  124. package/lang/translations/eu.po +0 -52
  125. package/lang/translations/fa.po +0 -52
  126. package/lang/translations/fi.po +0 -52
  127. package/lang/translations/fr.po +0 -52
  128. package/lang/translations/gl.po +0 -52
  129. package/lang/translations/gu.po +0 -52
  130. package/lang/translations/he.po +0 -52
  131. package/lang/translations/hi.po +0 -52
  132. package/lang/translations/hr.po +0 -52
  133. package/lang/translations/hu.po +0 -52
  134. package/lang/translations/hy.po +0 -52
  135. package/lang/translations/id.po +0 -52
  136. package/lang/translations/it.po +0 -52
  137. package/lang/translations/ja.po +0 -52
  138. package/lang/translations/jv.po +0 -52
  139. package/lang/translations/kk.po +0 -52
  140. package/lang/translations/km.po +0 -52
  141. package/lang/translations/kn.po +0 -52
  142. package/lang/translations/ko.po +0 -52
  143. package/lang/translations/ku.po +0 -52
  144. package/lang/translations/lt.po +0 -52
  145. package/lang/translations/lv.po +0 -52
  146. package/lang/translations/ms.po +0 -52
  147. package/lang/translations/nb.po +0 -52
  148. package/lang/translations/ne.po +0 -52
  149. package/lang/translations/nl.po +0 -52
  150. package/lang/translations/no.po +0 -52
  151. package/lang/translations/oc.po +0 -52
  152. package/lang/translations/pl.po +0 -52
  153. package/lang/translations/pt-br.po +0 -52
  154. package/lang/translations/pt.po +0 -52
  155. package/lang/translations/ro.po +0 -52
  156. package/lang/translations/ru.po +0 -52
  157. package/lang/translations/si.po +0 -52
  158. package/lang/translations/sk.po +0 -52
  159. package/lang/translations/sl.po +0 -52
  160. package/lang/translations/sq.po +0 -52
  161. package/lang/translations/sr-latn.po +0 -52
  162. package/lang/translations/sr.po +0 -52
  163. package/lang/translations/sv.po +0 -52
  164. package/lang/translations/th.po +0 -52
  165. package/lang/translations/ti.po +0 -52
  166. package/lang/translations/tk.po +0 -52
  167. package/lang/translations/tr.po +0 -52
  168. package/lang/translations/tt.po +0 -52
  169. package/lang/translations/ug.po +0 -52
  170. package/lang/translations/uk.po +0 -52
  171. package/lang/translations/ur.po +0 -52
  172. package/lang/translations/uz.po +0 -52
  173. package/lang/translations/vi.po +0 -52
  174. package/lang/translations/zh-cn.po +0 -52
  175. package/lang/translations/zh.po +0 -52
  176. package/src/augmentation.js +0 -5
  177. package/src/font.js +0 -43
  178. package/src/fontbackgroundcolor/fontbackgroundcolorcommand.js +0 -25
  179. package/src/fontbackgroundcolor/fontbackgroundcolorediting.js +0 -129
  180. package/src/fontbackgroundcolor/fontbackgroundcolorui.js +0 -33
  181. package/src/fontbackgroundcolor.js +0 -40
  182. package/src/fontcolor/fontcolorcommand.js +0 -24
  183. package/src/fontcolor/fontcolorediting.js +0 -140
  184. package/src/fontcolor/fontcolorui.js +0 -33
  185. package/src/fontcolor.js +0 -39
  186. package/src/fontcommand.js +0 -92
  187. package/src/fontconfig.js +0 -5
  188. package/src/fontfamily/fontfamilycommand.js +0 -24
  189. package/src/fontfamily/fontfamilyediting.js +0 -121
  190. package/src/fontfamily/fontfamilyui.js +0 -152
  191. package/src/fontfamily/utils.js +0 -91
  192. package/src/fontfamily.js +0 -39
  193. package/src/fontsize/fontsizecommand.js +0 -24
  194. package/src/fontsize/fontsizeediting.js +0 -171
  195. package/src/fontsize/fontsizeui.js +0 -158
  196. package/src/fontsize/utils.js +0 -167
  197. package/src/fontsize.js +0 -49
  198. package/src/index.js +0 -30
  199. package/src/ui/colorui.js +0 -201
  200. package/src/utils.js +0 -107
  201. package/theme/fontsize.css +0 -33
  202. /package/{src → dist}/augmentation.d.ts +0 -0
  203. /package/{src → dist}/fontfamily/utils.d.ts +0 -0
  204. /package/{src → dist}/fontsize/utils.d.ts +0 -0
  205. /package/{src → dist}/index.d.ts +0 -0
package/src/fontsize.js DELETED
@@ -1,49 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- /**
6
- * @module font/fontsize
7
- */
8
- import { Plugin } from 'ckeditor5/src/core.js';
9
- import { FontSizeEditing } from './fontsize/fontsizeediting.js';
10
- import { FontSizeUI } from './fontsize/fontsizeui.js';
11
- import { normalizeOptions } from './fontsize/utils.js';
12
- /**
13
- * The font size plugin.
14
- *
15
- * For a detailed overview, check the {@glink features/font font feature} documentation
16
- * and the {@glink api/font package page}.
17
- *
18
- * This is a "glue" plugin which loads the {@link module:font/fontsize/fontsizeediting~FontSizeEditing} and
19
- * {@link module:font/fontsize/fontsizeui~FontSizeUI} features in the editor.
20
- */
21
- export class FontSize extends Plugin {
22
- /**
23
- * @inheritDoc
24
- */
25
- static get requires() {
26
- return [FontSizeEditing, FontSizeUI];
27
- }
28
- /**
29
- * @inheritDoc
30
- */
31
- static get pluginName() {
32
- return 'FontSize';
33
- }
34
- /**
35
- * @inheritDoc
36
- */
37
- static get isOfficialPlugin() {
38
- return true;
39
- }
40
- /**
41
- * Normalizes and translates the {@link module:font/fontconfig~FontSizeConfig#options configuration options}
42
- * to the {@link module:font/fontconfig~FontSizeOption} format.
43
- *
44
- * @param options An array of options taken from the configuration.
45
- */
46
- normalizeSizeOptions(options) {
47
- return normalizeOptions(options);
48
- }
49
- }
package/src/index.js DELETED
@@ -1,30 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- /**
6
- * @module font
7
- */
8
- export { Font } from './font.js';
9
- export { FontBackgroundColor } from './fontbackgroundcolor.js';
10
- export { FontColor } from './fontcolor.js';
11
- export { FontFamily } from './fontfamily.js';
12
- export { FontSize } from './fontsize.js';
13
- export { FontCommand } from './fontcommand.js';
14
- export { FontBackgroundColorEditing } from './fontbackgroundcolor/fontbackgroundcolorediting.js';
15
- export { FontBackgroundColorUI } from './fontbackgroundcolor/fontbackgroundcolorui.js';
16
- export { FontColorEditing } from './fontcolor/fontcolorediting.js';
17
- export { FontColorUI } from './fontcolor/fontcolorui.js';
18
- export { FontFamilyEditing } from './fontfamily/fontfamilyediting.js';
19
- export { FontFamilyUI } from './fontfamily/fontfamilyui.js';
20
- export { FontSizeEditing } from './fontsize/fontsizeediting.js';
21
- export { FontSizeUI } from './fontsize/fontsizeui.js';
22
- export { FontBackgroundColorCommand } from './fontbackgroundcolor/fontbackgroundcolorcommand.js';
23
- export { FontColorCommand } from './fontcolor/fontcolorcommand.js';
24
- export { FontFamilyCommand } from './fontfamily/fontfamilycommand.js';
25
- export { FontSizeCommand } from './fontsize/fontsizecommand.js';
26
- export { FontColorUIBase } from './ui/colorui.js';
27
- export { buildDefinition as _buildFontDefinition, renderUpcastAttribute as _renderUpcastFontColorAttribute, renderDowncastElement as _renderDowncastFontElement, addColorSelectorToDropdown as _addFontColorSelectorToDropdown } from './utils.js';
28
- export { normalizeOptions as _normalizeFontFamilyOptions } from './fontfamily/utils.js';
29
- export { normalizeOptions as _normalizeFontSizeOptions } from './fontsize/utils.js';
30
- import './augmentation.js';
package/src/ui/colorui.js DELETED
@@ -1,201 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- /**
6
- * @module font/ui/colorui
7
- */
8
- import { Plugin } from 'ckeditor5/src/core.js';
9
- import { createDropdown, normalizeColorOptions, getLocalizedColorOptions, focusChildOnDropdownOpen, MenuBarMenuView, ColorSelectorView } from 'ckeditor5/src/ui.js';
10
- import { addColorSelectorToDropdown } from '../utils.js';
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:ui/colorselector/colorselectorview~ColorSelectorView}.
16
- */
17
- export class FontColorUIBase extends Plugin {
18
- /**
19
- * The name of the command which will be executed when a color tile is clicked.
20
- */
21
- commandName;
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;
27
- /**
28
- * The SVG icon used by the dropdown.
29
- */
30
- icon;
31
- /**
32
- * The label used by the dropdown.
33
- */
34
- dropdownLabel;
35
- /**
36
- * The number of columns in the color grid.
37
- */
38
- columns;
39
- /**
40
- * Creates a plugin which introduces a dropdown with a pre–configured
41
- * {@link module:ui/colorselector/colorselectorview~ColorSelectorView}.
42
- *
43
- * @param editor An editor instance.
44
- * @param config The configuration object.
45
- * @param config.commandName The name of the command which will be executed when a color tile is clicked.
46
- * @param config.componentName The name of the dropdown in the {@link module:ui/componentfactory~ComponentFactory}
47
- * and the configuration scope name in `editor.config`.
48
- * @param config.icon The SVG icon used by the dropdown.
49
- * @param config.dropdownLabel The label used by the dropdown.
50
- */
51
- constructor(editor, { commandName, componentName, icon, dropdownLabel }) {
52
- super(editor);
53
- this.commandName = commandName;
54
- this.componentName = componentName;
55
- this.icon = icon;
56
- this.dropdownLabel = dropdownLabel;
57
- this.columns = editor.config.get(`${this.componentName}.columns`);
58
- }
59
- /**
60
- * @inheritDoc
61
- */
62
- init() {
63
- const editor = this.editor;
64
- const locale = editor.locale;
65
- const t = locale.t;
66
- const command = editor.commands.get(this.commandName);
67
- const componentConfig = editor.config.get(this.componentName);
68
- const colorsConfig = normalizeColorOptions(componentConfig.colors);
69
- const localizedColors = getLocalizedColorOptions(locale, colorsConfig);
70
- const documentColorsCount = componentConfig.documentColors;
71
- const hasColorPicker = componentConfig.colorPicker !== false;
72
- // Register the UI component.
73
- editor.ui.componentFactory.add(this.componentName, locale => {
74
- const dropdownView = createDropdown(locale);
75
- // Font color dropdown rendering is deferred once it gets open to improve performance (#6192).
76
- let dropdownContentRendered = false;
77
- const colorSelectorView = addColorSelectorToDropdown({
78
- dropdownView,
79
- colors: localizedColors.map(option => ({
80
- label: option.label,
81
- color: option.model,
82
- options: {
83
- hasBorder: option.hasBorder
84
- }
85
- })),
86
- columns: this.columns,
87
- removeButtonLabel: t('Remove color'),
88
- colorPickerLabel: t('Color picker'),
89
- documentColorsLabel: documentColorsCount !== 0 ? t('Document colors') : '',
90
- documentColorsCount: documentColorsCount === undefined ? this.columns : documentColorsCount,
91
- colorPickerViewConfig: hasColorPicker ? (componentConfig.colorPicker || {}) : false
92
- });
93
- colorSelectorView.bind('selectedColor').to(command, 'value');
94
- dropdownView.buttonView.set({
95
- label: this.dropdownLabel,
96
- icon: this.icon,
97
- tooltip: true
98
- });
99
- dropdownView.extendTemplate({
100
- attributes: {
101
- class: 'ck-color-ui-dropdown'
102
- }
103
- });
104
- dropdownView.bind('isEnabled').to(command);
105
- colorSelectorView.on('execute', (evt, data) => {
106
- if (dropdownView.isOpen) {
107
- editor.execute(this.commandName, {
108
- value: data.value,
109
- batch: this._undoStepBatch
110
- });
111
- }
112
- if (data.source !== 'colorPicker') {
113
- editor.editing.view.focus();
114
- }
115
- if (data.source === 'colorPickerSaveButton') {
116
- dropdownView.isOpen = false;
117
- }
118
- });
119
- colorSelectorView.on('colorPicker:show', () => {
120
- this._undoStepBatch = editor.model.createBatch();
121
- });
122
- colorSelectorView.on('colorPicker:cancel', () => {
123
- if (this._undoStepBatch.operations.length) {
124
- // We need to close the dropdown before the undo batch.
125
- // Otherwise, FontColorUIBase treats undo as a selected color change,
126
- // propagating the update to the whole selection.
127
- // That's an issue if spans with various colors were selected.
128
- dropdownView.isOpen = false;
129
- editor.execute('undo', this._undoStepBatch);
130
- }
131
- editor.editing.view.focus();
132
- });
133
- dropdownView.on('change:isOpen', (evt, name, isVisible) => {
134
- if (!dropdownContentRendered) {
135
- dropdownContentRendered = true;
136
- dropdownView.colorSelectorView.appendUI();
137
- }
138
- if (isVisible) {
139
- if (documentColorsCount !== 0) {
140
- colorSelectorView.updateDocumentColors(editor.model, this.componentName);
141
- }
142
- colorSelectorView.updateSelectedColors();
143
- colorSelectorView.showColorGridsFragment();
144
- }
145
- });
146
- // Accessibility: focus the first active color when opening the dropdown.
147
- focusChildOnDropdownOpen(dropdownView, () => dropdownView.colorSelectorView.colorGridsFragmentView.staticColorsGrid.items.find((item) => item.isOn));
148
- return dropdownView;
149
- });
150
- // Register menu bar button..
151
- editor.ui.componentFactory.add(`menuBar:${this.componentName}`, locale => {
152
- const menuView = new MenuBarMenuView(locale);
153
- menuView.buttonView.set({
154
- label: this.dropdownLabel,
155
- icon: this.icon
156
- });
157
- menuView.bind('isEnabled').to(command);
158
- // Font color sub-menu rendering is deferred once it gets open to improve performance (#6192).
159
- let contentRendered = false;
160
- const colorSelectorView = new ColorSelectorView(locale, {
161
- colors: localizedColors.map(option => ({
162
- label: option.label,
163
- color: option.model,
164
- options: {
165
- hasBorder: option.hasBorder
166
- }
167
- })),
168
- columns: this.columns,
169
- removeButtonLabel: t('Remove color'),
170
- colorPickerLabel: t('Color picker'),
171
- documentColorsLabel: documentColorsCount !== 0 ? t('Document colors') : '',
172
- documentColorsCount: documentColorsCount === undefined ? this.columns : documentColorsCount,
173
- colorPickerViewConfig: false
174
- });
175
- colorSelectorView.bind('selectedColor').to(command, 'value');
176
- colorSelectorView.delegate('execute').to(menuView);
177
- colorSelectorView.on('execute', (evt, data) => {
178
- editor.execute(this.commandName, {
179
- value: data.value,
180
- batch: this._undoStepBatch
181
- });
182
- editor.editing.view.focus();
183
- });
184
- menuView.on('change:isOpen', (evt, name, isVisible) => {
185
- if (!contentRendered) {
186
- contentRendered = true;
187
- colorSelectorView.appendUI();
188
- }
189
- if (isVisible) {
190
- if (documentColorsCount !== 0) {
191
- colorSelectorView.updateDocumentColors(editor.model, this.componentName);
192
- }
193
- colorSelectorView.updateSelectedColors();
194
- colorSelectorView.showColorGridsFragment();
195
- }
196
- });
197
- menuView.panelView.children.add(colorSelectorView);
198
- return menuView;
199
- });
200
- }
201
- }
package/src/utils.js DELETED
@@ -1,107 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- import { ColorSelectorView } from 'ckeditor5/src/ui.js';
6
- /**
7
- * The name of the font size plugin.
8
- */
9
- export const FONT_SIZE = 'fontSize';
10
- /**
11
- * The name of the font family plugin.
12
- */
13
- export const FONT_FAMILY = 'fontFamily';
14
- /**
15
- * The name of the font color plugin.
16
- */
17
- export const FONT_COLOR = 'fontColor';
18
- /**
19
- * The name of the font background color plugin.
20
- */
21
- export const FONT_BACKGROUND_COLOR = 'fontBackgroundColor';
22
- /**
23
- * Builds a proper converter definition out of input data.
24
- *
25
- * @internal
26
- */
27
- export function buildDefinition(modelAttributeKey, options) {
28
- const definition = {
29
- model: {
30
- key: modelAttributeKey,
31
- values: []
32
- },
33
- view: {},
34
- upcastAlso: {}
35
- };
36
- for (const option of options) {
37
- definition.model.values.push(option.model);
38
- definition.view[option.model] = option.view;
39
- if (option.upcastAlso) {
40
- definition.upcastAlso[option.model] = option.upcastAlso;
41
- }
42
- }
43
- return definition;
44
- }
45
- /**
46
- * A {@link module:font/fontcolor~FontColor font color} and
47
- * {@link module:font/fontbackgroundcolor~FontBackgroundColor font background color} helper
48
- * responsible for upcasting data to the model.
49
- *
50
- * **Note**: The `styleAttr` parameter should be either `'color'` or `'background-color'`.
51
- *
52
- * @internal
53
- */
54
- export function renderUpcastAttribute(styleAttr) {
55
- return (viewElement) => normalizeColorCode(viewElement.getStyle(styleAttr));
56
- }
57
- /**
58
- * A {@link module:font/fontcolor~FontColor font color} and
59
- * {@link module:font/fontbackgroundcolor~FontBackgroundColor font background color} helper
60
- * responsible for downcasting a color attribute to a `<span>` element.
61
- *
62
- * **Note**: The `styleAttr` parameter should be either `'color'` or `'background-color'`.
63
- *
64
- * @internal
65
- */
66
- export function renderDowncastElement(styleAttr) {
67
- return (modelAttributeValue, { writer }) => writer.createAttributeElement('span', {
68
- style: `${styleAttr}:${modelAttributeValue}`
69
- }, { priority: 7 });
70
- }
71
- /**
72
- * A helper that adds {@link module:ui/colorselector/colorselectorview~ColorSelectorView} to the color dropdown with proper initial values.
73
- *
74
- * @param options Configuration options
75
- * @param options.dropdownView The dropdown view to which a {@link module:ui/colorselector/colorselectorview~ColorSelectorView}
76
- * will be added.
77
- * @param options.colors An array with definitions representing colors to be displayed in the color selector.
78
- * @param options.columns The number of columns in the color grid.
79
- * @param options.removeButtonLabel The label for the button responsible for removing the color.
80
- * @param options.colorPickerLabel The label for the color picker button.
81
- * @param options.documentColorsLabel The label for the section with document colors.
82
- * @param options.documentColorsCount The number of document colors inside the dropdown.
83
- * @param options.colorPickerViewConfig Configuration of the color picker view.
84
- * @returns The new color selector view.
85
- * @internal
86
- */
87
- export function addColorSelectorToDropdown({ dropdownView, colors, columns, removeButtonLabel, colorPickerLabel, documentColorsLabel, documentColorsCount, colorPickerViewConfig }) {
88
- const locale = dropdownView.locale;
89
- const colorSelectorView = new ColorSelectorView(locale, {
90
- colors,
91
- columns,
92
- removeButtonLabel,
93
- colorPickerLabel,
94
- documentColorsLabel,
95
- documentColorsCount,
96
- colorPickerViewConfig
97
- });
98
- dropdownView.colorSelectorView = colorSelectorView;
99
- dropdownView.panelView.children.add(colorSelectorView);
100
- return colorSelectorView;
101
- }
102
- /**
103
- * Fixes the color value string.
104
- */
105
- function normalizeColorCode(value) {
106
- return value.replace(/\s/g, '');
107
- }
@@ -1,33 +0,0 @@
1
- /*
2
- * Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
-
6
- /* The values should be synchronized with the "FONT_SIZE_PRESET_UNITS" object in the "/src/fontsize/utils.js" file. */
7
-
8
- :root {
9
- --ck-content-font-size-tiny: 0.7em;
10
- --ck-content-font-size-small: 0.85em;
11
- --ck-content-font-size-big: 1.4em;
12
- --ck-content-font-size-huge: 1.8em;
13
- }
14
-
15
- /* Styles should be prefixed with the `.ck-content` class.
16
- See https://github.com/ckeditor/ckeditor5/issues/6636 */
17
- .ck-content {
18
- & .text-tiny {
19
- font-size: var(--ck-content-font-size-tiny);
20
- }
21
-
22
- & .text-small {
23
- font-size: var(--ck-content-font-size-small);
24
- }
25
-
26
- & .text-big {
27
- font-size: var(--ck-content-font-size-big);
28
- }
29
-
30
- & .text-huge {
31
- font-size: var(--ck-content-font-size-huge);
32
- }
33
- }
File without changes
File without changes
File without changes
File without changes