@ckeditor/ckeditor5-show-blocks 40.0.0 → 40.2.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/LICENSE.md CHANGED
@@ -2,7 +2,7 @@ Software License Agreement
2
2
  ==========================
3
3
 
4
4
  **CKEditor&nbsp;5 show blocks feature** – https://github.com/ckeditor/packages/ckeditor5-show-blocks <br>
5
- Copyright (c) 2003-2023, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
5
+ Copyright (c) 20032023, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
6
6
 
7
7
  Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html).
8
8
 
@@ -14,4 +14,4 @@ Where not otherwise indicated, all CKEditor content is authored by CKSource engi
14
14
  Trademarks
15
15
  ----------
16
16
 
17
- **CKEditor** is a trademark of [CKSource Holding sp. z o.o.](https://cksource.com) All other brand and product names are trademarks, registered trademarks or service marks of their respective holders.
17
+ **CKEditor** is a trademark of [CKSource Holding sp. z o.o.](https://cksource.com) All other brand and product names are trademarks, registered trademarks, or service marks of their respective holders.
@@ -0,0 +1 @@
1
+ !function(i){const n=i["sr-latn"]=i["sr-latn"]||{};n.dictionary=Object.assign(n.dictionary||{},{"Show blocks":"Prikaži blokove"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
@@ -0,0 +1,22 @@
1
+ # Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ #
3
+ # !!! IMPORTANT !!!
4
+ #
5
+ # Before you edit this file, please keep in mind that contributing to the project
6
+ # translations is possible ONLY via the Transifex online service.
7
+ #
8
+ # To submit your translations, visit https://www.transifex.com/ckeditor/ckeditor5.
9
+ #
10
+ # To learn more, check out the official contributor's guide:
11
+ # https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
12
+ #
13
+ msgid ""
14
+ msgstr ""
15
+ "Language-Team: Serbian (Latin) (https://app.transifex.com/ckeditor/teams/11143/sr@latin/)\n"
16
+ "Language: sr@latin\n"
17
+ "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
19
+
20
+ msgctxt "The label of the show blocks toolbar button."
21
+ msgid "Show blocks"
22
+ msgstr "Prikaži blokove"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-show-blocks",
3
- "version": "40.0.0",
3
+ "version": "40.2.0",
4
4
  "description": "Show blocks feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -12,8 +12,8 @@
12
12
  ],
13
13
  "main": "src/index.js",
14
14
  "dependencies": {
15
- "ckeditor5": "40.0.0",
16
- "@ckeditor/ckeditor5-ui": "40.0.0"
15
+ "ckeditor5": "40.2.0",
16
+ "@ckeditor/ckeditor5-ui": "40.2.0"
17
17
  },
18
18
  "author": "CKSource (http://cksource.com/)",
19
19
  "license": "GPL-2.0-or-later",
@@ -1,15 +1,15 @@
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
- import type { ShowBlocks, ShowBlocksCommand, ShowBlocksEditing, ShowBlocksUI } from './index';
6
- declare module '@ckeditor/ckeditor5-core' {
7
- interface PluginsMap {
8
- [ShowBlocks.pluginName]: ShowBlocks;
9
- [ShowBlocksEditing.pluginName]: ShowBlocksEditing;
10
- [ShowBlocksUI.pluginName]: ShowBlocksUI;
11
- }
12
- interface CommandsMap {
13
- showBlocks: ShowBlocksCommand;
14
- }
15
- }
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
+ import type { ShowBlocks, ShowBlocksCommand, ShowBlocksEditing, ShowBlocksUI } from './index';
6
+ declare module '@ckeditor/ckeditor5-core' {
7
+ interface PluginsMap {
8
+ [ShowBlocks.pluginName]: ShowBlocks;
9
+ [ShowBlocksEditing.pluginName]: ShowBlocksEditing;
10
+ [ShowBlocksUI.pluginName]: ShowBlocksUI;
11
+ }
12
+ interface CommandsMap {
13
+ showBlocks: ShowBlocksCommand;
14
+ }
15
+ }
@@ -1,5 +1,5 @@
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
- export {};
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
+ export {};
package/src/index.d.ts CHANGED
@@ -1,12 +1,12 @@
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 show-blocks
7
- */
8
- export { default as ShowBlocks } from './showblocks';
9
- export { default as ShowBlocksCommand } from './showblockscommand';
10
- export { default as ShowBlocksEditing } from './showblocksediting';
11
- export { default as ShowBlocksUI } from './showblocksui';
12
- import './augmentation';
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 show-blocks
7
+ */
8
+ export { default as ShowBlocks } from './showblocks';
9
+ export { default as ShowBlocksCommand } from './showblockscommand';
10
+ export { default as ShowBlocksEditing } from './showblocksediting';
11
+ export { default as ShowBlocksUI } from './showblocksui';
12
+ import './augmentation';
package/src/index.js CHANGED
@@ -1,12 +1,12 @@
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 show-blocks
7
- */
8
- export { default as ShowBlocks } from './showblocks';
9
- export { default as ShowBlocksCommand } from './showblockscommand';
10
- export { default as ShowBlocksEditing } from './showblocksediting';
11
- export { default as ShowBlocksUI } from './showblocksui';
12
- import './augmentation';
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 show-blocks
7
+ */
8
+ export { default as ShowBlocks } from './showblocks';
9
+ export { default as ShowBlocksCommand } from './showblockscommand';
10
+ export { default as ShowBlocksEditing } from './showblocksediting';
11
+ export { default as ShowBlocksUI } from './showblocksui';
12
+ import './augmentation';
@@ -1,25 +1,25 @@
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 show-blocks/showblocks
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- import ShowBlocksEditing from './showblocksediting';
10
- import ShowBlocksUI from './showblocksui';
11
- /**
12
- * The show blocks feature.
13
- *
14
- * For a detailed overview, check the {@glink features/show-blocks Show blocks} feature guide.
15
- */
16
- export default class ShowBlocks extends Plugin {
17
- /**
18
- * @inheritDoc
19
- */
20
- static get pluginName(): "ShowBlocks";
21
- /**
22
- * @inheritDoc
23
- */
24
- static get requires(): readonly [typeof ShowBlocksEditing, typeof ShowBlocksUI];
25
- }
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 show-blocks/showblocks
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ import ShowBlocksEditing from './showblocksediting';
10
+ import ShowBlocksUI from './showblocksui';
11
+ /**
12
+ * The show blocks feature.
13
+ *
14
+ * For a detailed overview, check the {@glink features/show-blocks Show blocks} feature guide.
15
+ */
16
+ export default class ShowBlocks extends Plugin {
17
+ /**
18
+ * @inheritDoc
19
+ */
20
+ static get pluginName(): "ShowBlocks";
21
+ /**
22
+ * @inheritDoc
23
+ */
24
+ static get requires(): readonly [typeof ShowBlocksEditing, typeof ShowBlocksUI];
25
+ }
package/src/showblocks.js CHANGED
@@ -1,29 +1,29 @@
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 show-blocks/showblocks
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- import ShowBlocksEditing from './showblocksediting';
10
- import ShowBlocksUI from './showblocksui';
11
- /**
12
- * The show blocks feature.
13
- *
14
- * For a detailed overview, check the {@glink features/show-blocks Show blocks} feature guide.
15
- */
16
- export default class ShowBlocks extends Plugin {
17
- /**
18
- * @inheritDoc
19
- */
20
- static get pluginName() {
21
- return 'ShowBlocks';
22
- }
23
- /**
24
- * @inheritDoc
25
- */
26
- static get requires() {
27
- return [ShowBlocksEditing, ShowBlocksUI];
28
- }
29
- }
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 show-blocks/showblocks
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ import ShowBlocksEditing from './showblocksediting';
10
+ import ShowBlocksUI from './showblocksui';
11
+ /**
12
+ * The show blocks feature.
13
+ *
14
+ * For a detailed overview, check the {@glink features/show-blocks Show blocks} feature guide.
15
+ */
16
+ export default class ShowBlocks extends Plugin {
17
+ /**
18
+ * @inheritDoc
19
+ */
20
+ static get pluginName() {
21
+ return 'ShowBlocks';
22
+ }
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ static get requires() {
27
+ return [ShowBlocksEditing, ShowBlocksUI];
28
+ }
29
+ }
@@ -1,27 +1,27 @@
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 show-blocks/showblockscommand
7
- */
8
- import { Command, type Editor } from 'ckeditor5/src/core';
9
- /**
10
- * The show blocks command.
11
- *
12
- * Displays the HTML element names for content blocks.
13
- */
14
- export default class ShowBlocksCommand extends Command {
15
- /**
16
- * Flag indicating whether the command is active, i.e. content blocks are displayed.
17
- */
18
- value: boolean;
19
- /**
20
- * @inheritDoc
21
- */
22
- constructor(editor: Editor);
23
- /**
24
- * Toggles the visibility of content blocks.
25
- */
26
- execute(): void;
27
- }
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 show-blocks/showblockscommand
7
+ */
8
+ import { Command, type Editor } from 'ckeditor5/src/core';
9
+ /**
10
+ * The show blocks command.
11
+ *
12
+ * Displays the HTML element names for content blocks.
13
+ */
14
+ export default class ShowBlocksCommand extends Command {
15
+ /**
16
+ * Flag indicating whether the command is active, i.e. content blocks are displayed.
17
+ */
18
+ value: boolean;
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ constructor(editor: Editor);
23
+ /**
24
+ * Toggles the visibility of content blocks.
25
+ */
26
+ execute(): void;
27
+ }
@@ -1,44 +1,44 @@
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 show-blocks/showblockscommand
7
- */
8
- import { Command } from 'ckeditor5/src/core';
9
- /**
10
- * The show blocks command.
11
- *
12
- * Displays the HTML element names for content blocks.
13
- */
14
- export default class ShowBlocksCommand extends Command {
15
- /**
16
- * @inheritDoc
17
- */
18
- constructor(editor) {
19
- super(editor);
20
- // It does not affect data so should be enabled in read-only mode.
21
- this.affectsData = false;
22
- this.value = false;
23
- }
24
- /**
25
- * Toggles the visibility of content blocks.
26
- */
27
- execute() {
28
- const CLASS_NAME = 'ck-show-blocks';
29
- const view = this.editor.editing.view;
30
- view.change(writer => {
31
- // Multiroot support.
32
- for (const root of view.document.roots) {
33
- if (!root.hasClass(CLASS_NAME)) {
34
- writer.addClass(CLASS_NAME, root);
35
- this.value = true;
36
- }
37
- else {
38
- writer.removeClass(CLASS_NAME, root);
39
- this.value = false;
40
- }
41
- }
42
- });
43
- }
44
- }
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 show-blocks/showblockscommand
7
+ */
8
+ import { Command } from 'ckeditor5/src/core';
9
+ /**
10
+ * The show blocks command.
11
+ *
12
+ * Displays the HTML element names for content blocks.
13
+ */
14
+ export default class ShowBlocksCommand extends Command {
15
+ /**
16
+ * @inheritDoc
17
+ */
18
+ constructor(editor) {
19
+ super(editor);
20
+ // It does not affect data so should be enabled in read-only mode.
21
+ this.affectsData = false;
22
+ this.value = false;
23
+ }
24
+ /**
25
+ * Toggles the visibility of content blocks.
26
+ */
27
+ execute() {
28
+ const CLASS_NAME = 'ck-show-blocks';
29
+ const view = this.editor.editing.view;
30
+ view.change(writer => {
31
+ // Multiroot support.
32
+ for (const root of view.document.roots) {
33
+ if (!root.hasClass(CLASS_NAME)) {
34
+ writer.addClass(CLASS_NAME, root);
35
+ this.value = true;
36
+ }
37
+ else {
38
+ writer.removeClass(CLASS_NAME, root);
39
+ this.value = false;
40
+ }
41
+ }
42
+ });
43
+ }
44
+ }
@@ -1,21 +1,21 @@
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 show-blocks/showblocksediting
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- /**
10
- * The show blocks editing plugin.
11
- */
12
- export default class ShowBlocksEditing extends Plugin {
13
- /**
14
- * @inheritDoc
15
- */
16
- static get pluginName(): "ShowBlocksEditing";
17
- /**
18
- * @inheritDoc
19
- */
20
- init(): void;
21
- }
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 show-blocks/showblocksediting
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ /**
10
+ * The show blocks editing plugin.
11
+ */
12
+ export default class ShowBlocksEditing extends Plugin {
13
+ /**
14
+ * @inheritDoc
15
+ */
16
+ static get pluginName(): "ShowBlocksEditing";
17
+ /**
18
+ * @inheritDoc
19
+ */
20
+ init(): void;
21
+ }
@@ -1,27 +1,27 @@
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 show-blocks/showblocksediting
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- import ShowBlocksCommand from './showblockscommand';
10
- /**
11
- * The show blocks editing plugin.
12
- */
13
- export default class ShowBlocksEditing extends Plugin {
14
- /**
15
- * @inheritDoc
16
- */
17
- static get pluginName() {
18
- return 'ShowBlocksEditing';
19
- }
20
- /**
21
- * @inheritDoc
22
- */
23
- init() {
24
- const { editor } = this;
25
- editor.commands.add('showBlocks', new ShowBlocksCommand(editor));
26
- }
27
- }
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 show-blocks/showblocksediting
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ import ShowBlocksCommand from './showblockscommand';
10
+ /**
11
+ * The show blocks editing plugin.
12
+ */
13
+ export default class ShowBlocksEditing extends Plugin {
14
+ /**
15
+ * @inheritDoc
16
+ */
17
+ static get pluginName() {
18
+ return 'ShowBlocksEditing';
19
+ }
20
+ /**
21
+ * @inheritDoc
22
+ */
23
+ init() {
24
+ const { editor } = this;
25
+ editor.commands.add('showBlocks', new ShowBlocksCommand(editor));
26
+ }
27
+ }
@@ -1,25 +1,25 @@
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 show-blocks/showblocksui
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- import '../theme/showblocks.css';
10
- /**
11
- * The UI plugin of the show blocks feature.
12
- *
13
- * It registers the `'showBlocks'` UI button in the editor's {@link module:ui/componentfactory~ComponentFactory component factory}
14
- * that toggles the visibility of the HTML element names of content blocks.
15
- */
16
- export default class ShowBlocksUI extends Plugin {
17
- /**
18
- * @inheritDoc
19
- */
20
- static get pluginName(): "ShowBlocksUI";
21
- /**
22
- * @inheritDoc
23
- */
24
- init(): void;
25
- }
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 show-blocks/showblocksui
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ import '../theme/showblocks.css';
10
+ /**
11
+ * The UI plugin of the show blocks feature.
12
+ *
13
+ * It registers the `'showBlocks'` UI button in the editor's {@link module:ui/componentfactory~ComponentFactory component factory}
14
+ * that toggles the visibility of the HTML element names of content blocks.
15
+ */
16
+ export default class ShowBlocksUI extends Plugin {
17
+ /**
18
+ * @inheritDoc
19
+ */
20
+ static get pluginName(): "ShowBlocksUI";
21
+ /**
22
+ * @inheritDoc
23
+ */
24
+ init(): void;
25
+ }
@@ -1,49 +1,49 @@
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 show-blocks/showblocksui
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- import { ButtonView } from 'ckeditor5/src/ui';
10
- import showBlocksIcon from '../theme/icons/show-blocks.svg';
11
- import '../theme/showblocks.css';
12
- /**
13
- * The UI plugin of the show blocks feature.
14
- *
15
- * It registers the `'showBlocks'` UI button in the editor's {@link module:ui/componentfactory~ComponentFactory component factory}
16
- * that toggles the visibility of the HTML element names of content blocks.
17
- */
18
- export default class ShowBlocksUI extends Plugin {
19
- /**
20
- * @inheritDoc
21
- */
22
- static get pluginName() {
23
- return 'ShowBlocksUI';
24
- }
25
- /**
26
- * @inheritDoc
27
- */
28
- init() {
29
- const editor = this.editor;
30
- editor.ui.componentFactory.add('showBlocks', locale => {
31
- const command = editor.commands.get('showBlocks');
32
- const view = new ButtonView(locale);
33
- const t = locale.t;
34
- view.set({
35
- label: t('Show blocks'),
36
- icon: showBlocksIcon,
37
- tooltip: true
38
- });
39
- view.bind('isOn').to(command, 'value', command, 'isEnabled', (value, isEnabled) => value && isEnabled);
40
- view.bind('isEnabled').to(command);
41
- // Execute the command.
42
- this.listenTo(view, 'execute', () => {
43
- editor.execute('showBlocks');
44
- editor.editing.view.focus();
45
- });
46
- return view;
47
- });
48
- }
49
- }
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 show-blocks/showblocksui
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ import { ButtonView } from 'ckeditor5/src/ui';
10
+ import showBlocksIcon from '../theme/icons/show-blocks.svg';
11
+ import '../theme/showblocks.css';
12
+ /**
13
+ * The UI plugin of the show blocks feature.
14
+ *
15
+ * It registers the `'showBlocks'` UI button in the editor's {@link module:ui/componentfactory~ComponentFactory component factory}
16
+ * that toggles the visibility of the HTML element names of content blocks.
17
+ */
18
+ export default class ShowBlocksUI extends Plugin {
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ static get pluginName() {
23
+ return 'ShowBlocksUI';
24
+ }
25
+ /**
26
+ * @inheritDoc
27
+ */
28
+ init() {
29
+ const editor = this.editor;
30
+ editor.ui.componentFactory.add('showBlocks', locale => {
31
+ const command = editor.commands.get('showBlocks');
32
+ const view = new ButtonView(locale);
33
+ const t = locale.t;
34
+ view.set({
35
+ label: t('Show blocks'),
36
+ icon: showBlocksIcon,
37
+ tooltip: true
38
+ });
39
+ view.bind('isOn').to(command, 'value', command, 'isEnabled', (value, isEnabled) => value && isEnabled);
40
+ view.bind('isEnabled').to(command);
41
+ // Execute the command.
42
+ this.listenTo(view, 'execute', () => {
43
+ editor.execute('showBlocks');
44
+ editor.editing.view.focus();
45
+ });
46
+ return view;
47
+ });
48
+ }
49
+ }