@ckeditor/ckeditor5-remove-format 47.6.1 → 48.0.0-alpha.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 (165) hide show
  1. package/ckeditor5-metadata.json +2 -2
  2. package/dist/index.css +3 -0
  3. package/dist/index.css.map +1 -0
  4. package/dist/index.js +11 -4
  5. package/dist/index.js.map +1 -1
  6. package/{src → dist}/removeformat.d.ts +1 -1
  7. package/{src → dist}/removeformatcommand.d.ts +2 -2
  8. package/{src → dist}/removeformatediting.d.ts +1 -1
  9. package/{src → dist}/removeformatui.d.ts +1 -1
  10. package/package.json +23 -44
  11. package/build/remove-format.js +0 -5
  12. package/build/translations/af.js +0 -1
  13. package/build/translations/ar.js +0 -1
  14. package/build/translations/ast.js +0 -1
  15. package/build/translations/az.js +0 -1
  16. package/build/translations/be.js +0 -1
  17. package/build/translations/bg.js +0 -1
  18. package/build/translations/bn.js +0 -1
  19. package/build/translations/bs.js +0 -1
  20. package/build/translations/ca.js +0 -1
  21. package/build/translations/cs.js +0 -1
  22. package/build/translations/da.js +0 -1
  23. package/build/translations/de-ch.js +0 -1
  24. package/build/translations/de.js +0 -1
  25. package/build/translations/el.js +0 -1
  26. package/build/translations/en-au.js +0 -1
  27. package/build/translations/en-gb.js +0 -1
  28. package/build/translations/eo.js +0 -1
  29. package/build/translations/es-co.js +0 -1
  30. package/build/translations/es.js +0 -1
  31. package/build/translations/et.js +0 -1
  32. package/build/translations/eu.js +0 -1
  33. package/build/translations/fa.js +0 -1
  34. package/build/translations/fi.js +0 -1
  35. package/build/translations/fr.js +0 -1
  36. package/build/translations/gl.js +0 -1
  37. package/build/translations/gu.js +0 -1
  38. package/build/translations/he.js +0 -1
  39. package/build/translations/hi.js +0 -1
  40. package/build/translations/hr.js +0 -1
  41. package/build/translations/hu.js +0 -1
  42. package/build/translations/hy.js +0 -1
  43. package/build/translations/id.js +0 -1
  44. package/build/translations/it.js +0 -1
  45. package/build/translations/ja.js +0 -1
  46. package/build/translations/jv.js +0 -1
  47. package/build/translations/kk.js +0 -1
  48. package/build/translations/km.js +0 -1
  49. package/build/translations/kn.js +0 -1
  50. package/build/translations/ko.js +0 -1
  51. package/build/translations/ku.js +0 -1
  52. package/build/translations/lt.js +0 -1
  53. package/build/translations/lv.js +0 -1
  54. package/build/translations/ms.js +0 -1
  55. package/build/translations/nb.js +0 -1
  56. package/build/translations/ne.js +0 -1
  57. package/build/translations/nl.js +0 -1
  58. package/build/translations/no.js +0 -1
  59. package/build/translations/oc.js +0 -1
  60. package/build/translations/pl.js +0 -1
  61. package/build/translations/pt-br.js +0 -1
  62. package/build/translations/pt.js +0 -1
  63. package/build/translations/ro.js +0 -1
  64. package/build/translations/ru.js +0 -1
  65. package/build/translations/si.js +0 -1
  66. package/build/translations/sk.js +0 -1
  67. package/build/translations/sl.js +0 -1
  68. package/build/translations/sq.js +0 -1
  69. package/build/translations/sr-latn.js +0 -1
  70. package/build/translations/sr.js +0 -1
  71. package/build/translations/sv.js +0 -1
  72. package/build/translations/th.js +0 -1
  73. package/build/translations/ti.js +0 -1
  74. package/build/translations/tk.js +0 -1
  75. package/build/translations/tr.js +0 -1
  76. package/build/translations/tt.js +0 -1
  77. package/build/translations/ug.js +0 -1
  78. package/build/translations/uk.js +0 -1
  79. package/build/translations/ur.js +0 -1
  80. package/build/translations/uz.js +0 -1
  81. package/build/translations/vi.js +0 -1
  82. package/build/translations/zh-cn.js +0 -1
  83. package/build/translations/zh.js +0 -1
  84. package/lang/contexts.json +0 -3
  85. package/lang/translations/af.po +0 -16
  86. package/lang/translations/ar.po +0 -16
  87. package/lang/translations/ast.po +0 -16
  88. package/lang/translations/az.po +0 -16
  89. package/lang/translations/be.po +0 -16
  90. package/lang/translations/bg.po +0 -16
  91. package/lang/translations/bn.po +0 -16
  92. package/lang/translations/bs.po +0 -16
  93. package/lang/translations/ca.po +0 -16
  94. package/lang/translations/cs.po +0 -16
  95. package/lang/translations/da.po +0 -16
  96. package/lang/translations/de-ch.po +0 -16
  97. package/lang/translations/de.po +0 -16
  98. package/lang/translations/el.po +0 -16
  99. package/lang/translations/en-au.po +0 -16
  100. package/lang/translations/en-gb.po +0 -16
  101. package/lang/translations/en.po +0 -16
  102. package/lang/translations/eo.po +0 -16
  103. package/lang/translations/es-co.po +0 -16
  104. package/lang/translations/es.po +0 -16
  105. package/lang/translations/et.po +0 -16
  106. package/lang/translations/eu.po +0 -16
  107. package/lang/translations/fa.po +0 -16
  108. package/lang/translations/fi.po +0 -16
  109. package/lang/translations/fr.po +0 -16
  110. package/lang/translations/gl.po +0 -16
  111. package/lang/translations/gu.po +0 -16
  112. package/lang/translations/he.po +0 -16
  113. package/lang/translations/hi.po +0 -16
  114. package/lang/translations/hr.po +0 -16
  115. package/lang/translations/hu.po +0 -16
  116. package/lang/translations/hy.po +0 -16
  117. package/lang/translations/id.po +0 -16
  118. package/lang/translations/it.po +0 -16
  119. package/lang/translations/ja.po +0 -16
  120. package/lang/translations/jv.po +0 -16
  121. package/lang/translations/kk.po +0 -16
  122. package/lang/translations/km.po +0 -16
  123. package/lang/translations/kn.po +0 -16
  124. package/lang/translations/ko.po +0 -16
  125. package/lang/translations/ku.po +0 -16
  126. package/lang/translations/lt.po +0 -16
  127. package/lang/translations/lv.po +0 -16
  128. package/lang/translations/ms.po +0 -16
  129. package/lang/translations/nb.po +0 -16
  130. package/lang/translations/ne.po +0 -16
  131. package/lang/translations/nl.po +0 -16
  132. package/lang/translations/no.po +0 -16
  133. package/lang/translations/oc.po +0 -16
  134. package/lang/translations/pl.po +0 -16
  135. package/lang/translations/pt-br.po +0 -16
  136. package/lang/translations/pt.po +0 -16
  137. package/lang/translations/ro.po +0 -16
  138. package/lang/translations/ru.po +0 -16
  139. package/lang/translations/si.po +0 -16
  140. package/lang/translations/sk.po +0 -16
  141. package/lang/translations/sl.po +0 -16
  142. package/lang/translations/sq.po +0 -16
  143. package/lang/translations/sr-latn.po +0 -16
  144. package/lang/translations/sr.po +0 -16
  145. package/lang/translations/sv.po +0 -16
  146. package/lang/translations/th.po +0 -16
  147. package/lang/translations/ti.po +0 -16
  148. package/lang/translations/tk.po +0 -16
  149. package/lang/translations/tr.po +0 -16
  150. package/lang/translations/tt.po +0 -16
  151. package/lang/translations/ug.po +0 -16
  152. package/lang/translations/uk.po +0 -16
  153. package/lang/translations/ur.po +0 -16
  154. package/lang/translations/uz.po +0 -16
  155. package/lang/translations/vi.po +0 -16
  156. package/lang/translations/zh-cn.po +0 -16
  157. package/lang/translations/zh.po +0 -16
  158. package/src/augmentation.js +0 -5
  159. package/src/index.js +0 -12
  160. package/src/removeformat.js +0 -38
  161. package/src/removeformatcommand.js +0 -132
  162. package/src/removeformatediting.js +0 -48
  163. package/src/removeformatui.js +0 -64
  164. /package/{src → dist}/augmentation.d.ts +0 -0
  165. /package/{src → dist}/index.d.ts +0 -0
@@ -1,16 +0,0 @@
1
- # Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
2
- #
3
- # Want to contribute to this file? Submit your changes via a GitHub Pull Request.
4
- #
5
- # Check out the official contributor's guide:
6
- # https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
7
- #
8
- msgid ""
9
- msgstr ""
10
- "Language: ur\n"
11
- "Plural-Forms: nplurals=2; plural=(n != 1);\n"
12
- "Content-Type: text/plain; charset=UTF-8\n"
13
-
14
- msgctxt "The label of the remove format toolbar button."
15
- msgid "Remove Format"
16
- msgstr "فارمیٹ ہٹائیں"
@@ -1,16 +0,0 @@
1
- # Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
2
- #
3
- # Want to contribute to this file? Submit your changes via a GitHub Pull Request.
4
- #
5
- # Check out the official contributor's guide:
6
- # https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
7
- #
8
- msgid ""
9
- msgstr ""
10
- "Language: uz\n"
11
- "Plural-Forms: nplurals=2; plural=(n > 1);\n"
12
- "Content-Type: text/plain; charset=UTF-8\n"
13
-
14
- msgctxt "The label of the remove format toolbar button."
15
- msgid "Remove Format"
16
- msgstr "Formatlashni olib tashlash"
@@ -1,16 +0,0 @@
1
- # Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
2
- #
3
- # Want to contribute to this file? Submit your changes via a GitHub Pull Request.
4
- #
5
- # Check out the official contributor's guide:
6
- # https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
7
- #
8
- msgid ""
9
- msgstr ""
10
- "Language: vi\n"
11
- "Plural-Forms: nplurals=1; plural=0;\n"
12
- "Content-Type: text/plain; charset=UTF-8\n"
13
-
14
- msgctxt "The label of the remove format toolbar button."
15
- msgid "Remove Format"
16
- msgstr "Xóa định dang"
@@ -1,16 +0,0 @@
1
- # Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
2
- #
3
- # Want to contribute to this file? Submit your changes via a GitHub Pull Request.
4
- #
5
- # Check out the official contributor's guide:
6
- # https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
7
- #
8
- msgid ""
9
- msgstr ""
10
- "Language: zh_CN\n"
11
- "Plural-Forms: nplurals=1; plural=0;\n"
12
- "Content-Type: text/plain; charset=UTF-8\n"
13
-
14
- msgctxt "The label of the remove format toolbar button."
15
- msgid "Remove Format"
16
- msgstr "移除格式"
@@ -1,16 +0,0 @@
1
- # Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
2
- #
3
- # Want to contribute to this file? Submit your changes via a GitHub Pull Request.
4
- #
5
- # Check out the official contributor's guide:
6
- # https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
7
- #
8
- msgid ""
9
- msgstr ""
10
- "Language: zh_TW\n"
11
- "Plural-Forms: nplurals=1; plural=0;\n"
12
- "Content-Type: text/plain; charset=UTF-8\n"
13
-
14
- msgctxt "The label of the remove format toolbar button."
15
- msgid "Remove Format"
16
- msgstr "移除格式"
@@ -1,5 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- export {};
package/src/index.js DELETED
@@ -1,12 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- /**
6
- * @module remove-format
7
- */
8
- export { RemoveFormat } from './removeformat.js';
9
- export { RemoveFormatEditing } from './removeformatediting.js';
10
- export { RemoveFormatUI } from './removeformatui.js';
11
- export { RemoveFormatCommand } from './removeformatcommand.js';
12
- import './augmentation.js';
@@ -1,38 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- /**
6
- * @module remove-format/removeformat
7
- */
8
- import { Plugin } from 'ckeditor5/src/core.js';
9
- import { RemoveFormatUI } from './removeformatui.js';
10
- import { RemoveFormatEditing } from './removeformatediting.js';
11
- /**
12
- * The remove format plugin.
13
- *
14
- * This is a "glue" plugin which loads the {@link module:remove-format/removeformatediting~RemoveFormatEditing}
15
- * and {@link module:remove-format/removeformatui~RemoveFormatUI} plugins.
16
- *
17
- * For a detailed overview, check out the {@glink features/remove-format remove format} feature documentation.
18
- */
19
- export class RemoveFormat extends Plugin {
20
- /**
21
- * @inheritDoc
22
- */
23
- static get requires() {
24
- return [RemoveFormatEditing, RemoveFormatUI];
25
- }
26
- /**
27
- * @inheritDoc
28
- */
29
- static get pluginName() {
30
- return 'RemoveFormat';
31
- }
32
- /**
33
- * @inheritDoc
34
- */
35
- static get isOfficialPlugin() {
36
- return true;
37
- }
38
- }
@@ -1,132 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- import { Command } from 'ckeditor5/src/core.js';
6
- import { first } from 'ckeditor5/src/utils.js';
7
- /**
8
- * The remove format command.
9
- *
10
- * It is used by the {@link module:remove-format/removeformat~RemoveFormat remove format feature}
11
- * to clear the formatting in the selection.
12
- *
13
- * ```ts
14
- * editor.execute( 'removeFormat' );
15
- * ```
16
- */
17
- export class RemoveFormatCommand extends Command {
18
- /**
19
- * List of all registered custom attribute handlers.
20
- */
21
- _customAttributesHandlers = [];
22
- /**
23
- * @inheritDoc
24
- */
25
- refresh() {
26
- const model = this.editor.model;
27
- this.isEnabled = !!first(this._getFormattingItems(model.document.selection));
28
- }
29
- /**
30
- * @inheritDoc
31
- */
32
- execute() {
33
- const model = this.editor.model;
34
- model.change(writer => {
35
- for (const item of this._getFormattingItems(model.document.selection)) {
36
- if (item.is('selection')) {
37
- for (const attributeName of this._getFormattingAttributes(item)) {
38
- writer.removeSelectionAttribute(attributeName);
39
- }
40
- }
41
- else {
42
- // Workaround for items with multiple removable attributes. See
43
- // https://github.com/ckeditor/ckeditor5-remove-format/pull/1#pullrequestreview-220515609
44
- const itemRange = writer.createRangeOn(item);
45
- for (const attributeName of this._getFormattingAttributes(item)) {
46
- this._removeFormatting(attributeName, item, itemRange, writer);
47
- }
48
- }
49
- }
50
- });
51
- }
52
- /**
53
- * Registers a custom attribute handler that will be used to determine if an attribute is formatting and how to remove it.
54
- *
55
- * @internal
56
- */
57
- registerCustomAttribute(isFormatting, removeFormatting) {
58
- this._customAttributesHandlers.push({
59
- isFormatting,
60
- removeFormatting
61
- });
62
- }
63
- /**
64
- * Helper method that removes a formatting attribute from an item either using custom callbacks or writer remove attribute.
65
- */
66
- _removeFormatting(attributeName, item, itemRange, writer) {
67
- let customHandled = false;
68
- for (const { isFormatting, removeFormatting } of this._customAttributesHandlers) {
69
- if (isFormatting(attributeName, item)) {
70
- removeFormatting(attributeName, itemRange, writer);
71
- customHandled = true;
72
- }
73
- }
74
- if (!customHandled) {
75
- writer.removeAttribute(attributeName, itemRange);
76
- }
77
- }
78
- /**
79
- * Returns an iterable of items in a selection (including the selection itself) that have formatting model
80
- * attributes to be removed by the feature.
81
- */
82
- *_getFormattingItems(selection) {
83
- const model = this.editor.model;
84
- const schema = model.schema;
85
- const itemHasRemovableFormatting = (item) => {
86
- return !!first(this._getFormattingAttributes(item));
87
- };
88
- // Check formatting on selected items.
89
- for (const curRange of selection.getRanges()) {
90
- for (const item of curRange.getItems()) {
91
- // Ignore last block if range ends at the beginning of it.
92
- if (schema.isBlock(item) && curRange.end.isTouching(model.createPositionAt(item, 0))) {
93
- continue;
94
- }
95
- if (itemHasRemovableFormatting(item)) {
96
- yield item;
97
- }
98
- }
99
- }
100
- // Check formatting from selected blocks (to include partly selected blocks).
101
- for (const block of selection.getSelectedBlocks()) {
102
- if (itemHasRemovableFormatting(block)) {
103
- yield block;
104
- }
105
- }
106
- // Finally the selection might be formatted as well, so make sure to check it.
107
- if (itemHasRemovableFormatting(selection)) {
108
- yield selection;
109
- }
110
- }
111
- /**
112
- * Returns an iterable of formatting attributes of a given model item.
113
- *
114
- * **Note:** Formatting items have the `isFormatting` property set to `true`.
115
- *
116
- * @returns The names of formatting attributes found in a given item.
117
- */
118
- *_getFormattingAttributes(item) {
119
- const schema = this.editor.model.schema;
120
- for (const [attributeName] of item.getAttributes()) {
121
- for (const { isFormatting } of this._customAttributesHandlers) {
122
- if (isFormatting(attributeName, item)) {
123
- yield attributeName;
124
- }
125
- }
126
- const attributeProperties = schema.getAttributeProperties(attributeName);
127
- if (attributeProperties && attributeProperties.isFormatting) {
128
- yield attributeName;
129
- }
130
- }
131
- }
132
- }
@@ -1,48 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- /**
6
- * @module remove-format/removeformatediting
7
- */
8
- import { Plugin } from 'ckeditor5/src/core.js';
9
- import { RemoveFormatCommand } from './removeformatcommand.js';
10
- /**
11
- * The remove format editing plugin.
12
- *
13
- * It registers the {@link module:remove-format/removeformatcommand~RemoveFormatCommand removeFormat} command.
14
- */
15
- export class RemoveFormatEditing extends Plugin {
16
- /**
17
- * @inheritDoc
18
- */
19
- static get pluginName() {
20
- return 'RemoveFormatEditing';
21
- }
22
- /**
23
- * @inheritDoc
24
- * @internal
25
- */
26
- static get licenseFeatureCode() {
27
- return 'RF';
28
- }
29
- /**
30
- * @inheritDoc
31
- */
32
- static get isOfficialPlugin() {
33
- return true;
34
- }
35
- /**
36
- * @inheritDoc
37
- */
38
- static get isPremiumPlugin() {
39
- return true;
40
- }
41
- /**
42
- * @inheritDoc
43
- */
44
- init() {
45
- const editor = this.editor;
46
- editor.commands.add('removeFormat', new RemoveFormatCommand(editor));
47
- }
48
- }
@@ -1,64 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- /**
6
- * @module remove-format/removeformatui
7
- */
8
- import { Plugin } from 'ckeditor5/src/core.js';
9
- import { IconRemoveFormat } from 'ckeditor5/src/icons.js';
10
- import { ButtonView, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';
11
- const REMOVE_FORMAT = 'removeFormat';
12
- /**
13
- * The remove format UI plugin. It registers the `'removeFormat'` button which can be
14
- * used in the toolbar.
15
- */
16
- export class RemoveFormatUI extends Plugin {
17
- /**
18
- * @inheritDoc
19
- */
20
- static get pluginName() {
21
- return 'RemoveFormatUI';
22
- }
23
- /**
24
- * @inheritDoc
25
- */
26
- static get isOfficialPlugin() {
27
- return true;
28
- }
29
- /**
30
- * @inheritDoc
31
- */
32
- init() {
33
- const editor = this.editor;
34
- editor.ui.componentFactory.add(REMOVE_FORMAT, () => {
35
- const view = this._createButton(ButtonView);
36
- view.set({
37
- tooltip: true
38
- });
39
- return view;
40
- });
41
- editor.ui.componentFactory.add(`menuBar:${REMOVE_FORMAT}`, () => this._createButton(MenuBarMenuListItemButtonView));
42
- }
43
- /**
44
- * Creates a button for remove format command to use either in toolbar or in menu bar.
45
- */
46
- _createButton(ButtonClass) {
47
- const editor = this.editor;
48
- const locale = editor.locale;
49
- const command = editor.commands.get(REMOVE_FORMAT);
50
- const view = new ButtonClass(editor.locale);
51
- const t = locale.t;
52
- view.set({
53
- label: t('Remove Format'),
54
- icon: IconRemoveFormat
55
- });
56
- view.bind('isEnabled').to(command, 'isEnabled');
57
- // Execute the command.
58
- this.listenTo(view, 'execute', () => {
59
- editor.execute(REMOVE_FORMAT);
60
- editor.editing.view.focus();
61
- });
62
- return view;
63
- }
64
- }
File without changes
File without changes