@ckeditor/ckeditor5-restricted-editing 48.2.0 → 48.3.0-alpha.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.
@@ -1,63 +1,63 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, 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
5
  /**
6
- * @module restricted-editing/restrictededitingconfig
7
- */
6
+ * @module restricted-editing/restrictededitingconfig
7
+ */
8
8
  /**
9
- * The configuration of the restricted editing mode feature.
10
- * The option is used by the {@link module:restricted-editing/restrictededitingmode~RestrictedEditingMode} feature.
11
- *
12
- * ```ts
13
- * ClassicEditor
14
- * .create( {
15
- * restrictedEditing: {
16
- * allowedCommands: [ 'bold', 'link', 'unlink' ],
17
- * allowedAttributes: [ 'bold', 'linkHref' ]
18
- * }
19
- * } )
20
- * .then( ... )
21
- * .catch( ... );
22
- * ```
23
- *
24
- * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
25
- */
9
+ * The configuration of the restricted editing mode feature.
10
+ * The option is used by the {@link module:restricted-editing/restrictededitingmode~RestrictedEditingMode} feature.
11
+ *
12
+ * ```ts
13
+ * ClassicEditor
14
+ * .create( {
15
+ * restrictedEditing: {
16
+ * allowedCommands: [ 'bold', 'link', 'unlink' ],
17
+ * allowedAttributes: [ 'bold', 'linkHref' ]
18
+ * }
19
+ * } )
20
+ * .then( ... )
21
+ * .catch( ... );
22
+ * ```
23
+ *
24
+ * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
25
+ */
26
26
  export interface RestrictedEditingConfig {
27
- /**
28
- * The command names allowed in inline non-restricted areas of the content.
29
- *
30
- * Defines which feature commands should be enabled in the restricted editing mode. The commands used for typing and deleting text
31
- * (`'input'`, `'delete'` and `'deleteForward'`) are allowed by the feature inside non-restricted regions and do not need to be defined.
32
- *
33
- * **Note**: The restricted editing mode always allows to use the restricted mode navigation commands as well as `'undo'` and `'redo'`
34
- * commands.
35
- *
36
- * The default value is:
37
- *
38
- * ```ts
39
- * const restrictedEditingConfig = {
40
- * allowedCommands: [ 'bold', 'italic', 'link', 'unlink' ]
41
- * };
42
- * ```
43
- *
44
- * Only inline content inserting or editing commands are allowed in this setting. Block content commands such as
45
- * `insertTable` or `enter` cannot be allowed via this setting, as they are not supported in the restricted editing mode.
46
- *
47
- * To make a command always enabled (also outside non-restricted areas) use the
48
- * {@link module:restricted-editing/restrictededitingmodeediting~RestrictedEditingModeEditing#enableCommand} method.
49
- */
50
- allowedCommands: Array<string>;
51
- /**
52
- * The text attribute names allowed when pasting content in inline non-restricted areas.
53
- *
54
- * The default value is:
55
- *
56
- * ```ts
57
- * const restrictedEditingConfig = {
58
- * allowedAttributes: [ 'bold', 'italic', 'linkHref' ]
59
- * };
60
- * ```
61
- */
62
- allowedAttributes: Array<string>;
27
+ /**
28
+ * The command names allowed in inline non-restricted areas of the content.
29
+ *
30
+ * Defines which feature commands should be enabled in the restricted editing mode. The commands used for typing and deleting text
31
+ * (`'input'`, `'delete'` and `'deleteForward'`) are allowed by the feature inside non-restricted regions and do not need to be defined.
32
+ *
33
+ * **Note**: The restricted editing mode always allows to use the restricted mode navigation commands as well as `'undo'` and `'redo'`
34
+ * commands.
35
+ *
36
+ * The default value is:
37
+ *
38
+ * ```ts
39
+ * const restrictedEditingConfig = {
40
+ * allowedCommands: [ 'bold', 'italic', 'link', 'unlink' ]
41
+ * };
42
+ * ```
43
+ *
44
+ * Only inline content inserting or editing commands are allowed in this setting. Block content commands such as
45
+ * `insertTable` or `enter` cannot be allowed via this setting, as they are not supported in the restricted editing mode.
46
+ *
47
+ * To make a command always enabled (also outside non-restricted areas) use the
48
+ * {@link module:restricted-editing/restrictededitingmodeediting~RestrictedEditingModeEditing#enableCommand} method.
49
+ */
50
+ allowedCommands: Array<string>;
51
+ /**
52
+ * The text attribute names allowed when pasting content in inline non-restricted areas.
53
+ *
54
+ * The default value is:
55
+ *
56
+ * ```ts
57
+ * const restrictedEditingConfig = {
58
+ * allowedAttributes: [ 'bold', 'italic', 'linkHref' ]
59
+ * };
60
+ * ```
61
+ */
62
+ allowedAttributes: Array<string>;
63
63
  }
@@ -1,39 +1,39 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, 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
5
  /**
6
- * @module restricted-editing/restrictededitingexceptionautocommand
7
- */
8
- import { Command, type Editor } from '@ckeditor/ckeditor5-core';
6
+ * @module restricted-editing/restrictededitingexceptionautocommand
7
+ */
8
+ import { Command, type Editor } from "@ckeditor/ckeditor5-core";
9
9
  /**
10
- * The command that toggles exceptions from the restricted editing on text or on blocks.
11
- */
10
+ * The command that toggles exceptions from the restricted editing on text or on blocks.
11
+ */
12
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;
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
+ override refresh(): void;
35
+ /**
36
+ * @inheritDoc
37
+ */
38
+ override execute(): void;
39
39
  }
@@ -1,57 +1,57 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, 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
5
  /**
6
- * @module restricted-editing/restrictededitingexceptionblockcommand
7
- */
8
- import { Command } from '@ckeditor/ckeditor5-core';
6
+ * @module restricted-editing/restrictededitingexceptionblockcommand
7
+ */
8
+ import { Command } from "@ckeditor/ckeditor5-core";
9
9
  /**
10
- * The command that toggles exception blocks for the restricted editing.
11
- */
10
+ * The command that toggles exception blocks for the restricted editing.
11
+ */
12
12
  export declare class RestrictedEditingExceptionBlockCommand extends Command {
13
- /**
14
- * Whether the selection starts in a block exception.
15
- *
16
- * @observable
17
- * @readonly
18
- */
19
- value: boolean;
20
- /**
21
- * @inheritDoc
22
- */
23
- refresh(): void;
24
- /**
25
- * Wraps or unwraps the selected blocks with non-restricted area.
26
- *
27
- * @fires execute
28
- * @param options Command options.
29
- * @param options.forceValue If set, it will force the command behavior. If `true`, the command will apply a block exception,
30
- * otherwise the command will remove the block exception. If not set, the command will act basing on its current value.
31
- */
32
- execute(options?: {
33
- forceValue?: boolean;
34
- }): void;
35
- /**
36
- * Checks the command's {@link #value}.
37
- */
38
- private _getValue;
39
- /**
40
- * Checks whether the command can be enabled in the current context.
41
- *
42
- * @returns Whether the command should be enabled.
43
- */
44
- private _checkEnabled;
45
- /**
46
- * Unwraps the exception from given blocks.
47
- *
48
- * If blocks which are supposed to be unwrapped are in the middle of an exception,
49
- * start it or end it, then the exception will be split (if needed) and the blocks
50
- * will be moved out of it, so other exception blocks remained wrapped.
51
- */
52
- private _removeException;
53
- /**
54
- * Applies the exception to given blocks.
55
- */
56
- private _applyException;
13
+ /**
14
+ * Whether the selection starts in a block exception.
15
+ *
16
+ * @observable
17
+ * @readonly
18
+ */
19
+ value: boolean;
20
+ /**
21
+ * @inheritDoc
22
+ */
23
+ override refresh(): void;
24
+ /**
25
+ * Wraps or unwraps the selected blocks with non-restricted area.
26
+ *
27
+ * @fires execute
28
+ * @param options Command options.
29
+ * @param options.forceValue If set, it will force the command behavior. If `true`, the command will apply a block exception,
30
+ * otherwise the command will remove the block exception. If not set, the command will act basing on its current value.
31
+ */
32
+ override execute(options?: {
33
+ forceValue?: boolean;
34
+ }): void;
35
+ /**
36
+ * Checks the command's {@link #value}.
37
+ */
38
+ private _getValue;
39
+ /**
40
+ * Checks whether the command can be enabled in the current context.
41
+ *
42
+ * @returns Whether the command should be enabled.
43
+ */
44
+ private _checkEnabled;
45
+ /**
46
+ * Unwraps the exception from given blocks.
47
+ *
48
+ * If blocks which are supposed to be unwrapped are in the middle of an exception,
49
+ * start it or end it, then the exception will be split (if needed) and the blocks
50
+ * will be moved out of it, so other exception blocks remained wrapped.
51
+ */
52
+ private _removeException;
53
+ /**
54
+ * Applies the exception to given blocks.
55
+ */
56
+ private _applyException;
57
57
  }
@@ -1,30 +1,30 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, 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
5
  /**
6
- * @module restricted-editing/restrictededitingexceptioncommand
7
- */
8
- import { Command } from '@ckeditor/ckeditor5-core';
6
+ * @module restricted-editing/restrictededitingexceptioncommand
7
+ */
8
+ import { Command } from "@ckeditor/ckeditor5-core";
9
9
  /**
10
- * The command that toggles exceptions from the restricted editing on text.
11
- */
10
+ * The command that toggles exceptions from the restricted editing on text.
11
+ */
12
12
  export declare class RestrictedEditingExceptionCommand extends Command {
13
- /**
14
- * A flag indicating whether the command is active
15
- *
16
- * @readonly
17
- */
18
- value: boolean;
19
- /**
20
- * @inheritDoc
21
- */
22
- refresh(): void;
23
- /**
24
- * @inheritDoc
25
- */
26
- execute(options?: RestrictedEditingExceptionCommandParams): void;
13
+ /**
14
+ * A flag indicating whether the command is active
15
+ *
16
+ * @readonly
17
+ */
18
+ value: boolean;
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ override refresh(): void;
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ override execute(options?: RestrictedEditingExceptionCommandParams): void;
27
27
  }
28
28
  export interface RestrictedEditingExceptionCommandParams {
29
- forceValue?: unknown;
29
+ forceValue?: unknown;
30
30
  }
@@ -1,47 +1,47 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, 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
5
  /**
6
- * @module restricted-editing/restrictededitingmode/converters
7
- */
8
- import type { Editor } from '@ckeditor/ckeditor5-core';
9
- import { type MatcherPattern, type ModelPostFixer, type UpcastDispatcher } from '@ckeditor/ckeditor5-engine';
6
+ * @module restricted-editing/restrictededitingmode/converters
7
+ */
8
+ import type { Editor } from "@ckeditor/ckeditor5-core";
9
+ import { type MatcherPattern, type ModelPostFixer, type UpcastDispatcher } from "@ckeditor/ckeditor5-engine";
10
10
  /**
11
- * Adds a visual highlight style to a restricted editing exception that the selection is anchored to.
12
- *
13
- * The highlight is turned on by adding the `.restricted-editing-exception_selected` class to the
14
- * exception in the view:
15
- *
16
- * * The class is removed before the conversion starts, as callbacks added with the `'highest'` priority
17
- * to {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher} events.
18
- * * The class is added in the view post-fixer, after other changes in the model tree are converted to the view.
19
- *
20
- * This way, adding and removing the highlight does not interfere with conversion.
21
- *
22
- * @internal
23
- */
11
+ * Adds a visual highlight style to a restricted editing exception that the selection is anchored to.
12
+ *
13
+ * The highlight is turned on by adding the `.restricted-editing-exception_selected` class to the
14
+ * exception in the view:
15
+ *
16
+ * * The class is removed before the conversion starts, as callbacks added with the `'highest'` priority
17
+ * to {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher} events.
18
+ * * The class is added in the view post-fixer, after other changes in the model tree are converted to the view.
19
+ *
20
+ * This way, adding and removing the highlight does not interfere with conversion.
21
+ *
22
+ * @internal
23
+ */
24
24
  export declare function setupExceptionHighlighting(editor: Editor): void;
25
25
  /**
26
- * A post-fixer that prevents removing a collapsed marker from the document.
27
- *
28
- * @internal
29
- */
26
+ * A post-fixer that prevents removing a collapsed marker from the document.
27
+ *
28
+ * @internal
29
+ */
30
30
  export declare function resurrectCollapsedMarkerPostFixer(editor: Editor): ModelPostFixer;
31
31
  /**
32
- * A post-fixer that extends a marker when the user types on its boundaries.
33
- *
34
- * @internal
35
- */
32
+ * A post-fixer that extends a marker when the user types on its boundaries.
33
+ *
34
+ * @internal
35
+ */
36
36
  export declare function extendMarkerOnTypingPostFixer(editor: Editor): ModelPostFixer;
37
37
  /**
38
- * A view highlight-to-marker conversion helper.
39
- *
40
- * @param config Conversion configuration.
41
- * @internal
42
- */
38
+ * A view highlight-to-marker conversion helper.
39
+ *
40
+ * @param config Conversion configuration.
41
+ * @internal
42
+ */
43
43
  export declare function upcastHighlightToMarker(config: {
44
- view: MatcherPattern;
45
- model: () => string;
46
- useWrapperElement?: boolean;
44
+ view: MatcherPattern;
45
+ model: () => string;
46
+ useWrapperElement?: boolean;
47
47
  }): (dispatcher: UpcastDispatcher) => void;
@@ -1,42 +1,42 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, 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
5
  /**
6
- * @module restricted-editing/restrictededitingmode/utils
7
- */
8
- import type { Editor } from '@ckeditor/ckeditor5-core';
9
- import type { ModelDocumentSelection, Marker, ModelPosition, ModelRange, Model } from '@ckeditor/ckeditor5-engine';
6
+ * @module restricted-editing/restrictededitingmode/utils
7
+ */
8
+ import type { Editor } from "@ckeditor/ckeditor5-core";
9
+ import type { ModelDocumentSelection, Marker, ModelPosition, ModelRange, Model } from "@ckeditor/ckeditor5-engine";
10
10
  /**
11
- * Returns a single "restricted-editing-exception" marker at a given position. Contrary to
12
- * {@link module:engine/model/markercollection~MarkerCollection#getMarkersAtPosition}, it returns a marker also when the position is
13
- * equal to one of the marker's start or end positions.
14
- *
15
- * @internal
16
- */
11
+ * Returns a single "restricted-editing-exception" marker at a given position. Contrary to
12
+ * {@link module:engine/model/markercollection~MarkerCollection#getMarkersAtPosition}, it returns a marker also when the position is
13
+ * equal to one of the marker's start or end positions.
14
+ *
15
+ * @internal
16
+ */
17
17
  export declare function getMarkerAtPosition(editor: Editor, position: ModelPosition): Marker | undefined;
18
18
  /**
19
- * Checks if the position is fully contained in the range. Positions equal to range start or end are considered "in".
20
- *
21
- * @internal
22
- */
19
+ * Checks if the position is fully contained in the range. Positions equal to range start or end are considered "in".
20
+ *
21
+ * @internal
22
+ */
23
23
  export declare function isPositionInRangeBoundaries(range: ModelRange, position: ModelPosition): boolean;
24
24
  /**
25
- * Checks if the selection is fully contained in the marker. Positions on marker boundaries are considered "in".
26
- *
27
- * ```xml
28
- * <marker>[]foo</marker> -> true
29
- * <marker>f[oo]</marker> -> true
30
- * <marker>f[oo</marker> ba]r -> false
31
- * <marker>foo</marker> []bar -> false
32
- * ```
33
- *
34
- * @internal
35
- */
25
+ * Checks if the selection is fully contained in the marker. Positions on marker boundaries are considered "in".
26
+ *
27
+ * ```xml
28
+ * <marker>[]foo</marker> -> true
29
+ * <marker>f[oo]</marker> -> true
30
+ * <marker>f[oo</marker> ba]r -> false
31
+ * <marker>foo</marker> []bar -> false
32
+ * ```
33
+ *
34
+ * @internal
35
+ */
36
36
  export declare function isSelectionInMarker(selection: ModelDocumentSelection, model: Model, marker?: Marker): boolean;
37
37
  /**
38
- * Returns the marker range asjusted to the inside of exception wrapper element if needed.
39
- *
40
- * @internal
41
- */
38
+ * Returns the marker range asjusted to the inside of exception wrapper element if needed.
39
+ *
40
+ * @internal
41
+ */
42
42
  export declare function getExceptionRange(marker: Marker, model: Model): ModelRange;
@@ -1,33 +1,33 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, 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
5
  /**
6
- * @module restricted-editing/restrictededitingmode
7
- */
8
- import { Plugin } from '@ckeditor/ckeditor5-core';
9
- import { RestrictedEditingModeEditing } from './restrictededitingmodeediting.js';
10
- import { RestrictedEditingModeUI } from './restrictededitingmodeui.js';
11
- import '../theme/restrictedediting.css';
6
+ * @module restricted-editing/restrictededitingmode
7
+ */
8
+ import { Plugin, type PluginDependenciesOf } from "@ckeditor/ckeditor5-core";
9
+ import { RestrictedEditingModeEditing } from "./restrictededitingmodeediting.js";
10
+ import { RestrictedEditingModeUI } from "./restrictededitingmodeui.js";
11
+ import "../theme/restrictedediting.css";
12
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
- */
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
20
  export declare class RestrictedEditingMode extends Plugin {
21
- /**
22
- * @inheritDoc
23
- */
24
- static get pluginName(): "RestrictedEditingMode";
25
- /**
26
- * @inheritDoc
27
- */
28
- static get isOfficialPlugin(): true;
29
- /**
30
- * @inheritDoc
31
- */
32
- static get requires(): readonly [typeof RestrictedEditingModeEditing, typeof RestrictedEditingModeUI];
21
+ /**
22
+ * @inheritDoc
23
+ */
24
+ static get pluginName(): "RestrictedEditingMode";
25
+ /**
26
+ * @inheritDoc
27
+ */
28
+ static override get isOfficialPlugin(): true;
29
+ /**
30
+ * @inheritDoc
31
+ */
32
+ static get requires(): PluginDependenciesOf<[RestrictedEditingModeEditing, RestrictedEditingModeUI]>;
33
33
  }