@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.
Files changed (52) hide show
  1. package/build/font.js.map +1 -0
  2. package/package.json +2 -2
  3. package/src/augmentation.d.ts +58 -58
  4. package/src/augmentation.js +5 -5
  5. package/src/font.d.ts +33 -33
  6. package/src/font.js +37 -37
  7. package/src/fontbackgroundcolor/fontbackgroundcolorcommand.d.ts +26 -26
  8. package/src/fontbackgroundcolor/fontbackgroundcolorcommand.js +25 -25
  9. package/src/fontbackgroundcolor/fontbackgroundcolorediting.d.ts +26 -26
  10. package/src/fontbackgroundcolor/fontbackgroundcolorediting.js +123 -123
  11. package/src/fontbackgroundcolor/fontbackgroundcolorui.d.ts +22 -22
  12. package/src/fontbackgroundcolor/fontbackgroundcolorui.js +33 -33
  13. package/src/fontbackgroundcolor.d.ts +30 -30
  14. package/src/fontbackgroundcolor.js +34 -34
  15. package/src/fontcolor/fontcolorcommand.d.ts +25 -25
  16. package/src/fontcolor/fontcolorcommand.js +24 -24
  17. package/src/fontcolor/fontcolorediting.d.ts +26 -26
  18. package/src/fontcolor/fontcolorediting.js +134 -134
  19. package/src/fontcolor/fontcolorui.d.ts +22 -22
  20. package/src/fontcolor/fontcolorui.js +33 -33
  21. package/src/fontcolor.d.ts +29 -29
  22. package/src/fontcolor.js +33 -33
  23. package/src/fontcommand.d.ts +48 -48
  24. package/src/fontcommand.js +79 -79
  25. package/src/fontconfig.d.ts +373 -373
  26. package/src/fontconfig.js +5 -5
  27. package/src/fontfamily/fontfamilycommand.d.ts +25 -25
  28. package/src/fontfamily/fontfamilycommand.js +24 -24
  29. package/src/fontfamily/fontfamilyediting.d.ts +39 -39
  30. package/src/fontfamily/fontfamilyediting.js +115 -115
  31. package/src/fontfamily/fontfamilyui.d.ts +30 -30
  32. package/src/fontfamily/fontfamilyui.js +114 -114
  33. package/src/fontfamily/utils.d.ts +15 -15
  34. package/src/fontfamily/utils.js +80 -80
  35. package/src/fontfamily.d.ts +29 -29
  36. package/src/fontfamily.js +33 -33
  37. package/src/fontsize/fontsizecommand.d.ts +25 -25
  38. package/src/fontsize/fontsizecommand.js +24 -24
  39. package/src/fontsize/fontsizeediting.d.ts +44 -44
  40. package/src/fontsize/fontsizeediting.js +165 -165
  41. package/src/fontsize/fontsizeui.d.ts +31 -31
  42. package/src/fontsize/fontsizeui.js +122 -122
  43. package/src/fontsize/utils.d.ts +12 -12
  44. package/src/fontsize/utils.js +166 -166
  45. package/src/fontsize.d.ts +37 -37
  46. package/src/fontsize.js +43 -43
  47. package/src/index.d.ts +27 -27
  48. package/src/index.js +21 -21
  49. package/src/ui/colorui.d.ts +68 -68
  50. package/src/ui/colorui.js +130 -130
  51. package/src/utils.d.ts +80 -80
  52. package/src/utils.js +97 -97
package/src/fontcolor.js CHANGED
@@ -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
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() {
25
- return [FontColorEditing, FontColorUI];
26
- }
27
- /**
28
- * @inheritDoc
29
- */
30
- static get pluginName() {
31
- return 'FontColor';
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
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() {
25
+ return [FontColorEditing, FontColorUI];
26
+ }
27
+ /**
28
+ * @inheritDoc
29
+ */
30
+ static get pluginName() {
31
+ return 'FontColor';
32
+ }
33
+ }
@@ -1,48 +1,48 @@
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
- import { type Batch } from 'ckeditor5/src/engine';
10
- /**
11
- * The base font command.
12
- */
13
- export default abstract class FontCommand extends Command {
14
- /**
15
- * When set, it reflects the {@link #attributeKey} value of the selection.
16
- *
17
- * @observable
18
- * @readonly
19
- */
20
- value: string;
21
- /**
22
- * A model attribute on which this command operates.
23
- */
24
- readonly attributeKey: string;
25
- /**
26
- * Creates an instance of the command.
27
- *
28
- * @param editor Editor instance.
29
- * @param attributeKey The name of a model attribute on which this command operates.
30
- */
31
- constructor(editor: Editor, attributeKey: string);
32
- /**
33
- * @inheritDoc
34
- */
35
- refresh(): void;
36
- /**
37
- * Executes the command. Applies the `value` of the {@link #attributeKey} to the selection.
38
- * If no `value` is passed, it removes the attribute from the selection.
39
- *
40
- * @param options Options for the executed command.
41
- * @param options.value The value to apply.
42
- * @fires execute
43
- */
44
- execute(options?: {
45
- value?: string;
46
- batch?: Batch;
47
- }): void;
48
- }
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
+ import { type Batch } from 'ckeditor5/src/engine';
10
+ /**
11
+ * The base font command.
12
+ */
13
+ export default abstract class FontCommand extends Command {
14
+ /**
15
+ * When set, it reflects the {@link #attributeKey} value of the selection.
16
+ *
17
+ * @observable
18
+ * @readonly
19
+ */
20
+ value: string;
21
+ /**
22
+ * A model attribute on which this command operates.
23
+ */
24
+ readonly attributeKey: string;
25
+ /**
26
+ * Creates an instance of the command.
27
+ *
28
+ * @param editor Editor instance.
29
+ * @param attributeKey The name of a model attribute on which this command operates.
30
+ */
31
+ constructor(editor: Editor, attributeKey: string);
32
+ /**
33
+ * @inheritDoc
34
+ */
35
+ refresh(): void;
36
+ /**
37
+ * Executes the command. Applies the `value` of the {@link #attributeKey} to the selection.
38
+ * If no `value` is passed, it removes the attribute from the selection.
39
+ *
40
+ * @param options Options for the executed command.
41
+ * @param options.value The value to apply.
42
+ * @fires execute
43
+ */
44
+ execute(options?: {
45
+ value?: string;
46
+ batch?: Batch;
47
+ }): void;
48
+ }
@@ -1,79 +1,79 @@
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 } from 'ckeditor5/src/core';
9
- /**
10
- * The base font command.
11
- */
12
- export default class FontCommand extends Command {
13
- /**
14
- * Creates an instance of the command.
15
- *
16
- * @param editor Editor instance.
17
- * @param attributeKey The name of a model attribute on which this command operates.
18
- */
19
- constructor(editor, attributeKey) {
20
- super(editor);
21
- this.attributeKey = attributeKey;
22
- }
23
- /**
24
- * @inheritDoc
25
- */
26
- refresh() {
27
- const model = this.editor.model;
28
- const doc = model.document;
29
- this.value = doc.selection.getAttribute(this.attributeKey);
30
- this.isEnabled = model.schema.checkAttributeInSelection(doc.selection, this.attributeKey);
31
- }
32
- /**
33
- * Executes the command. Applies the `value` of the {@link #attributeKey} to the selection.
34
- * If no `value` is passed, it removes the attribute from the selection.
35
- *
36
- * @param options Options for the executed command.
37
- * @param options.value The value to apply.
38
- * @fires execute
39
- */
40
- execute(options = {}) {
41
- const model = this.editor.model;
42
- const document = model.document;
43
- const selection = document.selection;
44
- const value = options.value;
45
- const batch = options.batch;
46
- const updateAttribute = (writer) => {
47
- if (selection.isCollapsed) {
48
- if (value) {
49
- writer.setSelectionAttribute(this.attributeKey, value);
50
- }
51
- else {
52
- writer.removeSelectionAttribute(this.attributeKey);
53
- }
54
- }
55
- else {
56
- const ranges = model.schema.getValidRanges(selection.getRanges(), this.attributeKey);
57
- for (const range of ranges) {
58
- if (value) {
59
- writer.setAttribute(this.attributeKey, value, range);
60
- }
61
- else {
62
- writer.removeAttribute(this.attributeKey, range);
63
- }
64
- }
65
- }
66
- };
67
- // In some scenarios, you may want to use a single undo step for multiple changes (e.g. in color picker).
68
- if (batch) {
69
- model.enqueueChange(batch, writer => {
70
- updateAttribute(writer);
71
- });
72
- }
73
- else {
74
- model.change(writer => {
75
- updateAttribute(writer);
76
- });
77
- }
78
- }
79
- }
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 } from 'ckeditor5/src/core';
9
+ /**
10
+ * The base font command.
11
+ */
12
+ export default class FontCommand extends Command {
13
+ /**
14
+ * Creates an instance of the command.
15
+ *
16
+ * @param editor Editor instance.
17
+ * @param attributeKey The name of a model attribute on which this command operates.
18
+ */
19
+ constructor(editor, attributeKey) {
20
+ super(editor);
21
+ this.attributeKey = attributeKey;
22
+ }
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ refresh() {
27
+ const model = this.editor.model;
28
+ const doc = model.document;
29
+ this.value = doc.selection.getAttribute(this.attributeKey);
30
+ this.isEnabled = model.schema.checkAttributeInSelection(doc.selection, this.attributeKey);
31
+ }
32
+ /**
33
+ * Executes the command. Applies the `value` of the {@link #attributeKey} to the selection.
34
+ * If no `value` is passed, it removes the attribute from the selection.
35
+ *
36
+ * @param options Options for the executed command.
37
+ * @param options.value The value to apply.
38
+ * @fires execute
39
+ */
40
+ execute(options = {}) {
41
+ const model = this.editor.model;
42
+ const document = model.document;
43
+ const selection = document.selection;
44
+ const value = options.value;
45
+ const batch = options.batch;
46
+ const updateAttribute = (writer) => {
47
+ if (selection.isCollapsed) {
48
+ if (value) {
49
+ writer.setSelectionAttribute(this.attributeKey, value);
50
+ }
51
+ else {
52
+ writer.removeSelectionAttribute(this.attributeKey);
53
+ }
54
+ }
55
+ else {
56
+ const ranges = model.schema.getValidRanges(selection.getRanges(), this.attributeKey);
57
+ for (const range of ranges) {
58
+ if (value) {
59
+ writer.setAttribute(this.attributeKey, value, range);
60
+ }
61
+ else {
62
+ writer.removeAttribute(this.attributeKey, range);
63
+ }
64
+ }
65
+ }
66
+ };
67
+ // In some scenarios, you may want to use a single undo step for multiple changes (e.g. in color picker).
68
+ if (batch) {
69
+ model.enqueueChange(batch, writer => {
70
+ updateAttribute(writer);
71
+ });
72
+ }
73
+ else {
74
+ model.change(writer => {
75
+ updateAttribute(writer);
76
+ });
77
+ }
78
+ }
79
+ }