@ckeditor/ckeditor5-font 36.0.1 → 37.0.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.
- package/build/font.js +1 -1
- package/package.json +20 -15
- package/src/documentcolorcollection.d.ts +47 -0
- package/src/documentcolorcollection.js +34 -63
- package/src/font.d.ts +34 -0
- package/src/font.js +12 -19
- package/src/fontbackgroundcolor/fontbackgroundcolorcommand.d.ts +32 -0
- package/src/fontbackgroundcolor/fontbackgroundcolorcommand.js +9 -15
- package/src/fontbackgroundcolor/fontbackgroundcolorediting.d.ts +31 -0
- package/src/fontbackgroundcolor/fontbackgroundcolorediting.js +102 -115
- package/src/fontbackgroundcolor/fontbackgroundcolorui.d.ts +27 -0
- package/src/fontbackgroundcolor/fontbackgroundcolorui.js +18 -25
- package/src/fontbackgroundcolor.d.ts +33 -0
- package/src/fontbackgroundcolor.js +12 -165
- package/src/fontcolor/fontcolorcommand.d.ts +31 -0
- package/src/fontcolor/fontcolorcommand.js +9 -15
- package/src/fontcolor/fontcolorediting.d.ts +31 -0
- package/src/fontcolor/fontcolorediting.js +115 -128
- package/src/fontcolor/fontcolorui.d.ts +27 -0
- package/src/fontcolor/fontcolorui.js +18 -25
- package/src/fontcolor.d.ts +29 -0
- package/src/fontcolor.js +12 -168
- package/src/fontcommand.d.ts +46 -0
- package/src/fontcommand.js +54 -78
- package/src/fontconfig.d.ts +399 -0
- package/src/fontconfig.js +5 -0
- package/src/fontfamily/fontfamilycommand.d.ts +31 -0
- package/src/fontfamily/fontfamilycommand.js +9 -15
- package/src/fontfamily/fontfamilyediting.d.ts +45 -0
- package/src/fontfamily/fontfamilyediting.js +96 -116
- package/src/fontfamily/fontfamilyui.d.ts +35 -0
- package/src/fontfamily/fontfamilyui.js +90 -122
- package/src/fontfamily/utils.d.ts +15 -0
- package/src/fontfamily/utils.js +66 -79
- package/src/fontfamily.d.ts +29 -0
- package/src/fontfamily.js +12 -112
- package/src/fontsize/fontsizecommand.d.ts +31 -0
- package/src/fontsize/fontsizecommand.js +9 -15
- package/src/fontsize/fontsizeediting.d.ts +50 -0
- package/src/fontsize/fontsizeediting.js +138 -169
- package/src/fontsize/fontsizeui.d.ts +36 -0
- package/src/fontsize/fontsizeui.js +98 -130
- package/src/fontsize/utils.d.ts +12 -0
- package/src/fontsize/utils.js +145 -174
- package/src/fontsize.d.ts +40 -0
- package/src/fontsize.js +21 -141
- package/src/index.d.ts +20 -0
- package/src/index.js +0 -2
- package/src/ui/colortableview.d.ts +167 -0
- package/src/ui/colortableview.js +240 -416
- package/src/ui/colorui.d.ts +64 -0
- package/src/ui/colorui.js +79 -132
- package/src/utils.d.ts +77 -0
- package/src/utils.js +42 -72
|
@@ -2,146 +2,133 @@
|
|
|
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/fontcolor/fontcolorediting
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
8
|
import { Plugin } from 'ckeditor5/src/core';
|
|
11
9
|
import FontColorCommand from './fontcolorcommand';
|
|
12
10
|
import { FONT_COLOR, renderDowncastElement, renderUpcastAttribute } from '../utils';
|
|
13
|
-
|
|
14
11
|
/**
|
|
15
12
|
* The font color editing feature.
|
|
16
13
|
*
|
|
17
14
|
* It introduces the {@link module:font/fontcolor/fontcolorcommand~FontColorCommand command} and
|
|
18
15
|
* the `fontColor` attribute in the {@link module:engine/model/model~Model model} which renders
|
|
19
16
|
* in the {@link module:engine/view/view view} as a `<span>` element (`<span style="color: ...">`),
|
|
20
|
-
* depending on the {@link module:font/
|
|
21
|
-
*
|
|
22
|
-
* @extends module:core/plugin~Plugin
|
|
17
|
+
* depending on the {@link module:font/fontconfig~FontColorConfig configuration}.
|
|
23
18
|
*/
|
|
24
19
|
export default class FontColorEditing extends Plugin {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
// Allow the font color attribute on text nodes.
|
|
140
|
-
editor.model.schema.extend( '$text', { allowAttributes: FONT_COLOR } );
|
|
141
|
-
|
|
142
|
-
editor.model.schema.setAttributeProperties( FONT_COLOR, {
|
|
143
|
-
isFormatting: true,
|
|
144
|
-
copyOnEnter: true
|
|
145
|
-
} );
|
|
146
|
-
}
|
|
20
|
+
/**
|
|
21
|
+
* @inheritDoc
|
|
22
|
+
*/
|
|
23
|
+
static get pluginName() {
|
|
24
|
+
return 'FontColorEditing';
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @inheritDoc
|
|
28
|
+
*/
|
|
29
|
+
constructor(editor) {
|
|
30
|
+
super(editor);
|
|
31
|
+
editor.config.define(FONT_COLOR, {
|
|
32
|
+
colors: [
|
|
33
|
+
{
|
|
34
|
+
color: 'hsl(0, 0%, 0%)',
|
|
35
|
+
label: 'Black'
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
color: 'hsl(0, 0%, 30%)',
|
|
39
|
+
label: 'Dim grey'
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
color: 'hsl(0, 0%, 60%)',
|
|
43
|
+
label: 'Grey'
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
color: 'hsl(0, 0%, 90%)',
|
|
47
|
+
label: 'Light grey'
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
color: 'hsl(0, 0%, 100%)',
|
|
51
|
+
label: 'White',
|
|
52
|
+
hasBorder: true
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
color: 'hsl(0, 75%, 60%)',
|
|
56
|
+
label: 'Red'
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
color: 'hsl(30, 75%, 60%)',
|
|
60
|
+
label: 'Orange'
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
color: 'hsl(60, 75%, 60%)',
|
|
64
|
+
label: 'Yellow'
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
color: 'hsl(90, 75%, 60%)',
|
|
68
|
+
label: 'Light green'
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
color: 'hsl(120, 75%, 60%)',
|
|
72
|
+
label: 'Green'
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
color: 'hsl(150, 75%, 60%)',
|
|
76
|
+
label: 'Aquamarine'
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
color: 'hsl(180, 75%, 60%)',
|
|
80
|
+
label: 'Turquoise'
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
color: 'hsl(210, 75%, 60%)',
|
|
84
|
+
label: 'Light blue'
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
color: 'hsl(240, 75%, 60%)',
|
|
88
|
+
label: 'Blue'
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
color: 'hsl(270, 75%, 60%)',
|
|
92
|
+
label: 'Purple'
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
columns: 5
|
|
96
|
+
});
|
|
97
|
+
editor.conversion.for('upcast').elementToAttribute({
|
|
98
|
+
view: {
|
|
99
|
+
name: 'span',
|
|
100
|
+
styles: {
|
|
101
|
+
'color': /[\s\S]+/
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
model: {
|
|
105
|
+
key: FONT_COLOR,
|
|
106
|
+
value: renderUpcastAttribute('color')
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
// Support legacy `<font color="..">` formatting.
|
|
110
|
+
editor.conversion.for('upcast').elementToAttribute({
|
|
111
|
+
view: {
|
|
112
|
+
name: 'font',
|
|
113
|
+
attributes: {
|
|
114
|
+
'color': /^#?\w+$/
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
model: {
|
|
118
|
+
key: FONT_COLOR,
|
|
119
|
+
value: (viewElement) => viewElement.getAttribute('color')
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
editor.conversion.for('downcast').attributeToElement({
|
|
123
|
+
model: FONT_COLOR,
|
|
124
|
+
view: renderDowncastElement('color')
|
|
125
|
+
});
|
|
126
|
+
editor.commands.add(FONT_COLOR, new FontColorCommand(editor));
|
|
127
|
+
// Allow the font color attribute on text nodes.
|
|
128
|
+
editor.model.schema.extend('$text', { allowAttributes: FONT_COLOR });
|
|
129
|
+
editor.model.schema.setAttributeProperties(FONT_COLOR, {
|
|
130
|
+
isFormatting: true,
|
|
131
|
+
copyOnEnter: true
|
|
132
|
+
});
|
|
133
|
+
}
|
|
147
134
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
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/fontcolor/fontcolorui
|
|
7
|
+
*/
|
|
8
|
+
import ColorUI from '../ui/colorui';
|
|
9
|
+
import type { Editor } from 'ckeditor5/src/core';
|
|
10
|
+
/**
|
|
11
|
+
* The font color UI plugin. It introduces the `'fontColor'` dropdown.
|
|
12
|
+
*/
|
|
13
|
+
export default class FontColorUI extends ColorUI {
|
|
14
|
+
/**
|
|
15
|
+
* @inheritDoc
|
|
16
|
+
*/
|
|
17
|
+
constructor(editor: Editor);
|
|
18
|
+
/**
|
|
19
|
+
* @inheritDoc
|
|
20
|
+
*/
|
|
21
|
+
static get pluginName(): 'FontColorUI';
|
|
22
|
+
}
|
|
23
|
+
declare module '@ckeditor/ckeditor5-core' {
|
|
24
|
+
interface PluginsMap {
|
|
25
|
+
[FontColorUI.pluginName]: FontColorUI;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -2,39 +2,32 @@
|
|
|
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/fontcolor/fontcolorui
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
8
|
import ColorUI from '../ui/colorui';
|
|
11
9
|
import { FONT_COLOR } from '../utils';
|
|
12
10
|
import fontColorIcon from '../../theme/icons/font-color.svg';
|
|
13
|
-
|
|
14
11
|
/**
|
|
15
12
|
* The font color UI plugin. It introduces the `'fontColor'` dropdown.
|
|
16
|
-
*
|
|
17
|
-
* @extends module:core/plugin~Plugin
|
|
18
13
|
*/
|
|
19
14
|
export default class FontColorUI extends ColorUI {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return 'FontColorUI';
|
|
39
|
-
}
|
|
15
|
+
/**
|
|
16
|
+
* @inheritDoc
|
|
17
|
+
*/
|
|
18
|
+
constructor(editor) {
|
|
19
|
+
const t = editor.locale.t;
|
|
20
|
+
super(editor, {
|
|
21
|
+
commandName: FONT_COLOR,
|
|
22
|
+
componentName: FONT_COLOR,
|
|
23
|
+
icon: fontColorIcon,
|
|
24
|
+
dropdownLabel: t('Font Color')
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @inheritDoc
|
|
29
|
+
*/
|
|
30
|
+
static get pluginName() {
|
|
31
|
+
return 'FontColorUI';
|
|
32
|
+
}
|
|
40
33
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
import { Plugin, type PluginDependencies } from 'ckeditor5/src/core';
|
|
6
|
+
/**
|
|
7
|
+
* The font color plugin.
|
|
8
|
+
*
|
|
9
|
+
* For a detailed overview, check the {@glink features/font font feature} documentation
|
|
10
|
+
* and the {@glink api/font package page}.
|
|
11
|
+
*
|
|
12
|
+
* This is a "glue" plugin which loads the {@link module:font/fontcolor/fontcolorediting~FontColorEditing} and
|
|
13
|
+
* {@link module:font/fontcolor/fontcolorui~FontColorUI} features in the editor.
|
|
14
|
+
*/
|
|
15
|
+
export default class FontColor extends Plugin {
|
|
16
|
+
/**
|
|
17
|
+
* @inheritDoc
|
|
18
|
+
*/
|
|
19
|
+
static get requires(): PluginDependencies;
|
|
20
|
+
/**
|
|
21
|
+
* @inheritDoc
|
|
22
|
+
*/
|
|
23
|
+
static get pluginName(): 'FontColor';
|
|
24
|
+
}
|
|
25
|
+
declare module '@ckeditor/ckeditor5-core' {
|
|
26
|
+
interface PluginsMap {
|
|
27
|
+
[FontColor.pluginName]: FontColor;
|
|
28
|
+
}
|
|
29
|
+
}
|
package/src/fontcolor.js
CHANGED
|
@@ -2,15 +2,9 @@
|
|
|
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
|
-
/**
|
|
7
|
-
* @module font/fontcolor
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
5
|
import { Plugin } from 'ckeditor5/src/core';
|
|
11
6
|
import FontColorEditing from './fontcolor/fontcolorediting';
|
|
12
7
|
import FontColorUI from './fontcolor/fontcolorui';
|
|
13
|
-
|
|
14
8
|
/**
|
|
15
9
|
* The font color plugin.
|
|
16
10
|
*
|
|
@@ -19,168 +13,18 @@ import FontColorUI from './fontcolor/fontcolorui';
|
|
|
19
13
|
*
|
|
20
14
|
* This is a "glue" plugin which loads the {@link module:font/fontcolor/fontcolorediting~FontColorEditing} and
|
|
21
15
|
* {@link module:font/fontcolor/fontcolorui~FontColorUI} features in the editor.
|
|
22
|
-
*
|
|
23
|
-
* @extends module:core/plugin~Plugin
|
|
24
16
|
*/
|
|
25
17
|
export default class FontColor extends Plugin {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
18
|
+
/**
|
|
19
|
+
* @inheritDoc
|
|
20
|
+
*/
|
|
21
|
+
static get requires() {
|
|
22
|
+
return [FontColorEditing, FontColorUI];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @inheritDoc
|
|
26
|
+
*/
|
|
27
|
+
static get pluginName() {
|
|
28
|
+
return 'FontColor';
|
|
29
|
+
}
|
|
39
30
|
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* The configuration of the font color feature.
|
|
43
|
-
* It is introduced by the {@link module:font/fontcolor/fontcolorediting~FontColorEditing} feature.
|
|
44
|
-
*
|
|
45
|
-
* Read more in {@link module:font/fontcolor~FontColorConfig}.
|
|
46
|
-
*
|
|
47
|
-
* @member {module:font/fontcolor~FontColorConfig} module:core/editor/editorconfig~EditorConfig#fontColor
|
|
48
|
-
*/
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* The configuration of the font color feature.
|
|
52
|
-
* This option is used by the {@link module:font/fontcolor/fontcolorediting~FontColorEditing} feature.
|
|
53
|
-
*
|
|
54
|
-
* ClassicEditor
|
|
55
|
-
* .create( {
|
|
56
|
-
* fontColor: ... // Font color feature configuration.
|
|
57
|
-
* } )
|
|
58
|
-
* .then( ... )
|
|
59
|
-
* .catch( ... );
|
|
60
|
-
*
|
|
61
|
-
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
|
62
|
-
*
|
|
63
|
-
* @interface module:font/fontcolor~FontColorConfig
|
|
64
|
-
*/
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Available font colors defined as an array of strings or objects.
|
|
68
|
-
*
|
|
69
|
-
* The default value registers the following colors:
|
|
70
|
-
*
|
|
71
|
-
* const fontColorConfig = {
|
|
72
|
-
* colors: [
|
|
73
|
-
* {
|
|
74
|
-
* color: 'hsl(0, 0%, 0%)',
|
|
75
|
-
* label: 'Black'
|
|
76
|
-
* },
|
|
77
|
-
* {
|
|
78
|
-
* color: 'hsl(0, 0%, 30%)',
|
|
79
|
-
* label: 'Dim grey'
|
|
80
|
-
* },
|
|
81
|
-
* {
|
|
82
|
-
* color: 'hsl(0, 0%, 60%)',
|
|
83
|
-
* label: 'Grey'
|
|
84
|
-
* },
|
|
85
|
-
* {
|
|
86
|
-
* color: 'hsl(0, 0%, 90%)',
|
|
87
|
-
* label: 'Light grey'
|
|
88
|
-
* },
|
|
89
|
-
* {
|
|
90
|
-
* color: 'hsl(0, 0%, 100%)',
|
|
91
|
-
* label: 'White',
|
|
92
|
-
* hasBorder: true
|
|
93
|
-
* },
|
|
94
|
-
* {
|
|
95
|
-
* color: 'hsl(0, 75%, 60%)',
|
|
96
|
-
* label: 'Red'
|
|
97
|
-
* },
|
|
98
|
-
* {
|
|
99
|
-
* color: 'hsl(30, 75%, 60%)',
|
|
100
|
-
* label: 'Orange'
|
|
101
|
-
* },
|
|
102
|
-
* {
|
|
103
|
-
* color: 'hsl(60, 75%, 60%)',
|
|
104
|
-
* label: 'Yellow'
|
|
105
|
-
* },
|
|
106
|
-
* {
|
|
107
|
-
* color: 'hsl(90, 75%, 60%)',
|
|
108
|
-
* label: 'Light green'
|
|
109
|
-
* },
|
|
110
|
-
* {
|
|
111
|
-
* color: 'hsl(120, 75%, 60%)',
|
|
112
|
-
* label: 'Green'
|
|
113
|
-
* },
|
|
114
|
-
* {
|
|
115
|
-
* color: 'hsl(150, 75%, 60%)',
|
|
116
|
-
* label: 'Aquamarine'
|
|
117
|
-
* },
|
|
118
|
-
* {
|
|
119
|
-
* color: 'hsl(180, 75%, 60%)',
|
|
120
|
-
* label: 'Turquoise'
|
|
121
|
-
* },
|
|
122
|
-
* {
|
|
123
|
-
* color: 'hsl(210, 75%, 60%)',
|
|
124
|
-
* label: 'Light blue'
|
|
125
|
-
* },
|
|
126
|
-
* {
|
|
127
|
-
* color: 'hsl(240, 75%, 60%)',
|
|
128
|
-
* label: 'Blue'
|
|
129
|
-
* },
|
|
130
|
-
* {
|
|
131
|
-
* color: 'hsl(270, 75%, 60%)',
|
|
132
|
-
* label: 'Purple'
|
|
133
|
-
* }
|
|
134
|
-
* ]
|
|
135
|
-
* };
|
|
136
|
-
*
|
|
137
|
-
* **Note**: The colors are displayed in the `'fontColor'` dropdown.
|
|
138
|
-
*
|
|
139
|
-
* @member {Array.<String|Object>} module:font/fontcolor~FontColorConfig#colors
|
|
140
|
-
*/
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Represents the number of columns in the font color dropdown.
|
|
144
|
-
*
|
|
145
|
-
* The default value is:
|
|
146
|
-
*
|
|
147
|
-
* const fontColorConfig = {
|
|
148
|
-
* columns: 5
|
|
149
|
-
* }
|
|
150
|
-
*
|
|
151
|
-
* @member {Number} module:font/fontcolor~FontColorConfig#columns
|
|
152
|
-
*/
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Determines the maximum number of available document colors.
|
|
156
|
-
* Setting it to `0` will disable the document colors feature.
|
|
157
|
-
*
|
|
158
|
-
* By default it equals to the {@link module:font/fontcolor~FontColorConfig#columns} value.
|
|
159
|
-
*
|
|
160
|
-
* Examples:
|
|
161
|
-
*
|
|
162
|
-
* // 1) Neither document colors nor columns are defined in the configuration.
|
|
163
|
-
* // Document colors will equal 5,
|
|
164
|
-
* // because the value will be inherited from columns,
|
|
165
|
-
* // which has a predefined value of 5.
|
|
166
|
-
* const fontColorConfig = {}
|
|
167
|
-
*
|
|
168
|
-
* // 2) Document colors will equal 8, because the value will be inherited from columns.
|
|
169
|
-
* const fontColorConfig = {
|
|
170
|
-
* columns: 8
|
|
171
|
-
* }
|
|
172
|
-
*
|
|
173
|
-
* // 3) Document colors will equal 24, because it has its own value defined.
|
|
174
|
-
* const fontColorConfig = {
|
|
175
|
-
* columns: 8,
|
|
176
|
-
* documentColors: 24
|
|
177
|
-
* }
|
|
178
|
-
*
|
|
179
|
-
* // 4) The document colors feature will be disabled.
|
|
180
|
-
* const fontColorConfig = {
|
|
181
|
-
* columns: 8,
|
|
182
|
-
* documentColors: 0
|
|
183
|
-
* }
|
|
184
|
-
*
|
|
185
|
-
* @member {Number} module:font/fontcolor~FontColorConfig#documentColors
|
|
186
|
-
*/
|
|
@@ -0,0 +1,46 @@
|
|
|
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/fontcommand
|
|
7
|
+
*/
|
|
8
|
+
import { Command, type Editor } from 'ckeditor5/src/core';
|
|
9
|
+
/**
|
|
10
|
+
* The base font command.
|
|
11
|
+
*/
|
|
12
|
+
export default abstract class FontCommand extends Command {
|
|
13
|
+
/**
|
|
14
|
+
* When set, it reflects the {@link #attributeKey} value of the selection.
|
|
15
|
+
*
|
|
16
|
+
* @observable
|
|
17
|
+
* @readonly
|
|
18
|
+
*/
|
|
19
|
+
value: string;
|
|
20
|
+
/**
|
|
21
|
+
* A model attribute on which this command operates.
|
|
22
|
+
*/
|
|
23
|
+
readonly attributeKey: string;
|
|
24
|
+
/**
|
|
25
|
+
* Creates an instance of the command.
|
|
26
|
+
*
|
|
27
|
+
* @param editor Editor instance.
|
|
28
|
+
* @param attributeKey The name of a model attribute on which this command operates.
|
|
29
|
+
*/
|
|
30
|
+
constructor(editor: Editor, attributeKey: string);
|
|
31
|
+
/**
|
|
32
|
+
* @inheritDoc
|
|
33
|
+
*/
|
|
34
|
+
refresh(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Executes the command. Applies the `value` of the {@link #attributeKey} to the selection.
|
|
37
|
+
* If no `value` is passed, it removes the attribute from the selection.
|
|
38
|
+
*
|
|
39
|
+
* @param options Options for the executed command.
|
|
40
|
+
* @param options.value The value to apply.
|
|
41
|
+
* @fires execute
|
|
42
|
+
*/
|
|
43
|
+
execute(options?: {
|
|
44
|
+
value?: string;
|
|
45
|
+
}): void;
|
|
46
|
+
}
|