@ckeditor/ckeditor5-remove-format 47.6.1 → 48.0.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/ckeditor5-metadata.json +2 -2
- package/dist/index.css +3 -0
- package/dist/index.css.map +1 -0
- package/dist/index.js +11 -4
- package/dist/index.js.map +1 -1
- package/{src → dist}/removeformat.d.ts +1 -1
- package/{src → dist}/removeformatcommand.d.ts +2 -2
- package/{src → dist}/removeformatediting.d.ts +1 -1
- package/{src → dist}/removeformatui.d.ts +1 -1
- package/package.json +23 -44
- package/build/remove-format.js +0 -5
- package/build/translations/af.js +0 -1
- package/build/translations/ar.js +0 -1
- package/build/translations/ast.js +0 -1
- package/build/translations/az.js +0 -1
- package/build/translations/be.js +0 -1
- package/build/translations/bg.js +0 -1
- package/build/translations/bn.js +0 -1
- package/build/translations/bs.js +0 -1
- package/build/translations/ca.js +0 -1
- package/build/translations/cs.js +0 -1
- package/build/translations/da.js +0 -1
- package/build/translations/de-ch.js +0 -1
- package/build/translations/de.js +0 -1
- package/build/translations/el.js +0 -1
- package/build/translations/en-au.js +0 -1
- package/build/translations/en-gb.js +0 -1
- package/build/translations/eo.js +0 -1
- package/build/translations/es-co.js +0 -1
- package/build/translations/es.js +0 -1
- package/build/translations/et.js +0 -1
- package/build/translations/eu.js +0 -1
- package/build/translations/fa.js +0 -1
- package/build/translations/fi.js +0 -1
- package/build/translations/fr.js +0 -1
- package/build/translations/gl.js +0 -1
- package/build/translations/gu.js +0 -1
- package/build/translations/he.js +0 -1
- package/build/translations/hi.js +0 -1
- package/build/translations/hr.js +0 -1
- package/build/translations/hu.js +0 -1
- package/build/translations/hy.js +0 -1
- package/build/translations/id.js +0 -1
- package/build/translations/it.js +0 -1
- package/build/translations/ja.js +0 -1
- package/build/translations/jv.js +0 -1
- package/build/translations/kk.js +0 -1
- package/build/translations/km.js +0 -1
- package/build/translations/kn.js +0 -1
- package/build/translations/ko.js +0 -1
- package/build/translations/ku.js +0 -1
- package/build/translations/lt.js +0 -1
- package/build/translations/lv.js +0 -1
- package/build/translations/ms.js +0 -1
- package/build/translations/nb.js +0 -1
- package/build/translations/ne.js +0 -1
- package/build/translations/nl.js +0 -1
- package/build/translations/no.js +0 -1
- package/build/translations/oc.js +0 -1
- package/build/translations/pl.js +0 -1
- package/build/translations/pt-br.js +0 -1
- package/build/translations/pt.js +0 -1
- package/build/translations/ro.js +0 -1
- package/build/translations/ru.js +0 -1
- package/build/translations/si.js +0 -1
- package/build/translations/sk.js +0 -1
- package/build/translations/sl.js +0 -1
- package/build/translations/sq.js +0 -1
- package/build/translations/sr-latn.js +0 -1
- package/build/translations/sr.js +0 -1
- package/build/translations/sv.js +0 -1
- package/build/translations/th.js +0 -1
- package/build/translations/ti.js +0 -1
- package/build/translations/tk.js +0 -1
- package/build/translations/tr.js +0 -1
- package/build/translations/tt.js +0 -1
- package/build/translations/ug.js +0 -1
- package/build/translations/uk.js +0 -1
- package/build/translations/ur.js +0 -1
- package/build/translations/uz.js +0 -1
- package/build/translations/vi.js +0 -1
- package/build/translations/zh-cn.js +0 -1
- package/build/translations/zh.js +0 -1
- package/lang/contexts.json +0 -3
- package/lang/translations/af.po +0 -16
- package/lang/translations/ar.po +0 -16
- package/lang/translations/ast.po +0 -16
- package/lang/translations/az.po +0 -16
- package/lang/translations/be.po +0 -16
- package/lang/translations/bg.po +0 -16
- package/lang/translations/bn.po +0 -16
- package/lang/translations/bs.po +0 -16
- package/lang/translations/ca.po +0 -16
- package/lang/translations/cs.po +0 -16
- package/lang/translations/da.po +0 -16
- package/lang/translations/de-ch.po +0 -16
- package/lang/translations/de.po +0 -16
- package/lang/translations/el.po +0 -16
- package/lang/translations/en-au.po +0 -16
- package/lang/translations/en-gb.po +0 -16
- package/lang/translations/en.po +0 -16
- package/lang/translations/eo.po +0 -16
- package/lang/translations/es-co.po +0 -16
- package/lang/translations/es.po +0 -16
- package/lang/translations/et.po +0 -16
- package/lang/translations/eu.po +0 -16
- package/lang/translations/fa.po +0 -16
- package/lang/translations/fi.po +0 -16
- package/lang/translations/fr.po +0 -16
- package/lang/translations/gl.po +0 -16
- package/lang/translations/gu.po +0 -16
- package/lang/translations/he.po +0 -16
- package/lang/translations/hi.po +0 -16
- package/lang/translations/hr.po +0 -16
- package/lang/translations/hu.po +0 -16
- package/lang/translations/hy.po +0 -16
- package/lang/translations/id.po +0 -16
- package/lang/translations/it.po +0 -16
- package/lang/translations/ja.po +0 -16
- package/lang/translations/jv.po +0 -16
- package/lang/translations/kk.po +0 -16
- package/lang/translations/km.po +0 -16
- package/lang/translations/kn.po +0 -16
- package/lang/translations/ko.po +0 -16
- package/lang/translations/ku.po +0 -16
- package/lang/translations/lt.po +0 -16
- package/lang/translations/lv.po +0 -16
- package/lang/translations/ms.po +0 -16
- package/lang/translations/nb.po +0 -16
- package/lang/translations/ne.po +0 -16
- package/lang/translations/nl.po +0 -16
- package/lang/translations/no.po +0 -16
- package/lang/translations/oc.po +0 -16
- package/lang/translations/pl.po +0 -16
- package/lang/translations/pt-br.po +0 -16
- package/lang/translations/pt.po +0 -16
- package/lang/translations/ro.po +0 -16
- package/lang/translations/ru.po +0 -16
- package/lang/translations/si.po +0 -16
- package/lang/translations/sk.po +0 -16
- package/lang/translations/sl.po +0 -16
- package/lang/translations/sq.po +0 -16
- package/lang/translations/sr-latn.po +0 -16
- package/lang/translations/sr.po +0 -16
- package/lang/translations/sv.po +0 -16
- package/lang/translations/th.po +0 -16
- package/lang/translations/ti.po +0 -16
- package/lang/translations/tk.po +0 -16
- package/lang/translations/tr.po +0 -16
- package/lang/translations/tt.po +0 -16
- package/lang/translations/ug.po +0 -16
- package/lang/translations/uk.po +0 -16
- package/lang/translations/ur.po +0 -16
- package/lang/translations/uz.po +0 -16
- package/lang/translations/vi.po +0 -16
- package/lang/translations/zh-cn.po +0 -16
- package/lang/translations/zh.po +0 -16
- package/src/augmentation.js +0 -5
- package/src/index.js +0 -12
- package/src/removeformat.js +0 -38
- package/src/removeformatcommand.js +0 -132
- package/src/removeformatediting.js +0 -48
- package/src/removeformatui.js +0 -64
- /package/{src → dist}/augmentation.d.ts +0 -0
- /package/{src → dist}/index.d.ts +0 -0
package/lang/translations/ur.po
DELETED
|
@@ -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 "فارمیٹ ہٹائیں"
|
package/lang/translations/uz.po
DELETED
|
@@ -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"
|
package/lang/translations/vi.po
DELETED
|
@@ -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 "移除格式"
|
package/lang/translations/zh.po
DELETED
|
@@ -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 "移除格式"
|
package/src/augmentation.js
DELETED
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';
|
package/src/removeformat.js
DELETED
|
@@ -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
|
-
}
|
package/src/removeformatui.js
DELETED
|
@@ -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
|
/package/{src → dist}/index.d.ts
RENAMED
|
File without changes
|