@ckeditor/ckeditor5-font 39.0.1 → 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 (113) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/LICENSE.md +1 -1
  3. package/README.md +3 -3
  4. package/build/font.js.map +1 -0
  5. package/lang/translations/ar.po +1 -0
  6. package/lang/translations/az.po +1 -0
  7. package/lang/translations/bg.po +1 -0
  8. package/lang/translations/bn.po +1 -0
  9. package/lang/translations/bs.po +1 -0
  10. package/lang/translations/ca.po +1 -0
  11. package/lang/translations/cs.po +1 -0
  12. package/lang/translations/da.po +1 -0
  13. package/lang/translations/de-ch.po +1 -0
  14. package/lang/translations/de.po +1 -0
  15. package/lang/translations/el.po +1 -0
  16. package/lang/translations/en-au.po +1 -0
  17. package/lang/translations/en-gb.po +1 -0
  18. package/lang/translations/en.po +1 -0
  19. package/lang/translations/es.po +1 -0
  20. package/lang/translations/et.po +1 -0
  21. package/lang/translations/fa.po +1 -0
  22. package/lang/translations/fi.po +1 -0
  23. package/lang/translations/fr.po +1 -0
  24. package/lang/translations/gl.po +1 -0
  25. package/lang/translations/he.po +1 -0
  26. package/lang/translations/hi.po +1 -0
  27. package/lang/translations/hr.po +1 -0
  28. package/lang/translations/hu.po +1 -0
  29. package/lang/translations/id.po +1 -0
  30. package/lang/translations/it.po +1 -0
  31. package/lang/translations/ja.po +1 -0
  32. package/lang/translations/jv.po +1 -0
  33. package/lang/translations/ko.po +1 -0
  34. package/lang/translations/ku.po +1 -0
  35. package/lang/translations/lt.po +1 -0
  36. package/lang/translations/lv.po +1 -0
  37. package/lang/translations/ms.po +1 -0
  38. package/lang/translations/nb.po +1 -0
  39. package/lang/translations/ne.po +1 -0
  40. package/lang/translations/nl.po +1 -0
  41. package/lang/translations/no.po +1 -0
  42. package/lang/translations/pl.po +1 -0
  43. package/lang/translations/pt-br.po +1 -0
  44. package/lang/translations/pt.po +1 -0
  45. package/lang/translations/ro.po +1 -0
  46. package/lang/translations/ru.po +1 -0
  47. package/lang/translations/sk.po +1 -0
  48. package/lang/translations/sl.po +1 -0
  49. package/lang/translations/sq.po +1 -0
  50. package/lang/translations/sr-latn.po +1 -0
  51. package/lang/translations/sr.po +1 -0
  52. package/lang/translations/sv.po +1 -0
  53. package/lang/translations/th.po +1 -0
  54. package/lang/translations/tk.po +1 -0
  55. package/lang/translations/tr.po +1 -0
  56. package/lang/translations/ug.po +1 -0
  57. package/lang/translations/uk.po +1 -0
  58. package/lang/translations/ur.po +1 -0
  59. package/lang/translations/uz.po +1 -0
  60. package/lang/translations/vi.po +1 -0
  61. package/lang/translations/zh-cn.po +1 -0
  62. package/lang/translations/zh.po +1 -0
  63. package/package.json +2 -6
  64. package/src/augmentation.d.ts +58 -58
  65. package/src/augmentation.js +5 -5
  66. package/src/font.d.ts +33 -33
  67. package/src/font.js +37 -37
  68. package/src/fontbackgroundcolor/fontbackgroundcolorcommand.d.ts +26 -26
  69. package/src/fontbackgroundcolor/fontbackgroundcolorcommand.js +25 -25
  70. package/src/fontbackgroundcolor/fontbackgroundcolorediting.d.ts +26 -26
  71. package/src/fontbackgroundcolor/fontbackgroundcolorediting.js +123 -123
  72. package/src/fontbackgroundcolor/fontbackgroundcolorui.d.ts +22 -22
  73. package/src/fontbackgroundcolor/fontbackgroundcolorui.js +33 -33
  74. package/src/fontbackgroundcolor.d.ts +30 -30
  75. package/src/fontbackgroundcolor.js +34 -34
  76. package/src/fontcolor/fontcolorcommand.d.ts +25 -25
  77. package/src/fontcolor/fontcolorcommand.js +24 -24
  78. package/src/fontcolor/fontcolorediting.d.ts +26 -26
  79. package/src/fontcolor/fontcolorediting.js +134 -134
  80. package/src/fontcolor/fontcolorui.d.ts +22 -22
  81. package/src/fontcolor/fontcolorui.js +33 -33
  82. package/src/fontcolor.d.ts +29 -29
  83. package/src/fontcolor.js +33 -33
  84. package/src/fontcommand.d.ts +48 -48
  85. package/src/fontcommand.js +79 -79
  86. package/src/fontconfig.d.ts +373 -373
  87. package/src/fontconfig.js +5 -5
  88. package/src/fontfamily/fontfamilycommand.d.ts +25 -25
  89. package/src/fontfamily/fontfamilycommand.js +24 -24
  90. package/src/fontfamily/fontfamilyediting.d.ts +39 -39
  91. package/src/fontfamily/fontfamilyediting.js +115 -115
  92. package/src/fontfamily/fontfamilyui.d.ts +30 -30
  93. package/src/fontfamily/fontfamilyui.js +114 -114
  94. package/src/fontfamily/utils.d.ts +15 -15
  95. package/src/fontfamily/utils.js +80 -80
  96. package/src/fontfamily.d.ts +29 -29
  97. package/src/fontfamily.js +33 -33
  98. package/src/fontsize/fontsizecommand.d.ts +25 -25
  99. package/src/fontsize/fontsizecommand.js +24 -24
  100. package/src/fontsize/fontsizeediting.d.ts +44 -44
  101. package/src/fontsize/fontsizeediting.js +165 -165
  102. package/src/fontsize/fontsizeui.d.ts +31 -31
  103. package/src/fontsize/fontsizeui.js +122 -122
  104. package/src/fontsize/utils.d.ts +12 -12
  105. package/src/fontsize/utils.js +166 -166
  106. package/src/fontsize.d.ts +37 -37
  107. package/src/fontsize.js +43 -43
  108. package/src/index.d.ts +27 -27
  109. package/src/index.js +21 -21
  110. package/src/ui/colorui.d.ts +68 -68
  111. package/src/ui/colorui.js +130 -130
  112. package/src/utils.d.ts +80 -80
  113. package/src/utils.js +97 -97
@@ -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
+ }