@ckeditor/ckeditor5-code-block 44.3.0 → 45.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.
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2025, 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
+ import type { Translations } from '@ckeditor/ckeditor5-utils';
7
+ declare const translations: Translations;
8
+ export default translations;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2025, 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 default {"be":{"dictionary":{"Insert code block":"Уставіць код","Plain text":"Просты тэкст","Leaving %0 code snippet":"Астаўляем фрагмент кода %0","Entering %0 code snippet":"Увод фрагмента кода %0","Entering code snippet":"Увод фрагмента кода","Leaving code snippet":"Астаўляем фрагмент кода","Code block":"Блок кода"},getPluralForm(n){return (n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);}}}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2025, 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
+ ( e => {
7
+ const { [ 'be' ]: { dictionary, getPluralForm } } = {"be":{"dictionary":{"Insert code block":"Уставіць код","Plain text":"Просты тэкст","Leaving %0 code snippet":"Астаўляем фрагмент кода %0","Entering %0 code snippet":"Увод фрагмента кода %0","Entering code snippet":"Увод фрагмента кода","Leaving code snippet":"Астаўляем фрагмент кода","Code block":"Блок кода"},getPluralForm(n){return (n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);}}};
8
+ e[ 'be' ] ||= { dictionary: {}, getPluralForm: null };
9
+ e[ 'be' ].dictionary = Object.assign( e[ 'be' ].dictionary, dictionary );
10
+ e[ 'be' ].getPluralForm = getPluralForm;
11
+ } )( window.CKEDITOR_TRANSLATIONS ||= {} );
@@ -0,0 +1,40 @@
1
+ # Copyright (c) 2003-2025, 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: be\n"
11
+ "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"
12
+ "Content-Type: text/plain; charset=UTF-8\n"
13
+
14
+ msgctxt "A label of the button that allows inserting a new code block into the editor content."
15
+ msgid "Insert code block"
16
+ msgstr "Уставіць код"
17
+
18
+ msgctxt "A language of the code block in the editor content when no specific programming language is associated with it."
19
+ msgid "Plain text"
20
+ msgstr "Просты тэкст"
21
+
22
+ msgctxt "Assistive technologies label for leaving the code block with a specified programming language. Example: 'Leaving JavaScript code snippet'"
23
+ msgid "Leaving %0 code snippet"
24
+ msgstr "Астаўляем фрагмент кода %0"
25
+
26
+ msgctxt "Assistive technologies label for entering the code block with a specified programming language. Example: 'Entering JavaScript code snippet'"
27
+ msgid "Entering %0 code snippet"
28
+ msgstr "Увод фрагмента кода %0"
29
+
30
+ msgctxt "Assistive technologies label for entering the code block with unspecified programming language."
31
+ msgid "Entering code snippet"
32
+ msgstr "Увод фрагмента кода"
33
+
34
+ msgctxt "Assistive technologies label for leaving the code block with unspecified programming language."
35
+ msgid "Leaving code snippet"
36
+ msgstr "Астаўляем фрагмент кода"
37
+
38
+ msgctxt "The accessible label of the menu bar button that inserts a code block into editor content."
39
+ msgid "Code block"
40
+ msgstr "Блок кода"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-code-block",
3
- "version": "44.3.0",
3
+ "version": "45.0.0-alpha.1",
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": "44.3.0",
17
- "@ckeditor/ckeditor5-clipboard": "44.3.0",
18
- "@ckeditor/ckeditor5-engine": "44.3.0",
19
- "@ckeditor/ckeditor5-enter": "44.3.0",
20
- "@ckeditor/ckeditor5-ui": "44.3.0",
21
- "@ckeditor/ckeditor5-utils": "44.3.0",
22
- "ckeditor5": "44.3.0"
16
+ "@ckeditor/ckeditor5-core": "45.0.0-alpha.1",
17
+ "@ckeditor/ckeditor5-clipboard": "45.0.0-alpha.1",
18
+ "@ckeditor/ckeditor5-engine": "45.0.0-alpha.1",
19
+ "@ckeditor/ckeditor5-enter": "45.0.0-alpha.1",
20
+ "@ckeditor/ckeditor5-icons": "45.0.0-alpha.1",
21
+ "@ckeditor/ckeditor5-ui": "45.0.0-alpha.1",
22
+ "@ckeditor/ckeditor5-utils": "45.0.0-alpha.1",
23
+ "ckeditor5": "45.0.0-alpha.1"
23
24
  },
24
25
  "author": "CKSource (http://cksource.com/)",
25
26
  "license": "SEE LICENSE IN LICENSE.md",
@@ -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 = !!(firstBlock && firstBlock.is('element', 'codeBlock'));
69
+ const isCodeBlock = !!firstBlock?.is('element', 'codeBlock');
66
70
  return isCodeBlock ? firstBlock.getAttribute('language') : false;
67
71
  }
68
72
  /**
@@ -5,9 +5,10 @@
5
5
  /**
6
6
  * @module code-block/codeblockui
7
7
  */
8
- import { icons, Plugin } from 'ckeditor5/src/core.js';
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: icons.codeBlock,
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: icons.codeBlock
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');