@ckeditor/ckeditor5-restricted-editing 0.0.0-internal-20241017.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/CHANGELOG.md +4 -0
- package/LICENSE.md +17 -0
- package/README.md +26 -0
- package/build/restricted-editing.js +5 -0
- package/build/translations/ar.js +1 -0
- package/build/translations/az.js +1 -0
- package/build/translations/bg.js +1 -0
- package/build/translations/bn.js +1 -0
- package/build/translations/ca.js +1 -0
- package/build/translations/cs.js +1 -0
- package/build/translations/da.js +1 -0
- package/build/translations/de-ch.js +1 -0
- package/build/translations/de.js +1 -0
- package/build/translations/el.js +1 -0
- package/build/translations/en-au.js +1 -0
- package/build/translations/en-gb.js +1 -0
- package/build/translations/es.js +1 -0
- package/build/translations/et.js +1 -0
- package/build/translations/fa.js +1 -0
- package/build/translations/fi.js +1 -0
- package/build/translations/fr.js +1 -0
- package/build/translations/gl.js +1 -0
- package/build/translations/he.js +1 -0
- package/build/translations/hi.js +1 -0
- package/build/translations/hr.js +1 -0
- package/build/translations/hu.js +1 -0
- package/build/translations/id.js +1 -0
- package/build/translations/it.js +1 -0
- package/build/translations/ja.js +1 -0
- package/build/translations/ko.js +1 -0
- package/build/translations/ku.js +1 -0
- package/build/translations/lt.js +1 -0
- package/build/translations/lv.js +1 -0
- package/build/translations/ms.js +1 -0
- package/build/translations/nl.js +1 -0
- package/build/translations/no.js +1 -0
- package/build/translations/pl.js +1 -0
- package/build/translations/pt-br.js +1 -0
- package/build/translations/pt.js +1 -0
- package/build/translations/ro.js +1 -0
- package/build/translations/ru.js +1 -0
- package/build/translations/sk.js +1 -0
- package/build/translations/sq.js +1 -0
- package/build/translations/sr-latn.js +1 -0
- package/build/translations/sr.js +1 -0
- package/build/translations/sv.js +1 -0
- package/build/translations/th.js +1 -0
- package/build/translations/tk.js +1 -0
- package/build/translations/tr.js +1 -0
- package/build/translations/uk.js +1 -0
- package/build/translations/ur.js +1 -0
- package/build/translations/uz.js +1 -0
- package/build/translations/vi.js +1 -0
- package/build/translations/zh-cn.js +1 -0
- package/build/translations/zh.js +1 -0
- package/ckeditor5-metadata.json +44 -0
- package/dist/augmentation.d.ts +33 -0
- package/dist/index-content.css +4 -0
- package/dist/index-editor.css +4 -0
- package/dist/index.css +4 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +1058 -0
- package/dist/index.js.map +1 -0
- package/dist/restrictededitingconfig.d.ts +64 -0
- package/dist/restrictededitingexceptioncommand.d.ts +34 -0
- package/dist/restrictededitingmode/converters.d.ts +43 -0
- package/dist/restrictededitingmode/utils.d.ts +34 -0
- package/dist/restrictededitingmode.d.ts +37 -0
- package/dist/restrictededitingmodeediting.d.ts +91 -0
- package/dist/restrictededitingmodenavigationcommand.d.ts +46 -0
- package/dist/restrictededitingmodeui.d.ts +50 -0
- package/dist/standardeditingmode.d.ts +34 -0
- package/dist/standardeditingmodeediting.d.ts +33 -0
- package/dist/standardeditingmodeui.d.ts +35 -0
- package/dist/translations/ar.d.ts +8 -0
- package/dist/translations/ar.js +5 -0
- package/dist/translations/ar.umd.js +11 -0
- package/dist/translations/az.d.ts +8 -0
- package/dist/translations/az.js +5 -0
- package/dist/translations/az.umd.js +11 -0
- package/dist/translations/bg.d.ts +8 -0
- package/dist/translations/bg.js +5 -0
- package/dist/translations/bg.umd.js +11 -0
- package/dist/translations/bn.d.ts +8 -0
- package/dist/translations/bn.js +5 -0
- package/dist/translations/bn.umd.js +11 -0
- package/dist/translations/ca.d.ts +8 -0
- package/dist/translations/ca.js +5 -0
- package/dist/translations/ca.umd.js +11 -0
- package/dist/translations/cs.d.ts +8 -0
- package/dist/translations/cs.js +5 -0
- package/dist/translations/cs.umd.js +11 -0
- package/dist/translations/da.d.ts +8 -0
- package/dist/translations/da.js +5 -0
- package/dist/translations/da.umd.js +11 -0
- package/dist/translations/de-ch.d.ts +8 -0
- package/dist/translations/de-ch.js +5 -0
- package/dist/translations/de-ch.umd.js +11 -0
- package/dist/translations/de.d.ts +8 -0
- package/dist/translations/de.js +5 -0
- package/dist/translations/de.umd.js +11 -0
- package/dist/translations/el.d.ts +8 -0
- package/dist/translations/el.js +5 -0
- package/dist/translations/el.umd.js +11 -0
- package/dist/translations/en-au.d.ts +8 -0
- package/dist/translations/en-au.js +5 -0
- package/dist/translations/en-au.umd.js +11 -0
- package/dist/translations/en-gb.d.ts +8 -0
- package/dist/translations/en-gb.js +5 -0
- package/dist/translations/en-gb.umd.js +11 -0
- package/dist/translations/en.d.ts +8 -0
- package/dist/translations/en.js +5 -0
- package/dist/translations/en.umd.js +11 -0
- package/dist/translations/es.d.ts +8 -0
- package/dist/translations/es.js +5 -0
- package/dist/translations/es.umd.js +11 -0
- package/dist/translations/et.d.ts +8 -0
- package/dist/translations/et.js +5 -0
- package/dist/translations/et.umd.js +11 -0
- package/dist/translations/fa.d.ts +8 -0
- package/dist/translations/fa.js +5 -0
- package/dist/translations/fa.umd.js +11 -0
- package/dist/translations/fi.d.ts +8 -0
- package/dist/translations/fi.js +5 -0
- package/dist/translations/fi.umd.js +11 -0
- package/dist/translations/fr.d.ts +8 -0
- package/dist/translations/fr.js +5 -0
- package/dist/translations/fr.umd.js +11 -0
- package/dist/translations/gl.d.ts +8 -0
- package/dist/translations/gl.js +5 -0
- package/dist/translations/gl.umd.js +11 -0
- package/dist/translations/he.d.ts +8 -0
- package/dist/translations/he.js +5 -0
- package/dist/translations/he.umd.js +11 -0
- package/dist/translations/hi.d.ts +8 -0
- package/dist/translations/hi.js +5 -0
- package/dist/translations/hi.umd.js +11 -0
- package/dist/translations/hr.d.ts +8 -0
- package/dist/translations/hr.js +5 -0
- package/dist/translations/hr.umd.js +11 -0
- package/dist/translations/hu.d.ts +8 -0
- package/dist/translations/hu.js +5 -0
- package/dist/translations/hu.umd.js +11 -0
- package/dist/translations/id.d.ts +8 -0
- package/dist/translations/id.js +5 -0
- package/dist/translations/id.umd.js +11 -0
- package/dist/translations/it.d.ts +8 -0
- package/dist/translations/it.js +5 -0
- package/dist/translations/it.umd.js +11 -0
- package/dist/translations/ja.d.ts +8 -0
- package/dist/translations/ja.js +5 -0
- package/dist/translations/ja.umd.js +11 -0
- package/dist/translations/ko.d.ts +8 -0
- package/dist/translations/ko.js +5 -0
- package/dist/translations/ko.umd.js +11 -0
- package/dist/translations/ku.d.ts +8 -0
- package/dist/translations/ku.js +5 -0
- package/dist/translations/ku.umd.js +11 -0
- package/dist/translations/lt.d.ts +8 -0
- package/dist/translations/lt.js +5 -0
- package/dist/translations/lt.umd.js +11 -0
- package/dist/translations/lv.d.ts +8 -0
- package/dist/translations/lv.js +5 -0
- package/dist/translations/lv.umd.js +11 -0
- package/dist/translations/ms.d.ts +8 -0
- package/dist/translations/ms.js +5 -0
- package/dist/translations/ms.umd.js +11 -0
- package/dist/translations/nl.d.ts +8 -0
- package/dist/translations/nl.js +5 -0
- package/dist/translations/nl.umd.js +11 -0
- package/dist/translations/no.d.ts +8 -0
- package/dist/translations/no.js +5 -0
- package/dist/translations/no.umd.js +11 -0
- package/dist/translations/pl.d.ts +8 -0
- package/dist/translations/pl.js +5 -0
- package/dist/translations/pl.umd.js +11 -0
- package/dist/translations/pt-br.d.ts +8 -0
- package/dist/translations/pt-br.js +5 -0
- package/dist/translations/pt-br.umd.js +11 -0
- package/dist/translations/pt.d.ts +8 -0
- package/dist/translations/pt.js +5 -0
- package/dist/translations/pt.umd.js +11 -0
- package/dist/translations/ro.d.ts +8 -0
- package/dist/translations/ro.js +5 -0
- package/dist/translations/ro.umd.js +11 -0
- package/dist/translations/ru.d.ts +8 -0
- package/dist/translations/ru.js +5 -0
- package/dist/translations/ru.umd.js +11 -0
- package/dist/translations/sk.d.ts +8 -0
- package/dist/translations/sk.js +5 -0
- package/dist/translations/sk.umd.js +11 -0
- package/dist/translations/sq.d.ts +8 -0
- package/dist/translations/sq.js +5 -0
- package/dist/translations/sq.umd.js +11 -0
- package/dist/translations/sr-latn.d.ts +8 -0
- package/dist/translations/sr-latn.js +5 -0
- package/dist/translations/sr-latn.umd.js +11 -0
- package/dist/translations/sr.d.ts +8 -0
- package/dist/translations/sr.js +5 -0
- package/dist/translations/sr.umd.js +11 -0
- package/dist/translations/sv.d.ts +8 -0
- package/dist/translations/sv.js +5 -0
- package/dist/translations/sv.umd.js +11 -0
- package/dist/translations/th.d.ts +8 -0
- package/dist/translations/th.js +5 -0
- package/dist/translations/th.umd.js +11 -0
- package/dist/translations/tk.d.ts +8 -0
- package/dist/translations/tk.js +5 -0
- package/dist/translations/tk.umd.js +11 -0
- package/dist/translations/tr.d.ts +8 -0
- package/dist/translations/tr.js +5 -0
- package/dist/translations/tr.umd.js +11 -0
- package/dist/translations/uk.d.ts +8 -0
- package/dist/translations/uk.js +5 -0
- package/dist/translations/uk.umd.js +11 -0
- package/dist/translations/ur.d.ts +8 -0
- package/dist/translations/ur.js +5 -0
- package/dist/translations/ur.umd.js +11 -0
- package/dist/translations/uz.d.ts +8 -0
- package/dist/translations/uz.js +5 -0
- package/dist/translations/uz.umd.js +11 -0
- package/dist/translations/vi.d.ts +8 -0
- package/dist/translations/vi.js +5 -0
- package/dist/translations/vi.umd.js +11 -0
- package/dist/translations/zh-cn.d.ts +8 -0
- package/dist/translations/zh-cn.js +5 -0
- package/dist/translations/zh-cn.umd.js +11 -0
- package/dist/translations/zh.d.ts +8 -0
- package/dist/translations/zh.js +5 -0
- package/dist/translations/zh.umd.js +11 -0
- package/lang/contexts.json +7 -0
- package/lang/translations/ar.po +38 -0
- package/lang/translations/az.po +38 -0
- package/lang/translations/bg.po +38 -0
- package/lang/translations/bn.po +38 -0
- package/lang/translations/ca.po +38 -0
- package/lang/translations/cs.po +38 -0
- package/lang/translations/da.po +38 -0
- package/lang/translations/de-ch.po +38 -0
- package/lang/translations/de.po +38 -0
- package/lang/translations/el.po +38 -0
- package/lang/translations/en-au.po +38 -0
- package/lang/translations/en-gb.po +38 -0
- package/lang/translations/en.po +38 -0
- package/lang/translations/es.po +38 -0
- package/lang/translations/et.po +38 -0
- package/lang/translations/fa.po +38 -0
- package/lang/translations/fi.po +38 -0
- package/lang/translations/fr.po +38 -0
- package/lang/translations/gl.po +38 -0
- package/lang/translations/he.po +38 -0
- package/lang/translations/hi.po +38 -0
- package/lang/translations/hr.po +38 -0
- package/lang/translations/hu.po +38 -0
- package/lang/translations/id.po +38 -0
- package/lang/translations/it.po +38 -0
- package/lang/translations/ja.po +38 -0
- package/lang/translations/ko.po +38 -0
- package/lang/translations/ku.po +38 -0
- package/lang/translations/lt.po +38 -0
- package/lang/translations/lv.po +38 -0
- package/lang/translations/ms.po +38 -0
- package/lang/translations/nl.po +38 -0
- package/lang/translations/no.po +38 -0
- package/lang/translations/pl.po +38 -0
- package/lang/translations/pt-br.po +38 -0
- package/lang/translations/pt.po +38 -0
- package/lang/translations/ro.po +38 -0
- package/lang/translations/ru.po +38 -0
- package/lang/translations/sk.po +38 -0
- package/lang/translations/sq.po +38 -0
- package/lang/translations/sr-latn.po +38 -0
- package/lang/translations/sr.po +38 -0
- package/lang/translations/sv.po +38 -0
- package/lang/translations/th.po +38 -0
- package/lang/translations/tk.po +38 -0
- package/lang/translations/tr.po +38 -0
- package/lang/translations/uk.po +38 -0
- package/lang/translations/ur.po +38 -0
- package/lang/translations/uz.po +38 -0
- package/lang/translations/vi.po +38 -0
- package/lang/translations/zh-cn.po +38 -0
- package/lang/translations/zh.po +38 -0
- package/package.json +41 -0
- package/src/augmentation.d.ts +29 -0
- package/src/augmentation.js +5 -0
- package/src/index.d.ts +17 -0
- package/src/index.js +14 -0
- package/src/restrictededitingconfig.d.ts +60 -0
- package/src/restrictededitingconfig.js +5 -0
- package/src/restrictededitingexceptioncommand.d.ts +30 -0
- package/src/restrictededitingexceptioncommand.js +61 -0
- package/src/restrictededitingmode/converters.d.ts +39 -0
- package/src/restrictededitingmode/converters.js +143 -0
- package/src/restrictededitingmode/utils.d.ts +30 -0
- package/src/restrictededitingmode/utils.js +50 -0
- package/src/restrictededitingmode.d.ts +33 -0
- package/src/restrictededitingmode.js +39 -0
- package/src/restrictededitingmodeediting.d.ts +87 -0
- package/src/restrictededitingmodeediting.js +430 -0
- package/src/restrictededitingmodenavigationcommand.d.ts +42 -0
- package/src/restrictededitingmodenavigationcommand.js +94 -0
- package/src/restrictededitingmodeui.d.ts +46 -0
- package/src/restrictededitingmodeui.js +139 -0
- package/src/standardeditingmode.d.ts +30 -0
- package/src/standardeditingmode.js +36 -0
- package/src/standardeditingmodeediting.d.ts +29 -0
- package/src/standardeditingmodeediting.js +59 -0
- package/src/standardeditingmodeui.d.ts +31 -0
- package/src/standardeditingmodeui.js +67 -0
- package/theme/icons/contentlock.svg +1 -0
- package/theme/icons/contentunlock.svg +1 -0
- package/theme/restrictedediting.css +10 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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/restrictededitingmodeui
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import { ViewModel, createDropdown, addListToDropdown, MenuBarMenuListItemButtonView, MenuBarMenuView, MenuBarMenuListView, MenuBarMenuListItemView } from 'ckeditor5/src/ui.js';
|
|
10
|
+
import { Collection } from 'ckeditor5/src/utils.js';
|
|
11
|
+
import lockIcon from '../theme/icons/contentlock.svg';
|
|
12
|
+
/**
|
|
13
|
+
* The restricted editing mode UI feature.
|
|
14
|
+
*
|
|
15
|
+
* It introduces the `'restrictedEditing'` dropdown that offers tools to navigate between exceptions across
|
|
16
|
+
* the document.
|
|
17
|
+
*/
|
|
18
|
+
export default class RestrictedEditingModeUI extends Plugin {
|
|
19
|
+
/**
|
|
20
|
+
* @inheritDoc
|
|
21
|
+
*/
|
|
22
|
+
static get pluginName() {
|
|
23
|
+
return 'RestrictedEditingModeUI';
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @inheritDoc
|
|
27
|
+
*/
|
|
28
|
+
static get isOfficialPlugin() {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* @inheritDoc
|
|
33
|
+
*/
|
|
34
|
+
init() {
|
|
35
|
+
const editor = this.editor;
|
|
36
|
+
const t = editor.t;
|
|
37
|
+
editor.ui.componentFactory.add('restrictedEditing', locale => {
|
|
38
|
+
const dropdownView = createDropdown(locale);
|
|
39
|
+
const listItems = new Collection();
|
|
40
|
+
this._getButtonDefinitions().forEach(({ commandName, label, keystroke }) => {
|
|
41
|
+
listItems.add(this._getButtonDefinition(commandName, label, keystroke));
|
|
42
|
+
});
|
|
43
|
+
addListToDropdown(dropdownView, listItems, {
|
|
44
|
+
role: 'menu'
|
|
45
|
+
});
|
|
46
|
+
dropdownView.buttonView.set({
|
|
47
|
+
label: t('Navigate editable regions'),
|
|
48
|
+
icon: lockIcon,
|
|
49
|
+
tooltip: true,
|
|
50
|
+
isEnabled: true,
|
|
51
|
+
isOn: false
|
|
52
|
+
});
|
|
53
|
+
this.listenTo(dropdownView, 'execute', evt => {
|
|
54
|
+
const { _commandName } = evt.source;
|
|
55
|
+
editor.execute(_commandName);
|
|
56
|
+
editor.editing.view.focus();
|
|
57
|
+
});
|
|
58
|
+
return dropdownView;
|
|
59
|
+
});
|
|
60
|
+
editor.ui.componentFactory.add('menuBar:restrictedEditing', locale => {
|
|
61
|
+
const menuView = new MenuBarMenuView(locale);
|
|
62
|
+
const listView = new MenuBarMenuListView(locale);
|
|
63
|
+
listView.set({
|
|
64
|
+
ariaLabel: t('Navigate editable regions'),
|
|
65
|
+
role: 'menu'
|
|
66
|
+
});
|
|
67
|
+
menuView.buttonView.set({
|
|
68
|
+
label: t('Navigate editable regions'),
|
|
69
|
+
icon: lockIcon
|
|
70
|
+
});
|
|
71
|
+
menuView.panelView.children.add(listView);
|
|
72
|
+
this._getButtonDefinitions().forEach(({ commandName, label, keystroke }) => {
|
|
73
|
+
const listItemView = new MenuBarMenuListItemView(locale, menuView);
|
|
74
|
+
const buttonView = this._createMenuBarButton(label, commandName, keystroke);
|
|
75
|
+
buttonView.delegate('execute').to(menuView);
|
|
76
|
+
listItemView.children.add(buttonView);
|
|
77
|
+
listView.items.add(listItemView);
|
|
78
|
+
});
|
|
79
|
+
return menuView;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Creates a button for restricted editing command to use in menu bar.
|
|
84
|
+
*/
|
|
85
|
+
_createMenuBarButton(label, commandName, keystroke) {
|
|
86
|
+
const editor = this.editor;
|
|
87
|
+
const command = editor.commands.get(commandName);
|
|
88
|
+
const view = new MenuBarMenuListItemButtonView(editor.locale);
|
|
89
|
+
view.set({
|
|
90
|
+
label,
|
|
91
|
+
keystroke,
|
|
92
|
+
isEnabled: true,
|
|
93
|
+
isOn: false
|
|
94
|
+
});
|
|
95
|
+
view.bind('isEnabled').to(command);
|
|
96
|
+
// Execute the command.
|
|
97
|
+
this.listenTo(view, 'execute', () => {
|
|
98
|
+
editor.execute(commandName);
|
|
99
|
+
editor.editing.view.focus();
|
|
100
|
+
});
|
|
101
|
+
return view;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Returns a definition of the navigation button to be used in the dropdown.
|
|
105
|
+
*
|
|
106
|
+
* @param commandName The name of the command that the button represents.
|
|
107
|
+
* @param label The translated label of the button.
|
|
108
|
+
* @param keystroke The button keystroke.
|
|
109
|
+
*/
|
|
110
|
+
_getButtonDefinition(commandName, label, keystroke) {
|
|
111
|
+
const editor = this.editor;
|
|
112
|
+
const command = editor.commands.get(commandName);
|
|
113
|
+
const definition = {
|
|
114
|
+
type: 'button',
|
|
115
|
+
model: new ViewModel({
|
|
116
|
+
label,
|
|
117
|
+
withText: true,
|
|
118
|
+
keystroke,
|
|
119
|
+
withKeystroke: true,
|
|
120
|
+
role: 'menuitem',
|
|
121
|
+
_commandName: commandName
|
|
122
|
+
})
|
|
123
|
+
};
|
|
124
|
+
definition.model.bind('isEnabled').to(command, 'isEnabled');
|
|
125
|
+
return definition;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Returns definitions for UI buttons.
|
|
129
|
+
*
|
|
130
|
+
* @internal
|
|
131
|
+
*/
|
|
132
|
+
_getButtonDefinitions() {
|
|
133
|
+
const t = this.editor.locale.t;
|
|
134
|
+
return [
|
|
135
|
+
{ commandName: 'goToPreviousRestrictedEditingException', label: t('Previous editable region'), keystroke: 'Shift+Tab' },
|
|
136
|
+
{ commandName: 'goToNextRestrictedEditingException', label: t('Next editable region'), keystroke: 'Tab' }
|
|
137
|
+
];
|
|
138
|
+
}
|
|
139
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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/standardeditingmode
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import StandardEditingModeEditing from './standardeditingmodeediting.js';
|
|
10
|
+
import StandardEditingModeUI from './standardeditingmodeui.js';
|
|
11
|
+
import '../theme/restrictedediting.css';
|
|
12
|
+
/**
|
|
13
|
+
* The standard editing mode plugin.
|
|
14
|
+
*
|
|
15
|
+
* This is a "glue" plugin that loads the following plugins:
|
|
16
|
+
*
|
|
17
|
+
* * The {@link module:restricted-editing/standardeditingmodeediting~StandardEditingModeEditing standard mode editing feature}.
|
|
18
|
+
* * The {@link module:restricted-editing/standardeditingmodeui~StandardEditingModeUI standard mode UI feature}.
|
|
19
|
+
*/
|
|
20
|
+
export default class StandardEditingMode extends Plugin {
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
*/
|
|
24
|
+
static get pluginName(): "StandardEditingMode";
|
|
25
|
+
/**
|
|
26
|
+
* @inheritDoc
|
|
27
|
+
*/
|
|
28
|
+
static get isOfficialPlugin(): true;
|
|
29
|
+
static get requires(): readonly [typeof StandardEditingModeEditing, typeof StandardEditingModeUI];
|
|
30
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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/standardeditingmode
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import StandardEditingModeEditing from './standardeditingmodeediting.js';
|
|
10
|
+
import StandardEditingModeUI from './standardeditingmodeui.js';
|
|
11
|
+
import '../theme/restrictedediting.css';
|
|
12
|
+
/**
|
|
13
|
+
* The standard editing mode plugin.
|
|
14
|
+
*
|
|
15
|
+
* This is a "glue" plugin that loads the following plugins:
|
|
16
|
+
*
|
|
17
|
+
* * The {@link module:restricted-editing/standardeditingmodeediting~StandardEditingModeEditing standard mode editing feature}.
|
|
18
|
+
* * The {@link module:restricted-editing/standardeditingmodeui~StandardEditingModeUI standard mode UI feature}.
|
|
19
|
+
*/
|
|
20
|
+
export default class StandardEditingMode extends Plugin {
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
*/
|
|
24
|
+
static get pluginName() {
|
|
25
|
+
return 'StandardEditingMode';
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @inheritDoc
|
|
29
|
+
*/
|
|
30
|
+
static get isOfficialPlugin() {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
static get requires() {
|
|
34
|
+
return [StandardEditingModeEditing, StandardEditingModeUI];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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.js';
|
|
9
|
+
/**
|
|
10
|
+
* The standard editing mode editing feature.
|
|
11
|
+
*
|
|
12
|
+
* * It introduces the `restrictedEditingException` text attribute that is rendered as
|
|
13
|
+
* a `<span>` element with the `restricted-editing-exception` CSS class.
|
|
14
|
+
* * It registers the `'restrictedEditingException'` command.
|
|
15
|
+
*/
|
|
16
|
+
export default class StandardEditingModeEditing extends Plugin {
|
|
17
|
+
/**
|
|
18
|
+
* @inheritDoc
|
|
19
|
+
*/
|
|
20
|
+
static get pluginName(): "StandardEditingModeEditing";
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
*/
|
|
24
|
+
static get isOfficialPlugin(): true;
|
|
25
|
+
/**
|
|
26
|
+
* @inheritDoc
|
|
27
|
+
*/
|
|
28
|
+
init(): void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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.js';
|
|
9
|
+
import RestrictedEditingExceptionCommand from './restrictededitingexceptioncommand.js';
|
|
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
|
+
static get isOfficialPlugin() {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @inheritDoc
|
|
32
|
+
*/
|
|
33
|
+
init() {
|
|
34
|
+
const editor = this.editor;
|
|
35
|
+
editor.model.schema.extend('$text', { allowAttributes: ['restrictedEditingException'] });
|
|
36
|
+
editor.conversion.for('upcast').elementToAttribute({
|
|
37
|
+
model: 'restrictedEditingException',
|
|
38
|
+
view: {
|
|
39
|
+
name: 'span',
|
|
40
|
+
classes: 'restricted-editing-exception'
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
editor.conversion.for('downcast').attributeToElement({
|
|
44
|
+
model: 'restrictedEditingException',
|
|
45
|
+
view: (modelAttributeValue, { writer }) => {
|
|
46
|
+
if (modelAttributeValue) {
|
|
47
|
+
// Make the restricted editing <span> outer-most in the view.
|
|
48
|
+
return writer.createAttributeElement('span', { class: 'restricted-editing-exception' }, { priority: -10 });
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
editor.commands.add('restrictedEditingException', new RestrictedEditingExceptionCommand(editor));
|
|
53
|
+
editor.editing.view.change(writer => {
|
|
54
|
+
for (const root of editor.editing.view.document.roots) {
|
|
55
|
+
writer.addClass('ck-restricted-editing_mode_standard', root);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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.js';
|
|
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
|
+
static get isOfficialPlugin(): true;
|
|
23
|
+
/**
|
|
24
|
+
* @inheritDoc
|
|
25
|
+
*/
|
|
26
|
+
init(): void;
|
|
27
|
+
/**
|
|
28
|
+
* Creates a button for restricted editing exception command to use either in toolbar or in menu bar.
|
|
29
|
+
*/
|
|
30
|
+
private _createButton;
|
|
31
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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.js';
|
|
9
|
+
import { ButtonView, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';
|
|
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
|
+
static get isOfficialPlugin() {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @inheritDoc
|
|
31
|
+
*/
|
|
32
|
+
init() {
|
|
33
|
+
const editor = this.editor;
|
|
34
|
+
editor.ui.componentFactory.add('restrictedEditingException', () => {
|
|
35
|
+
const button = this._createButton(ButtonView);
|
|
36
|
+
button.set({
|
|
37
|
+
tooltip: true,
|
|
38
|
+
isToggleable: true
|
|
39
|
+
});
|
|
40
|
+
return button;
|
|
41
|
+
});
|
|
42
|
+
editor.ui.componentFactory.add('menuBar:restrictedEditingException', () => {
|
|
43
|
+
return this._createButton(MenuBarMenuListItemButtonView);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Creates a button for restricted editing exception command to use either in toolbar or in menu bar.
|
|
48
|
+
*/
|
|
49
|
+
_createButton(ButtonClass) {
|
|
50
|
+
const editor = this.editor;
|
|
51
|
+
const locale = editor.locale;
|
|
52
|
+
const command = this.editor.commands.get('restrictedEditingException');
|
|
53
|
+
const view = new ButtonClass(locale);
|
|
54
|
+
const t = locale.t;
|
|
55
|
+
view.icon = unlockIcon;
|
|
56
|
+
view.bind('isOn', 'isEnabled').to(command, 'value', 'isEnabled');
|
|
57
|
+
view.bind('label').to(command, 'value', value => {
|
|
58
|
+
return value ? t('Disable editing') : t('Enable editing');
|
|
59
|
+
});
|
|
60
|
+
// Execute the command.
|
|
61
|
+
this.listenTo(view, 'execute', () => {
|
|
62
|
+
editor.execute('restrictedEditingException');
|
|
63
|
+
editor.editing.view.focus();
|
|
64
|
+
});
|
|
65
|
+
return view;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M15.5 6.5a3.5 3.5 0 0 1 3.495 3.308L19 10v2a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1h-7a1 1 0 0 1-1-1v-5a1 1 0 0 1 1-1v-2l.005-.192A3.5 3.5 0 0 1 15.5 6.5zm0 7.5a.5.5 0 0 0-.492.41L15 14.5v2a.5.5 0 0 0 .992.09L16 16.5v-2a.5.5 0 0 0-.5-.5zm0-6a2 2 0 0 0-2 2v2h4v-2a2 2 0 0 0-2-2zm-9.25 8a.75.75 0 1 1 0 1.5H.75a.75.75 0 1 1 0-1.5h5.5zm0-5a.75.75 0 1 1 0 1.5H.75a.75.75 0 1 1 0-1.5h5.5zm3-5a.75.75 0 0 1 0 1.5H.75a.75.75 0 0 1 0-1.5h8.5zm6-5a.75.75 0 1 1 0 1.5H.75a.75.75 0 0 1 0-1.5h14.5z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.25 16a.75.75 0 1 1 0 1.5H.75a.75.75 0 1 1 0-1.5h5.5zm0-5a.75.75 0 1 1 0 1.5H.75a.75.75 0 1 1 0-1.5h5.5zm3-5a.75.75 0 0 1 0 1.5H.75a.75.75 0 0 1 0-1.5h8.5zm6-5a.75.75 0 1 1 0 1.5H.75a.75.75 0 0 1 0-1.5h14.5zm.25 5.5a3.5 3.5 0 0 1 3.143 1.959.75.75 0 0 1-1.36.636A2 2 0 0 0 13.5 10v2H19a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1h-7a1 1 0 0 1-1-1v-5a1 1 0 0 1 1-1v-2l.005-.192A3.5 3.5 0 0 1 15.5 6.5zm0 7.5a.5.5 0 0 0-.492.41L15 14.5v2a.5.5 0 0 0 .992.09L16 16.5v-2a.5.5 0 0 0-.5-.5z"/></svg>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2003-2024, 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
|
+
/*
|
|
7
|
+
* Note: This file should contain the wireframe styles only. But since there are no such styles,
|
|
8
|
+
* it acts as a message to the builder telling that it should look for the corresponding styles
|
|
9
|
+
* **in the theme** when compiling the editor.
|
|
10
|
+
*/
|