@ckeditor/ckeditor5-restricted-editing 47.2.0 → 47.3.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.
- package/LICENSE.md +3 -3
- package/build/restricted-editing.js +2 -2
- package/build/translations/af.js +1 -1
- package/build/translations/ar.js +1 -1
- package/build/translations/ast.js +1 -1
- package/build/translations/az.js +1 -1
- package/build/translations/be.js +1 -1
- package/build/translations/bg.js +1 -1
- package/build/translations/bn.js +1 -1
- package/build/translations/bs.js +1 -1
- package/build/translations/ca.js +1 -1
- package/build/translations/cs.js +1 -1
- package/build/translations/da.js +1 -1
- package/build/translations/de-ch.js +1 -1
- package/build/translations/de.js +1 -1
- package/build/translations/el.js +1 -1
- package/build/translations/en-au.js +1 -1
- package/build/translations/en-gb.js +1 -1
- package/build/translations/eo.js +1 -1
- package/build/translations/es-co.js +1 -1
- package/build/translations/es.js +1 -1
- package/build/translations/et.js +1 -1
- package/build/translations/eu.js +1 -1
- package/build/translations/fa.js +1 -1
- package/build/translations/fi.js +1 -1
- package/build/translations/fr.js +1 -1
- package/build/translations/gl.js +1 -1
- package/build/translations/gu.js +1 -1
- package/build/translations/he.js +1 -1
- package/build/translations/hi.js +1 -1
- package/build/translations/hr.js +1 -1
- package/build/translations/hu.js +1 -1
- package/build/translations/hy.js +1 -1
- package/build/translations/id.js +1 -1
- package/build/translations/it.js +1 -1
- package/build/translations/ja.js +1 -1
- package/build/translations/jv.js +1 -1
- package/build/translations/kk.js +1 -1
- package/build/translations/km.js +1 -1
- package/build/translations/kn.js +1 -1
- package/build/translations/ko.js +1 -1
- package/build/translations/ku.js +1 -1
- package/build/translations/lt.js +1 -1
- package/build/translations/lv.js +1 -1
- package/build/translations/ms.js +1 -1
- package/build/translations/nb.js +1 -1
- package/build/translations/ne.js +1 -1
- package/build/translations/nl.js +1 -1
- package/build/translations/no.js +1 -1
- package/build/translations/oc.js +1 -1
- package/build/translations/pl.js +1 -1
- package/build/translations/pt-br.js +1 -1
- package/build/translations/pt.js +1 -1
- package/build/translations/ro.js +1 -1
- package/build/translations/ru.js +1 -1
- package/build/translations/si.js +1 -1
- package/build/translations/sk.js +1 -1
- package/build/translations/sl.js +1 -1
- package/build/translations/sq.js +1 -1
- package/build/translations/sr-latn.js +1 -1
- package/build/translations/sr.js +1 -1
- package/build/translations/sv.js +1 -1
- package/build/translations/th.js +1 -1
- package/build/translations/ti.js +1 -1
- package/build/translations/tk.js +1 -1
- package/build/translations/tr.js +1 -1
- package/build/translations/tt.js +1 -1
- package/build/translations/ug.js +1 -1
- package/build/translations/uk.js +1 -1
- package/build/translations/ur.js +1 -1
- package/build/translations/uz.js +1 -1
- package/build/translations/vi.js +1 -1
- package/build/translations/zh-cn.js +1 -1
- package/build/translations/zh.js +1 -1
- package/dist/index.js +74 -7
- package/dist/index.js.map +1 -1
- package/dist/translations/af.js +1 -1
- package/dist/translations/af.umd.js +1 -1
- package/dist/translations/ar.js +1 -1
- package/dist/translations/ar.umd.js +1 -1
- package/dist/translations/ast.js +1 -1
- package/dist/translations/ast.umd.js +1 -1
- package/dist/translations/az.js +1 -1
- package/dist/translations/az.umd.js +1 -1
- package/dist/translations/be.js +1 -1
- package/dist/translations/be.umd.js +1 -1
- package/dist/translations/bg.js +1 -1
- package/dist/translations/bg.umd.js +1 -1
- package/dist/translations/bn.js +1 -1
- package/dist/translations/bn.umd.js +1 -1
- package/dist/translations/bs.js +1 -1
- package/dist/translations/bs.umd.js +1 -1
- package/dist/translations/ca.js +1 -1
- package/dist/translations/ca.umd.js +1 -1
- package/dist/translations/cs.js +1 -1
- package/dist/translations/cs.umd.js +1 -1
- package/dist/translations/da.js +1 -1
- package/dist/translations/da.umd.js +1 -1
- package/dist/translations/de-ch.js +1 -1
- package/dist/translations/de-ch.umd.js +1 -1
- package/dist/translations/de.js +1 -1
- package/dist/translations/de.umd.js +1 -1
- package/dist/translations/el.js +1 -1
- package/dist/translations/el.umd.js +1 -1
- package/dist/translations/en-au.js +1 -1
- package/dist/translations/en-au.umd.js +1 -1
- package/dist/translations/en-gb.js +1 -1
- package/dist/translations/en-gb.umd.js +1 -1
- package/dist/translations/en.js +1 -1
- package/dist/translations/en.umd.js +1 -1
- package/dist/translations/eo.js +1 -1
- package/dist/translations/eo.umd.js +1 -1
- package/dist/translations/es-co.js +1 -1
- package/dist/translations/es-co.umd.js +1 -1
- package/dist/translations/es.js +1 -1
- package/dist/translations/es.umd.js +1 -1
- package/dist/translations/et.js +1 -1
- package/dist/translations/et.umd.js +1 -1
- package/dist/translations/eu.js +1 -1
- package/dist/translations/eu.umd.js +1 -1
- package/dist/translations/fa.js +1 -1
- package/dist/translations/fa.umd.js +1 -1
- package/dist/translations/fi.js +1 -1
- package/dist/translations/fi.umd.js +1 -1
- package/dist/translations/fr.js +1 -1
- package/dist/translations/fr.umd.js +1 -1
- package/dist/translations/gl.js +1 -1
- package/dist/translations/gl.umd.js +1 -1
- package/dist/translations/gu.js +1 -1
- package/dist/translations/gu.umd.js +1 -1
- package/dist/translations/he.js +1 -1
- package/dist/translations/he.umd.js +1 -1
- package/dist/translations/hi.js +1 -1
- package/dist/translations/hi.umd.js +1 -1
- package/dist/translations/hr.js +1 -1
- package/dist/translations/hr.umd.js +1 -1
- package/dist/translations/hu.js +1 -1
- package/dist/translations/hu.umd.js +1 -1
- package/dist/translations/hy.js +1 -1
- package/dist/translations/hy.umd.js +1 -1
- package/dist/translations/id.js +1 -1
- package/dist/translations/id.umd.js +1 -1
- package/dist/translations/it.js +1 -1
- package/dist/translations/it.umd.js +1 -1
- package/dist/translations/ja.js +1 -1
- package/dist/translations/ja.umd.js +1 -1
- package/dist/translations/jv.js +1 -1
- package/dist/translations/jv.umd.js +1 -1
- package/dist/translations/kk.js +1 -1
- package/dist/translations/kk.umd.js +1 -1
- package/dist/translations/km.js +1 -1
- package/dist/translations/km.umd.js +1 -1
- package/dist/translations/kn.js +1 -1
- package/dist/translations/kn.umd.js +1 -1
- package/dist/translations/ko.js +1 -1
- package/dist/translations/ko.umd.js +1 -1
- package/dist/translations/ku.js +1 -1
- package/dist/translations/ku.umd.js +1 -1
- package/dist/translations/lt.js +1 -1
- package/dist/translations/lt.umd.js +1 -1
- package/dist/translations/lv.js +1 -1
- package/dist/translations/lv.umd.js +1 -1
- package/dist/translations/ms.js +1 -1
- package/dist/translations/ms.umd.js +1 -1
- package/dist/translations/nb.js +1 -1
- package/dist/translations/nb.umd.js +1 -1
- package/dist/translations/ne.js +1 -1
- package/dist/translations/ne.umd.js +1 -1
- package/dist/translations/nl.js +1 -1
- package/dist/translations/nl.umd.js +1 -1
- package/dist/translations/no.js +1 -1
- package/dist/translations/no.umd.js +1 -1
- package/dist/translations/oc.js +1 -1
- package/dist/translations/oc.umd.js +1 -1
- package/dist/translations/pl.js +1 -1
- package/dist/translations/pl.umd.js +1 -1
- package/dist/translations/pt-br.js +1 -1
- package/dist/translations/pt-br.umd.js +1 -1
- package/dist/translations/pt.js +1 -1
- package/dist/translations/pt.umd.js +1 -1
- package/dist/translations/ro.js +1 -1
- package/dist/translations/ro.umd.js +1 -1
- package/dist/translations/ru.js +1 -1
- package/dist/translations/ru.umd.js +1 -1
- package/dist/translations/si.js +1 -1
- package/dist/translations/si.umd.js +1 -1
- package/dist/translations/sk.js +1 -1
- package/dist/translations/sk.umd.js +1 -1
- package/dist/translations/sl.js +1 -1
- package/dist/translations/sl.umd.js +1 -1
- package/dist/translations/sq.js +1 -1
- package/dist/translations/sq.umd.js +1 -1
- package/dist/translations/sr-latn.js +1 -1
- package/dist/translations/sr-latn.umd.js +1 -1
- package/dist/translations/sr.js +1 -1
- package/dist/translations/sr.umd.js +1 -1
- package/dist/translations/sv.js +1 -1
- package/dist/translations/sv.umd.js +1 -1
- package/dist/translations/th.js +1 -1
- package/dist/translations/th.umd.js +1 -1
- package/dist/translations/ti.js +1 -1
- package/dist/translations/ti.umd.js +1 -1
- package/dist/translations/tk.js +1 -1
- package/dist/translations/tk.umd.js +1 -1
- package/dist/translations/tr.js +1 -1
- package/dist/translations/tr.umd.js +1 -1
- package/dist/translations/tt.js +1 -1
- package/dist/translations/tt.umd.js +1 -1
- package/dist/translations/ug.js +1 -1
- package/dist/translations/ug.umd.js +1 -1
- package/dist/translations/uk.js +1 -1
- package/dist/translations/uk.umd.js +1 -1
- package/dist/translations/ur.js +1 -1
- package/dist/translations/ur.umd.js +1 -1
- package/dist/translations/uz.js +1 -1
- package/dist/translations/uz.umd.js +1 -1
- package/dist/translations/vi.js +1 -1
- package/dist/translations/vi.umd.js +1 -1
- package/dist/translations/zh-cn.js +1 -1
- package/dist/translations/zh-cn.umd.js +1 -1
- package/dist/translations/zh.js +1 -1
- package/dist/translations/zh.umd.js +1 -1
- package/lang/contexts.json +2 -1
- package/lang/translations/af.po +4 -0
- package/lang/translations/ar.po +4 -0
- package/lang/translations/ast.po +4 -0
- package/lang/translations/az.po +4 -0
- package/lang/translations/be.po +4 -0
- package/lang/translations/bg.po +4 -0
- package/lang/translations/bn.po +4 -0
- package/lang/translations/bs.po +4 -0
- package/lang/translations/ca.po +4 -0
- package/lang/translations/cs.po +4 -0
- package/lang/translations/da.po +4 -0
- package/lang/translations/de-ch.po +4 -0
- package/lang/translations/de.po +4 -0
- package/lang/translations/el.po +4 -0
- package/lang/translations/en-au.po +4 -0
- package/lang/translations/en-gb.po +4 -0
- package/lang/translations/en.po +4 -0
- package/lang/translations/eo.po +4 -0
- package/lang/translations/es-co.po +4 -0
- package/lang/translations/es.po +4 -0
- package/lang/translations/et.po +4 -0
- package/lang/translations/eu.po +4 -0
- package/lang/translations/fa.po +4 -0
- package/lang/translations/fi.po +4 -0
- package/lang/translations/fr.po +4 -0
- package/lang/translations/gl.po +4 -0
- package/lang/translations/gu.po +4 -0
- package/lang/translations/he.po +4 -0
- package/lang/translations/hi.po +4 -0
- package/lang/translations/hr.po +4 -0
- package/lang/translations/hu.po +4 -0
- package/lang/translations/hy.po +4 -0
- package/lang/translations/id.po +4 -0
- package/lang/translations/it.po +4 -0
- package/lang/translations/ja.po +4 -0
- package/lang/translations/jv.po +4 -0
- package/lang/translations/kk.po +4 -0
- package/lang/translations/km.po +4 -0
- package/lang/translations/kn.po +4 -0
- package/lang/translations/ko.po +4 -0
- package/lang/translations/ku.po +4 -0
- package/lang/translations/lt.po +4 -0
- package/lang/translations/lv.po +4 -0
- package/lang/translations/ms.po +4 -0
- package/lang/translations/nb.po +4 -0
- package/lang/translations/ne.po +4 -0
- package/lang/translations/nl.po +4 -0
- package/lang/translations/no.po +4 -0
- package/lang/translations/oc.po +4 -0
- package/lang/translations/pl.po +4 -0
- package/lang/translations/pt-br.po +4 -0
- package/lang/translations/pt.po +4 -0
- package/lang/translations/ro.po +4 -0
- package/lang/translations/ru.po +4 -0
- package/lang/translations/si.po +4 -0
- package/lang/translations/sk.po +4 -0
- package/lang/translations/sl.po +4 -0
- package/lang/translations/sq.po +4 -0
- package/lang/translations/sr-latn.po +4 -0
- package/lang/translations/sr.po +4 -0
- package/lang/translations/sv.po +4 -0
- package/lang/translations/th.po +4 -0
- package/lang/translations/ti.po +4 -0
- package/lang/translations/tk.po +4 -0
- package/lang/translations/tr.po +4 -0
- package/lang/translations/tt.po +4 -0
- package/lang/translations/ug.po +4 -0
- package/lang/translations/uk.po +4 -0
- package/lang/translations/ur.po +4 -0
- package/lang/translations/uz.po +4 -0
- package/lang/translations/vi.po +4 -0
- package/lang/translations/zh-cn.po +4 -0
- package/lang/translations/zh.po +4 -0
- package/package.json +7 -7
- package/src/augmentation.d.ts +2 -1
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/restrictededitingexceptionautocommand.d.ts +39 -0
- package/src/restrictededitingexceptionautocommand.js +73 -0
- package/src/standardeditingmodeediting.js +2 -0
- package/src/standardeditingmodeui.js +24 -5
package/src/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { RestrictedEditingModeUI } from './restrictededitingmodeui.js';
|
|
|
11
11
|
export { RestrictedEditingExceptionCommand, type RestrictedEditingExceptionCommandParams } from './restrictededitingexceptioncommand.js';
|
|
12
12
|
export { RestrictedEditingModeNavigationCommand, type RestrictedEditingModeNavigationDirection } from './restrictededitingmodenavigationcommand.js';
|
|
13
13
|
export { RestrictedEditingExceptionBlockCommand } from './restrictededitingexceptionblockcommand.js';
|
|
14
|
+
export { RestrictedEditingExceptionAutoCommand } from './restrictededitingexceptionautocommand.js';
|
|
14
15
|
export { StandardEditingMode } from './standardeditingmode.js';
|
|
15
16
|
export { StandardEditingModeEditing } from './standardeditingmodeediting.js';
|
|
16
17
|
export { StandardEditingModeUI } from './standardeditingmodeui.js';
|
package/src/index.js
CHANGED
|
@@ -11,6 +11,7 @@ export { RestrictedEditingModeUI } from './restrictededitingmodeui.js';
|
|
|
11
11
|
export { RestrictedEditingExceptionCommand } from './restrictededitingexceptioncommand.js';
|
|
12
12
|
export { RestrictedEditingModeNavigationCommand } from './restrictededitingmodenavigationcommand.js';
|
|
13
13
|
export { RestrictedEditingExceptionBlockCommand } from './restrictededitingexceptionblockcommand.js';
|
|
14
|
+
export { RestrictedEditingExceptionAutoCommand } from './restrictededitingexceptionautocommand.js';
|
|
14
15
|
export { StandardEditingMode } from './standardeditingmode.js';
|
|
15
16
|
export { StandardEditingModeEditing } from './standardeditingmodeediting.js';
|
|
16
17
|
export { StandardEditingModeUI } from './standardeditingmodeui.js';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module restricted-editing/restrictededitingexceptionautocommand
|
|
7
|
+
*/
|
|
8
|
+
import { Command, type Editor } from 'ckeditor5/src/core.js';
|
|
9
|
+
/**
|
|
10
|
+
* The command that toggles exceptions from the restricted editing on text or on blocks.
|
|
11
|
+
*/
|
|
12
|
+
export declare class RestrictedEditingExceptionAutoCommand extends Command {
|
|
13
|
+
/**
|
|
14
|
+
* A flag indicating whether the command is active.
|
|
15
|
+
*
|
|
16
|
+
* @readonly
|
|
17
|
+
*/
|
|
18
|
+
value: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* The inline exception command.
|
|
21
|
+
*/
|
|
22
|
+
private readonly _inlineCommand;
|
|
23
|
+
/**
|
|
24
|
+
* The block exception command.
|
|
25
|
+
*/
|
|
26
|
+
private readonly _blockCommand;
|
|
27
|
+
/**
|
|
28
|
+
* @inheritDoc
|
|
29
|
+
*/
|
|
30
|
+
constructor(editor: Editor);
|
|
31
|
+
/**
|
|
32
|
+
* @inheritDoc
|
|
33
|
+
*/
|
|
34
|
+
refresh(): void;
|
|
35
|
+
/**
|
|
36
|
+
* @inheritDoc
|
|
37
|
+
*/
|
|
38
|
+
execute(): void;
|
|
39
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module restricted-editing/restrictededitingexceptionautocommand
|
|
7
|
+
*/
|
|
8
|
+
import { Command } from 'ckeditor5/src/core.js';
|
|
9
|
+
import { count } from 'ckeditor5/src/utils.js';
|
|
10
|
+
/**
|
|
11
|
+
* The command that toggles exceptions from the restricted editing on text or on blocks.
|
|
12
|
+
*/
|
|
13
|
+
export class RestrictedEditingExceptionAutoCommand extends Command {
|
|
14
|
+
/**
|
|
15
|
+
* The inline exception command.
|
|
16
|
+
*/
|
|
17
|
+
_inlineCommand;
|
|
18
|
+
/**
|
|
19
|
+
* The block exception command.
|
|
20
|
+
*/
|
|
21
|
+
_blockCommand;
|
|
22
|
+
/**
|
|
23
|
+
* @inheritDoc
|
|
24
|
+
*/
|
|
25
|
+
constructor(editor) {
|
|
26
|
+
super(editor);
|
|
27
|
+
this._inlineCommand = editor.commands.get('restrictedEditingException');
|
|
28
|
+
this._blockCommand = editor.commands.get('restrictedEditingExceptionBlock');
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @inheritDoc
|
|
32
|
+
*/
|
|
33
|
+
refresh() {
|
|
34
|
+
this.value = this._inlineCommand.value || this._blockCommand.value;
|
|
35
|
+
this.isEnabled = this._inlineCommand.isEnabled || this._blockCommand.isEnabled;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @inheritDoc
|
|
39
|
+
*/
|
|
40
|
+
execute() {
|
|
41
|
+
const editor = this.editor;
|
|
42
|
+
// Selection is inside an inline exception.
|
|
43
|
+
if (this._inlineCommand.value) {
|
|
44
|
+
editor.execute('restrictedEditingException');
|
|
45
|
+
}
|
|
46
|
+
// Selection inside a block exception.
|
|
47
|
+
else if (this._blockCommand.value) {
|
|
48
|
+
editor.execute('restrictedEditingExceptionBlock');
|
|
49
|
+
}
|
|
50
|
+
// Selection allows only for inline exception.
|
|
51
|
+
else if (this._inlineCommand.isEnabled && !this._blockCommand.isEnabled) {
|
|
52
|
+
editor.execute('restrictedEditingException');
|
|
53
|
+
}
|
|
54
|
+
// Selection allows only for block exception.
|
|
55
|
+
else if (this._blockCommand.isEnabled && !this._inlineCommand.isEnabled) {
|
|
56
|
+
editor.execute('restrictedEditingExceptionBlock');
|
|
57
|
+
}
|
|
58
|
+
// Check selection to pick exception type.
|
|
59
|
+
else {
|
|
60
|
+
const schema = editor.model.schema;
|
|
61
|
+
const selection = editor.model.document.selection;
|
|
62
|
+
const selectedElement = selection.getSelectedElement();
|
|
63
|
+
if (selection.isCollapsed ||
|
|
64
|
+
selectedElement && schema.isObject(selectedElement) && schema.isBlock(selectedElement) ||
|
|
65
|
+
count(selection.getSelectedBlocks()) > 1) {
|
|
66
|
+
editor.execute('restrictedEditingExceptionBlock');
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
editor.execute('restrictedEditingException');
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -9,6 +9,7 @@ import { Plugin } from 'ckeditor5/src/core.js';
|
|
|
9
9
|
import { Matcher } from 'ckeditor5/src/engine.js';
|
|
10
10
|
import { RestrictedEditingExceptionCommand } from './restrictededitingexceptioncommand.js';
|
|
11
11
|
import { RestrictedEditingExceptionBlockCommand } from './restrictededitingexceptionblockcommand.js';
|
|
12
|
+
import { RestrictedEditingExceptionAutoCommand } from './restrictededitingexceptionautocommand.js';
|
|
12
13
|
/**
|
|
13
14
|
* The standard editing mode editing feature.
|
|
14
15
|
*
|
|
@@ -158,6 +159,7 @@ export class StandardEditingModeEditing extends Plugin {
|
|
|
158
159
|
});
|
|
159
160
|
editor.commands.add('restrictedEditingException', new RestrictedEditingExceptionCommand(editor));
|
|
160
161
|
editor.commands.add('restrictedEditingExceptionBlock', new RestrictedEditingExceptionBlockCommand(editor));
|
|
162
|
+
editor.commands.add('restrictedEditingExceptionAuto', new RestrictedEditingExceptionAutoCommand(editor));
|
|
161
163
|
editor.editing.view.change(writer => {
|
|
162
164
|
for (const root of editor.editing.view.document.roots) {
|
|
163
165
|
writer.addClass('ck-restricted-editing_mode_standard', root);
|
|
@@ -32,6 +32,7 @@ export class StandardEditingModeUI extends Plugin {
|
|
|
32
32
|
init() {
|
|
33
33
|
const editor = this.editor;
|
|
34
34
|
const componentFactory = editor.ui.componentFactory;
|
|
35
|
+
// Dropdown button with inline/block buttons.
|
|
35
36
|
componentFactory.add('restrictedEditingException:dropdown', locale => {
|
|
36
37
|
const dropdownView = createDropdown(locale);
|
|
37
38
|
const t = locale.t;
|
|
@@ -70,28 +71,40 @@ export class StandardEditingModeUI extends Plugin {
|
|
|
70
71
|
});
|
|
71
72
|
return dropdownView;
|
|
72
73
|
});
|
|
74
|
+
// Inline exception button.
|
|
73
75
|
componentFactory.add('restrictedEditingException:inline', () => {
|
|
74
76
|
const button = this._createButton('restrictedEditingException', ButtonView);
|
|
75
77
|
button.set({
|
|
76
|
-
tooltip: true
|
|
77
|
-
isToggleable: true
|
|
78
|
+
tooltip: true
|
|
78
79
|
});
|
|
79
80
|
return button;
|
|
80
81
|
});
|
|
82
|
+
// Block exception button.
|
|
81
83
|
componentFactory.add('restrictedEditingException:block', () => {
|
|
82
84
|
const button = this._createButton('restrictedEditingExceptionBlock', ButtonView);
|
|
83
85
|
button.set({
|
|
84
|
-
tooltip: true
|
|
85
|
-
isToggleable: true
|
|
86
|
+
tooltip: true
|
|
86
87
|
});
|
|
87
88
|
return button;
|
|
88
89
|
});
|
|
90
|
+
// Menu bar inline/block buttons.
|
|
89
91
|
componentFactory.add('menuBar:restrictedEditingException:inline', () => {
|
|
90
92
|
return this._createButton('restrictedEditingException', MenuBarMenuListItemButtonView);
|
|
91
93
|
});
|
|
92
94
|
componentFactory.add('menuBar:restrictedEditingException:block', () => {
|
|
93
95
|
return this._createButton('restrictedEditingExceptionBlock', MenuBarMenuListItemButtonView);
|
|
94
96
|
});
|
|
97
|
+
// Auto button - triggers inline or block exception command.
|
|
98
|
+
componentFactory.add('restrictedEditingException:auto', () => {
|
|
99
|
+
const button = this._createButton('restrictedEditingExceptionAuto', ButtonView);
|
|
100
|
+
button.set({
|
|
101
|
+
tooltip: true
|
|
102
|
+
});
|
|
103
|
+
return button;
|
|
104
|
+
});
|
|
105
|
+
componentFactory.add('menuBar:restrictedEditingException:auto', () => {
|
|
106
|
+
return this._createButton('restrictedEditingExceptionAuto', MenuBarMenuListItemButtonView);
|
|
107
|
+
});
|
|
95
108
|
// Aliases for backward compatibility.
|
|
96
109
|
componentFactory.add('restrictedEditingException', () => {
|
|
97
110
|
return componentFactory.create('restrictedEditingException:inline');
|
|
@@ -110,8 +123,14 @@ export class StandardEditingModeUI extends Plugin {
|
|
|
110
123
|
const view = new ButtonClass(locale);
|
|
111
124
|
const t = locale.t;
|
|
112
125
|
view.icon = IconContentUnlock;
|
|
126
|
+
view.isToggleable = true;
|
|
113
127
|
view.bind('isOn', 'isEnabled').to(command, 'value', 'isEnabled');
|
|
114
|
-
if (commandName == '
|
|
128
|
+
if (commandName == 'restrictedEditingExceptionAuto') {
|
|
129
|
+
view.bind('label').to(command, 'value', value => {
|
|
130
|
+
return value ? t('Disable editing') : t('Enable editing');
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
else if (commandName == 'restrictedEditingExceptionBlock') {
|
|
115
134
|
view.bind('label').to(command, 'value', value => {
|
|
116
135
|
return value ? t('Disable block editing') : t('Enable block editing');
|
|
117
136
|
});
|