@ckeditor/ckeditor5-font 45.2.1 → 46.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/dist/index-content.css +10 -4
- package/dist/index-editor.css +6 -0
- package/dist/index.css +11 -4
- package/dist/index.css.map +1 -1
- package/dist/index.js +31 -13
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/src/font.d.ts +5 -5
- package/src/font.js +5 -5
- package/src/fontbackgroundcolor/fontbackgroundcolorcommand.d.ts +2 -2
- package/src/fontbackgroundcolor/fontbackgroundcolorcommand.js +2 -2
- package/src/fontbackgroundcolor/fontbackgroundcolorediting.d.ts +1 -1
- package/src/fontbackgroundcolor/fontbackgroundcolorediting.js +4 -4
- package/src/fontbackgroundcolor/fontbackgroundcolorui.d.ts +2 -2
- package/src/fontbackgroundcolor/fontbackgroundcolorui.js +2 -2
- package/src/fontbackgroundcolor.d.ts +3 -3
- package/src/fontbackgroundcolor.js +3 -3
- package/src/fontcolor/fontcolorcommand.d.ts +2 -2
- package/src/fontcolor/fontcolorcommand.js +2 -2
- package/src/fontcolor/fontcolorediting.d.ts +1 -1
- package/src/fontcolor/fontcolorediting.js +2 -2
- package/src/fontcolor/fontcolorui.d.ts +2 -2
- package/src/fontcolor/fontcolorui.js +2 -2
- package/src/fontcolor.d.ts +3 -3
- package/src/fontcolor.js +3 -3
- package/src/fontcommand.d.ts +1 -1
- package/src/fontcommand.js +1 -1
- package/src/fontfamily/fontfamilycommand.d.ts +2 -2
- package/src/fontfamily/fontfamilycommand.js +2 -2
- package/src/fontfamily/fontfamilyediting.d.ts +1 -1
- package/src/fontfamily/fontfamilyediting.js +2 -2
- package/src/fontfamily/fontfamilyui.d.ts +1 -1
- package/src/fontfamily/fontfamilyui.js +7 -5
- package/src/fontfamily/utils.d.ts +7 -0
- package/src/fontfamily/utils.js +12 -1
- package/src/fontfamily.d.ts +3 -3
- package/src/fontfamily.js +3 -3
- package/src/fontsize/fontsizecommand.d.ts +2 -2
- package/src/fontsize/fontsizecommand.js +2 -2
- package/src/fontsize/fontsizeediting.d.ts +1 -1
- package/src/fontsize/fontsizeediting.js +4 -4
- package/src/fontsize/fontsizeui.d.ts +1 -1
- package/src/fontsize/fontsizeui.js +3 -3
- package/src/fontsize/utils.d.ts +1 -0
- package/src/fontsize/utils.js +1 -0
- package/src/fontsize.d.ts +3 -3
- package/src/fontsize.js +3 -3
- package/src/index.d.ts +23 -19
- package/src/index.js +22 -13
- package/src/ui/colorui.d.ts +1 -1
- package/src/ui/colorui.js +2 -2
- package/src/utils.d.ts +12 -2
- package/src/utils.js +7 -0
- package/theme/fontsize.css +11 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-font",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "46.0.0-alpha.0",
|
|
4
4
|
"description": "Font feature for CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
"type": "module",
|
|
14
14
|
"main": "src/index.js",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@ckeditor/ckeditor5-core": "
|
|
17
|
-
"@ckeditor/ckeditor5-engine": "
|
|
18
|
-
"@ckeditor/ckeditor5-icons": "
|
|
19
|
-
"@ckeditor/ckeditor5-ui": "
|
|
20
|
-
"@ckeditor/ckeditor5-utils": "
|
|
21
|
-
"ckeditor5": "
|
|
16
|
+
"@ckeditor/ckeditor5-core": "46.0.0-alpha.0",
|
|
17
|
+
"@ckeditor/ckeditor5-engine": "46.0.0-alpha.0",
|
|
18
|
+
"@ckeditor/ckeditor5-icons": "46.0.0-alpha.0",
|
|
19
|
+
"@ckeditor/ckeditor5-ui": "46.0.0-alpha.0",
|
|
20
|
+
"@ckeditor/ckeditor5-utils": "46.0.0-alpha.0",
|
|
21
|
+
"ckeditor5": "46.0.0-alpha.0"
|
|
22
22
|
},
|
|
23
23
|
"author": "CKSource (http://cksource.com/)",
|
|
24
24
|
"license": "SEE LICENSE IN LICENSE.md",
|
package/src/font.d.ts
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
* @module font/font
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import FontFamily from './fontfamily.js';
|
|
10
|
-
import FontSize from './fontsize.js';
|
|
11
|
-
import FontColor from './fontcolor.js';
|
|
12
|
-
import FontBackgroundColor from './fontbackgroundcolor.js';
|
|
9
|
+
import { FontFamily } from './fontfamily.js';
|
|
10
|
+
import { FontSize } from './fontsize.js';
|
|
11
|
+
import { FontColor } from './fontcolor.js';
|
|
12
|
+
import { FontBackgroundColor } from './fontbackgroundcolor.js';
|
|
13
13
|
/**
|
|
14
14
|
* A plugin that enables a set of text styling features:
|
|
15
15
|
*
|
|
@@ -21,7 +21,7 @@ import FontBackgroundColor from './fontbackgroundcolor.js';
|
|
|
21
21
|
* For a detailed overview, check the {@glink features/font Font feature} documentation
|
|
22
22
|
* and the {@glink api/font package page}.
|
|
23
23
|
*/
|
|
24
|
-
export
|
|
24
|
+
export declare class Font extends Plugin {
|
|
25
25
|
/**
|
|
26
26
|
* @inheritDoc
|
|
27
27
|
*/
|
package/src/font.js
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
* @module font/font
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import FontFamily from './fontfamily.js';
|
|
10
|
-
import FontSize from './fontsize.js';
|
|
11
|
-
import FontColor from './fontcolor.js';
|
|
12
|
-
import FontBackgroundColor from './fontbackgroundcolor.js';
|
|
9
|
+
import { FontFamily } from './fontfamily.js';
|
|
10
|
+
import { FontSize } from './fontsize.js';
|
|
11
|
+
import { FontColor } from './fontcolor.js';
|
|
12
|
+
import { FontBackgroundColor } from './fontbackgroundcolor.js';
|
|
13
13
|
/**
|
|
14
14
|
* A plugin that enables a set of text styling features:
|
|
15
15
|
*
|
|
@@ -21,7 +21,7 @@ import FontBackgroundColor from './fontbackgroundcolor.js';
|
|
|
21
21
|
* For a detailed overview, check the {@glink features/font Font feature} documentation
|
|
22
22
|
* and the {@glink api/font package page}.
|
|
23
23
|
*/
|
|
24
|
-
export
|
|
24
|
+
export class Font extends Plugin {
|
|
25
25
|
/**
|
|
26
26
|
* @inheritDoc
|
|
27
27
|
*/
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @module font/fontbackgroundcolor/fontbackgroundcolorcommand
|
|
7
7
|
*/
|
|
8
8
|
import type { Editor } from 'ckeditor5/src/core.js';
|
|
9
|
-
import FontCommand from '../fontcommand.js';
|
|
9
|
+
import { FontCommand } from '../fontcommand.js';
|
|
10
10
|
/**
|
|
11
11
|
* The font background color command. It is used by
|
|
12
12
|
* {@link module:font/fontbackgroundcolor/fontbackgroundcolorediting~FontBackgroundColorEditing}
|
|
@@ -18,7 +18,7 @@ import FontCommand from '../fontcommand.js';
|
|
|
18
18
|
*
|
|
19
19
|
* **Note**: Executing the command with the `null` value removes the attribute from the model.
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
21
|
+
export declare class FontBackgroundColorCommand extends FontCommand {
|
|
22
22
|
/**
|
|
23
23
|
* @inheritDoc
|
|
24
24
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
|
-
import FontCommand from '../fontcommand.js';
|
|
5
|
+
import { FontCommand } from '../fontcommand.js';
|
|
6
6
|
import { FONT_BACKGROUND_COLOR } from '../utils.js';
|
|
7
7
|
/**
|
|
8
8
|
* The font background color command. It is used by
|
|
@@ -15,7 +15,7 @@ import { FONT_BACKGROUND_COLOR } from '../utils.js';
|
|
|
15
15
|
*
|
|
16
16
|
* **Note**: Executing the command with the `null` value removes the attribute from the model.
|
|
17
17
|
*/
|
|
18
|
-
export
|
|
18
|
+
export class FontBackgroundColorCommand extends FontCommand {
|
|
19
19
|
/**
|
|
20
20
|
* @inheritDoc
|
|
21
21
|
*/
|
|
@@ -14,7 +14,7 @@ import { Plugin, type Editor } from 'ckeditor5/src/core.js';
|
|
|
14
14
|
* in the {@link module:engine/view/view view} as a `<span>` element (`<span style="background-color: ...">`),
|
|
15
15
|
* depending on the {@link module:font/fontconfig~FontColorConfig configuration}.
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export declare class FontBackgroundColorEditing extends Plugin {
|
|
18
18
|
/**
|
|
19
19
|
* @inheritDoc
|
|
20
20
|
*/
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @module font/fontbackgroundcolor/fontbackgroundcolorediting
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import {
|
|
10
|
-
import FontBackgroundColorCommand from './fontbackgroundcolorcommand.js';
|
|
9
|
+
import { addBackgroundStylesRules } from 'ckeditor5/src/engine.js';
|
|
10
|
+
import { FontBackgroundColorCommand } from './fontbackgroundcolorcommand.js';
|
|
11
11
|
import { FONT_BACKGROUND_COLOR, renderDowncastElement, renderUpcastAttribute } from '../utils.js';
|
|
12
12
|
/**
|
|
13
13
|
* The font background color editing feature.
|
|
@@ -17,7 +17,7 @@ import { FONT_BACKGROUND_COLOR, renderDowncastElement, renderUpcastAttribute } f
|
|
|
17
17
|
* in the {@link module:engine/view/view view} as a `<span>` element (`<span style="background-color: ...">`),
|
|
18
18
|
* depending on the {@link module:font/fontconfig~FontColorConfig configuration}.
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export class FontBackgroundColorEditing extends Plugin {
|
|
21
21
|
/**
|
|
22
22
|
* @inheritDoc
|
|
23
23
|
*/
|
|
@@ -101,7 +101,7 @@ export default class FontBackgroundColorEditing extends Plugin {
|
|
|
101
101
|
],
|
|
102
102
|
columns: 5
|
|
103
103
|
});
|
|
104
|
-
editor.data.addStyleProcessorRules(
|
|
104
|
+
editor.data.addStyleProcessorRules(addBackgroundStylesRules);
|
|
105
105
|
editor.conversion.for('upcast').elementToAttribute({
|
|
106
106
|
view: {
|
|
107
107
|
name: 'span',
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import { FontColorUIBase } from '../ui/colorui.js';
|
|
6
6
|
import type { Editor } from 'ckeditor5/src/core.js';
|
|
7
7
|
/**
|
|
8
8
|
* The font background color UI plugin. It introduces the `'fontBackgroundColor'` dropdown.
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
10
|
+
export declare class FontBackgroundColorUI extends FontColorUIBase {
|
|
11
11
|
/**
|
|
12
12
|
* @inheritDoc
|
|
13
13
|
*/
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
* @module font/fontbackgroundcolor/fontbackgroundcolorui
|
|
7
7
|
*/
|
|
8
8
|
import { IconFontBackground } from 'ckeditor5/src/icons.js';
|
|
9
|
-
import
|
|
9
|
+
import { FontColorUIBase } from '../ui/colorui.js';
|
|
10
10
|
import { FONT_BACKGROUND_COLOR } from '../utils.js';
|
|
11
11
|
/**
|
|
12
12
|
* The font background color UI plugin. It introduces the `'fontBackgroundColor'` dropdown.
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
14
|
+
export class FontBackgroundColorUI extends FontColorUIBase {
|
|
15
15
|
/**
|
|
16
16
|
* @inheritDoc
|
|
17
17
|
*/
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @module font/fontbackgroundcolor
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import FontBackgroundColorEditing from './fontbackgroundcolor/fontbackgroundcolorediting.js';
|
|
10
|
-
import FontBackgroundColorUI from './fontbackgroundcolor/fontbackgroundcolorui.js';
|
|
9
|
+
import { FontBackgroundColorEditing } from './fontbackgroundcolor/fontbackgroundcolorediting.js';
|
|
10
|
+
import { FontBackgroundColorUI } from './fontbackgroundcolor/fontbackgroundcolorui.js';
|
|
11
11
|
/**
|
|
12
12
|
* The font background color plugin.
|
|
13
13
|
*
|
|
@@ -18,7 +18,7 @@ import FontBackgroundColorUI from './fontbackgroundcolor/fontbackgroundcolorui.j
|
|
|
18
18
|
* the {@link module:font/fontbackgroundcolor/fontbackgroundcolorediting~FontBackgroundColorEditing} and
|
|
19
19
|
* {@link module:font/fontbackgroundcolor/fontbackgroundcolorui~FontBackgroundColorUI} features in the editor.
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
21
|
+
export declare class FontBackgroundColor extends Plugin {
|
|
22
22
|
/**
|
|
23
23
|
* @inheritDoc
|
|
24
24
|
*/
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @module font/fontbackgroundcolor
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import FontBackgroundColorEditing from './fontbackgroundcolor/fontbackgroundcolorediting.js';
|
|
10
|
-
import FontBackgroundColorUI from './fontbackgroundcolor/fontbackgroundcolorui.js';
|
|
9
|
+
import { FontBackgroundColorEditing } from './fontbackgroundcolor/fontbackgroundcolorediting.js';
|
|
10
|
+
import { FontBackgroundColorUI } from './fontbackgroundcolor/fontbackgroundcolorui.js';
|
|
11
11
|
/**
|
|
12
12
|
* The font background color plugin.
|
|
13
13
|
*
|
|
@@ -18,7 +18,7 @@ import FontBackgroundColorUI from './fontbackgroundcolor/fontbackgroundcolorui.j
|
|
|
18
18
|
* the {@link module:font/fontbackgroundcolor/fontbackgroundcolorediting~FontBackgroundColorEditing} and
|
|
19
19
|
* {@link module:font/fontbackgroundcolor/fontbackgroundcolorui~FontBackgroundColorUI} features in the editor.
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
21
|
+
export class FontBackgroundColor extends Plugin {
|
|
22
22
|
/**
|
|
23
23
|
* @inheritDoc
|
|
24
24
|
*/
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @module font/fontcolor/fontcolorcommand
|
|
7
7
|
*/
|
|
8
8
|
import type { Editor } from 'ckeditor5/src/core.js';
|
|
9
|
-
import FontCommand from '../fontcommand.js';
|
|
9
|
+
import { FontCommand } from '../fontcommand.js';
|
|
10
10
|
/**
|
|
11
11
|
* The font color command. It is used by {@link module:font/fontcolor/fontcolorediting~FontColorEditing}
|
|
12
12
|
* to apply the font color.
|
|
@@ -17,7 +17,7 @@ import FontCommand from '../fontcommand.js';
|
|
|
17
17
|
*
|
|
18
18
|
* **Note**: Executing the command with the `null` value removes the attribute from the model.
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export declare class FontColorCommand extends FontCommand {
|
|
21
21
|
/**
|
|
22
22
|
* @inheritDoc
|
|
23
23
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
|
-
import FontCommand from '../fontcommand.js';
|
|
5
|
+
import { FontCommand } from '../fontcommand.js';
|
|
6
6
|
import { FONT_COLOR } from '../utils.js';
|
|
7
7
|
/**
|
|
8
8
|
* The font color command. It is used by {@link module:font/fontcolor/fontcolorediting~FontColorEditing}
|
|
@@ -14,7 +14,7 @@ import { FONT_COLOR } from '../utils.js';
|
|
|
14
14
|
*
|
|
15
15
|
* **Note**: Executing the command with the `null` value removes the attribute from the model.
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export class FontColorCommand extends FontCommand {
|
|
18
18
|
/**
|
|
19
19
|
* @inheritDoc
|
|
20
20
|
*/
|
|
@@ -14,7 +14,7 @@ import { Plugin, type Editor } from 'ckeditor5/src/core.js';
|
|
|
14
14
|
* in the {@link module:engine/view/view view} as a `<span>` element (`<span style="color: ...">`),
|
|
15
15
|
* depending on the {@link module:font/fontconfig~FontColorConfig configuration}.
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export declare class FontColorEditing extends Plugin {
|
|
18
18
|
/**
|
|
19
19
|
* @inheritDoc
|
|
20
20
|
*/
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @module font/fontcolor/fontcolorediting
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import FontColorCommand from './fontcolorcommand.js';
|
|
9
|
+
import { FontColorCommand } from './fontcolorcommand.js';
|
|
10
10
|
import { FONT_COLOR, renderDowncastElement, renderUpcastAttribute } from '../utils.js';
|
|
11
11
|
/**
|
|
12
12
|
* The font color editing feature.
|
|
@@ -16,7 +16,7 @@ import { FONT_COLOR, renderDowncastElement, renderUpcastAttribute } from '../uti
|
|
|
16
16
|
* in the {@link module:engine/view/view view} as a `<span>` element (`<span style="color: ...">`),
|
|
17
17
|
* depending on the {@link module:font/fontconfig~FontColorConfig configuration}.
|
|
18
18
|
*/
|
|
19
|
-
export
|
|
19
|
+
export class FontColorEditing extends Plugin {
|
|
20
20
|
/**
|
|
21
21
|
* @inheritDoc
|
|
22
22
|
*/
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import { FontColorUIBase } from '../ui/colorui.js';
|
|
6
6
|
import type { Editor } from 'ckeditor5/src/core.js';
|
|
7
7
|
/**
|
|
8
8
|
* The font color UI plugin. It introduces the `'fontColor'` dropdown.
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
10
|
+
export declare class FontColorUI extends FontColorUIBase {
|
|
11
11
|
/**
|
|
12
12
|
* @inheritDoc
|
|
13
13
|
*/
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
* @module font/fontcolor/fontcolorui
|
|
7
7
|
*/
|
|
8
8
|
import { IconFontColor } from 'ckeditor5/src/icons.js';
|
|
9
|
-
import
|
|
9
|
+
import { FontColorUIBase } from '../ui/colorui.js';
|
|
10
10
|
import { FONT_COLOR } from '../utils.js';
|
|
11
11
|
/**
|
|
12
12
|
* The font color UI plugin. It introduces the `'fontColor'` dropdown.
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
14
|
+
export class FontColorUI extends FontColorUIBase {
|
|
15
15
|
/**
|
|
16
16
|
* @inheritDoc
|
|
17
17
|
*/
|
package/src/fontcolor.d.ts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @module font/fontcolor
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import FontColorEditing from './fontcolor/fontcolorediting.js';
|
|
10
|
-
import FontColorUI from './fontcolor/fontcolorui.js';
|
|
9
|
+
import { FontColorEditing } from './fontcolor/fontcolorediting.js';
|
|
10
|
+
import { FontColorUI } from './fontcolor/fontcolorui.js';
|
|
11
11
|
/**
|
|
12
12
|
* The font color plugin.
|
|
13
13
|
*
|
|
@@ -17,7 +17,7 @@ import FontColorUI from './fontcolor/fontcolorui.js';
|
|
|
17
17
|
* This is a "glue" plugin which loads the {@link module:font/fontcolor/fontcolorediting~FontColorEditing} and
|
|
18
18
|
* {@link module:font/fontcolor/fontcolorui~FontColorUI} features in the editor.
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export declare class FontColor extends Plugin {
|
|
21
21
|
/**
|
|
22
22
|
* @inheritDoc
|
|
23
23
|
*/
|
package/src/fontcolor.js
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @module font/fontcolor
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import FontColorEditing from './fontcolor/fontcolorediting.js';
|
|
10
|
-
import FontColorUI from './fontcolor/fontcolorui.js';
|
|
9
|
+
import { FontColorEditing } from './fontcolor/fontcolorediting.js';
|
|
10
|
+
import { FontColorUI } from './fontcolor/fontcolorui.js';
|
|
11
11
|
/**
|
|
12
12
|
* The font color plugin.
|
|
13
13
|
*
|
|
@@ -17,7 +17,7 @@ import FontColorUI from './fontcolor/fontcolorui.js';
|
|
|
17
17
|
* This is a "glue" plugin which loads the {@link module:font/fontcolor/fontcolorediting~FontColorEditing} and
|
|
18
18
|
* {@link module:font/fontcolor/fontcolorui~FontColorUI} features in the editor.
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export class FontColor extends Plugin {
|
|
21
21
|
/**
|
|
22
22
|
* @inheritDoc
|
|
23
23
|
*/
|
package/src/fontcommand.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { type Batch } from 'ckeditor5/src/engine.js';
|
|
|
10
10
|
/**
|
|
11
11
|
* The base font command.
|
|
12
12
|
*/
|
|
13
|
-
export
|
|
13
|
+
export declare abstract class FontCommand extends Command {
|
|
14
14
|
/**
|
|
15
15
|
* When set, it reflects the {@link #attributeKey} value of the selection.
|
|
16
16
|
*
|
package/src/fontcommand.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @module font/fontfamily/fontfamilycommand
|
|
7
7
|
*/
|
|
8
8
|
import type { Editor } from 'ckeditor5/src/core.js';
|
|
9
|
-
import FontCommand from '../fontcommand.js';
|
|
9
|
+
import { FontCommand } from '../fontcommand.js';
|
|
10
10
|
/**
|
|
11
11
|
* The font family command. It is used by {@link module:font/fontfamily/fontfamilyediting~FontFamilyEditing}
|
|
12
12
|
* to apply the font family.
|
|
@@ -17,7 +17,7 @@ import FontCommand from '../fontcommand.js';
|
|
|
17
17
|
*
|
|
18
18
|
* **Note**: Executing the command without the value removes the attribute from the model.
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export declare class FontFamilyCommand extends FontCommand {
|
|
21
21
|
/**
|
|
22
22
|
* @inheritDoc
|
|
23
23
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
|
-
import FontCommand from '../fontcommand.js';
|
|
5
|
+
import { FontCommand } from '../fontcommand.js';
|
|
6
6
|
import { FONT_FAMILY } from '../utils.js';
|
|
7
7
|
/**
|
|
8
8
|
* The font family command. It is used by {@link module:font/fontfamily/fontfamilyediting~FontFamilyEditing}
|
|
@@ -14,7 +14,7 @@ import { FONT_FAMILY } from '../utils.js';
|
|
|
14
14
|
*
|
|
15
15
|
* **Note**: Executing the command without the value removes the attribute from the model.
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export class FontFamilyCommand extends FontCommand {
|
|
18
18
|
/**
|
|
19
19
|
* @inheritDoc
|
|
20
20
|
*/
|
|
@@ -14,7 +14,7 @@ import { type Editor, Plugin } from 'ckeditor5/src/core.js';
|
|
|
14
14
|
* in the {@link module:engine/view/view view} as an inline `<span>` element (`<span style="font-family: Arial">`),
|
|
15
15
|
* depending on the {@link module:font/fontconfig~FontFamilyConfig configuration}.
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export declare class FontFamilyEditing extends Plugin {
|
|
18
18
|
/**
|
|
19
19
|
* @inheritDoc
|
|
20
20
|
*/
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @module font/fontfamily/fontfamilyediting
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import FontFamilyCommand from './fontfamilycommand.js';
|
|
9
|
+
import { FontFamilyCommand } from './fontfamilycommand.js';
|
|
10
10
|
import { normalizeOptions } from './utils.js';
|
|
11
11
|
import { buildDefinition, FONT_FAMILY } from '../utils.js';
|
|
12
12
|
/**
|
|
@@ -17,7 +17,7 @@ import { buildDefinition, FONT_FAMILY } from '../utils.js';
|
|
|
17
17
|
* in the {@link module:engine/view/view view} as an inline `<span>` element (`<span style="font-family: Arial">`),
|
|
18
18
|
* depending on the {@link module:font/fontconfig~FontFamilyConfig configuration}.
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export class FontFamilyEditing extends Plugin {
|
|
21
21
|
/**
|
|
22
22
|
* @inheritDoc
|
|
23
23
|
*/
|
|
@@ -9,7 +9,7 @@ import { Plugin } from 'ckeditor5/src/core.js';
|
|
|
9
9
|
/**
|
|
10
10
|
* The font family UI plugin. It introduces the `'fontFamily'` dropdown.
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export declare class FontFamilyUI extends Plugin {
|
|
13
13
|
/**
|
|
14
14
|
* @inheritDoc
|
|
15
15
|
*/
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
9
|
import { Collection } from 'ckeditor5/src/utils.js';
|
|
10
10
|
import { IconFontFamily } from 'ckeditor5/src/icons.js';
|
|
11
|
-
import {
|
|
12
|
-
import { normalizeOptions } from './utils.js';
|
|
11
|
+
import { UIModel, createDropdown, addListToDropdown, MenuBarMenuView, MenuBarMenuListView, MenuBarMenuListItemView, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';
|
|
12
|
+
import { normalizeFontFamilies, normalizeOptions } from './utils.js';
|
|
13
13
|
import { FONT_FAMILY } from '../utils.js';
|
|
14
14
|
/**
|
|
15
15
|
* The font family UI plugin. It introduces the `'fontFamily'` dropdown.
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export class FontFamilyUI extends Plugin {
|
|
18
18
|
/**
|
|
19
19
|
* @inheritDoc
|
|
20
20
|
*/
|
|
@@ -122,7 +122,7 @@ function _prepareListOptions(options, command) {
|
|
|
122
122
|
for (const option of options) {
|
|
123
123
|
const def = {
|
|
124
124
|
type: 'button',
|
|
125
|
-
model: new
|
|
125
|
+
model: new UIModel({
|
|
126
126
|
commandName: FONT_FAMILY,
|
|
127
127
|
commandParam: option.model,
|
|
128
128
|
label: option.title,
|
|
@@ -138,7 +138,9 @@ function _prepareListOptions(options, command) {
|
|
|
138
138
|
if (!value || !option.model) {
|
|
139
139
|
return false;
|
|
140
140
|
}
|
|
141
|
-
|
|
141
|
+
const valueNormalized = normalizeFontFamilies(value)[0].toLowerCase();
|
|
142
|
+
const optionNormalized = normalizeFontFamilies(option.model)[0].toLowerCase();
|
|
143
|
+
return valueNormalized === optionNormalized;
|
|
142
144
|
});
|
|
143
145
|
// Try to set a dropdown list item style.
|
|
144
146
|
if (option.view && typeof option.view !== 'string' && option.view.styles) {
|
|
@@ -11,5 +11,12 @@ import type { FontFamilyOption } from '../fontconfig.js';
|
|
|
11
11
|
* to the {@link module:font/fontconfig~FontFamilyOption} format.
|
|
12
12
|
*
|
|
13
13
|
* @param configuredOptions An array of options taken from the configuration.
|
|
14
|
+
* @internal
|
|
14
15
|
*/
|
|
15
16
|
export declare function normalizeOptions(configuredOptions: Array<string | FontFamilyOption>): Array<FontFamilyOption>;
|
|
17
|
+
/**
|
|
18
|
+
* Normalizes the CSS `font-family` property value to an array of unquoted and trimmed font faces.
|
|
19
|
+
*
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export declare function normalizeFontFamilies(fontDefinition: string): Array<string>;
|
package/src/fontfamily/utils.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* to the {@link module:font/fontconfig~FontFamilyOption} format.
|
|
11
11
|
*
|
|
12
12
|
* @param configuredOptions An array of options taken from the configuration.
|
|
13
|
+
* @internal
|
|
13
14
|
*/
|
|
14
15
|
export function normalizeOptions(configuredOptions) {
|
|
15
16
|
// Convert options to objects.
|
|
@@ -18,6 +19,16 @@ export function normalizeOptions(configuredOptions) {
|
|
|
18
19
|
// Filter out undefined values that `getOptionDefinition` might return.
|
|
19
20
|
.filter(option => option !== undefined);
|
|
20
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Normalizes the CSS `font-family` property value to an array of unquoted and trimmed font faces.
|
|
24
|
+
*
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
export function normalizeFontFamilies(fontDefinition) {
|
|
28
|
+
return fontDefinition
|
|
29
|
+
.replace(/["']/g, '').split(',')
|
|
30
|
+
.map(name => name.trim());
|
|
31
|
+
}
|
|
21
32
|
/**
|
|
22
33
|
* Returns an option definition either created from string shortcut.
|
|
23
34
|
* If object is passed then this method will return it without alternating it. Returns undefined for item than cannot be parsed.
|
|
@@ -50,7 +61,7 @@ function getOptionDefinition(option) {
|
|
|
50
61
|
*/
|
|
51
62
|
function generateFontPreset(fontDefinition) {
|
|
52
63
|
// Remove quotes from font names. They will be normalized later.
|
|
53
|
-
const fontNames = fontDefinition
|
|
64
|
+
const fontNames = normalizeFontFamilies(fontDefinition);
|
|
54
65
|
// The first matched font name will be used as dropdown list item title and as model value.
|
|
55
66
|
const firstFontName = fontNames[0];
|
|
56
67
|
// CSS-compatible font names.
|
package/src/fontfamily.d.ts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @module font/fontfamily
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import FontFamilyEditing from './fontfamily/fontfamilyediting.js';
|
|
10
|
-
import FontFamilyUI from './fontfamily/fontfamilyui.js';
|
|
9
|
+
import { FontFamilyEditing } from './fontfamily/fontfamilyediting.js';
|
|
10
|
+
import { FontFamilyUI } from './fontfamily/fontfamilyui.js';
|
|
11
11
|
/**
|
|
12
12
|
* The font family plugin.
|
|
13
13
|
*
|
|
@@ -17,7 +17,7 @@ import FontFamilyUI from './fontfamily/fontfamilyui.js';
|
|
|
17
17
|
* This is a "glue" plugin which loads the {@link module:font/fontfamily/fontfamilyediting~FontFamilyEditing} and
|
|
18
18
|
* {@link module:font/fontfamily/fontfamilyui~FontFamilyUI} features in the editor.
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export declare class FontFamily extends Plugin {
|
|
21
21
|
/**
|
|
22
22
|
* @inheritDoc
|
|
23
23
|
*/
|
package/src/fontfamily.js
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @module font/fontfamily
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import FontFamilyEditing from './fontfamily/fontfamilyediting.js';
|
|
10
|
-
import FontFamilyUI from './fontfamily/fontfamilyui.js';
|
|
9
|
+
import { FontFamilyEditing } from './fontfamily/fontfamilyediting.js';
|
|
10
|
+
import { FontFamilyUI } from './fontfamily/fontfamilyui.js';
|
|
11
11
|
/**
|
|
12
12
|
* The font family plugin.
|
|
13
13
|
*
|
|
@@ -17,7 +17,7 @@ import FontFamilyUI from './fontfamily/fontfamilyui.js';
|
|
|
17
17
|
* This is a "glue" plugin which loads the {@link module:font/fontfamily/fontfamilyediting~FontFamilyEditing} and
|
|
18
18
|
* {@link module:font/fontfamily/fontfamilyui~FontFamilyUI} features in the editor.
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export class FontFamily extends Plugin {
|
|
21
21
|
/**
|
|
22
22
|
* @inheritDoc
|
|
23
23
|
*/
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @module font/fontsize/fontsizecommand
|
|
7
7
|
*/
|
|
8
8
|
import type { Editor } from 'ckeditor5/src/core.js';
|
|
9
|
-
import FontCommand from '../fontcommand.js';
|
|
9
|
+
import { FontCommand } from '../fontcommand.js';
|
|
10
10
|
/**
|
|
11
11
|
* The font size command. It is used by {@link module:font/fontsize/fontsizeediting~FontSizeEditing}
|
|
12
12
|
* to apply the font size.
|
|
@@ -17,7 +17,7 @@ import FontCommand from '../fontcommand.js';
|
|
|
17
17
|
*
|
|
18
18
|
* **Note**: Executing the command without the value removes the attribute from the model.
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export declare class FontSizeCommand extends FontCommand {
|
|
21
21
|
/**
|
|
22
22
|
* @inheritDoc
|
|
23
23
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
|
-
import FontCommand from '../fontcommand.js';
|
|
5
|
+
import { FontCommand } from '../fontcommand.js';
|
|
6
6
|
import { FONT_SIZE } from '../utils.js';
|
|
7
7
|
/**
|
|
8
8
|
* The font size command. It is used by {@link module:font/fontsize/fontsizeediting~FontSizeEditing}
|
|
@@ -14,7 +14,7 @@ import { FONT_SIZE } from '../utils.js';
|
|
|
14
14
|
*
|
|
15
15
|
* **Note**: Executing the command without the value removes the attribute from the model.
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export class FontSizeCommand extends FontCommand {
|
|
18
18
|
/**
|
|
19
19
|
* @inheritDoc
|
|
20
20
|
*/
|
|
@@ -17,7 +17,7 @@ import { Plugin, type Editor } from 'ckeditor5/src/core.js';
|
|
|
17
17
|
*
|
|
18
18
|
* depending on the {@link module:font/fontconfig~FontSizeConfig configuration}.
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export declare class FontSizeEditing extends Plugin {
|
|
21
21
|
/**
|
|
22
22
|
* @inheritDoc
|
|
23
23
|
*/
|