@ckeditor/ckeditor5-restricted-editing 39.0.2 → 40.0.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.
@@ -1,53 +1,53 @@
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 restricted-editing/standardeditingmodeediting
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- import RestrictedEditingExceptionCommand from './restrictededitingexceptioncommand';
10
- /**
11
- * The standard editing mode editing feature.
12
- *
13
- * * It introduces the `restrictedEditingException` text attribute that is rendered as
14
- * a `<span>` element with the `restricted-editing-exception` CSS class.
15
- * * It registers the `'restrictedEditingException'` command.
16
- */
17
- export default class StandardEditingModeEditing extends Plugin {
18
- /**
19
- * @inheritDoc
20
- */
21
- static get pluginName() {
22
- return 'StandardEditingModeEditing';
23
- }
24
- /**
25
- * @inheritDoc
26
- */
27
- init() {
28
- const editor = this.editor;
29
- editor.model.schema.extend('$text', { allowAttributes: ['restrictedEditingException'] });
30
- editor.conversion.for('upcast').elementToAttribute({
31
- model: 'restrictedEditingException',
32
- view: {
33
- name: 'span',
34
- classes: 'restricted-editing-exception'
35
- }
36
- });
37
- editor.conversion.for('downcast').attributeToElement({
38
- model: 'restrictedEditingException',
39
- view: (modelAttributeValue, { writer }) => {
40
- if (modelAttributeValue) {
41
- // Make the restricted editing <span> outer-most in the view.
42
- return writer.createAttributeElement('span', { class: 'restricted-editing-exception' }, { priority: -10 });
43
- }
44
- }
45
- });
46
- editor.commands.add('restrictedEditingException', new RestrictedEditingExceptionCommand(editor));
47
- editor.editing.view.change(writer => {
48
- for (const root of editor.editing.view.document.roots) {
49
- writer.addClass('ck-restricted-editing_mode_standard', root);
50
- }
51
- });
52
- }
53
- }
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 restricted-editing/standardeditingmodeediting
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ import RestrictedEditingExceptionCommand from './restrictededitingexceptioncommand';
10
+ /**
11
+ * The standard editing mode editing feature.
12
+ *
13
+ * * It introduces the `restrictedEditingException` text attribute that is rendered as
14
+ * a `<span>` element with the `restricted-editing-exception` CSS class.
15
+ * * It registers the `'restrictedEditingException'` command.
16
+ */
17
+ export default class StandardEditingModeEditing extends Plugin {
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ static get pluginName() {
22
+ return 'StandardEditingModeEditing';
23
+ }
24
+ /**
25
+ * @inheritDoc
26
+ */
27
+ init() {
28
+ const editor = this.editor;
29
+ editor.model.schema.extend('$text', { allowAttributes: ['restrictedEditingException'] });
30
+ editor.conversion.for('upcast').elementToAttribute({
31
+ model: 'restrictedEditingException',
32
+ view: {
33
+ name: 'span',
34
+ classes: 'restricted-editing-exception'
35
+ }
36
+ });
37
+ editor.conversion.for('downcast').attributeToElement({
38
+ model: 'restrictedEditingException',
39
+ view: (modelAttributeValue, { writer }) => {
40
+ if (modelAttributeValue) {
41
+ // Make the restricted editing <span> outer-most in the view.
42
+ return writer.createAttributeElement('span', { class: 'restricted-editing-exception' }, { priority: -10 });
43
+ }
44
+ }
45
+ });
46
+ editor.commands.add('restrictedEditingException', new RestrictedEditingExceptionCommand(editor));
47
+ editor.editing.view.change(writer => {
48
+ for (const root of editor.editing.view.document.roots) {
49
+ writer.addClass('ck-restricted-editing_mode_standard', root);
50
+ }
51
+ });
52
+ }
53
+ }
@@ -1,23 +1,23 @@
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 restricted-editing/standardeditingmodeui
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- /**
10
- * The standard editing mode UI feature.
11
- *
12
- * It introduces the `'restrictedEditingException'` button that marks text as unrestricted for editing.
13
- */
14
- export default class StandardEditingModeUI extends Plugin {
15
- /**
16
- * @inheritDoc
17
- */
18
- static get pluginName(): "StandardEditingModeUI";
19
- /**
20
- * @inheritDoc
21
- */
22
- init(): void;
23
- }
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 restricted-editing/standardeditingmodeui
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ /**
10
+ * The standard editing mode UI feature.
11
+ *
12
+ * It introduces the `'restrictedEditingException'` button that marks text as unrestricted for editing.
13
+ */
14
+ export default class StandardEditingModeUI extends Plugin {
15
+ /**
16
+ * @inheritDoc
17
+ */
18
+ static get pluginName(): "StandardEditingModeUI";
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ init(): void;
23
+ }
@@ -1,48 +1,48 @@
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 restricted-editing/standardeditingmodeui
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- import { ButtonView } from 'ckeditor5/src/ui';
10
- import unlockIcon from '../theme/icons/contentunlock.svg';
11
- /**
12
- * The standard editing mode UI feature.
13
- *
14
- * It introduces the `'restrictedEditingException'` button that marks text as unrestricted for editing.
15
- */
16
- export default class StandardEditingModeUI extends Plugin {
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
- }
48
- }
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 restricted-editing/standardeditingmodeui
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ import { ButtonView } from 'ckeditor5/src/ui';
10
+ import unlockIcon from '../theme/icons/contentunlock.svg';
11
+ /**
12
+ * The standard editing mode UI feature.
13
+ *
14
+ * It introduces the `'restrictedEditingException'` button that marks text as unrestricted for editing.
15
+ */
16
+ export default class StandardEditingModeUI extends Plugin {
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
+ }
48
+ }