@ckeditor/ckeditor5-restricted-editing 36.0.1 → 37.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.
@@ -2,52 +2,47 @@
2
2
  * @license Copyright (c) 2003-2023, 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
-
6
5
  /**
7
6
  * @module restricted-editing/standardeditingmodeui
8
7
  */
9
-
10
8
  import { Plugin } from 'ckeditor5/src/core';
11
9
  import { ButtonView } from 'ckeditor5/src/ui';
12
-
13
10
  import unlockIcon from '../theme/icons/contentunlock.svg';
14
-
15
11
  /**
16
12
  * The standard editing mode UI feature.
17
13
  *
18
14
  * It introduces the `'restrictedEditingException'` button that marks text as unrestricted for editing.
19
- *
20
- * @extends module:core/plugin~Plugin
21
15
  */
22
16
  export default class StandardEditingModeUI extends Plugin {
23
- /**
24
- * @inheritDoc
25
- */
26
- init() {
27
- const editor = this.editor;
28
- const t = editor.t;
29
-
30
- editor.ui.componentFactory.add( 'restrictedEditingException', locale => {
31
- const command = editor.commands.get( 'restrictedEditingException' );
32
- const view = new ButtonView( locale );
33
-
34
- view.set( {
35
- icon: unlockIcon,
36
- tooltip: true,
37
- isToggleable: true
38
- } );
39
-
40
- view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );
41
- view.bind( 'label' ).to( command, 'value', value => {
42
- return value ? t( 'Disable editing' ) : t( 'Enable editing' );
43
- } );
44
-
45
- this.listenTo( view, 'execute', () => {
46
- editor.execute( 'restrictedEditingException' );
47
- editor.editing.view.focus();
48
- } );
49
-
50
- return view;
51
- } );
52
- }
17
+ /**
18
+ * @inheritDoc
19
+ */
20
+ static get pluginName() {
21
+ return 'StandardEditingModeUI';
22
+ }
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ init() {
27
+ const editor = this.editor;
28
+ const t = editor.t;
29
+ editor.ui.componentFactory.add('restrictedEditingException', locale => {
30
+ const command = editor.commands.get('restrictedEditingException');
31
+ const view = new ButtonView(locale);
32
+ view.set({
33
+ icon: unlockIcon,
34
+ tooltip: true,
35
+ isToggleable: true
36
+ });
37
+ view.bind('isOn', 'isEnabled').to(command, 'value', 'isEnabled');
38
+ view.bind('label').to(command, 'value', value => {
39
+ return value ? t('Disable editing') : t('Enable editing');
40
+ });
41
+ this.listenTo(view, 'execute', () => {
42
+ editor.execute('restrictedEditingException');
43
+ editor.editing.view.focus();
44
+ });
45
+ return view;
46
+ });
47
+ }
53
48
  }