@ckeditor/ckeditor5-restricted-editing 38.1.0 → 38.1.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.
- package/build/restricted-editing.js +1 -1
- package/build/restricted-editing.js.map +1 -0
- package/package.json +2 -2
- package/src/augmentation.d.ts +29 -29
- package/src/augmentation.js +5 -5
- package/src/index.d.ts +17 -17
- package/src/index.js +14 -14
- package/src/restrictededitingconfig.d.ts +60 -60
- package/src/restrictededitingconfig.js +5 -5
- package/src/restrictededitingexceptioncommand.d.ts +30 -30
- package/src/restrictededitingexceptioncommand.js +61 -61
- package/src/restrictededitingmode/converters.d.ts +39 -39
- package/src/restrictededitingmode/converters.js +142 -142
- package/src/restrictededitingmode/utils.d.ts +30 -30
- package/src/restrictededitingmode/utils.js +50 -50
- package/src/restrictededitingmode.d.ts +29 -29
- package/src/restrictededitingmode.js +33 -33
- package/src/restrictededitingmodeediting.d.ts +83 -83
- package/src/restrictededitingmodeediting.js +391 -391
- package/src/restrictededitingmodenavigationcommand.d.ts +42 -42
- package/src/restrictededitingmodenavigationcommand.js +94 -94
- package/src/restrictededitingmodeui.d.ts +32 -32
- package/src/restrictededitingmodeui.js +75 -75
- package/src/standardeditingmode.d.ts +26 -26
- package/src/standardeditingmode.js +30 -30
- package/src/standardeditingmodeediting.d.ts +25 -25
- package/src/standardeditingmodeediting.js +53 -53
- package/src/standardeditingmodeui.d.ts +23 -23
- package/src/standardeditingmodeui.js +48 -48
@@ -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
|
+
}
|