@ckeditor/ckeditor5-show-blocks 40.0.0 → 40.1.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 +2 -2
- package/package.json +3 -3
- package/src/augmentation.d.ts +15 -15
- package/src/augmentation.js +5 -5
- package/src/index.d.ts +12 -12
- package/src/index.js +12 -12
- package/src/showblocks.d.ts +25 -25
- package/src/showblocks.js +29 -29
- package/src/showblockscommand.d.ts +27 -27
- package/src/showblockscommand.js +44 -44
- package/src/showblocksediting.d.ts +21 -21
- package/src/showblocksediting.js +27 -27
- package/src/showblocksui.d.ts +25 -25
- package/src/showblocksui.js +49 -49
package/LICENSE.md
CHANGED
|
@@ -2,7 +2,7 @@ Software License Agreement
|
|
|
2
2
|
==========================
|
|
3
3
|
|
|
4
4
|
**CKEditor 5 show blocks feature** – https://github.com/ckeditor/packages/ckeditor5-show-blocks <br>
|
|
5
|
-
Copyright (c) 2003
|
|
5
|
+
Copyright (c) 2003–2023, [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.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-show-blocks",
|
|
3
|
-
"version": "40.
|
|
3
|
+
"version": "40.1.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.
|
|
16
|
-
"@ckeditor/ckeditor5-ui": "40.
|
|
15
|
+
"ckeditor5": "40.1.0",
|
|
16
|
+
"@ckeditor/ckeditor5-ui": "40.1.0"
|
|
17
17
|
},
|
|
18
18
|
"author": "CKSource (http://cksource.com/)",
|
|
19
19
|
"license": "GPL-2.0-or-later",
|
package/src/augmentation.d.ts
CHANGED
|
@@ -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
|
+
}
|
package/src/augmentation.js
CHANGED
|
@@ -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';
|
package/src/showblocks.d.ts
CHANGED
|
@@ -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
|
+
}
|
package/src/showblockscommand.js
CHANGED
|
@@ -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
|
+
}
|
package/src/showblocksediting.js
CHANGED
|
@@ -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
|
+
}
|
package/src/showblocksui.d.ts
CHANGED
|
@@ -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
|
+
}
|
package/src/showblocksui.js
CHANGED
|
@@ -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
|
+
}
|