@ckeditor/ckeditor5-font 41.3.1 → 41.4.0-alpha.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.
Files changed (150) hide show
  1. package/dist/index-content.css +16 -0
  2. package/dist/index-editor.css +4 -0
  3. package/dist/index.css +27 -0
  4. package/dist/index.css.map +1 -0
  5. package/dist/index.js +1428 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/translations/ar.d.ts +8 -0
  8. package/dist/translations/ar.js +5 -0
  9. package/dist/translations/az.d.ts +8 -0
  10. package/dist/translations/az.js +5 -0
  11. package/dist/translations/bg.d.ts +8 -0
  12. package/dist/translations/bg.js +5 -0
  13. package/dist/translations/bn.d.ts +8 -0
  14. package/dist/translations/bn.js +5 -0
  15. package/dist/translations/bs.d.ts +8 -0
  16. package/dist/translations/bs.js +5 -0
  17. package/dist/translations/ca.d.ts +8 -0
  18. package/dist/translations/ca.js +5 -0
  19. package/dist/translations/cs.d.ts +8 -0
  20. package/dist/translations/cs.js +5 -0
  21. package/dist/translations/da.d.ts +8 -0
  22. package/dist/translations/da.js +5 -0
  23. package/dist/translations/de-ch.d.ts +8 -0
  24. package/dist/translations/de-ch.js +5 -0
  25. package/dist/translations/de.d.ts +8 -0
  26. package/dist/translations/de.js +5 -0
  27. package/dist/translations/el.d.ts +8 -0
  28. package/dist/translations/el.js +5 -0
  29. package/dist/translations/en-au.d.ts +8 -0
  30. package/dist/translations/en-au.js +5 -0
  31. package/dist/translations/en-gb.d.ts +8 -0
  32. package/dist/translations/en-gb.js +5 -0
  33. package/dist/translations/en.d.ts +8 -0
  34. package/dist/translations/en.js +5 -0
  35. package/dist/translations/es-co.d.ts +8 -0
  36. package/dist/translations/es-co.js +5 -0
  37. package/dist/translations/es.d.ts +8 -0
  38. package/dist/translations/es.js +5 -0
  39. package/dist/translations/et.d.ts +8 -0
  40. package/dist/translations/et.js +5 -0
  41. package/dist/translations/fa.d.ts +8 -0
  42. package/dist/translations/fa.js +5 -0
  43. package/dist/translations/fi.d.ts +8 -0
  44. package/dist/translations/fi.js +5 -0
  45. package/dist/translations/fr.d.ts +8 -0
  46. package/dist/translations/fr.js +5 -0
  47. package/dist/translations/gl.d.ts +8 -0
  48. package/dist/translations/gl.js +5 -0
  49. package/dist/translations/he.d.ts +8 -0
  50. package/dist/translations/he.js +5 -0
  51. package/dist/translations/hi.d.ts +8 -0
  52. package/dist/translations/hi.js +5 -0
  53. package/dist/translations/hr.d.ts +8 -0
  54. package/dist/translations/hr.js +5 -0
  55. package/dist/translations/hu.d.ts +8 -0
  56. package/dist/translations/hu.js +5 -0
  57. package/dist/translations/id.d.ts +8 -0
  58. package/dist/translations/id.js +5 -0
  59. package/dist/translations/it.d.ts +8 -0
  60. package/dist/translations/it.js +5 -0
  61. package/dist/translations/ja.d.ts +8 -0
  62. package/dist/translations/ja.js +5 -0
  63. package/dist/translations/jv.d.ts +8 -0
  64. package/dist/translations/jv.js +5 -0
  65. package/dist/translations/ko.d.ts +8 -0
  66. package/dist/translations/ko.js +5 -0
  67. package/dist/translations/ku.d.ts +8 -0
  68. package/dist/translations/ku.js +5 -0
  69. package/dist/translations/lt.d.ts +8 -0
  70. package/dist/translations/lt.js +5 -0
  71. package/dist/translations/lv.d.ts +8 -0
  72. package/dist/translations/lv.js +5 -0
  73. package/dist/translations/ms.d.ts +8 -0
  74. package/dist/translations/ms.js +5 -0
  75. package/dist/translations/nb.d.ts +8 -0
  76. package/dist/translations/nb.js +5 -0
  77. package/dist/translations/ne.d.ts +8 -0
  78. package/dist/translations/ne.js +5 -0
  79. package/dist/translations/nl.d.ts +8 -0
  80. package/dist/translations/nl.js +5 -0
  81. package/dist/translations/no.d.ts +8 -0
  82. package/dist/translations/no.js +5 -0
  83. package/dist/translations/pl.d.ts +8 -0
  84. package/dist/translations/pl.js +5 -0
  85. package/dist/translations/pt-br.d.ts +8 -0
  86. package/dist/translations/pt-br.js +5 -0
  87. package/dist/translations/pt.d.ts +8 -0
  88. package/dist/translations/pt.js +5 -0
  89. package/dist/translations/ro.d.ts +8 -0
  90. package/dist/translations/ro.js +5 -0
  91. package/dist/translations/ru.d.ts +8 -0
  92. package/dist/translations/ru.js +5 -0
  93. package/dist/translations/sk.d.ts +8 -0
  94. package/dist/translations/sk.js +5 -0
  95. package/dist/translations/sl.d.ts +8 -0
  96. package/dist/translations/sl.js +5 -0
  97. package/dist/translations/sq.d.ts +8 -0
  98. package/dist/translations/sq.js +5 -0
  99. package/dist/translations/sr-latn.d.ts +8 -0
  100. package/dist/translations/sr-latn.js +5 -0
  101. package/dist/translations/sr.d.ts +8 -0
  102. package/dist/translations/sr.js +5 -0
  103. package/dist/translations/sv.d.ts +8 -0
  104. package/dist/translations/sv.js +5 -0
  105. package/dist/translations/th.d.ts +8 -0
  106. package/dist/translations/th.js +5 -0
  107. package/dist/translations/tk.d.ts +8 -0
  108. package/dist/translations/tk.js +5 -0
  109. package/dist/translations/tr.d.ts +8 -0
  110. package/dist/translations/tr.js +5 -0
  111. package/dist/translations/ug.d.ts +8 -0
  112. package/dist/translations/ug.js +5 -0
  113. package/dist/translations/uk.d.ts +8 -0
  114. package/dist/translations/uk.js +5 -0
  115. package/dist/translations/ur.d.ts +8 -0
  116. package/dist/translations/ur.js +5 -0
  117. package/dist/translations/uz.d.ts +8 -0
  118. package/dist/translations/uz.js +5 -0
  119. package/dist/translations/vi.d.ts +8 -0
  120. package/dist/translations/vi.js +5 -0
  121. package/dist/translations/zh-cn.d.ts +8 -0
  122. package/dist/translations/zh-cn.js +5 -0
  123. package/dist/translations/zh.d.ts +8 -0
  124. package/dist/translations/zh.js +5 -0
  125. package/dist/types/augmentation.d.ts +62 -0
  126. package/dist/types/font.d.ts +37 -0
  127. package/dist/types/fontbackgroundcolor/fontbackgroundcolorcommand.d.ts +30 -0
  128. package/dist/types/fontbackgroundcolor/fontbackgroundcolorediting.d.ts +30 -0
  129. package/dist/types/fontbackgroundcolor/fontbackgroundcolorui.d.ts +26 -0
  130. package/dist/types/fontbackgroundcolor.d.ts +34 -0
  131. package/dist/types/fontcolor/fontcolorcommand.d.ts +29 -0
  132. package/dist/types/fontcolor/fontcolorediting.d.ts +30 -0
  133. package/dist/types/fontcolor/fontcolorui.d.ts +26 -0
  134. package/dist/types/fontcolor.d.ts +33 -0
  135. package/dist/types/fontcommand.d.ts +52 -0
  136. package/dist/types/fontconfig.d.ts +377 -0
  137. package/dist/types/fontfamily/fontfamilycommand.d.ts +29 -0
  138. package/dist/types/fontfamily/fontfamilyediting.d.ts +43 -0
  139. package/dist/types/fontfamily/fontfamilyui.d.ts +34 -0
  140. package/dist/types/fontfamily/utils.d.ts +19 -0
  141. package/dist/types/fontfamily.d.ts +33 -0
  142. package/dist/types/fontsize/fontsizecommand.d.ts +29 -0
  143. package/dist/types/fontsize/fontsizeediting.d.ts +48 -0
  144. package/dist/types/fontsize/fontsizeui.d.ts +35 -0
  145. package/dist/types/fontsize/utils.d.ts +16 -0
  146. package/dist/types/fontsize.d.ts +41 -0
  147. package/dist/types/index.d.ts +31 -0
  148. package/dist/types/ui/colorui.d.ts +67 -0
  149. package/dist/types/utils.d.ts +84 -0
  150. package/package.json +3 -2
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module font/fontbackgroundcolor/fontbackgroundcolorui
11
+ */
12
+ import ColorUI from '../ui/colorui.js';
13
+ import type { Editor } from 'ckeditor5/src/core.js';
14
+ /**
15
+ * The font background color UI plugin. It introduces the `'fontBackgroundColor'` dropdown.
16
+ */
17
+ export default class FontBackgroundColorUI extends ColorUI {
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ constructor(editor: Editor);
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ static get pluginName(): "FontBackgroundColorUI";
26
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module font/fontbackgroundcolor
11
+ */
12
+ import { Plugin } from 'ckeditor5/src/core.js';
13
+ import FontBackgroundColorEditing from './fontbackgroundcolor/fontbackgroundcolorediting.js';
14
+ import FontBackgroundColorUI from './fontbackgroundcolor/fontbackgroundcolorui.js';
15
+ /**
16
+ * The font background color plugin.
17
+ *
18
+ * For a detailed overview, check the {@glink features/font font feature} documentation
19
+ * and the {@glink api/font package page}.
20
+ *
21
+ * This is a "glue" plugin which loads
22
+ * the {@link module:font/fontbackgroundcolor/fontbackgroundcolorediting~FontBackgroundColorEditing} and
23
+ * {@link module:font/fontbackgroundcolor/fontbackgroundcolorui~FontBackgroundColorUI} features in the editor.
24
+ */
25
+ export default class FontBackgroundColor extends Plugin {
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ static get requires(): readonly [typeof FontBackgroundColorEditing, typeof FontBackgroundColorUI];
30
+ /**
31
+ * @inheritDoc
32
+ */
33
+ static get pluginName(): "FontBackgroundColor";
34
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module font/fontcolor/fontcolorcommand
11
+ */
12
+ import type { Editor } from 'ckeditor5/src/core.js';
13
+ import FontCommand from '../fontcommand.js';
14
+ /**
15
+ * The font color command. It is used by {@link module:font/fontcolor/fontcolorediting~FontColorEditing}
16
+ * to apply the font color.
17
+ *
18
+ * ```ts
19
+ * editor.execute( 'fontColor', { value: 'rgb(250, 20, 20)' } );
20
+ * ```
21
+ *
22
+ * **Note**: Executing the command with the `null` value removes the attribute from the model.
23
+ */
24
+ export default class FontColorCommand extends FontCommand {
25
+ /**
26
+ * @inheritDoc
27
+ */
28
+ constructor(editor: Editor);
29
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module font/fontcolor/fontcolorediting
11
+ */
12
+ import { Plugin, type Editor } from 'ckeditor5/src/core.js';
13
+ /**
14
+ * The font color editing feature.
15
+ *
16
+ * It introduces the {@link module:font/fontcolor/fontcolorcommand~FontColorCommand command} and
17
+ * the `fontColor` attribute in the {@link module:engine/model/model~Model model} which renders
18
+ * in the {@link module:engine/view/view view} as a `<span>` element (`<span style="color: ...">`),
19
+ * depending on the {@link module:font/fontconfig~FontColorConfig configuration}.
20
+ */
21
+ export default class FontColorEditing extends Plugin {
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ static get pluginName(): "FontColorEditing";
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ constructor(editor: Editor);
30
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module font/fontcolor/fontcolorui
11
+ */
12
+ import ColorUI from '../ui/colorui.js';
13
+ import type { Editor } from 'ckeditor5/src/core.js';
14
+ /**
15
+ * The font color UI plugin. It introduces the `'fontColor'` dropdown.
16
+ */
17
+ export default class FontColorUI extends ColorUI {
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ constructor(editor: Editor);
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ static get pluginName(): "FontColorUI";
26
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module font/fontcolor
11
+ */
12
+ import { Plugin } from 'ckeditor5/src/core.js';
13
+ import FontColorEditing from './fontcolor/fontcolorediting.js';
14
+ import FontColorUI from './fontcolor/fontcolorui.js';
15
+ /**
16
+ * The font color plugin.
17
+ *
18
+ * For a detailed overview, check the {@glink features/font font feature} documentation
19
+ * and the {@glink api/font package page}.
20
+ *
21
+ * This is a "glue" plugin which loads the {@link module:font/fontcolor/fontcolorediting~FontColorEditing} and
22
+ * {@link module:font/fontcolor/fontcolorui~FontColorUI} features in the editor.
23
+ */
24
+ export default class FontColor extends Plugin {
25
+ /**
26
+ * @inheritDoc
27
+ */
28
+ static get requires(): readonly [typeof FontColorEditing, typeof FontColorUI];
29
+ /**
30
+ * @inheritDoc
31
+ */
32
+ static get pluginName(): "FontColor";
33
+ }
@@ -0,0 +1,52 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module font/fontcommand
11
+ */
12
+ import { Command, type Editor } from 'ckeditor5/src/core.js';
13
+ import { type Batch } from 'ckeditor5/src/engine.js';
14
+ /**
15
+ * The base font command.
16
+ */
17
+ export default abstract class FontCommand extends Command {
18
+ /**
19
+ * When set, it reflects the {@link #attributeKey} value of the selection.
20
+ *
21
+ * @observable
22
+ * @readonly
23
+ */
24
+ value: string;
25
+ /**
26
+ * A model attribute on which this command operates.
27
+ */
28
+ readonly attributeKey: string;
29
+ /**
30
+ * Creates an instance of the command.
31
+ *
32
+ * @param editor Editor instance.
33
+ * @param attributeKey The name of a model attribute on which this command operates.
34
+ */
35
+ constructor(editor: Editor, attributeKey: string);
36
+ /**
37
+ * @inheritDoc
38
+ */
39
+ refresh(): void;
40
+ /**
41
+ * Executes the command. Applies the `value` of the {@link #attributeKey} to the selection.
42
+ * If no `value` is passed, it removes the attribute from the selection.
43
+ *
44
+ * @param options Options for the executed command.
45
+ * @param options.value The value to apply.
46
+ * @fires execute
47
+ */
48
+ execute(options?: {
49
+ value?: string;
50
+ batch?: Batch;
51
+ }): void;
52
+ }
@@ -0,0 +1,377 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module font/fontconfig
11
+ */
12
+ import type { ColorOption, ColorPickerConfig } from 'ckeditor5/src/ui.js';
13
+ import type { MatcherPattern, ViewElementDefinition } from 'ckeditor5/src/engine.js';
14
+ /**
15
+ * The configuration of the font color and font background color features.
16
+ * This option is used by the {@link module:font/fontcolor/fontcolorediting~FontColorEditing} and
17
+ * {@link module:font/fontbackgroundcolor/fontbackgroundcolorediting~FontBackgroundColorEditing} features.
18
+ *
19
+ * ```ts
20
+ * ClassicEditor
21
+ * .create( {
22
+ * fontColor: ... // Font color feature configuration.
23
+ * fontBackgroundColor: ... // Font background color feature configuration.
24
+ * } )
25
+ * .then( ... )
26
+ * .catch( ... );
27
+ * ```
28
+ *
29
+ * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
30
+ */
31
+ export interface FontColorConfig {
32
+ /**
33
+ * Available font colors defined as an array of strings or objects.
34
+ *
35
+ * The default value registers the following colors:
36
+ *
37
+ * ```ts
38
+ * const fontColorConfig = {
39
+ * colors: [
40
+ * {
41
+ * color: 'hsl(0, 0%, 0%)',
42
+ * label: 'Black'
43
+ * },
44
+ * {
45
+ * color: 'hsl(0, 0%, 30%)',
46
+ * label: 'Dim grey'
47
+ * },
48
+ * {
49
+ * color: 'hsl(0, 0%, 60%)',
50
+ * label: 'Grey'
51
+ * },
52
+ * {
53
+ * color: 'hsl(0, 0%, 90%)',
54
+ * label: 'Light grey'
55
+ * },
56
+ * {
57
+ * color: 'hsl(0, 0%, 100%)',
58
+ * label: 'White',
59
+ * hasBorder: true
60
+ * },
61
+ * {
62
+ * color: 'hsl(0, 75%, 60%)',
63
+ * label: 'Red'
64
+ * },
65
+ * {
66
+ * color: 'hsl(30, 75%, 60%)',
67
+ * label: 'Orange'
68
+ * },
69
+ * {
70
+ * color: 'hsl(60, 75%, 60%)',
71
+ * label: 'Yellow'
72
+ * },
73
+ * {
74
+ * color: 'hsl(90, 75%, 60%)',
75
+ * label: 'Light green'
76
+ * },
77
+ * {
78
+ * color: 'hsl(120, 75%, 60%)',
79
+ * label: 'Green'
80
+ * },
81
+ * {
82
+ * color: 'hsl(150, 75%, 60%)',
83
+ * label: 'Aquamarine'
84
+ * },
85
+ * {
86
+ * color: 'hsl(180, 75%, 60%)',
87
+ * label: 'Turquoise'
88
+ * },
89
+ * {
90
+ * color: 'hsl(210, 75%, 60%)',
91
+ * label: 'Light blue'
92
+ * },
93
+ * {
94
+ * color: 'hsl(240, 75%, 60%)',
95
+ * label: 'Blue'
96
+ * },
97
+ * {
98
+ * color: 'hsl(270, 75%, 60%)',
99
+ * label: 'Purple'
100
+ * }
101
+ * ]
102
+ * };
103
+ * ```
104
+ *
105
+ * **Note**: The colors are displayed in the `'fontColor'` dropdown.
106
+ */
107
+ colors?: Array<string | ColorOption>;
108
+ /**
109
+ * Determines the maximum number of available document colors.
110
+ * Setting it to `0` will disable the document colors feature.
111
+ *
112
+ * By default it equals to the {@link module:font/fontconfig~FontColorConfig#columns} value.
113
+ *
114
+ * Examples:
115
+ *
116
+ * ```ts
117
+ * // 1) Neither document colors nor columns are defined in the configuration.
118
+ * // Document colors will equal 5,
119
+ * // because the value will be inherited from columns,
120
+ * // which has a predefined value of 5.
121
+ * const fontColorConfig = {}
122
+ *
123
+ * // 2) Document colors will equal 8, because the value will be inherited from columns.
124
+ * const fontColorConfig = {
125
+ * columns: 8
126
+ * }
127
+ *
128
+ * // 3) Document colors will equal 24, because it has its own value defined.
129
+ * const fontColorConfig = {
130
+ * columns: 8,
131
+ * documentColors: 24
132
+ * }
133
+ *
134
+ * // 4) The document colors feature will be disabled.
135
+ * const fontColorConfig = {
136
+ * columns: 8,
137
+ * documentColors: 0
138
+ * }
139
+ * ```
140
+ */
141
+ documentColors?: number;
142
+ /**
143
+ * Represents the number of columns in the font color dropdown.
144
+ *
145
+ * The default value is:
146
+ *
147
+ * ```ts
148
+ * const fontColorConfig = {
149
+ * columns: 5
150
+ * }
151
+ * ```
152
+ */
153
+ columns?: number;
154
+ /**
155
+ * Configuration of the color picker feature.
156
+ *
157
+ * If set to `false` the picker will not appear.
158
+ */
159
+ colorPicker?: false | ColorPickerConfig;
160
+ }
161
+ /**
162
+ * The configuration of the font family feature.
163
+ * This option is used by the {@link module:font/fontfamily/fontfamilyediting~FontFamilyEditing} feature.
164
+ *
165
+ * ```ts
166
+ * ClassicEditor
167
+ * .create( {
168
+ * fontFamily: ... // Font family feature configuration.
169
+ * } )
170
+ * .then( ... )
171
+ * .catch( ... );
172
+ * ```
173
+ *
174
+ * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
175
+ */
176
+ export interface FontFamilyConfig {
177
+ /**
178
+ * Available font family options defined as an array of strings. The default value is:
179
+ *
180
+ * ```ts
181
+ * const fontFamilyConfig = {
182
+ * options: [
183
+ * 'default',
184
+ * 'Arial, Helvetica, sans-serif',
185
+ * 'Courier New, Courier, monospace',
186
+ * 'Georgia, serif',
187
+ * 'Lucida Sans Unicode, Lucida Grande, sans-serif',
188
+ * 'Tahoma, Geneva, sans-serif',
189
+ * 'Times New Roman, Times, serif',
190
+ * 'Trebuchet MS, Helvetica, sans-serif',
191
+ * 'Verdana, Geneva, sans-serif'
192
+ * ]
193
+ * };
194
+ * ```
195
+ *
196
+ * which configures 8 font family options. Each option consists of one or more comma–separated font family names. The first font name is
197
+ * used as the dropdown item description in the UI.
198
+ *
199
+ * **Note:** The family names that consist of spaces should not have quotes (as opposed to the CSS standard). The necessary quotes
200
+ * will be added automatically in the view. For example, the `"Lucida Sans Unicode"` will render as follows:
201
+ *
202
+ * ```html
203
+ * <span style="font-family:'Lucida Sans Unicode', 'Lucida Grande', sans-serif">...</span>
204
+ * ```
205
+ *
206
+ * The "default" option removes the `fontFamily` attribute from the selection. In such case, the text will
207
+ * be rendered in the view using the default font family defined in the styles of the web page.
208
+ *
209
+ * Font family can be applied using the command API. To do that, use the `fontFamily` command and pass the desired family as a `value`.
210
+ * For example, the following code will apply the `fontFamily` attribute with the `'Arial'` `value` to the current selection:
211
+ *
212
+ * ```ts
213
+ * editor.execute( 'fontFamily', { value: 'Arial' } );
214
+ * ```
215
+ *
216
+ * Executing the `'fontFamily'` command without any value will remove the `fontFamily` attribute from the current selection.
217
+ */
218
+ options?: Array<string | FontFamilyOption>;
219
+ /**
220
+ * By default the plugin removes any `font-family` value that does not match the plugin's configuration.
221
+ * It means that if you paste content with font families that the editor does not understand, the `font-family` attribute
222
+ * will be removed and the content will be displayed with the default font.
223
+ *
224
+ * You can preserve pasted font family values by switching the `supportAllValues` option to `true`:
225
+ *
226
+ * ```ts
227
+ * const fontFamilyConfig = {
228
+ * supportAllValues: true
229
+ * };
230
+ * ```
231
+ *
232
+ * With this configuration font families not specified in the editor configuration will not be removed when pasting the content.
233
+ */
234
+ supportAllValues?: boolean;
235
+ }
236
+ /**
237
+ * The font family option descriptor.
238
+ */
239
+ export interface FontFamilyOption {
240
+ /**
241
+ * The user-readable title of the option.
242
+ */
243
+ title: string;
244
+ /**
245
+ * The attribute's unique value in the model.
246
+ */
247
+ model?: string;
248
+ /**
249
+ * View element configuration.
250
+ */
251
+ view?: ViewElementDefinition;
252
+ /**
253
+ * An array with all matched elements that the view-to-model conversion should also accept.
254
+ */
255
+ upcastAlso?: Array<MatcherPattern>;
256
+ }
257
+ /**
258
+ * The configuration of the font size feature.
259
+ * This option is used by the {@link module:font/fontsize/fontsizeediting~FontSizeEditing} feature.
260
+ *
261
+ * ```ts
262
+ * ClassicEditor
263
+ * .create( {
264
+ * fontSize: ... // Font size feature configuration.
265
+ * } )
266
+ * .then( ... )
267
+ * .catch( ... );
268
+ * ```
269
+ *
270
+ * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
271
+ */
272
+ export interface FontSizeConfig {
273
+ /**
274
+ * Available font size options. Expressed as predefined presets, numerical "pixel" values
275
+ * or the {@link module:font/fontconfig~FontSizeOption}.
276
+ *
277
+ * The default value is:
278
+ *
279
+ * ```ts
280
+ * const fontSizeConfig = {
281
+ * options: [
282
+ * 'tiny',
283
+ * 'small',
284
+ * 'default',
285
+ * 'big',
286
+ * 'huge'
287
+ * ]
288
+ * };
289
+ * ```
290
+ *
291
+ * It defines 4 sizes: **tiny**, **small**, **big**, and **huge**. These values will be rendered as `<span>` elements in the view.
292
+ * The **default** defines a text without the `fontSize` attribute.
293
+ *
294
+ * Each `<span>` has the the `class` attribute set to the corresponding size name. For instance, this is what the **small** size looks
295
+ * like in the view:
296
+ *
297
+ * ```html
298
+ * <span class="text-small">...</span>
299
+ * ```
300
+ *
301
+ * As an alternative, the font size might be defined using numerical values (either as a `Number` or as a `String`):
302
+ *
303
+ * ```ts
304
+ * const fontSizeConfig = {
305
+ * options: [ 9, 10, 11, 12, 13, 14, 15 ]
306
+ * };
307
+ * ```
308
+ *
309
+ * Also, you can define a label in the dropdown for numerical values:
310
+ *
311
+ * ```ts
312
+ * const fontSizeConfig = {
313
+ * options: [
314
+ * {
315
+ * title: 'Small',
316
+ * model: '8px'
317
+ * },
318
+ * 'default',
319
+ * {
320
+ * title: 'Big',
321
+ * model: '14px'
322
+ * }
323
+ * ]
324
+ * };
325
+ * ```
326
+ *
327
+ * Font size can be applied using the command API. To do that, use the `'fontSize'` command and pass the desired font size as a `value`.
328
+ * For example, the following code will apply the `fontSize` attribute with the **tiny** value to the current selection:
329
+ *
330
+ * ```ts
331
+ * editor.execute( 'fontSize', { value: 'tiny' } );
332
+ * ```
333
+ *
334
+ * Executing the `fontSize` command without value will remove the `fontSize` attribute from the current selection.
335
+ */
336
+ options?: Array<string | number | FontSizeOption>;
337
+ /**
338
+ * By default the plugin removes any `font-size` value that does not match the plugin's configuration.
339
+ * It means that if you paste content with font sizes that the editor does not understand, the `font-size` attribute
340
+ * will be removed and the content will be displayed with the default size.
341
+ *
342
+ * You can preserve pasted font size values by switching the `supportAllValues` option to `true`:
343
+ *
344
+ * ```ts
345
+ * const fontSizeConfig = {
346
+ * options: [ 9, 10, 11, 12, 'default', 14, 15 ],
347
+ * supportAllValues: true
348
+ * };
349
+ * ```
350
+ *
351
+ * **Note:** This option can only be used with numerical values as font size options.
352
+ *
353
+ * With this configuration font sizes not specified in the editor configuration will not be removed when pasting the content.
354
+ */
355
+ supportAllValues?: boolean;
356
+ }
357
+ /**
358
+ * The font size option descriptor.
359
+ */
360
+ export interface FontSizeOption {
361
+ /**
362
+ * The user-readable title of the option.
363
+ */
364
+ title: string;
365
+ /**
366
+ * The attribute's unique value in the model.
367
+ */
368
+ model?: string;
369
+ /**
370
+ * View element configuration.
371
+ */
372
+ view?: ViewElementDefinition;
373
+ /**
374
+ * An array with all matched elements that the view-to-model conversion should also accept.
375
+ */
376
+ upcastAlso?: Array<MatcherPattern>;
377
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module font/fontfamily/fontfamilycommand
11
+ */
12
+ import type { Editor } from 'ckeditor5/src/core.js';
13
+ import FontCommand from '../fontcommand.js';
14
+ /**
15
+ * The font family command. It is used by {@link module:font/fontfamily/fontfamilyediting~FontFamilyEditing}
16
+ * to apply the font family.
17
+ *
18
+ * ```ts
19
+ * editor.execute( 'fontFamily', { value: 'Arial' } );
20
+ * ```
21
+ *
22
+ * **Note**: Executing the command without the value removes the attribute from the model.
23
+ */
24
+ export default class FontFamilyCommand extends FontCommand {
25
+ /**
26
+ * @inheritDoc
27
+ */
28
+ constructor(editor: Editor);
29
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module font/fontfamily/fontfamilyediting
11
+ */
12
+ import { type Editor, Plugin } from 'ckeditor5/src/core.js';
13
+ /**
14
+ * The font family editing feature.
15
+ *
16
+ * It introduces the {@link module:font/fontfamily/fontfamilycommand~FontFamilyCommand command} and
17
+ * the `fontFamily` attribute in the {@link module:engine/model/model~Model model} which renders
18
+ * in the {@link module:engine/view/view view} as an inline `<span>` element (`<span style="font-family: Arial">`),
19
+ * depending on the {@link module:font/fontconfig~FontFamilyConfig configuration}.
20
+ */
21
+ export default class FontFamilyEditing extends Plugin {
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ static get pluginName(): "FontFamilyEditing";
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ constructor(editor: Editor);
30
+ /**
31
+ * @inheritDoc
32
+ */
33
+ init(): void;
34
+ /**
35
+ * These converters enable keeping any value found as `style="font-family: *"` as a value of an attribute on a text even
36
+ * if it is not defined in the plugin configuration.
37
+ */
38
+ private _prepareAnyValueConverters;
39
+ /**
40
+ * Adds support for legacy `<font face="..">` formatting.
41
+ */
42
+ private _prepareCompatibilityConverter;
43
+ }