@ckeditor/ckeditor5-code-block 0.0.0-nightly-20250303.0 → 0.0.0-nightly-next-20250303.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 +0 -4
- package/build/code-block.js +1 -1
- package/ckeditor5-metadata.json +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/package.json +9 -8
- package/src/codeblockcommand.js +5 -1
- package/src/codeblockui.js +4 -3
- package/src/indentcodeblockcommand.js +4 -0
- package/src/outdentcodeblockcommand.js +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-code-block",
|
|
3
|
-
"version": "0.0.0-nightly-20250303.0",
|
|
3
|
+
"version": "0.0.0-nightly-next-20250303.0",
|
|
4
4
|
"description": "Code block feature for CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -13,13 +13,14 @@
|
|
|
13
13
|
"type": "module",
|
|
14
14
|
"main": "src/index.js",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@ckeditor/ckeditor5-core": "0.0.0-nightly-20250303.0",
|
|
17
|
-
"@ckeditor/ckeditor5-clipboard": "0.0.0-nightly-20250303.0",
|
|
18
|
-
"@ckeditor/ckeditor5-engine": "0.0.0-nightly-20250303.0",
|
|
19
|
-
"@ckeditor/ckeditor5-enter": "0.0.0-nightly-20250303.0",
|
|
20
|
-
"@ckeditor/ckeditor5-
|
|
21
|
-
"@ckeditor/ckeditor5-
|
|
22
|
-
"ckeditor5": "0.0.0-nightly-20250303.0"
|
|
16
|
+
"@ckeditor/ckeditor5-core": "0.0.0-nightly-next-20250303.0",
|
|
17
|
+
"@ckeditor/ckeditor5-clipboard": "0.0.0-nightly-next-20250303.0",
|
|
18
|
+
"@ckeditor/ckeditor5-engine": "0.0.0-nightly-next-20250303.0",
|
|
19
|
+
"@ckeditor/ckeditor5-enter": "0.0.0-nightly-next-20250303.0",
|
|
20
|
+
"@ckeditor/ckeditor5-icons": "0.0.0-nightly-next-20250303.0",
|
|
21
|
+
"@ckeditor/ckeditor5-ui": "0.0.0-nightly-next-20250303.0",
|
|
22
|
+
"@ckeditor/ckeditor5-utils": "0.0.0-nightly-next-20250303.0",
|
|
23
|
+
"ckeditor5": "0.0.0-nightly-next-20250303.0"
|
|
23
24
|
},
|
|
24
25
|
"author": "CKSource (http://cksource.com/)",
|
|
25
26
|
"license": "SEE LICENSE IN LICENSE.md",
|
package/src/codeblockcommand.js
CHANGED
|
@@ -9,6 +9,10 @@ import { getNormalizedAndLocalizedLanguageDefinitions, canBeCodeBlock } from './
|
|
|
9
9
|
* The code block command plugin.
|
|
10
10
|
*/
|
|
11
11
|
export default class CodeBlockCommand extends Command {
|
|
12
|
+
/**
|
|
13
|
+
* Contains the last used language.
|
|
14
|
+
*/
|
|
15
|
+
_lastLanguage;
|
|
12
16
|
/**
|
|
13
17
|
* @inheritDoc
|
|
14
18
|
*/
|
|
@@ -62,7 +66,7 @@ export default class CodeBlockCommand extends Command {
|
|
|
62
66
|
_getValue() {
|
|
63
67
|
const selection = this.editor.model.document.selection;
|
|
64
68
|
const firstBlock = first(selection.getSelectedBlocks());
|
|
65
|
-
const isCodeBlock = !!
|
|
69
|
+
const isCodeBlock = !!firstBlock?.is('element', 'codeBlock');
|
|
66
70
|
return isCodeBlock ? firstBlock.getAttribute('language') : false;
|
|
67
71
|
}
|
|
68
72
|
/**
|
package/src/codeblockui.js
CHANGED
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module code-block/codeblockui
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
9
|
import { Collection } from 'ckeditor5/src/utils.js';
|
|
10
10
|
import { ViewModel, SplitButtonView, createDropdown, addListToDropdown, MenuBarMenuListItemButtonView, MenuBarMenuListView, MenuBarMenuView, MenuBarMenuListItemView } from 'ckeditor5/src/ui.js';
|
|
11
|
+
import { IconCodeBlock } from 'ckeditor5/src/icons.js';
|
|
11
12
|
import { getNormalizedAndLocalizedLanguageDefinitions } from './utils.js';
|
|
12
13
|
import '../theme/codeblock.css';
|
|
13
14
|
/**
|
|
@@ -45,7 +46,7 @@ export default class CodeBlockUI extends Plugin {
|
|
|
45
46
|
splitButtonView.set({
|
|
46
47
|
label: accessibleLabel,
|
|
47
48
|
tooltip: true,
|
|
48
|
-
icon:
|
|
49
|
+
icon: IconCodeBlock,
|
|
49
50
|
isToggleable: true
|
|
50
51
|
});
|
|
51
52
|
splitButtonView.bind('isOn').to(command, 'value', value => !!value);
|
|
@@ -75,7 +76,7 @@ export default class CodeBlockUI extends Plugin {
|
|
|
75
76
|
menuView.buttonView.set({
|
|
76
77
|
role: 'menuitem',
|
|
77
78
|
label: t('Code block'),
|
|
78
|
-
icon:
|
|
79
|
+
icon: IconCodeBlock
|
|
79
80
|
});
|
|
80
81
|
menuView.bind('isEnabled').to(command);
|
|
81
82
|
const listView = new MenuBarMenuListView(locale);
|
|
@@ -11,6 +11,10 @@ import { getIndentOutdentPositions, isModelSelectionInCodeBlock } from './utils.
|
|
|
11
11
|
* The code block indentation increase command plugin.
|
|
12
12
|
*/
|
|
13
13
|
export default class IndentCodeBlockCommand extends Command {
|
|
14
|
+
/**
|
|
15
|
+
* A sequence of characters added to the line when the command is executed.
|
|
16
|
+
*/
|
|
17
|
+
_indentSequence;
|
|
14
18
|
constructor(editor) {
|
|
15
19
|
super(editor);
|
|
16
20
|
this._indentSequence = editor.config.get('codeBlock.indentSequence');
|
|
@@ -8,6 +8,10 @@ import { getLeadingWhiteSpaces, getIndentOutdentPositions, isModelSelectionInCod
|
|
|
8
8
|
* The code block indentation decrease command plugin.
|
|
9
9
|
*/
|
|
10
10
|
export default class OutdentCodeBlockCommand extends Command {
|
|
11
|
+
/**
|
|
12
|
+
* A sequence of characters removed from the line when the command is executed.
|
|
13
|
+
*/
|
|
14
|
+
_indentSequence;
|
|
11
15
|
constructor(editor) {
|
|
12
16
|
super(editor);
|
|
13
17
|
this._indentSequence = editor.config.get('codeBlock.indentSequence');
|