@ckeditor/ckeditor5-basic-styles 42.0.2-alpha.2 → 43.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.
@@ -2,4 +2,4 @@
2
2
  * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
- export default {"sr-latn":{"dictionary":{"Bold":"Podebljano","Italic":"Kurziv","Underline":"Podvučen","Code":"Kod","Strikethrough":"Precrtan","Subscript":"Index dole","Superscript":"Index gore","Italic text":"","Move out of an inline code style":"","Bold text":"","Underline text":"","Strikethrough text":""},getPluralForm(n){return (n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);}}}
5
+ export default {"sr-latn":{"dictionary":{"Bold":"Podebljano","Italic":"Kurziv","Underline":"Podvučen","Code":"Kod","Strikethrough":"Precrtan","Subscript":"Index dole","Superscript":"Index gore","Italic text":"Kurziv tekst","Move out of an inline code style":"Izađite iz inline stila koda","Bold text":"Zadebljani tekst","Underline text":"Podvuci tekst","Strikethrough text":"Precrtan tekst"},getPluralForm(n){return (n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);}}}
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  ( e => {
7
- const { [ 'sr-latn' ]: { dictionary, getPluralForm } } = {"sr-latn":{"dictionary":{"Bold":"Podebljano","Italic":"Kurziv","Underline":"Podvučen","Code":"Kod","Strikethrough":"Precrtan","Subscript":"Index dole","Superscript":"Index gore","Italic text":"","Move out of an inline code style":"","Bold text":"","Underline text":"","Strikethrough text":""},getPluralForm(n){return (n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);}}};
7
+ const { [ 'sr-latn' ]: { dictionary, getPluralForm } } = {"sr-latn":{"dictionary":{"Bold":"Podebljano","Italic":"Kurziv","Underline":"Podvučen","Code":"Kod","Strikethrough":"Precrtan","Subscript":"Index dole","Superscript":"Index gore","Italic text":"Kurziv tekst","Move out of an inline code style":"Izađite iz inline stila koda","Bold text":"Zadebljani tekst","Underline text":"Podvuci tekst","Strikethrough text":"Precrtan tekst"},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
8
  e[ 'sr-latn' ] ||= { dictionary: {}, getPluralForm: null };
9
9
  e[ 'sr-latn' ].dictionary = Object.assign( e[ 'sr-latn' ].dictionary, dictionary );
10
10
  e[ 'sr-latn' ].getPluralForm = getPluralForm;
package/dist/utils.d.ts CHANGED
@@ -10,7 +10,7 @@
10
10
  * @module basic-styles/utils
11
11
  */
12
12
  import type { Editor, Plugin } from 'ckeditor5/src/core.js';
13
- import type { ButtonView, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';
13
+ import { MenuBarMenuListItemButtonView, type ButtonView } from 'ckeditor5/src/ui.js';
14
14
  /**
15
15
  * Returns a function that creates a (toolbar or menu bar) button for a basic style feature.
16
16
  */
@@ -47,20 +47,20 @@ msgstr "Index gore"
47
47
 
48
48
  msgctxt "Keystroke description for assistive technologies: keystroke for making text italic."
49
49
  msgid "Italic text"
50
- msgstr ""
50
+ msgstr "Kurziv tekst"
51
51
 
52
52
  msgctxt "Keystroke description for assistive technologies: keystroke for moving selection out of an inline code style."
53
53
  msgid "Move out of an inline code style"
54
- msgstr ""
54
+ msgstr "Izađite iz inline stila koda"
55
55
 
56
56
  msgctxt "Keystroke description for assistive technologies: keystroke for making text bold."
57
57
  msgid "Bold text"
58
- msgstr ""
58
+ msgstr "Zadebljani tekst"
59
59
 
60
60
  msgctxt "Keystroke description for assistive technologies: keystroke for making text underlined."
61
61
  msgid "Underline text"
62
- msgstr ""
62
+ msgstr "Podvuci tekst"
63
63
 
64
64
  msgctxt "Keystroke description for assistive technologies: keystroke for making text strikethrough."
65
65
  msgid "Strikethrough text"
66
- msgstr ""
66
+ msgstr "Precrtan tekst"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-basic-styles",
3
- "version": "42.0.2-alpha.2",
3
+ "version": "43.0.0-alpha.0",
4
4
  "description": "Basic styles feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -13,10 +13,10 @@
13
13
  "type": "module",
14
14
  "main": "src/index.js",
15
15
  "dependencies": {
16
- "@ckeditor/ckeditor5-core": "42.0.2-alpha.2",
17
- "@ckeditor/ckeditor5-typing": "42.0.2-alpha.2",
18
- "@ckeditor/ckeditor5-ui": "42.0.2-alpha.2",
19
- "ckeditor5": "42.0.2-alpha.2"
16
+ "@ckeditor/ckeditor5-core": "43.0.0-alpha.0",
17
+ "@ckeditor/ckeditor5-typing": "43.0.0-alpha.0",
18
+ "@ckeditor/ckeditor5-ui": "43.0.0-alpha.0",
19
+ "ckeditor5": "43.0.0-alpha.0"
20
20
  },
21
21
  "author": "CKSource (http://cksource.com/)",
22
22
  "license": "GPL-2.0-or-later",
@@ -25,7 +25,6 @@ export default class BoldUI extends Plugin {
25
25
  init() {
26
26
  const editor = this.editor;
27
27
  const t = editor.locale.t;
28
- const command = editor.commands.get(BOLD);
29
28
  const createButton = getButtonCreator({
30
29
  editor,
31
30
  commandName: BOLD,
@@ -35,16 +34,7 @@ export default class BoldUI extends Plugin {
35
34
  keystroke: 'CTRL+B'
36
35
  });
37
36
  // Add bold button to feature components.
38
- editor.ui.componentFactory.add(BOLD, () => {
39
- const buttonView = createButton(ButtonView);
40
- buttonView.set({
41
- tooltip: true
42
- });
43
- buttonView.bind('isOn').to(command, 'value');
44
- return buttonView;
45
- });
46
- editor.ui.componentFactory.add('menuBar:' + BOLD, () => {
47
- return createButton(MenuBarMenuListItemButtonView);
48
- });
37
+ editor.ui.componentFactory.add(BOLD, () => createButton(ButtonView));
38
+ editor.ui.componentFactory.add('menuBar:' + BOLD, () => createButton(MenuBarMenuListItemButtonView));
49
39
  }
50
40
  }
@@ -35,18 +35,7 @@ export default class CodeUI extends Plugin {
35
35
  label: t('Code')
36
36
  });
37
37
  // Add code button to feature components.
38
- editor.ui.componentFactory.add(CODE, () => {
39
- const buttonView = createButton(ButtonView);
40
- const command = editor.commands.get(CODE);
41
- buttonView.set({
42
- tooltip: true
43
- });
44
- // Bind button model to command.
45
- buttonView.bind('isOn').to(command, 'value');
46
- return buttonView;
47
- });
48
- editor.ui.componentFactory.add('menuBar:' + CODE, () => {
49
- return createButton(MenuBarMenuListItemButtonView);
50
- });
38
+ editor.ui.componentFactory.add(CODE, () => createButton(ButtonView));
39
+ editor.ui.componentFactory.add('menuBar:' + CODE, () => createButton(MenuBarMenuListItemButtonView));
51
40
  }
52
41
  }
@@ -25,7 +25,6 @@ export default class ItalicUI extends Plugin {
25
25
  */
26
26
  init() {
27
27
  const editor = this.editor;
28
- const command = editor.commands.get(ITALIC);
29
28
  const t = editor.locale.t;
30
29
  const createButton = getButtonCreator({
31
30
  editor,
@@ -36,16 +35,7 @@ export default class ItalicUI extends Plugin {
36
35
  label: t('Italic')
37
36
  });
38
37
  // Add bold button to feature components.
39
- editor.ui.componentFactory.add(ITALIC, () => {
40
- const buttonView = createButton(ButtonView);
41
- buttonView.set({
42
- tooltip: true
43
- });
44
- buttonView.bind('isOn').to(command, 'value');
45
- return buttonView;
46
- });
47
- editor.ui.componentFactory.add('menuBar:' + ITALIC, () => {
48
- return createButton(MenuBarMenuListItemButtonView);
49
- });
38
+ editor.ui.componentFactory.add(ITALIC, () => createButton(ButtonView));
39
+ editor.ui.componentFactory.add('menuBar:' + ITALIC, () => createButton(MenuBarMenuListItemButtonView));
50
40
  }
51
41
  }
@@ -35,18 +35,7 @@ export default class StrikethroughUI extends Plugin {
35
35
  label: t('Strikethrough')
36
36
  });
37
37
  // Add strikethrough button to feature components.
38
- editor.ui.componentFactory.add(STRIKETHROUGH, () => {
39
- const buttonView = createButton(ButtonView);
40
- const command = editor.commands.get(STRIKETHROUGH);
41
- buttonView.set({
42
- tooltip: true
43
- });
44
- // Bind button model to command.
45
- buttonView.bind('isOn').to(command, 'value');
46
- return buttonView;
47
- });
48
- editor.ui.componentFactory.add('menuBar:' + STRIKETHROUGH, () => {
49
- return createButton(MenuBarMenuListItemButtonView);
50
- });
38
+ editor.ui.componentFactory.add(STRIKETHROUGH, () => createButton(ButtonView));
39
+ editor.ui.componentFactory.add('menuBar:' + STRIKETHROUGH, () => createButton(MenuBarMenuListItemButtonView));
51
40
  }
52
41
  }
@@ -34,18 +34,7 @@ export default class SubscriptUI extends Plugin {
34
34
  label: t('Subscript')
35
35
  });
36
36
  // Add subscript button to feature components.
37
- editor.ui.componentFactory.add(SUBSCRIPT, () => {
38
- const buttonView = createButton(ButtonView);
39
- const command = editor.commands.get(SUBSCRIPT);
40
- buttonView.set({
41
- tooltip: true
42
- });
43
- // Bind button model to command.
44
- buttonView.bind('isOn').to(command, 'value');
45
- return buttonView;
46
- });
47
- editor.ui.componentFactory.add('menuBar:' + SUBSCRIPT, () => {
48
- return createButton(MenuBarMenuListItemButtonView);
49
- });
37
+ editor.ui.componentFactory.add(SUBSCRIPT, () => createButton(ButtonView));
38
+ editor.ui.componentFactory.add('menuBar:' + SUBSCRIPT, () => createButton(MenuBarMenuListItemButtonView));
50
39
  }
51
40
  }
@@ -34,18 +34,7 @@ export default class SuperscriptUI extends Plugin {
34
34
  label: t('Superscript')
35
35
  });
36
36
  // Add superscript button to feature components.
37
- editor.ui.componentFactory.add(SUPERSCRIPT, () => {
38
- const buttonView = createButton(ButtonView);
39
- const command = editor.commands.get(SUPERSCRIPT);
40
- buttonView.set({
41
- tooltip: true
42
- });
43
- // Bind button model to command.
44
- buttonView.bind('isOn').to(command, 'value');
45
- return buttonView;
46
- });
47
- editor.ui.componentFactory.add('menuBar:' + SUPERSCRIPT, () => {
48
- return createButton(MenuBarMenuListItemButtonView);
49
- });
37
+ editor.ui.componentFactory.add(SUPERSCRIPT, () => createButton(ButtonView));
38
+ editor.ui.componentFactory.add('menuBar:' + SUPERSCRIPT, () => createButton(MenuBarMenuListItemButtonView));
50
39
  }
51
40
  }
@@ -25,7 +25,6 @@ export default class UnderlineUI extends Plugin {
25
25
  */
26
26
  init() {
27
27
  const editor = this.editor;
28
- const command = editor.commands.get(UNDERLINE);
29
28
  const t = editor.locale.t;
30
29
  const createButton = getButtonCreator({
31
30
  editor,
@@ -36,16 +35,7 @@ export default class UnderlineUI extends Plugin {
36
35
  keystroke: 'CTRL+U'
37
36
  });
38
37
  // Add bold button to feature components.
39
- editor.ui.componentFactory.add(UNDERLINE, () => {
40
- const buttonView = createButton(ButtonView);
41
- buttonView.set({
42
- tooltip: true
43
- });
44
- buttonView.bind('isOn').to(command, 'value');
45
- return buttonView;
46
- });
47
- editor.ui.componentFactory.add('menuBar:' + UNDERLINE, () => {
48
- return createButton(MenuBarMenuListItemButtonView);
49
- });
38
+ editor.ui.componentFactory.add(UNDERLINE, () => createButton(ButtonView));
39
+ editor.ui.componentFactory.add('menuBar:' + UNDERLINE, () => createButton(MenuBarMenuListItemButtonView));
50
40
  }
51
41
  }
package/src/utils.d.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  * @module basic-styles/utils
7
7
  */
8
8
  import type { Editor, Plugin } from 'ckeditor5/src/core.js';
9
- import type { ButtonView, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';
9
+ import { MenuBarMenuListItemButtonView, type ButtonView } from 'ckeditor5/src/ui.js';
10
10
  /**
11
11
  * Returns a function that creates a (toolbar or menu bar) button for a basic style feature.
12
12
  */
package/src/utils.js CHANGED
@@ -2,6 +2,7 @@
2
2
  * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
+ import { MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';
5
6
  /**
6
7
  * Returns a function that creates a (toolbar or menu bar) button for a basic style feature.
7
8
  */
@@ -16,6 +17,17 @@ export function getButtonCreator({ editor, commandName, plugin, icon, label, key
16
17
  isToggleable: true
17
18
  });
18
19
  view.bind('isEnabled').to(command, 'isEnabled');
20
+ view.bind('isOn').to(command, 'value');
21
+ if (view instanceof MenuBarMenuListItemButtonView) {
22
+ view.set({
23
+ role: 'menuitemcheckbox'
24
+ });
25
+ }
26
+ else {
27
+ view.set({
28
+ tooltip: true
29
+ });
30
+ }
19
31
  // Execute the command.
20
32
  plugin.listenTo(view, 'execute', () => {
21
33
  editor.execute(commandName);