@ckeditor/ckeditor5-restricted-editing 0.0.0-nightly-20240604.1 → 0.0.0-nightly-20240605.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/README.md +0 -6
- package/dist/index.js +126 -177
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -15,12 +15,6 @@ Check out the demo in the [restricted editing feature guide](https://ckeditor.co
|
|
|
15
15
|
|
|
16
16
|
See the [`@ckeditor/ckeditor5-restricted-editing` package](https://ckeditor.com/docs/ckeditor5/latest/api/restricted-editing.html) page as well as the [restricted editing feature](https://ckeditor.com/docs/ckeditor5/latest/features/restricted-editing.html) guide in the [CKEditor 5 documentation](https://ckeditor.com/docs/ckeditor5/latest/).
|
|
17
17
|
|
|
18
|
-
## Installation
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
npm install ckeditor5
|
|
22
|
-
```
|
|
23
|
-
|
|
24
18
|
## License
|
|
25
19
|
|
|
26
20
|
Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html). For full details about the license, please check the `LICENSE.md` file or [https://ckeditor.com/legal/ckeditor-oss-license](https://ckeditor.com/legal/ckeditor-oss-license).
|
package/dist/index.js
CHANGED
|
@@ -7,33 +7,17 @@ import { Matcher } from '@ckeditor/ckeditor5-engine/dist/index.js';
|
|
|
7
7
|
import { createDropdown, addListToDropdown, MenuBarMenuView, MenuBarMenuListView, MenuBarMenuListItemView, MenuBarMenuListItemButtonView, ViewModel, ButtonView } from '@ckeditor/ckeditor5-ui/dist/index.js';
|
|
8
8
|
import { Collection } from '@ckeditor/ckeditor5-utils/dist/index.js';
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
* The command that allows navigation across the exceptions in the edited document.
|
|
12
|
-
*/ class RestrictedEditingModeNavigationCommand extends Command {
|
|
13
|
-
/**
|
|
14
|
-
* The direction of the command.
|
|
15
|
-
*/ _direction;
|
|
10
|
+
class RestrictedEditingModeNavigationCommand extends Command {
|
|
16
11
|
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
* @param editor The editor instance.
|
|
20
|
-
* @param direction The direction that the command works.
|
|
21
|
-
*/ constructor(editor, direction){
|
|
22
|
-
super(editor);
|
|
23
|
-
// It does not affect data so should be enabled in read-only mode and in restricted editing mode.
|
|
24
|
-
this.affectsData = false;
|
|
25
|
-
this._direction = direction;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* @inheritDoc
|
|
29
|
-
*/ refresh() {
|
|
12
|
+
* @inheritDoc
|
|
13
|
+
*/ refresh() {
|
|
30
14
|
this.isEnabled = this._checkEnabled();
|
|
31
15
|
}
|
|
32
16
|
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
17
|
+
* Executes the command.
|
|
18
|
+
*
|
|
19
|
+
* @fires execute
|
|
20
|
+
*/ execute() {
|
|
37
21
|
const position = getNearestExceptionRange(this.editor.model, this._direction);
|
|
38
22
|
if (!position) {
|
|
39
23
|
return;
|
|
@@ -43,12 +27,23 @@ import { Collection } from '@ckeditor/ckeditor5-utils/dist/index.js';
|
|
|
43
27
|
});
|
|
44
28
|
}
|
|
45
29
|
/**
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
30
|
+
* Checks whether the command can be enabled in the current context.
|
|
31
|
+
*
|
|
32
|
+
* @returns Whether the command should be enabled.
|
|
33
|
+
*/ _checkEnabled() {
|
|
50
34
|
return !!getNearestExceptionRange(this.editor.model, this._direction);
|
|
51
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Creates an instance of the command.
|
|
38
|
+
*
|
|
39
|
+
* @param editor The editor instance.
|
|
40
|
+
* @param direction The direction that the command works.
|
|
41
|
+
*/ constructor(editor, direction){
|
|
42
|
+
super(editor);
|
|
43
|
+
// It does not affect data so should be enabled in read-only mode and in restricted editing mode.
|
|
44
|
+
this.affectsData = false;
|
|
45
|
+
this._direction = direction;
|
|
46
|
+
}
|
|
52
47
|
}
|
|
53
48
|
/**
|
|
54
49
|
* Returns the range of the exception marker closest to the last position of the model selection.
|
|
@@ -276,58 +271,15 @@ const HIGHLIGHT_CLASS = 'restricted-editing-exception_selected';
|
|
|
276
271
|
}
|
|
277
272
|
|
|
278
273
|
const COMMAND_FORCE_DISABLE_ID = 'RestrictedEditingMode';
|
|
279
|
-
|
|
280
|
-
* The restricted editing mode editing feature.
|
|
281
|
-
*
|
|
282
|
-
* * It introduces the exception marker group that renders to `<span>` elements with the `restricted-editing-exception` CSS class.
|
|
283
|
-
* * It registers the `'goToPreviousRestrictedEditingException'` and `'goToNextRestrictedEditingException'` commands.
|
|
284
|
-
* * It also enables highlighting exception markers that are selected.
|
|
285
|
-
*/ class RestrictedEditingModeEditing extends Plugin {
|
|
274
|
+
class RestrictedEditingModeEditing extends Plugin {
|
|
286
275
|
/**
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* Commands allowed in non-restricted areas.
|
|
291
|
-
*
|
|
292
|
-
* Commands always enabled combine typing feature commands: `'input'`, `'insertText'`, `'delete'`, and `'deleteForward'` with
|
|
293
|
-
* commands defined in the feature configuration.
|
|
294
|
-
*/ _allowedInException;
|
|
295
|
-
/**
|
|
296
|
-
* @inheritDoc
|
|
297
|
-
*/ static get pluginName() {
|
|
276
|
+
* @inheritDoc
|
|
277
|
+
*/ static get pluginName() {
|
|
298
278
|
return 'RestrictedEditingModeEditing';
|
|
299
279
|
}
|
|
300
280
|
/**
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
super(editor);
|
|
304
|
-
editor.config.define('restrictedEditing', {
|
|
305
|
-
allowedCommands: [
|
|
306
|
-
'bold',
|
|
307
|
-
'italic',
|
|
308
|
-
'link',
|
|
309
|
-
'unlink'
|
|
310
|
-
],
|
|
311
|
-
allowedAttributes: [
|
|
312
|
-
'bold',
|
|
313
|
-
'italic',
|
|
314
|
-
'linkHref'
|
|
315
|
-
]
|
|
316
|
-
});
|
|
317
|
-
this._alwaysEnabled = new Set([
|
|
318
|
-
'undo',
|
|
319
|
-
'redo'
|
|
320
|
-
]);
|
|
321
|
-
this._allowedInException = new Set([
|
|
322
|
-
'input',
|
|
323
|
-
'insertText',
|
|
324
|
-
'delete',
|
|
325
|
-
'deleteForward'
|
|
326
|
-
]);
|
|
327
|
-
}
|
|
328
|
-
/**
|
|
329
|
-
* @inheritDoc
|
|
330
|
-
*/ init() {
|
|
281
|
+
* @inheritDoc
|
|
282
|
+
*/ init() {
|
|
331
283
|
const editor = this.editor;
|
|
332
284
|
const editingView = editor.editing.view;
|
|
333
285
|
const allowedCommands = editor.config.get('restrictedEditing.allowedCommands');
|
|
@@ -360,25 +312,25 @@ const COMMAND_FORCE_DISABLE_ID = 'RestrictedEditingMode';
|
|
|
360
312
|
});
|
|
361
313
|
}
|
|
362
314
|
/**
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
315
|
+
* Makes the given command always enabled in the restricted editing mode (regardless
|
|
316
|
+
* of selection location).
|
|
317
|
+
*
|
|
318
|
+
* To enable some commands in non-restricted areas of the content use
|
|
319
|
+
* {@link module:restricted-editing/restrictededitingconfig~RestrictedEditingConfig#allowedCommands} configuration option.
|
|
320
|
+
*
|
|
321
|
+
* @param commandName Name of the command to enable.
|
|
322
|
+
*/ enableCommand(commandName) {
|
|
371
323
|
const command = this.editor.commands.get(commandName);
|
|
372
324
|
command.clearForceDisabled(COMMAND_FORCE_DISABLE_ID);
|
|
373
325
|
this._alwaysEnabled.add(commandName);
|
|
374
326
|
}
|
|
375
327
|
/**
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
328
|
+
* Sets up the restricted mode editing conversion:
|
|
329
|
+
*
|
|
330
|
+
* * ucpast & downcast converters,
|
|
331
|
+
* * marker highlighting in the edting area,
|
|
332
|
+
* * marker post-fixers.
|
|
333
|
+
*/ _setupConversion() {
|
|
382
334
|
const editor = this.editor;
|
|
383
335
|
const model = editor.model;
|
|
384
336
|
const doc = model.document;
|
|
@@ -466,13 +418,13 @@ const COMMAND_FORCE_DISABLE_ID = 'RestrictedEditingMode';
|
|
|
466
418
|
setupExceptionHighlighting(editor);
|
|
467
419
|
}
|
|
468
420
|
/**
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
421
|
+
* Setups additional editing restrictions beyond command toggling:
|
|
422
|
+
*
|
|
423
|
+
* * delete content range trimming
|
|
424
|
+
* * disabling input command outside exception marker
|
|
425
|
+
* * restricting clipboard holder to text only
|
|
426
|
+
* * restricting text attributes in content
|
|
427
|
+
*/ _setupRestrictions() {
|
|
476
428
|
const editor = this.editor;
|
|
477
429
|
const model = editor.model;
|
|
478
430
|
const selection = model.document.selection;
|
|
@@ -508,8 +460,8 @@ const COMMAND_FORCE_DISABLE_ID = 'RestrictedEditingMode';
|
|
|
508
460
|
model.schema.addChildCheck(allowTextOnlyInClipboardHolder());
|
|
509
461
|
}
|
|
510
462
|
/**
|
|
511
|
-
|
|
512
|
-
|
|
463
|
+
* Sets up the command toggling which enables or disables commands based on the user selection.
|
|
464
|
+
*/ _setupCommandsToggling() {
|
|
513
465
|
const editor = this.editor;
|
|
514
466
|
const model = editor.model;
|
|
515
467
|
const doc = model.document;
|
|
@@ -518,8 +470,8 @@ const COMMAND_FORCE_DISABLE_ID = 'RestrictedEditingMode';
|
|
|
518
470
|
this.listenTo(doc, 'change:data', this._checkCommands.bind(this));
|
|
519
471
|
}
|
|
520
472
|
/**
|
|
521
|
-
|
|
522
|
-
|
|
473
|
+
* Checks if commands should be enabled or disabled based on the current selection.
|
|
474
|
+
*/ _checkCommands() {
|
|
523
475
|
const editor = this.editor;
|
|
524
476
|
const selection = editor.model.document.selection;
|
|
525
477
|
if (selection.rangeCount > 1) {
|
|
@@ -533,8 +485,8 @@ const COMMAND_FORCE_DISABLE_ID = 'RestrictedEditingMode';
|
|
|
533
485
|
}
|
|
534
486
|
}
|
|
535
487
|
/**
|
|
536
|
-
|
|
537
|
-
|
|
488
|
+
* Enables commands in non-restricted regions.
|
|
489
|
+
*/ _enableCommands(marker) {
|
|
538
490
|
const editor = this.editor;
|
|
539
491
|
for (const [commandName, command] of editor.commands){
|
|
540
492
|
if (!command.affectsData || this._alwaysEnabled.has(commandName)) {
|
|
@@ -552,8 +504,8 @@ const COMMAND_FORCE_DISABLE_ID = 'RestrictedEditingMode';
|
|
|
552
504
|
}
|
|
553
505
|
}
|
|
554
506
|
/**
|
|
555
|
-
|
|
556
|
-
|
|
507
|
+
* Disables commands outside non-restricted regions.
|
|
508
|
+
*/ _disableCommands() {
|
|
557
509
|
const editor = this.editor;
|
|
558
510
|
for (const [commandName, command] of editor.commands){
|
|
559
511
|
if (!command.affectsData || this._alwaysEnabled.has(commandName)) {
|
|
@@ -562,6 +514,34 @@ const COMMAND_FORCE_DISABLE_ID = 'RestrictedEditingMode';
|
|
|
562
514
|
command.forceDisabled(COMMAND_FORCE_DISABLE_ID);
|
|
563
515
|
}
|
|
564
516
|
}
|
|
517
|
+
/**
|
|
518
|
+
* @inheritDoc
|
|
519
|
+
*/ constructor(editor){
|
|
520
|
+
super(editor);
|
|
521
|
+
editor.config.define('restrictedEditing', {
|
|
522
|
+
allowedCommands: [
|
|
523
|
+
'bold',
|
|
524
|
+
'italic',
|
|
525
|
+
'link',
|
|
526
|
+
'unlink'
|
|
527
|
+
],
|
|
528
|
+
allowedAttributes: [
|
|
529
|
+
'bold',
|
|
530
|
+
'italic',
|
|
531
|
+
'linkHref'
|
|
532
|
+
]
|
|
533
|
+
});
|
|
534
|
+
this._alwaysEnabled = new Set([
|
|
535
|
+
'undo',
|
|
536
|
+
'redo'
|
|
537
|
+
]);
|
|
538
|
+
this._allowedInException = new Set([
|
|
539
|
+
'input',
|
|
540
|
+
'insertText',
|
|
541
|
+
'delete',
|
|
542
|
+
'deleteForward'
|
|
543
|
+
]);
|
|
544
|
+
}
|
|
565
545
|
}
|
|
566
546
|
/**
|
|
567
547
|
* Helper for handling Ctrl+A keydown behaviour.
|
|
@@ -705,20 +685,15 @@ function allowTextOnlyInClipboardHolder() {
|
|
|
705
685
|
|
|
706
686
|
var lockIcon = "<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>";
|
|
707
687
|
|
|
708
|
-
|
|
709
|
-
* The restricted editing mode UI feature.
|
|
710
|
-
*
|
|
711
|
-
* It introduces the `'restrictedEditing'` dropdown that offers tools to navigate between exceptions across
|
|
712
|
-
* the document.
|
|
713
|
-
*/ class RestrictedEditingModeUI extends Plugin {
|
|
688
|
+
class RestrictedEditingModeUI extends Plugin {
|
|
714
689
|
/**
|
|
715
|
-
|
|
716
|
-
|
|
690
|
+
* @inheritDoc
|
|
691
|
+
*/ static get pluginName() {
|
|
717
692
|
return 'RestrictedEditingModeUI';
|
|
718
693
|
}
|
|
719
694
|
/**
|
|
720
|
-
|
|
721
|
-
|
|
695
|
+
* @inheritDoc
|
|
696
|
+
*/ init() {
|
|
722
697
|
const editor = this.editor;
|
|
723
698
|
const t = editor.t;
|
|
724
699
|
editor.ui.componentFactory.add('restrictedEditing', (locale)=>{
|
|
@@ -767,8 +742,8 @@ var lockIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\">
|
|
|
767
742
|
});
|
|
768
743
|
}
|
|
769
744
|
/**
|
|
770
|
-
|
|
771
|
-
|
|
745
|
+
* Creates a button for restricted editing command to use in menu bar.
|
|
746
|
+
*/ _createMenuBarButton(label, commandName, keystroke) {
|
|
772
747
|
const editor = this.editor;
|
|
773
748
|
const command = editor.commands.get(commandName);
|
|
774
749
|
const view = new MenuBarMenuListItemButtonView(editor.locale);
|
|
@@ -787,12 +762,12 @@ var lockIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\">
|
|
|
787
762
|
return view;
|
|
788
763
|
}
|
|
789
764
|
/**
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
765
|
+
* Returns a definition of the navigation button to be used in the dropdown.
|
|
766
|
+
*
|
|
767
|
+
* @param commandName The name of the command that the button represents.
|
|
768
|
+
* @param label The translated label of the button.
|
|
769
|
+
* @param keystroke The button keystroke.
|
|
770
|
+
*/ _getButtonDefinition(commandName, label, keystroke) {
|
|
796
771
|
const editor = this.editor;
|
|
797
772
|
const command = editor.commands.get(commandName);
|
|
798
773
|
const definition = {
|
|
@@ -810,10 +785,10 @@ var lockIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\">
|
|
|
810
785
|
return definition;
|
|
811
786
|
}
|
|
812
787
|
/**
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
788
|
+
* Returns definitions for UI buttons.
|
|
789
|
+
*
|
|
790
|
+
* @internal
|
|
791
|
+
*/ _getButtonDefinitions() {
|
|
817
792
|
const t = this.editor.locale.t;
|
|
818
793
|
return [
|
|
819
794
|
{
|
|
@@ -830,22 +805,15 @@ var lockIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\">
|
|
|
830
805
|
}
|
|
831
806
|
}
|
|
832
807
|
|
|
833
|
-
|
|
834
|
-
* The restricted editing mode plugin.
|
|
835
|
-
*
|
|
836
|
-
* This is a "glue" plugin which loads the following plugins:
|
|
837
|
-
*
|
|
838
|
-
* * The {@link module:restricted-editing/restrictededitingmodeediting~RestrictedEditingModeEditing restricted mode editing feature}.
|
|
839
|
-
* * The {@link module:restricted-editing/restrictededitingmodeui~RestrictedEditingModeUI restricted mode UI feature}.
|
|
840
|
-
*/ class RestrictedEditingMode extends Plugin {
|
|
808
|
+
class RestrictedEditingMode extends Plugin {
|
|
841
809
|
/**
|
|
842
|
-
|
|
843
|
-
|
|
810
|
+
* @inheritDoc
|
|
811
|
+
*/ static get pluginName() {
|
|
844
812
|
return 'RestrictedEditingMode';
|
|
845
813
|
}
|
|
846
814
|
/**
|
|
847
|
-
|
|
848
|
-
|
|
815
|
+
* @inheritDoc
|
|
816
|
+
*/ static get requires() {
|
|
849
817
|
return [
|
|
850
818
|
RestrictedEditingModeEditing,
|
|
851
819
|
RestrictedEditingModeUI
|
|
@@ -853,20 +821,18 @@ var lockIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\">
|
|
|
853
821
|
}
|
|
854
822
|
}
|
|
855
823
|
|
|
856
|
-
|
|
857
|
-
* The command that toggles exceptions from the restricted editing on text.
|
|
858
|
-
*/ class RestrictedEditingExceptionCommand extends Command {
|
|
824
|
+
class RestrictedEditingExceptionCommand extends Command {
|
|
859
825
|
/**
|
|
860
|
-
|
|
861
|
-
|
|
826
|
+
* @inheritDoc
|
|
827
|
+
*/ refresh() {
|
|
862
828
|
const model = this.editor.model;
|
|
863
829
|
const doc = model.document;
|
|
864
830
|
this.value = !!doc.selection.getAttribute('restrictedEditingException');
|
|
865
831
|
this.isEnabled = model.schema.checkAttributeInSelection(doc.selection, 'restrictedEditingException');
|
|
866
832
|
}
|
|
867
833
|
/**
|
|
868
|
-
|
|
869
|
-
|
|
834
|
+
* @inheritDoc
|
|
835
|
+
*/ execute(options = {}) {
|
|
870
836
|
const model = this.editor.model;
|
|
871
837
|
const document = model.document;
|
|
872
838
|
const selection = document.selection;
|
|
@@ -903,21 +869,15 @@ var lockIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\">
|
|
|
903
869
|
}
|
|
904
870
|
}
|
|
905
871
|
|
|
906
|
-
|
|
907
|
-
* The standard editing mode editing feature.
|
|
908
|
-
*
|
|
909
|
-
* * It introduces the `restrictedEditingException` text attribute that is rendered as
|
|
910
|
-
* a `<span>` element with the `restricted-editing-exception` CSS class.
|
|
911
|
-
* * It registers the `'restrictedEditingException'` command.
|
|
912
|
-
*/ class StandardEditingModeEditing extends Plugin {
|
|
872
|
+
class StandardEditingModeEditing extends Plugin {
|
|
913
873
|
/**
|
|
914
|
-
|
|
915
|
-
|
|
874
|
+
* @inheritDoc
|
|
875
|
+
*/ static get pluginName() {
|
|
916
876
|
return 'StandardEditingModeEditing';
|
|
917
877
|
}
|
|
918
878
|
/**
|
|
919
|
-
|
|
920
|
-
|
|
879
|
+
* @inheritDoc
|
|
880
|
+
*/ init() {
|
|
921
881
|
const editor = this.editor;
|
|
922
882
|
editor.model.schema.extend('$text', {
|
|
923
883
|
allowAttributes: [
|
|
@@ -955,19 +915,15 @@ var lockIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\">
|
|
|
955
915
|
|
|
956
916
|
var unlockIcon = "<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>";
|
|
957
917
|
|
|
958
|
-
|
|
959
|
-
* The standard editing mode UI feature.
|
|
960
|
-
*
|
|
961
|
-
* It introduces the `'restrictedEditingException'` button that marks text as unrestricted for editing.
|
|
962
|
-
*/ class StandardEditingModeUI extends Plugin {
|
|
918
|
+
class StandardEditingModeUI extends Plugin {
|
|
963
919
|
/**
|
|
964
|
-
|
|
965
|
-
|
|
920
|
+
* @inheritDoc
|
|
921
|
+
*/ static get pluginName() {
|
|
966
922
|
return 'StandardEditingModeUI';
|
|
967
923
|
}
|
|
968
924
|
/**
|
|
969
|
-
|
|
970
|
-
|
|
925
|
+
* @inheritDoc
|
|
926
|
+
*/ init() {
|
|
971
927
|
const editor = this.editor;
|
|
972
928
|
editor.ui.componentFactory.add('restrictedEditingException', ()=>{
|
|
973
929
|
const button = this._createButton(ButtonView);
|
|
@@ -982,8 +938,8 @@ var unlockIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\
|
|
|
982
938
|
});
|
|
983
939
|
}
|
|
984
940
|
/**
|
|
985
|
-
|
|
986
|
-
|
|
941
|
+
* Creates a button for restricted editing exception command to use either in toolbar or in menu bar.
|
|
942
|
+
*/ _createButton(ButtonClass) {
|
|
987
943
|
const editor = this.editor;
|
|
988
944
|
const locale = editor.locale;
|
|
989
945
|
const command = this.editor.commands.get('restrictedEditingException');
|
|
@@ -1003,17 +959,10 @@ var unlockIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\
|
|
|
1003
959
|
}
|
|
1004
960
|
}
|
|
1005
961
|
|
|
1006
|
-
|
|
1007
|
-
* The standard editing mode plugin.
|
|
1008
|
-
*
|
|
1009
|
-
* This is a "glue" plugin that loads the following plugins:
|
|
1010
|
-
*
|
|
1011
|
-
* * The {@link module:restricted-editing/standardeditingmodeediting~StandardEditingModeEditing standard mode editing feature}.
|
|
1012
|
-
* * The {@link module:restricted-editing/standardeditingmodeui~StandardEditingModeUI standard mode UI feature}.
|
|
1013
|
-
*/ class StandardEditingMode extends Plugin {
|
|
962
|
+
class StandardEditingMode extends Plugin {
|
|
1014
963
|
/**
|
|
1015
|
-
|
|
1016
|
-
|
|
964
|
+
* @inheritDoc
|
|
965
|
+
*/ static get pluginName() {
|
|
1017
966
|
return 'StandardEditingMode';
|
|
1018
967
|
}
|
|
1019
968
|
static get requires() {
|