@ckeditor/ckeditor5-restricted-editing 41.2.0 → 41.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/dist/content-index.css +4 -0
- package/dist/editor-index.css +4 -0
- package/dist/index.css +4 -0
- package/dist/index.js +977 -0
- package/dist/index.js.map +1 -0
- package/dist/types/augmentation.d.ts +29 -0
- package/dist/types/index.d.ts +17 -0
- package/dist/types/restrictededitingconfig.d.ts +60 -0
- package/dist/types/restrictededitingexceptioncommand.d.ts +30 -0
- package/dist/types/restrictededitingmode/converters.d.ts +39 -0
- package/dist/types/restrictededitingmode/utils.d.ts +30 -0
- package/dist/types/restrictededitingmode.d.ts +29 -0
- package/dist/types/restrictededitingmodeediting.d.ts +83 -0
- package/dist/types/restrictededitingmodenavigationcommand.d.ts +42 -0
- package/dist/types/restrictededitingmodeui.d.ts +32 -0
- package/dist/types/standardeditingmode.d.ts +26 -0
- package/dist/types/standardeditingmodeediting.d.ts +25 -0
- package/dist/types/standardeditingmodeui.d.ts +23 -0
- package/package.json +3 -2
@@ -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
|
+
import type { Editor } from 'ckeditor5/src/core.js';
|
6
|
+
import type { DocumentSelection, Marker, Position, Range } from 'ckeditor5/src/engine.js';
|
7
|
+
/**
|
8
|
+
* @module restricted-editing/restrictededitingmode/utils
|
9
|
+
*/
|
10
|
+
/**
|
11
|
+
* Returns a single "restricted-editing-exception" marker at a given position. Contrary to
|
12
|
+
* {@link module:engine/model/markercollection~MarkerCollection#getMarkersAtPosition}, it returnd a marker also when the postion is
|
13
|
+
* equal to one of the marker's start or end positions.
|
14
|
+
*/
|
15
|
+
export declare function getMarkerAtPosition(editor: Editor, position: Position): Marker | undefined;
|
16
|
+
/**
|
17
|
+
* Checks if the position is fully contained in the range. Positions equal to range start or end are considered "in".
|
18
|
+
*/
|
19
|
+
export declare function isPositionInRangeBoundaries(range: Range, position: Position): boolean;
|
20
|
+
/**
|
21
|
+
* Checks if the selection is fully contained in the marker. Positions on marker boundaries are considered "in".
|
22
|
+
*
|
23
|
+
* ```xml
|
24
|
+
* <marker>[]foo</marker> -> true
|
25
|
+
* <marker>f[oo]</marker> -> true
|
26
|
+
* <marker>f[oo</marker> ba]r -> false
|
27
|
+
* <marker>foo</marker> []bar -> false
|
28
|
+
* ```
|
29
|
+
*/
|
30
|
+
export declare function isSelectionInMarker(selection: DocumentSelection, marker?: Marker): boolean;
|
@@ -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/restrictededitingmode
|
7
|
+
*/
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
9
|
+
import RestrictedEditingModeEditing from './restrictededitingmodeediting.js';
|
10
|
+
import RestrictedEditingModeUI from './restrictededitingmodeui.js';
|
11
|
+
import '../theme/restrictedediting.css';
|
12
|
+
/**
|
13
|
+
* The restricted editing mode plugin.
|
14
|
+
*
|
15
|
+
* This is a "glue" plugin which loads the following plugins:
|
16
|
+
*
|
17
|
+
* * The {@link module:restricted-editing/restrictededitingmodeediting~RestrictedEditingModeEditing restricted mode editing feature}.
|
18
|
+
* * The {@link module:restricted-editing/restrictededitingmodeui~RestrictedEditingModeUI restricted mode UI feature}.
|
19
|
+
*/
|
20
|
+
export default class RestrictedEditingMode extends Plugin {
|
21
|
+
/**
|
22
|
+
* @inheritDoc
|
23
|
+
*/
|
24
|
+
static get pluginName(): "RestrictedEditingMode";
|
25
|
+
/**
|
26
|
+
* @inheritDoc
|
27
|
+
*/
|
28
|
+
static get requires(): readonly [typeof RestrictedEditingModeEditing, typeof RestrictedEditingModeUI];
|
29
|
+
}
|
@@ -0,0 +1,83 @@
|
|
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/restrictededitingmodeediting
|
7
|
+
*/
|
8
|
+
import { Plugin, type Editor } from 'ckeditor5/src/core.js';
|
9
|
+
/**
|
10
|
+
* The restricted editing mode editing feature.
|
11
|
+
*
|
12
|
+
* * It introduces the exception marker group that renders to `<span>` elements with the `restricted-editing-exception` CSS class.
|
13
|
+
* * It registers the `'goToPreviousRestrictedEditingException'` and `'goToNextRestrictedEditingException'` commands.
|
14
|
+
* * It also enables highlighting exception markers that are selected.
|
15
|
+
*/
|
16
|
+
export default class RestrictedEditingModeEditing extends Plugin {
|
17
|
+
/**
|
18
|
+
* Command names that are enabled outside the non-restricted regions.
|
19
|
+
*/
|
20
|
+
private _alwaysEnabled;
|
21
|
+
/**
|
22
|
+
* Commands allowed in non-restricted areas.
|
23
|
+
*
|
24
|
+
* Commands always enabled combine typing feature commands: `'input'`, `'insertText'`, `'delete'`, and `'deleteForward'` with
|
25
|
+
* commands defined in the feature configuration.
|
26
|
+
*/
|
27
|
+
private _allowedInException;
|
28
|
+
/**
|
29
|
+
* @inheritDoc
|
30
|
+
*/
|
31
|
+
static get pluginName(): "RestrictedEditingModeEditing";
|
32
|
+
/**
|
33
|
+
* @inheritDoc
|
34
|
+
*/
|
35
|
+
constructor(editor: Editor);
|
36
|
+
/**
|
37
|
+
* @inheritDoc
|
38
|
+
*/
|
39
|
+
init(): void;
|
40
|
+
/**
|
41
|
+
* Makes the given command always enabled in the restricted editing mode (regardless
|
42
|
+
* of selection location).
|
43
|
+
*
|
44
|
+
* To enable some commands in non-restricted areas of the content use
|
45
|
+
* {@link module:restricted-editing/restrictededitingconfig~RestrictedEditingConfig#allowedCommands} configuration option.
|
46
|
+
*
|
47
|
+
* @param commandName Name of the command to enable.
|
48
|
+
*/
|
49
|
+
enableCommand(commandName: string): void;
|
50
|
+
/**
|
51
|
+
* Sets up the restricted mode editing conversion:
|
52
|
+
*
|
53
|
+
* * ucpast & downcast converters,
|
54
|
+
* * marker highlighting in the edting area,
|
55
|
+
* * marker post-fixers.
|
56
|
+
*/
|
57
|
+
private _setupConversion;
|
58
|
+
/**
|
59
|
+
* Setups additional editing restrictions beyond command toggling:
|
60
|
+
*
|
61
|
+
* * delete content range trimming
|
62
|
+
* * disabling input command outside exception marker
|
63
|
+
* * restricting clipboard holder to text only
|
64
|
+
* * restricting text attributes in content
|
65
|
+
*/
|
66
|
+
private _setupRestrictions;
|
67
|
+
/**
|
68
|
+
* Sets up the command toggling which enables or disables commands based on the user selection.
|
69
|
+
*/
|
70
|
+
private _setupCommandsToggling;
|
71
|
+
/**
|
72
|
+
* Checks if commands should be enabled or disabled based on the current selection.
|
73
|
+
*/
|
74
|
+
private _checkCommands;
|
75
|
+
/**
|
76
|
+
* Enables commands in non-restricted regions.
|
77
|
+
*/
|
78
|
+
private _enableCommands;
|
79
|
+
/**
|
80
|
+
* Disables commands outside non-restricted regions.
|
81
|
+
*/
|
82
|
+
private _disableCommands;
|
83
|
+
}
|
@@ -0,0 +1,42 @@
|
|
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
|
+
import { Command, type Editor } from 'ckeditor5/src/core.js';
|
6
|
+
/**
|
7
|
+
* The command that allows navigation across the exceptions in the edited document.
|
8
|
+
*/
|
9
|
+
export default class RestrictedEditingModeNavigationCommand extends Command {
|
10
|
+
/**
|
11
|
+
* The direction of the command.
|
12
|
+
*/
|
13
|
+
private _direction;
|
14
|
+
/**
|
15
|
+
* Creates an instance of the command.
|
16
|
+
*
|
17
|
+
* @param editor The editor instance.
|
18
|
+
* @param direction The direction that the command works.
|
19
|
+
*/
|
20
|
+
constructor(editor: Editor, direction: RestrictedEditingModeNavigationDirection);
|
21
|
+
/**
|
22
|
+
* @inheritDoc
|
23
|
+
*/
|
24
|
+
refresh(): void;
|
25
|
+
/**
|
26
|
+
* Executes the command.
|
27
|
+
*
|
28
|
+
* @fires execute
|
29
|
+
*/
|
30
|
+
execute(): void;
|
31
|
+
/**
|
32
|
+
* Checks whether the command can be enabled in the current context.
|
33
|
+
*
|
34
|
+
* @returns Whether the command should be enabled.
|
35
|
+
*/
|
36
|
+
private _checkEnabled;
|
37
|
+
}
|
38
|
+
/**
|
39
|
+
* Directions in which the
|
40
|
+
* {@link module:restricted-editing/restrictededitingmodenavigationcommand~RestrictedEditingModeNavigationCommand} can work.
|
41
|
+
*/
|
42
|
+
export type RestrictedEditingModeNavigationDirection = 'forward' | 'backward';
|
@@ -0,0 +1,32 @@
|
|
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
|
+
/**
|
10
|
+
* The restricted editing mode UI feature.
|
11
|
+
*
|
12
|
+
* It introduces the `'restrictedEditing'` dropdown that offers tools to navigate between exceptions across
|
13
|
+
* the document.
|
14
|
+
*/
|
15
|
+
export default class RestrictedEditingModeUI extends Plugin {
|
16
|
+
/**
|
17
|
+
* @inheritDoc
|
18
|
+
*/
|
19
|
+
static get pluginName(): "RestrictedEditingModeUI";
|
20
|
+
/**
|
21
|
+
* @inheritDoc
|
22
|
+
*/
|
23
|
+
init(): void;
|
24
|
+
/**
|
25
|
+
* Returns a definition of the navigation button to be used in the dropdown.
|
26
|
+
|
27
|
+
* @param commandName The name of the command that the button represents.
|
28
|
+
* @param label The translated label of the button.
|
29
|
+
* @param keystroke The button keystroke.
|
30
|
+
*/
|
31
|
+
private _getButtonDefinition;
|
32
|
+
}
|
@@ -0,0 +1,26 @@
|
|
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
|
+
static get requires(): readonly [typeof StandardEditingModeEditing, typeof StandardEditingModeUI];
|
26
|
+
}
|
@@ -0,0 +1,25 @@
|
|
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
|
+
init(): void;
|
25
|
+
}
|
@@ -0,0 +1,23 @@
|
|
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
|
+
init(): void;
|
23
|
+
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ckeditor/ckeditor5-restricted-editing",
|
3
|
-
"version": "41.
|
3
|
+
"version": "41.3.0-alpha.1",
|
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.
|
15
|
+
"ckeditor5": "41.3.0-alpha.1"
|
16
16
|
},
|
17
17
|
"author": "CKSource (http://cksource.com/)",
|
18
18
|
"license": "GPL-2.0-or-later",
|
@@ -24,6 +24,7 @@
|
|
24
24
|
"directory": "packages/ckeditor5-restricted-editing"
|
25
25
|
},
|
26
26
|
"files": [
|
27
|
+
"dist",
|
27
28
|
"lang",
|
28
29
|
"src/**/*.js",
|
29
30
|
"src/**/*.d.ts",
|