@ckeditor/ckeditor5-restricted-editing 36.0.0 → 37.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.
- package/build/restricted-editing.js +1 -1
- package/package.json +25 -20
- package/src/index.d.ts +13 -0
- package/src/index.js +0 -2
- package/src/restrictededitingconfig.d.ts +71 -0
- package/src/restrictededitingconfig.js +5 -0
- package/src/restrictededitingexceptioncommand.d.ts +35 -0
- package/src/restrictededitingexceptioncommand.js +49 -54
- package/src/restrictededitingmode/converters.d.ts +39 -0
- package/src/restrictededitingmode/converters.js +107 -156
- package/src/restrictededitingmode/utils.d.ts +30 -0
- package/src/restrictededitingmode/utils.js +28 -48
- package/src/restrictededitingmode.d.ts +32 -0
- package/src/restrictededitingmode.js +12 -82
- package/src/restrictededitingmodeediting.d.ts +88 -0
- package/src/restrictededitingmodeediting.js +363 -473
- package/src/restrictededitingmodenavigationcommand.d.ts +48 -0
- package/src/restrictededitingmodenavigationcommand.js +83 -109
- package/src/restrictededitingmodeui.d.ts +37 -0
- package/src/restrictededitingmodeui.js +55 -80
- package/src/standardeditingmode.d.ts +29 -0
- package/src/standardeditingmode.js +9 -17
- package/src/standardeditingmodeediting.d.ts +30 -0
- package/src/standardeditingmodeediting.js +35 -47
- package/src/standardeditingmodeui.d.ts +28 -0
- package/src/standardeditingmodeui.js +31 -36
@@ -0,0 +1,28 @@
|
|
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
|
+
}
|
24
|
+
declare module '@ckeditor/ckeditor5-core' {
|
25
|
+
interface PluginsMap {
|
26
|
+
[StandardEditingModeUI.pluginName]: StandardEditingModeUI;
|
27
|
+
}
|
28
|
+
}
|
@@ -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
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
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
|
}
|