@ckeditor/ckeditor5-font 38.1.0 → 38.1.1

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 (57) hide show
  1. package/build/font.js +1 -1
  2. package/build/font.js.map +1 -0
  3. package/package.json +3 -3
  4. package/src/augmentation.d.ts +58 -58
  5. package/src/augmentation.js +5 -5
  6. package/src/documentcolorcollection.d.ts +70 -70
  7. package/src/documentcolorcollection.js +42 -42
  8. package/src/font.d.ts +33 -33
  9. package/src/font.js +37 -37
  10. package/src/fontbackgroundcolor/fontbackgroundcolorcommand.d.ts +26 -26
  11. package/src/fontbackgroundcolor/fontbackgroundcolorcommand.js +25 -25
  12. package/src/fontbackgroundcolor/fontbackgroundcolorediting.d.ts +26 -26
  13. package/src/fontbackgroundcolor/fontbackgroundcolorediting.js +123 -123
  14. package/src/fontbackgroundcolor/fontbackgroundcolorui.d.ts +22 -22
  15. package/src/fontbackgroundcolor/fontbackgroundcolorui.js +33 -33
  16. package/src/fontbackgroundcolor.d.ts +30 -30
  17. package/src/fontbackgroundcolor.js +34 -34
  18. package/src/fontcolor/fontcolorcommand.d.ts +25 -25
  19. package/src/fontcolor/fontcolorcommand.js +24 -24
  20. package/src/fontcolor/fontcolorediting.d.ts +26 -26
  21. package/src/fontcolor/fontcolorediting.js +134 -134
  22. package/src/fontcolor/fontcolorui.d.ts +22 -22
  23. package/src/fontcolor/fontcolorui.js +33 -33
  24. package/src/fontcolor.d.ts +29 -29
  25. package/src/fontcolor.js +33 -33
  26. package/src/fontcommand.d.ts +48 -48
  27. package/src/fontcommand.js +79 -79
  28. package/src/fontconfig.d.ts +373 -373
  29. package/src/fontconfig.js +5 -5
  30. package/src/fontfamily/fontfamilycommand.d.ts +25 -25
  31. package/src/fontfamily/fontfamilycommand.js +24 -24
  32. package/src/fontfamily/fontfamilyediting.d.ts +39 -39
  33. package/src/fontfamily/fontfamilyediting.js +115 -115
  34. package/src/fontfamily/fontfamilyui.d.ts +30 -30
  35. package/src/fontfamily/fontfamilyui.js +114 -114
  36. package/src/fontfamily/utils.d.ts +15 -15
  37. package/src/fontfamily/utils.js +80 -80
  38. package/src/fontfamily.d.ts +29 -29
  39. package/src/fontfamily.js +33 -33
  40. package/src/fontsize/fontsizecommand.d.ts +25 -25
  41. package/src/fontsize/fontsizecommand.js +24 -24
  42. package/src/fontsize/fontsizeediting.d.ts +44 -44
  43. package/src/fontsize/fontsizeediting.js +165 -165
  44. package/src/fontsize/fontsizeui.d.ts +31 -31
  45. package/src/fontsize/fontsizeui.js +122 -122
  46. package/src/fontsize/utils.d.ts +12 -12
  47. package/src/fontsize/utils.js +166 -166
  48. package/src/fontsize.d.ts +37 -37
  49. package/src/fontsize.js +43 -43
  50. package/src/index.d.ts +27 -27
  51. package/src/index.js +21 -21
  52. package/src/ui/colortableview.d.ts +459 -459
  53. package/src/ui/colortableview.js +645 -645
  54. package/src/ui/colorui.d.ts +67 -67
  55. package/src/ui/colorui.js +128 -128
  56. package/src/utils.d.ts +79 -79
  57. package/src/utils.js +98 -98
@@ -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
+ }