@ckeditor/ckeditor5-font 39.0.2 → 40.0.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.map +1 -0
- package/package.json +2 -2
- package/src/augmentation.d.ts +58 -58
- package/src/augmentation.js +5 -5
- package/src/font.d.ts +33 -33
- package/src/font.js +37 -37
- package/src/fontbackgroundcolor/fontbackgroundcolorcommand.d.ts +26 -26
- package/src/fontbackgroundcolor/fontbackgroundcolorcommand.js +25 -25
- package/src/fontbackgroundcolor/fontbackgroundcolorediting.d.ts +26 -26
- package/src/fontbackgroundcolor/fontbackgroundcolorediting.js +123 -123
- package/src/fontbackgroundcolor/fontbackgroundcolorui.d.ts +22 -22
- package/src/fontbackgroundcolor/fontbackgroundcolorui.js +33 -33
- package/src/fontbackgroundcolor.d.ts +30 -30
- package/src/fontbackgroundcolor.js +34 -34
- package/src/fontcolor/fontcolorcommand.d.ts +25 -25
- package/src/fontcolor/fontcolorcommand.js +24 -24
- package/src/fontcolor/fontcolorediting.d.ts +26 -26
- package/src/fontcolor/fontcolorediting.js +134 -134
- package/src/fontcolor/fontcolorui.d.ts +22 -22
- package/src/fontcolor/fontcolorui.js +33 -33
- package/src/fontcolor.d.ts +29 -29
- package/src/fontcolor.js +33 -33
- package/src/fontcommand.d.ts +48 -48
- package/src/fontcommand.js +79 -79
- package/src/fontconfig.d.ts +373 -373
- package/src/fontconfig.js +5 -5
- package/src/fontfamily/fontfamilycommand.d.ts +25 -25
- package/src/fontfamily/fontfamilycommand.js +24 -24
- package/src/fontfamily/fontfamilyediting.d.ts +39 -39
- package/src/fontfamily/fontfamilyediting.js +115 -115
- package/src/fontfamily/fontfamilyui.d.ts +30 -30
- package/src/fontfamily/fontfamilyui.js +114 -114
- package/src/fontfamily/utils.d.ts +15 -15
- package/src/fontfamily/utils.js +80 -80
- package/src/fontfamily.d.ts +29 -29
- package/src/fontfamily.js +33 -33
- package/src/fontsize/fontsizecommand.d.ts +25 -25
- package/src/fontsize/fontsizecommand.js +24 -24
- package/src/fontsize/fontsizeediting.d.ts +44 -44
- package/src/fontsize/fontsizeediting.js +165 -165
- package/src/fontsize/fontsizeui.d.ts +31 -31
- package/src/fontsize/fontsizeui.js +122 -122
- package/src/fontsize/utils.d.ts +12 -12
- package/src/fontsize/utils.js +166 -166
- package/src/fontsize.d.ts +37 -37
- package/src/fontsize.js +43 -43
- package/src/index.d.ts +27 -27
- package/src/index.js +21 -21
- package/src/ui/colorui.d.ts +68 -68
- package/src/ui/colorui.js +130 -130
- package/src/utils.d.ts +80 -80
- package/src/utils.js +97 -97
|
@@ -1,34 +1,34 @@
|
|
|
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 } from 'ckeditor5/src/core';
|
|
9
|
-
import FontBackgroundColorEditing from './fontbackgroundcolor/fontbackgroundcolorediting';
|
|
10
|
-
import FontBackgroundColorUI from './fontbackgroundcolor/fontbackgroundcolorui';
|
|
11
|
-
/**
|
|
12
|
-
* The font background color plugin.
|
|
13
|
-
*
|
|
14
|
-
* For a detailed overview, check the {@glink features/font font feature} documentation
|
|
15
|
-
* and the {@glink api/font package page}.
|
|
16
|
-
*
|
|
17
|
-
* This is a "glue" plugin which loads
|
|
18
|
-
* the {@link module:font/fontbackgroundcolor/fontbackgroundcolorediting~FontBackgroundColorEditing} and
|
|
19
|
-
* {@link module:font/fontbackgroundcolor/fontbackgroundcolorui~FontBackgroundColorUI} features in the editor.
|
|
20
|
-
*/
|
|
21
|
-
export default class FontBackgroundColor extends Plugin {
|
|
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
|
-
}
|
|
34
|
-
}
|
|
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 } from 'ckeditor5/src/core';
|
|
9
|
+
import FontBackgroundColorEditing from './fontbackgroundcolor/fontbackgroundcolorediting';
|
|
10
|
+
import FontBackgroundColorUI from './fontbackgroundcolor/fontbackgroundcolorui';
|
|
11
|
+
/**
|
|
12
|
+
* The font background color plugin.
|
|
13
|
+
*
|
|
14
|
+
* For a detailed overview, check the {@glink features/font font feature} documentation
|
|
15
|
+
* and the {@glink api/font package page}.
|
|
16
|
+
*
|
|
17
|
+
* This is a "glue" plugin which loads
|
|
18
|
+
* the {@link module:font/fontbackgroundcolor/fontbackgroundcolorediting~FontBackgroundColorEditing} and
|
|
19
|
+
* {@link module:font/fontbackgroundcolor/fontbackgroundcolorui~FontBackgroundColorUI} features in the editor.
|
|
20
|
+
*/
|
|
21
|
+
export default class FontBackgroundColor extends Plugin {
|
|
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
|
+
}
|
|
34
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
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
|
-
/**
|
|
11
|
-
* The font color command. It is used by {@link module:font/fontcolor/fontcolorediting~FontColorEditing}
|
|
12
|
-
* to apply the font color.
|
|
13
|
-
*
|
|
14
|
-
* ```ts
|
|
15
|
-
* editor.execute( 'fontColor', { value: 'rgb(250, 20, 20)' } );
|
|
16
|
-
* ```
|
|
17
|
-
*
|
|
18
|
-
* **Note**: Executing the command with the `null` value removes the attribute from the model.
|
|
19
|
-
*/
|
|
20
|
-
export default class FontColorCommand extends FontCommand {
|
|
21
|
-
/**
|
|
22
|
-
* @inheritDoc
|
|
23
|
-
*/
|
|
24
|
-
constructor(editor: Editor);
|
|
25
|
-
}
|
|
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
|
+
/**
|
|
11
|
+
* The font color command. It is used by {@link module:font/fontcolor/fontcolorediting~FontColorEditing}
|
|
12
|
+
* to apply the font color.
|
|
13
|
+
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* editor.execute( 'fontColor', { value: 'rgb(250, 20, 20)' } );
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* **Note**: Executing the command with the `null` value removes the attribute from the model.
|
|
19
|
+
*/
|
|
20
|
+
export default class FontColorCommand extends FontCommand {
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
*/
|
|
24
|
+
constructor(editor: Editor);
|
|
25
|
+
}
|
|
@@ -1,24 +1,24 @@
|
|
|
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 FontCommand from '../fontcommand';
|
|
6
|
-
import { FONT_COLOR } from '../utils';
|
|
7
|
-
/**
|
|
8
|
-
* The font color command. It is used by {@link module:font/fontcolor/fontcolorediting~FontColorEditing}
|
|
9
|
-
* to apply the font color.
|
|
10
|
-
*
|
|
11
|
-
* ```ts
|
|
12
|
-
* editor.execute( 'fontColor', { value: 'rgb(250, 20, 20)' } );
|
|
13
|
-
* ```
|
|
14
|
-
*
|
|
15
|
-
* **Note**: Executing the command with the `null` value removes the attribute from the model.
|
|
16
|
-
*/
|
|
17
|
-
export default class FontColorCommand extends FontCommand {
|
|
18
|
-
/**
|
|
19
|
-
* @inheritDoc
|
|
20
|
-
*/
|
|
21
|
-
constructor(editor) {
|
|
22
|
-
super(editor, FONT_COLOR);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
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 FontCommand from '../fontcommand';
|
|
6
|
+
import { FONT_COLOR } from '../utils';
|
|
7
|
+
/**
|
|
8
|
+
* The font color command. It is used by {@link module:font/fontcolor/fontcolorediting~FontColorEditing}
|
|
9
|
+
* to apply the font color.
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* editor.execute( 'fontColor', { value: 'rgb(250, 20, 20)' } );
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* **Note**: Executing the command with the `null` value removes the attribute from the model.
|
|
16
|
+
*/
|
|
17
|
+
export default class FontColorCommand extends FontCommand {
|
|
18
|
+
/**
|
|
19
|
+
* @inheritDoc
|
|
20
|
+
*/
|
|
21
|
+
constructor(editor) {
|
|
22
|
+
super(editor, FONT_COLOR);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -1,26 +1,26 @@
|
|
|
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
|
-
}
|
|
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
|
+
}
|
|
@@ -1,134 +1,134 @@
|
|
|
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 } from 'ckeditor5/src/core';
|
|
9
|
-
import FontColorCommand from './fontcolorcommand';
|
|
10
|
-
import { FONT_COLOR, renderDowncastElement, renderUpcastAttribute } from '../utils';
|
|
11
|
-
/**
|
|
12
|
-
* The font color editing feature.
|
|
13
|
-
*
|
|
14
|
-
* It introduces the {@link module:font/fontcolor/fontcolorcommand~FontColorCommand command} and
|
|
15
|
-
* the `fontColor` attribute in the {@link module:engine/model/model~Model model} which renders
|
|
16
|
-
* in the {@link module:engine/view/view view} as a `<span>` element (`<span style="color: ...">`),
|
|
17
|
-
* depending on the {@link module:font/fontconfig~FontColorConfig configuration}.
|
|
18
|
-
*/
|
|
19
|
-
export default class FontColorEditing extends Plugin {
|
|
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
|
-
}
|
|
134
|
-
}
|
|
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 } from 'ckeditor5/src/core';
|
|
9
|
+
import FontColorCommand from './fontcolorcommand';
|
|
10
|
+
import { FONT_COLOR, renderDowncastElement, renderUpcastAttribute } from '../utils';
|
|
11
|
+
/**
|
|
12
|
+
* The font color editing feature.
|
|
13
|
+
*
|
|
14
|
+
* It introduces the {@link module:font/fontcolor/fontcolorcommand~FontColorCommand command} and
|
|
15
|
+
* the `fontColor` attribute in the {@link module:engine/model/model~Model model} which renders
|
|
16
|
+
* in the {@link module:engine/view/view view} as a `<span>` element (`<span style="color: ...">`),
|
|
17
|
+
* depending on the {@link module:font/fontconfig~FontColorConfig configuration}.
|
|
18
|
+
*/
|
|
19
|
+
export default class FontColorEditing extends Plugin {
|
|
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
|
+
}
|
|
134
|
+
}
|
|
@@ -1,22 +1,22 @@
|
|
|
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
|
-
}
|
|
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
|
+
}
|
|
@@ -1,33 +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/fontcolor/fontcolorui
|
|
7
|
-
*/
|
|
8
|
-
import ColorUI from '../ui/colorui';
|
|
9
|
-
import { FONT_COLOR } from '../utils';
|
|
10
|
-
import fontColorIcon from '../../theme/icons/font-color.svg';
|
|
11
|
-
/**
|
|
12
|
-
* The font color UI plugin. It introduces the `'fontColor'` dropdown.
|
|
13
|
-
*/
|
|
14
|
-
export default class FontColorUI extends ColorUI {
|
|
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
|
-
}
|
|
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/fontcolor/fontcolorui
|
|
7
|
+
*/
|
|
8
|
+
import ColorUI from '../ui/colorui';
|
|
9
|
+
import { FONT_COLOR } from '../utils';
|
|
10
|
+
import fontColorIcon from '../../theme/icons/font-color.svg';
|
|
11
|
+
/**
|
|
12
|
+
* The font color UI plugin. It introduces the `'fontColor'` dropdown.
|
|
13
|
+
*/
|
|
14
|
+
export default class FontColorUI extends ColorUI {
|
|
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
|
+
}
|
|
33
|
+
}
|
package/src/fontcolor.d.ts
CHANGED
|
@@ -1,29 +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
|
-
/**
|
|
6
|
-
* @module font/fontcolor
|
|
7
|
-
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
-
import FontColorEditing from './fontcolor/fontcolorediting';
|
|
10
|
-
import FontColorUI from './fontcolor/fontcolorui';
|
|
11
|
-
/**
|
|
12
|
-
* The font color plugin.
|
|
13
|
-
*
|
|
14
|
-
* For a detailed overview, check the {@glink features/font font feature} documentation
|
|
15
|
-
* and the {@glink api/font package page}.
|
|
16
|
-
*
|
|
17
|
-
* This is a "glue" plugin which loads the {@link module:font/fontcolor/fontcolorediting~FontColorEditing} and
|
|
18
|
-
* {@link module:font/fontcolor/fontcolorui~FontColorUI} features in the editor.
|
|
19
|
-
*/
|
|
20
|
-
export default class FontColor extends Plugin {
|
|
21
|
-
/**
|
|
22
|
-
* @inheritDoc
|
|
23
|
-
*/
|
|
24
|
-
static get requires(): readonly [typeof FontColorEditing, typeof FontColorUI];
|
|
25
|
-
/**
|
|
26
|
-
* @inheritDoc
|
|
27
|
-
*/
|
|
28
|
-
static get pluginName(): "FontColor";
|
|
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
|
+
/**
|
|
6
|
+
* @module font/fontcolor
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
+
import FontColorEditing from './fontcolor/fontcolorediting';
|
|
10
|
+
import FontColorUI from './fontcolor/fontcolorui';
|
|
11
|
+
/**
|
|
12
|
+
* The font color plugin.
|
|
13
|
+
*
|
|
14
|
+
* For a detailed overview, check the {@glink features/font font feature} documentation
|
|
15
|
+
* and the {@glink api/font package page}.
|
|
16
|
+
*
|
|
17
|
+
* This is a "glue" plugin which loads the {@link module:font/fontcolor/fontcolorediting~FontColorEditing} and
|
|
18
|
+
* {@link module:font/fontcolor/fontcolorui~FontColorUI} features in the editor.
|
|
19
|
+
*/
|
|
20
|
+
export default class FontColor extends Plugin {
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
*/
|
|
24
|
+
static get requires(): readonly [typeof FontColorEditing, typeof FontColorUI];
|
|
25
|
+
/**
|
|
26
|
+
* @inheritDoc
|
|
27
|
+
*/
|
|
28
|
+
static get pluginName(): "FontColor";
|
|
29
|
+
}
|