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