@ckeditor/ckeditor5-typing 48.2.0-alpha.7 → 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,27 +1,27 @@
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
- */
5
- import type { Delete, DeleteCommand, Input, InsertTextCommand, TextTransformation, TwoStepCaretMovement, Typing, TypingConfig } from './index.js';
6
- declare module '@ckeditor/ckeditor5-core' {
7
- interface EditorConfig {
8
- /**
9
- * The configuration of the typing features. Used by the features from the `@ckeditor/ckeditor5-typing` package.
10
- *
11
- * Read more in {@link module:typing/typingconfig~TypingConfig}.
12
- */
13
- typing?: TypingConfig;
14
- }
15
- interface CommandsMap {
16
- deleteForward: DeleteCommand;
17
- delete: DeleteCommand;
18
- insertText: InsertTextCommand;
19
- }
20
- interface PluginsMap {
21
- [Delete.pluginName]: Delete;
22
- [Input.pluginName]: Input;
23
- [TextTransformation.pluginName]: TextTransformation;
24
- [TwoStepCaretMovement.pluginName]: TwoStepCaretMovement;
25
- [Typing.pluginName]: Typing;
26
- }
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
+ import type { Delete, DeleteCommand, Input, InsertTextCommand, TextTransformation, TwoStepCaretMovement, Typing, TypingConfig } from "./index.js";
6
+ declare module "@ckeditor/ckeditor5-core" {
7
+ interface EditorConfig {
8
+ /**
9
+ * The configuration of the typing features. Used by the features from the `@ckeditor/ckeditor5-typing` package.
10
+ *
11
+ * Read more in {@link module:typing/typingconfig~TypingConfig}.
12
+ */
13
+ typing?: TypingConfig;
14
+ }
15
+ interface CommandsMap {
16
+ deleteForward: DeleteCommand;
17
+ delete: DeleteCommand;
18
+ insertText: InsertTextCommand;
19
+ }
20
+ interface PluginsMap {
21
+ [Delete.pluginName]: Delete;
22
+ [Input.pluginName]: Input;
23
+ [TextTransformation.pluginName]: TextTransformation;
24
+ [TwoStepCaretMovement.pluginName]: TwoStepCaretMovement;
25
+ [Typing.pluginName]: Typing;
26
+ }
27
27
  }
package/dist/delete.d.ts CHANGED
@@ -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
- */
5
- import { Plugin } from '@ckeditor/ckeditor5-core';
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
+ import { Plugin } from "@ckeditor/ckeditor5-core";
6
6
  /**
7
- * The delete and backspace feature. Handles keys such as <kbd>Delete</kbd> and <kbd>Backspace</kbd>, other
8
- * keystrokes and user actions that result in deleting content in the editor.
9
- */
7
+ * The delete and backspace feature. Handles keys such as <kbd>Delete</kbd> and <kbd>Backspace</kbd>, other
8
+ * keystrokes and user actions that result in deleting content in the editor.
9
+ */
10
10
  export declare class Delete extends Plugin {
11
- /**
12
- * Whether pressing backspace should trigger undo action
13
- */
14
- private _undoOnBackspace;
15
- /**
16
- * @inheritDoc
17
- */
18
- static get pluginName(): "Delete";
19
- /**
20
- * @inheritDoc
21
- */
22
- static get isOfficialPlugin(): true;
23
- /**
24
- * @inheritDoc
25
- */
26
- init(): void;
27
- /**
28
- * If the next user action after calling this method is pressing backspace, it would undo the last change.
29
- *
30
- * Requires {@link module:undo/undoediting~UndoEditing} plugin. If not loaded, does nothing.
31
- */
32
- requestUndoOnBackspace(): void;
11
+ /**
12
+ * Whether pressing backspace should trigger undo action
13
+ */
14
+ private _undoOnBackspace;
15
+ /**
16
+ * @inheritDoc
17
+ */
18
+ static get pluginName(): "Delete";
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ static override get isOfficialPlugin(): true;
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ init(): void;
27
+ /**
28
+ * If the next user action after calling this method is pressing backspace, it would undo the last change.
29
+ *
30
+ * Requires {@link module:undo/undoediting~UndoEditing} plugin. If not loaded, does nothing.
31
+ */
32
+ requestUndoOnBackspace(): void;
33
33
  }
@@ -1,83 +1,83 @@
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 typing/deletecommand
7
- */
8
- import { Command, type Editor } from '@ckeditor/ckeditor5-core';
9
- import type { ModelDocumentSelection, ModelSelection } from '@ckeditor/ckeditor5-engine';
10
- import { TypingChangeBuffer } from './utils/changebuffer.js';
6
+ * @module typing/deletecommand
7
+ */
8
+ import { Command, type Editor } from "@ckeditor/ckeditor5-core";
9
+ import type { ModelDocumentSelection, ModelSelection } from "@ckeditor/ckeditor5-engine";
10
+ import { TypingChangeBuffer } from "./utils/changebuffer.js";
11
11
  /**
12
- * The delete command. Used by the {@link module:typing/delete~Delete delete feature} to handle the <kbd>Delete</kbd> and
13
- * <kbd>Backspace</kbd> keys.
14
- */
12
+ * The delete command. Used by the {@link module:typing/delete~Delete delete feature} to handle the <kbd>Delete</kbd> and
13
+ * <kbd>Backspace</kbd> keys.
14
+ */
15
15
  export declare class DeleteCommand extends Command {
16
- /**
17
- * The directionality of the delete describing in what direction it should
18
- * consume the content when the selection is collapsed.
19
- */
20
- readonly direction: 'forward' | 'backward';
21
- /**
22
- * Delete's change buffer used to group subsequent changes into batches.
23
- */
24
- private readonly _buffer;
25
- /**
26
- * Creates an instance of the command.
27
- *
28
- * @param direction The directionality of the delete describing in what direction it
29
- * should consume the content when the selection is collapsed.
30
- */
31
- constructor(editor: Editor, direction: 'forward' | 'backward');
32
- /**
33
- * The current change buffer.
34
- */
35
- get buffer(): TypingChangeBuffer;
36
- /**
37
- * Executes the delete command. Depending on whether the selection is collapsed or not, deletes its content
38
- * or a piece of content in the {@link #direction defined direction}.
39
- *
40
- * @fires execute
41
- * @param options The command options.
42
- * @param options.unit See {@link module:engine/model/utils/modifyselection~modifySelection}'s options.
43
- * @param options.sequence A number describing which subsequent delete event it is without the key being released.
44
- * See the {@link module:engine/view/document~ViewDocument#event:delete} event data.
45
- * @param options.selection Selection to remove. If not set, current model selection will be used.
46
- */
47
- execute(options?: {
48
- unit?: 'character' | 'codePoint' | 'word';
49
- sequence?: number;
50
- selection?: ModelSelection | ModelDocumentSelection;
51
- }): void;
52
- /**
53
- * If the user keeps <kbd>Backspace</kbd> or <kbd>Delete</kbd> key pressed, the content of the current
54
- * editable will be cleared. However, this will not yet lead to resetting the remaining block to a paragraph
55
- * (which happens e.g. when the user does <kbd>Ctrl</kbd> + <kbd>A</kbd>, <kbd>Backspace</kbd>).
56
- *
57
- * But, if the user pressed the key in an empty editable for the first time,
58
- * we want to replace the entire content with a paragraph if:
59
- *
60
- * * the current limit element is empty,
61
- * * the paragraph is allowed in the limit element,
62
- * * the limit doesn't already have a paragraph inside.
63
- *
64
- * See https://github.com/ckeditor/ckeditor5-typing/issues/61.
65
- *
66
- * @param sequence A number describing which subsequent delete event it is without the key being released.
67
- */
68
- private _shouldEntireContentBeReplacedWithParagraph;
69
- /**
70
- * The entire content is replaced with the paragraph. Selection is moved inside the paragraph.
71
- *
72
- * @param writer The model writer.
73
- */
74
- private _replaceEntireContentWithParagraph;
75
- /**
76
- * Checks if the selection is inside an empty element that is the first child of the limit element
77
- * and should be replaced with a paragraph.
78
- *
79
- * @param selection The selection.
80
- * @param sequence A number describing which subsequent delete event it is without the key being released.
81
- */
82
- private _shouldReplaceFirstBlockWithParagraph;
16
+ /**
17
+ * The directionality of the delete describing in what direction it should
18
+ * consume the content when the selection is collapsed.
19
+ */
20
+ readonly direction: "forward" | "backward";
21
+ /**
22
+ * Delete's change buffer used to group subsequent changes into batches.
23
+ */
24
+ private readonly _buffer;
25
+ /**
26
+ * Creates an instance of the command.
27
+ *
28
+ * @param direction The directionality of the delete describing in what direction it
29
+ * should consume the content when the selection is collapsed.
30
+ */
31
+ constructor(editor: Editor, direction: "forward" | "backward");
32
+ /**
33
+ * The current change buffer.
34
+ */
35
+ get buffer(): TypingChangeBuffer;
36
+ /**
37
+ * Executes the delete command. Depending on whether the selection is collapsed or not, deletes its content
38
+ * or a piece of content in the {@link #direction defined direction}.
39
+ *
40
+ * @fires execute
41
+ * @param options The command options.
42
+ * @param options.unit See {@link module:engine/model/utils/modifyselection~modifySelection}'s options.
43
+ * @param options.sequence A number describing which subsequent delete event it is without the key being released.
44
+ * See the {@link module:engine/view/document~ViewDocument#event:delete} event data.
45
+ * @param options.selection Selection to remove. If not set, current model selection will be used.
46
+ */
47
+ override execute(options?: {
48
+ unit?: "character" | "codePoint" | "word";
49
+ sequence?: number;
50
+ selection?: ModelSelection | ModelDocumentSelection;
51
+ }): void;
52
+ /**
53
+ * If the user keeps <kbd>Backspace</kbd> or <kbd>Delete</kbd> key pressed, the content of the current
54
+ * editable will be cleared. However, this will not yet lead to resetting the remaining block to a paragraph
55
+ * (which happens e.g. when the user does <kbd>Ctrl</kbd> + <kbd>A</kbd>, <kbd>Backspace</kbd>).
56
+ *
57
+ * But, if the user pressed the key in an empty editable for the first time,
58
+ * we want to replace the entire content with a paragraph if:
59
+ *
60
+ * * the current limit element is empty,
61
+ * * the paragraph is allowed in the limit element,
62
+ * * the limit doesn't already have a paragraph inside.
63
+ *
64
+ * See https://github.com/ckeditor/ckeditor5-typing/issues/61.
65
+ *
66
+ * @param sequence A number describing which subsequent delete event it is without the key being released.
67
+ */
68
+ private _shouldEntireContentBeReplacedWithParagraph;
69
+ /**
70
+ * The entire content is replaced with the paragraph. Selection is moved inside the paragraph.
71
+ *
72
+ * @param writer The model writer.
73
+ */
74
+ private _replaceEntireContentWithParagraph;
75
+ /**
76
+ * Checks if the selection is inside an empty element that is the first child of the limit element
77
+ * and should be replaced with a paragraph.
78
+ *
79
+ * @param selection The selection.
80
+ * @param sequence A number describing which subsequent delete event it is without the key being released.
81
+ */
82
+ private _shouldReplaceFirstBlockWithParagraph;
83
83
  }
@@ -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
- */
5
- import { ViewDocumentDomEventData, Observer, type BubblingEvent, type ViewDocumentSelection, type ViewSelection, type EditingView } from '@ckeditor/ckeditor5-engine';
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
+ import { ViewDocumentDomEventData, Observer, type BubblingEvent, type ViewDocumentSelection, type ViewSelection, type EditingView } from "@ckeditor/ckeditor5-engine";
6
6
  /**
7
- * Delete observer introduces the {@link module:engine/view/document~ViewDocument#event:delete} event.
8
- *
9
- * @internal
10
- */
7
+ * Delete observer introduces the {@link module:engine/view/document~ViewDocument#event:delete} event.
8
+ *
9
+ * @internal
10
+ */
11
11
  export declare class DeleteObserver extends Observer {
12
- /**
13
- * @inheritDoc
14
- */
15
- constructor(view: EditingView);
16
- /**
17
- * @inheritDoc
18
- */
19
- observe(): void;
20
- /**
21
- * @inheritDoc
22
- */
23
- stopObserving(): void;
12
+ /**
13
+ * @inheritDoc
14
+ */
15
+ constructor(view: EditingView);
16
+ /**
17
+ * @inheritDoc
18
+ */
19
+ observe(): void;
20
+ /**
21
+ * @inheritDoc
22
+ */
23
+ stopObserving(): void;
24
24
  }
25
25
  /**
26
- * Event fired when the user tries to delete content (e.g. presses <kbd>Delete</kbd> or <kbd>Backspace</kbd>).
27
- *
28
- * Note: This event is fired by the {@link module:typing/deleteobserver~DeleteObserver delete observer}
29
- * (usually registered by the {@link module:typing/delete~Delete delete feature}).
30
- *
31
- * @eventName module:engine/view/document~ViewDocument#delete
32
- * @param data The event data.
33
- */
26
+ * Event fired when the user tries to delete content (e.g. presses <kbd>Delete</kbd> or <kbd>Backspace</kbd>).
27
+ *
28
+ * Note: This event is fired by the {@link module:typing/deleteobserver~DeleteObserver delete observer}
29
+ * (usually registered by the {@link module:typing/delete~Delete delete feature}).
30
+ *
31
+ * @eventName module:engine/view/document~ViewDocument#delete
32
+ * @param data The event data.
33
+ */
34
34
  export type ViewDocumentDeleteEvent = BubblingEvent<{
35
- name: 'delete';
36
- args: [data: DeleteEventData];
35
+ name: "delete";
36
+ args: [data: DeleteEventData];
37
37
  }>;
38
38
  export interface DeleteEventData extends ViewDocumentDomEventData<InputEvent> {
39
- /**
40
- * The direction in which the deletion should happen.
41
- */
42
- direction: 'backward' | 'forward';
43
- /**
44
- * The "amount" of content that should be deleted.
45
- */
46
- unit: 'selection' | 'codePoint' | 'character' | 'word';
47
- /**
48
- * A number describing which subsequent delete event it is without the key being released.
49
- * If it's 2 or more it means that the key was pressed and hold.
50
- */
51
- sequence: number;
52
- /**
53
- * View selection which content should be removed. If not set,
54
- * current selection should be used.
55
- */
56
- selectionToRemove?: ViewSelection | ViewDocumentSelection;
39
+ /**
40
+ * The direction in which the deletion should happen.
41
+ */
42
+ direction: "backward" | "forward";
43
+ /**
44
+ * The "amount" of content that should be deleted.
45
+ */
46
+ unit: "selection" | "codePoint" | "character" | "word";
47
+ /**
48
+ * A number describing which subsequent delete event it is without the key being released.
49
+ * If it's 2 or more it means that the key was pressed and hold.
50
+ */
51
+ sequence: number;
52
+ /**
53
+ * View selection which content should be removed. If not set,
54
+ * current selection should be used.
55
+ */
56
+ selectionToRemove?: ViewSelection | ViewDocumentSelection;
57
57
  }
@@ -2,3 +2,4 @@
2
2
  * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
+
@@ -2,3 +2,4 @@
2
2
  * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
+
package/dist/index.css CHANGED
@@ -3,5 +3,3 @@
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
 
6
-
7
- /*# sourceMappingURL=index.css.map */
package/dist/index.d.ts CHANGED
@@ -1,26 +1,26 @@
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 typing
7
- */
8
- export { Typing } from './typing.js';
9
- export { Input } from './input.js';
10
- export { Delete } from './delete.js';
11
- export { TextWatcher } from './textwatcher.js';
12
- export { TwoStepCaretMovement } from './twostepcaretmovement.js';
13
- export { TextTransformation } from './texttransformation.js';
14
- export type { TextTransformationConfig } from './typingconfig.js';
15
- export { inlineHighlight } from './utils/inlinehighlight.js';
16
- export { findAttributeRange, findAttributeRangeBound } from './utils/findattributerange.js';
17
- export { getLastTextLine, type LastTextLineData } from './utils/getlasttextline.js';
18
- export { TypingChangeBuffer } from './utils/changebuffer.js';
19
- export { InsertTextCommand, type InsertTextCommandExecuteEvent, type InsertTextCommandOptions } from './inserttextcommand.js';
20
- export { DeleteCommand } from './deletecommand.js';
21
- export { DeleteObserver as _DeleteObserver, type DeleteEventData } from './deleteobserver.js';
22
- export type { TypingConfig, TextTypingTransformationDescription } from './typingconfig.js';
23
- export type { ViewDocumentDeleteEvent } from './deleteobserver.js';
24
- export { type ViewDocumentInsertTextEvent, type InsertTextEventData, InsertTextObserver } from './inserttextobserver.js';
25
- export type { TextWatcherMatchedEvent, TextWatcherMatchedDataEvent, TextWatcherMatchedTypingDataEventData, TextWatcherMatchedTypingSelectionEvent, TextWatcherMatchedTypingSelectionEventData, TextWatcherUnmatchedTypingEvent } from './textwatcher.js';
26
- import './augmentation.js';
6
+ * @module typing
7
+ */
8
+ export { Typing } from "./typing.js";
9
+ export { Input } from "./input.js";
10
+ export { Delete } from "./delete.js";
11
+ export { TextWatcher } from "./textwatcher.js";
12
+ export { TwoStepCaretMovement } from "./twostepcaretmovement.js";
13
+ export { TextTransformation } from "./texttransformation.js";
14
+ export type { TextTransformationConfig } from "./typingconfig.js";
15
+ export { inlineHighlight } from "./utils/inlinehighlight.js";
16
+ export { findAttributeRange, findAttributeRangeBound } from "./utils/findattributerange.js";
17
+ export { getLastTextLine, type LastTextLineData } from "./utils/getlasttextline.js";
18
+ export { TypingChangeBuffer } from "./utils/changebuffer.js";
19
+ export { InsertTextCommand, type InsertTextCommandExecuteEvent, type InsertTextCommandOptions } from "./inserttextcommand.js";
20
+ export { DeleteCommand } from "./deletecommand.js";
21
+ export { DeleteObserver as _DeleteObserver, type DeleteEventData } from "./deleteobserver.js";
22
+ export type { TypingConfig, TextTypingTransformationDescription } from "./typingconfig.js";
23
+ export type { ViewDocumentDeleteEvent } from "./deleteobserver.js";
24
+ export { type ViewDocumentInsertTextEvent, type InsertTextEventData, InsertTextObserver } from "./inserttextobserver.js";
25
+ export type { TextWatcherMatchedEvent, TextWatcherMatchedDataEvent, TextWatcherMatchedTypingDataEventData, TextWatcherMatchedTypingSelectionEvent, TextWatcherMatchedTypingSelectionEventData, TextWatcherUnmatchedTypingEvent } from "./textwatcher.js";
26
+ import "./augmentation.js";