@ckeditor/ckeditor5-font 47.4.0 → 47.5.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.js +12 -4
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/src/fontcommand.js +12 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-font",
|
|
3
|
-
"version": "47.
|
|
3
|
+
"version": "47.5.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": "47.
|
|
17
|
-
"@ckeditor/ckeditor5-engine": "47.
|
|
18
|
-
"@ckeditor/ckeditor5-icons": "47.
|
|
19
|
-
"@ckeditor/ckeditor5-ui": "47.
|
|
20
|
-
"@ckeditor/ckeditor5-utils": "47.
|
|
21
|
-
"ckeditor5": "47.
|
|
16
|
+
"@ckeditor/ckeditor5-core": "47.5.0-alpha.0",
|
|
17
|
+
"@ckeditor/ckeditor5-engine": "47.5.0-alpha.0",
|
|
18
|
+
"@ckeditor/ckeditor5-icons": "47.5.0-alpha.0",
|
|
19
|
+
"@ckeditor/ckeditor5-ui": "47.5.0-alpha.0",
|
|
20
|
+
"@ckeditor/ckeditor5-utils": "47.5.0-alpha.0",
|
|
21
|
+
"ckeditor5": "47.5.0-alpha.0"
|
|
22
22
|
},
|
|
23
23
|
"author": "CKSource (http://cksource.com/)",
|
|
24
24
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -62,4 +62,4 @@
|
|
|
62
62
|
"./ckeditor5-metadata.json": "./ckeditor5-metadata.json",
|
|
63
63
|
"./package.json": "./package.json"
|
|
64
64
|
}
|
|
65
|
-
}
|
|
65
|
+
}
|
package/src/fontcommand.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* @module font/fontcommand
|
|
7
7
|
*/
|
|
8
8
|
import { Command } from 'ckeditor5/src/core.js';
|
|
9
|
+
import { ModelDocumentSelection } from 'ckeditor5/src/engine.js';
|
|
9
10
|
/**
|
|
10
11
|
* The base font command.
|
|
11
12
|
*/
|
|
@@ -57,13 +58,21 @@ export class FontCommand extends Command {
|
|
|
57
58
|
}
|
|
58
59
|
}
|
|
59
60
|
else {
|
|
60
|
-
const ranges = model.schema.getValidRanges(selection.getRanges(), this.attributeKey
|
|
61
|
+
const ranges = model.schema.getValidRanges(selection.getRanges(), this.attributeKey, {
|
|
62
|
+
includeEmptyRanges: true
|
|
63
|
+
});
|
|
61
64
|
for (const range of ranges) {
|
|
65
|
+
let itemOrRange = range;
|
|
66
|
+
let attributeKey = this.attributeKey;
|
|
67
|
+
if (range.isCollapsed) {
|
|
68
|
+
itemOrRange = range.start.parent;
|
|
69
|
+
attributeKey = ModelDocumentSelection._getStoreAttributeKey(this.attributeKey);
|
|
70
|
+
}
|
|
62
71
|
if (value) {
|
|
63
|
-
writer.setAttribute(
|
|
72
|
+
writer.setAttribute(attributeKey, value, itemOrRange);
|
|
64
73
|
}
|
|
65
74
|
else {
|
|
66
|
-
writer.removeAttribute(
|
|
75
|
+
writer.removeAttribute(attributeKey, itemOrRange);
|
|
67
76
|
}
|
|
68
77
|
}
|
|
69
78
|
}
|