@ckeditor/ckeditor5-restricted-editing 41.4.0-alpha.0 → 41.4.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/dist/index.js +55 -18
- package/dist/index.js.map +1 -1
- package/dist/translations/ar.umd.js +11 -0
- package/dist/translations/az.umd.js +11 -0
- package/dist/translations/bg.umd.js +11 -0
- package/dist/translations/bn.umd.js +11 -0
- package/dist/translations/ca.umd.js +11 -0
- package/dist/translations/cs.umd.js +11 -0
- package/dist/translations/da.umd.js +11 -0
- package/dist/translations/de-ch.umd.js +11 -0
- package/dist/translations/de.umd.js +11 -0
- package/dist/translations/el.umd.js +11 -0
- package/dist/translations/en-au.umd.js +11 -0
- package/dist/translations/en-gb.umd.js +11 -0
- package/dist/translations/en.umd.js +11 -0
- package/dist/translations/es.umd.js +11 -0
- package/dist/translations/et.umd.js +11 -0
- package/dist/translations/fa.umd.js +11 -0
- package/dist/translations/fi.umd.js +11 -0
- package/dist/translations/fr.umd.js +11 -0
- package/dist/translations/gl.umd.js +11 -0
- package/dist/translations/he.umd.js +11 -0
- package/dist/translations/hi.umd.js +11 -0
- package/dist/translations/hr.umd.js +11 -0
- package/dist/translations/hu.umd.js +11 -0
- package/dist/translations/id.umd.js +11 -0
- package/dist/translations/it.umd.js +11 -0
- package/dist/translations/ja.umd.js +11 -0
- package/dist/translations/ko.umd.js +11 -0
- package/dist/translations/ku.umd.js +11 -0
- package/dist/translations/lt.umd.js +11 -0
- package/dist/translations/lv.umd.js +11 -0
- package/dist/translations/ms.umd.js +11 -0
- package/dist/translations/nl.umd.js +11 -0
- package/dist/translations/no.umd.js +11 -0
- package/dist/translations/pl.umd.js +11 -0
- package/dist/translations/pt-br.umd.js +11 -0
- package/dist/translations/pt.umd.js +11 -0
- package/dist/translations/ro.umd.js +11 -0
- package/dist/translations/ru.umd.js +11 -0
- package/dist/translations/sk.umd.js +11 -0
- package/dist/translations/sq.umd.js +11 -0
- package/dist/translations/sr-latn.umd.js +11 -0
- package/dist/translations/sr.umd.js +11 -0
- package/dist/translations/sv.umd.js +11 -0
- package/dist/translations/th.umd.js +11 -0
- package/dist/translations/tk.umd.js +11 -0
- package/dist/translations/tr.umd.js +11 -0
- package/dist/translations/uk.umd.js +11 -0
- package/dist/translations/ur.umd.js +11 -0
- package/dist/translations/uz.umd.js +11 -0
- package/dist/translations/vi.umd.js +11 -0
- package/dist/translations/zh-cn.umd.js +11 -0
- package/dist/translations/zh.umd.js +11 -0
- package/package.json +2 -2
- package/src/restrictededitingmodeediting.js +51 -18
- package/src/restrictededitingmodeui.js +4 -1
@@ -0,0 +1,11 @@
|
|
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
|
+
( e => {
|
7
|
+
const { [ 'tr' ]: { dictionary, getPluralForm } } = {"tr":{"dictionary":{"Disable editing":"Düzenlemeyi devre dışı bırak","Enable editing":"Düzenlemeyi etkinleştir","Previous editable region":"Önceki düzenlenebilir alan","Next editable region":"Sonraki düzenlenebilir alan","Navigate editable regions":"Düzenlenebilir alanlara git"},getPluralForm(n){return (n > 1);}}};
|
8
|
+
e[ 'tr' ] ||= { dictionary: {}, getPluralForm: null };
|
9
|
+
e[ 'tr' ].dictionary = Object.assign( e[ 'tr' ].dictionary, dictionary );
|
10
|
+
e[ 'tr' ].getPluralForm = getPluralForm;
|
11
|
+
} )( window.CKEDITOR_TRANSLATIONS ||= {} );
|
@@ -0,0 +1,11 @@
|
|
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
|
+
( e => {
|
7
|
+
const { [ 'uk' ]: { dictionary, getPluralForm } } = {"uk":{"dictionary":{"Disable editing":"Вимкнути редагування","Enable editing":"Увімкнути редагування","Previous editable region":"Попередня область редагування","Next editable region":"Наступна область редагування","Navigate editable regions":"Навігація по областях редагування"},getPluralForm(n){return (n % 1 == 0 && n % 10 == 1 && n % 100 != 11 ? 0 : n % 1 == 0 && n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 12 || n % 100 > 14) ? 1 : n % 1 == 0 && (n % 10 ==0 || (n % 10 >=5 && n % 10 <=9) || (n % 100 >=11 && n % 100 <=14 )) ? 2: 3);}}};
|
8
|
+
e[ 'uk' ] ||= { dictionary: {}, getPluralForm: null };
|
9
|
+
e[ 'uk' ].dictionary = Object.assign( e[ 'uk' ].dictionary, dictionary );
|
10
|
+
e[ 'uk' ].getPluralForm = getPluralForm;
|
11
|
+
} )( window.CKEDITOR_TRANSLATIONS ||= {} );
|
@@ -0,0 +1,11 @@
|
|
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
|
+
( e => {
|
7
|
+
const { [ 'ur' ]: { dictionary, getPluralForm } } = {"ur":{"dictionary":{"Disable editing":"تدویں غیر فعال کریں","Enable editing":"تدوین فعال کریں","Previous editable region":"","Next editable region":"","Navigate editable regions":""},getPluralForm(n){return (n != 1);}}};
|
8
|
+
e[ 'ur' ] ||= { dictionary: {}, getPluralForm: null };
|
9
|
+
e[ 'ur' ].dictionary = Object.assign( e[ 'ur' ].dictionary, dictionary );
|
10
|
+
e[ 'ur' ].getPluralForm = getPluralForm;
|
11
|
+
} )( window.CKEDITOR_TRANSLATIONS ||= {} );
|
@@ -0,0 +1,11 @@
|
|
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
|
+
( e => {
|
7
|
+
const { [ 'uz' ]: { dictionary, getPluralForm } } = {"uz":{"dictionary":{"Disable editing":"Tahrirlashni o‘chirib qo‘yish","Enable editing":"Tahrirlashga ruxsat berish","Previous editable region":"Avvalgi tahrirlanadigan hudud","Next editable region":"Keyingi tahrirlanadigan hudud","Navigate editable regions":"Tahrirlanadigan hududlar boʻylab navigatsiya"},getPluralForm(n){return 0;}}};
|
8
|
+
e[ 'uz' ] ||= { dictionary: {}, getPluralForm: null };
|
9
|
+
e[ 'uz' ].dictionary = Object.assign( e[ 'uz' ].dictionary, dictionary );
|
10
|
+
e[ 'uz' ].getPluralForm = getPluralForm;
|
11
|
+
} )( window.CKEDITOR_TRANSLATIONS ||= {} );
|
@@ -0,0 +1,11 @@
|
|
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
|
+
( e => {
|
7
|
+
const { [ 'vi' ]: { dictionary, getPluralForm } } = {"vi":{"dictionary":{"Disable editing":"Tắt tính năng chỉnh sửa","Enable editing":"Bật tính năng chỉnh sửa","Previous editable region":"Vùng có thể chỉnh sửa trước đó","Next editable region":"Vùng có thể chỉnh sửa tiếp theo","Navigate editable regions":"Di chuyển giữa các vùng có thể chỉnh sửa"},getPluralForm(n){return 0;}}};
|
8
|
+
e[ 'vi' ] ||= { dictionary: {}, getPluralForm: null };
|
9
|
+
e[ 'vi' ].dictionary = Object.assign( e[ 'vi' ].dictionary, dictionary );
|
10
|
+
e[ 'vi' ].getPluralForm = getPluralForm;
|
11
|
+
} )( window.CKEDITOR_TRANSLATIONS ||= {} );
|
@@ -0,0 +1,11 @@
|
|
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
|
+
( e => {
|
7
|
+
const { [ 'zh-cn' ]: { dictionary, getPluralForm } } = {"zh-cn":{"dictionary":{"Disable editing":"禁用编辑","Enable editing":"允许编辑","Previous editable region":"上一个可编辑区域","Next editable region":"下一个可编辑区域","Navigate editable regions":"导航至可编辑区域"},getPluralForm(n){return 0;}}};
|
8
|
+
e[ 'zh-cn' ] ||= { dictionary: {}, getPluralForm: null };
|
9
|
+
e[ 'zh-cn' ].dictionary = Object.assign( e[ 'zh-cn' ].dictionary, dictionary );
|
10
|
+
e[ 'zh-cn' ].getPluralForm = getPluralForm;
|
11
|
+
} )( window.CKEDITOR_TRANSLATIONS ||= {} );
|
@@ -0,0 +1,11 @@
|
|
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
|
+
( e => {
|
7
|
+
const { [ 'zh' ]: { dictionary, getPluralForm } } = {"zh":{"dictionary":{"Disable editing":"停用編輯","Enable editing":"啟用編輯","Previous editable region":"上一個可編輯區域","Next editable region":"下一個可編輯區域","Navigate editable regions":"編輯區域導航"},getPluralForm(n){return 0;}}};
|
8
|
+
e[ 'zh' ] ||= { dictionary: {}, getPluralForm: null };
|
9
|
+
e[ 'zh' ].dictionary = Object.assign( e[ 'zh' ].dictionary, dictionary );
|
10
|
+
e[ 'zh' ].getPluralForm = getPluralForm;
|
11
|
+
} )( window.CKEDITOR_TRANSLATIONS ||= {} );
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ckeditor/ckeditor5-restricted-editing",
|
3
|
-
"version": "41.4.0
|
3
|
+
"version": "41.4.0",
|
4
4
|
"description": "Restricted editing feature for CKEditor 5 editors.",
|
5
5
|
"keywords": [
|
6
6
|
"ckeditor",
|
@@ -12,7 +12,7 @@
|
|
12
12
|
"type": "module",
|
13
13
|
"main": "src/index.js",
|
14
14
|
"dependencies": {
|
15
|
-
"ckeditor5": "41.4.0
|
15
|
+
"ckeditor5": "41.4.0"
|
16
16
|
},
|
17
17
|
"author": "CKSource (http://cksource.com/)",
|
18
18
|
"license": "GPL-2.0-or-later",
|
@@ -50,8 +50,18 @@ export default class RestrictedEditingModeEditing extends Plugin {
|
|
50
50
|
// Commands & keystrokes that allow navigation in the content.
|
51
51
|
editor.commands.add('goToPreviousRestrictedEditingException', new RestrictedEditingModeNavigationCommand(editor, 'backward'));
|
52
52
|
editor.commands.add('goToNextRestrictedEditingException', new RestrictedEditingModeNavigationCommand(editor, 'forward'));
|
53
|
-
|
54
|
-
|
53
|
+
this.listenTo(editingView.document, 'tab', (evt, data) => {
|
54
|
+
const commandName = !data.shiftKey ? 'goToNextRestrictedEditingException' : 'goToPreviousRestrictedEditingException';
|
55
|
+
const command = editor.commands.get(commandName);
|
56
|
+
if (command.isEnabled) {
|
57
|
+
editor.execute(commandName);
|
58
|
+
// Stop the event in the DOM: no listener in the web page will be triggered by this event.
|
59
|
+
data.preventDefault();
|
60
|
+
data.stopPropagation();
|
61
|
+
}
|
62
|
+
// Stop the event bubbling in the editor: no more callbacks will be executed for this keystroke.
|
63
|
+
evt.stop();
|
64
|
+
}, { context: '$capture' });
|
55
65
|
editor.keystrokes.set('Ctrl+A', getSelectAllHandler(editor));
|
56
66
|
editingView.change(writer => {
|
57
67
|
for (const root of editingView.document.roots) {
|
@@ -98,8 +108,43 @@ export default class RestrictedEditingModeEditing extends Plugin {
|
|
98
108
|
}
|
99
109
|
}));
|
100
110
|
// Currently the marker helpers are tied to other use-cases and do not render a collapsed marker as highlight.
|
101
|
-
//
|
102
|
-
//
|
111
|
+
// Also, markerToHighlight can not convert marker on an inline object. It handles only text and widgets,
|
112
|
+
// but it is not a case in the data pipeline. That's why there are 3 downcast converters for them:
|
113
|
+
//
|
114
|
+
// 1. The custom inline item (text or inline object) converter (but not the selection).
|
115
|
+
editor.conversion.for('downcast').add(dispatcher => {
|
116
|
+
dispatcher.on('addMarker:restrictedEditingException', (evt, data, conversionApi) => {
|
117
|
+
// Only convert per-item conversion.
|
118
|
+
if (!data.item) {
|
119
|
+
return;
|
120
|
+
}
|
121
|
+
// Do not convert the selection or non-inline items.
|
122
|
+
if (data.item.is('selection') || !conversionApi.schema.isInline(data.item)) {
|
123
|
+
return;
|
124
|
+
}
|
125
|
+
if (!conversionApi.consumable.consume(data.item, evt.name)) {
|
126
|
+
return;
|
127
|
+
}
|
128
|
+
const viewWriter = conversionApi.writer;
|
129
|
+
const viewElement = viewWriter.createAttributeElement('span', {
|
130
|
+
class: 'restricted-editing-exception'
|
131
|
+
}, {
|
132
|
+
id: data.markerName,
|
133
|
+
priority: -10
|
134
|
+
});
|
135
|
+
const viewRange = conversionApi.mapper.toViewRange(data.range);
|
136
|
+
const rangeAfterWrap = viewWriter.wrap(viewRange, viewElement);
|
137
|
+
for (const element of rangeAfterWrap.getItems()) {
|
138
|
+
if (element.is('attributeElement') && element.isSimilar(viewElement)) {
|
139
|
+
conversionApi.mapper.bindElementToMarker(element, data.markerName);
|
140
|
+
// One attribute element is enough, because all of them are bound together by the view writer.
|
141
|
+
// Mapper uses this binding to get all the elements no matter how many of them are registered in the mapper.
|
142
|
+
break;
|
143
|
+
}
|
144
|
+
}
|
145
|
+
});
|
146
|
+
});
|
147
|
+
// 2. The marker-to-highlight converter for the document selection.
|
103
148
|
editor.conversion.for('downcast').markerToHighlight({
|
104
149
|
model: 'restrictedEditingException',
|
105
150
|
// Use callback to return new object every time new marker instance is created - otherwise it will be seen as the same marker.
|
@@ -111,8 +156,8 @@ export default class RestrictedEditingModeEditing extends Plugin {
|
|
111
156
|
};
|
112
157
|
}
|
113
158
|
});
|
114
|
-
//
|
115
|
-
// Additionally the editing pipeline should always display a collapsed marker.
|
159
|
+
// 3. And for collapsed marker we need to render it as an element.
|
160
|
+
// Additionally, the editing pipeline should always display a collapsed marker.
|
116
161
|
editor.conversion.for('editingDowncast').markerToElement({
|
117
162
|
model: 'restrictedEditingException',
|
118
163
|
view: (markerData, { writer }) => {
|
@@ -231,18 +276,6 @@ export default class RestrictedEditingModeEditing extends Plugin {
|
|
231
276
|
}
|
232
277
|
}
|
233
278
|
}
|
234
|
-
/**
|
235
|
-
* Helper method for executing enabled commands only.
|
236
|
-
*/
|
237
|
-
function getCommandExecuter(editor, commandName) {
|
238
|
-
return (_, cancel) => {
|
239
|
-
const command = editor.commands.get(commandName);
|
240
|
-
if (command.isEnabled) {
|
241
|
-
editor.execute(commandName);
|
242
|
-
cancel();
|
243
|
-
}
|
244
|
-
};
|
245
|
-
}
|
246
279
|
/**
|
247
280
|
* Helper for handling Ctrl+A keydown behaviour.
|
248
281
|
*/
|
@@ -34,7 +34,9 @@ export default class RestrictedEditingModeUI extends Plugin {
|
|
34
34
|
this._getButtonDefinitions().forEach(({ commandName, label, keystroke }) => {
|
35
35
|
listItems.add(this._getButtonDefinition(commandName, label, keystroke));
|
36
36
|
});
|
37
|
-
addListToDropdown(dropdownView, listItems
|
37
|
+
addListToDropdown(dropdownView, listItems, {
|
38
|
+
role: 'menu'
|
39
|
+
});
|
38
40
|
dropdownView.buttonView.set({
|
39
41
|
label: t('Navigate editable regions'),
|
40
42
|
icon: lockIcon,
|
@@ -109,6 +111,7 @@ export default class RestrictedEditingModeUI extends Plugin {
|
|
109
111
|
withText: true,
|
110
112
|
keystroke,
|
111
113
|
withKeystroke: true,
|
114
|
+
role: 'menuitem',
|
112
115
|
_commandName: commandName
|
113
116
|
})
|
114
117
|
};
|