@ckeditor/ckeditor5-typing 45.2.1 → 46.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-typing",
3
- "version": "45.2.1",
3
+ "version": "46.0.0-alpha.1",
4
4
  "description": "Typing feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -13,10 +13,10 @@
13
13
  "type": "module",
14
14
  "main": "src/index.js",
15
15
  "dependencies": {
16
- "@ckeditor/ckeditor5-core": "45.2.1",
17
- "@ckeditor/ckeditor5-engine": "45.2.1",
18
- "@ckeditor/ckeditor5-utils": "45.2.1",
19
- "es-toolkit": "1.32.0"
16
+ "@ckeditor/ckeditor5-core": "46.0.0-alpha.1",
17
+ "@ckeditor/ckeditor5-engine": "46.0.0-alpha.1",
18
+ "@ckeditor/ckeditor5-utils": "46.0.0-alpha.1",
19
+ "es-toolkit": "1.39.5"
20
20
  },
21
21
  "author": "CKSource (http://cksource.com/)",
22
22
  "license": "SEE LICENSE IN LICENSE.md",
package/src/delete.d.ts CHANGED
@@ -7,7 +7,7 @@ import { Plugin } from '@ckeditor/ckeditor5-core';
7
7
  * The delete and backspace feature. Handles keys such as <kbd>Delete</kbd> and <kbd>Backspace</kbd>, other
8
8
  * keystrokes and user actions that result in deleting content in the editor.
9
9
  */
10
- export default class Delete extends Plugin {
10
+ export declare class Delete extends Plugin {
11
11
  /**
12
12
  * Whether pressing backspace should trigger undo action
13
13
  */
package/src/delete.js CHANGED
@@ -5,16 +5,16 @@
5
5
  /**
6
6
  * @module typing/delete
7
7
  */
8
- import { _tryFixingModelRange, BubblingEventInfo, DomEventData } from '@ckeditor/ckeditor5-engine';
8
+ import { _tryFixingModelRange, BubblingEventInfo, ViewDocumentDomEventData } from '@ckeditor/ckeditor5-engine';
9
9
  import { Plugin } from '@ckeditor/ckeditor5-core';
10
10
  import { keyCodes } from '@ckeditor/ckeditor5-utils';
11
- import DeleteCommand from './deletecommand.js';
12
- import DeleteObserver from './deleteobserver.js';
11
+ import { DeleteCommand } from './deletecommand.js';
12
+ import { DeleteObserver } from './deleteobserver.js';
13
13
  /**
14
14
  * The delete and backspace feature. Handles keys such as <kbd>Delete</kbd> and <kbd>Backspace</kbd>, other
15
15
  * keystrokes and user actions that result in deleting content in the editor.
16
16
  */
17
- export default class Delete extends Plugin {
17
+ export class Delete extends Plugin {
18
18
  /**
19
19
  * Whether pressing backspace should trigger undo action
20
20
  */
@@ -92,7 +92,7 @@ export default class Delete extends Plugin {
92
92
  direction: 'backward',
93
93
  selectionToRemove: viewSelection
94
94
  };
95
- viewDocument.fire(eventInfo, new DomEventData(view, data.domEvent, deleteData));
95
+ viewDocument.fire(eventInfo, new ViewDocumentDomEventData(view, data.domEvent, deleteData));
96
96
  }
97
97
  });
98
98
  if (this.editor.plugins.has('UndoEditing')) {
@@ -6,13 +6,13 @@
6
6
  * @module typing/deletecommand
7
7
  */
8
8
  import { Command, type Editor } from '@ckeditor/ckeditor5-core';
9
- import type { DocumentSelection, Selection } from '@ckeditor/ckeditor5-engine';
10
- import ChangeBuffer from './utils/changebuffer.js';
9
+ import type { ModelDocumentSelection, ModelSelection } from '@ckeditor/ckeditor5-engine';
10
+ import { TypingChangeBuffer } from './utils/changebuffer.js';
11
11
  /**
12
12
  * The delete command. Used by the {@link module:typing/delete~Delete delete feature} to handle the <kbd>Delete</kbd> and
13
13
  * <kbd>Backspace</kbd> keys.
14
14
  */
15
- export default class DeleteCommand extends Command {
15
+ export declare class DeleteCommand extends Command {
16
16
  /**
17
17
  * The directionality of the delete describing in what direction it should
18
18
  * consume the content when the selection is collapsed.
@@ -32,7 +32,7 @@ export default class DeleteCommand extends Command {
32
32
  /**
33
33
  * The current change buffer.
34
34
  */
35
- get buffer(): ChangeBuffer;
35
+ get buffer(): TypingChangeBuffer;
36
36
  /**
37
37
  * Executes the delete command. Depending on whether the selection is collapsed or not, deletes its content
38
38
  * or a piece of content in the {@link #direction defined direction}.
@@ -41,13 +41,13 @@ export default class DeleteCommand extends Command {
41
41
  * @param options The command options.
42
42
  * @param options.unit See {@link module:engine/model/utils/modifyselection~modifySelection}'s options.
43
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~Document#event:delete} event data.
44
+ * See the {@link module:engine/view/document~ViewDocument#event:delete} event data.
45
45
  * @param options.selection Selection to remove. If not set, current model selection will be used.
46
46
  */
47
47
  execute(options?: {
48
48
  unit?: 'character' | 'codePoint' | 'word';
49
49
  sequence?: number;
50
- selection?: Selection | DocumentSelection;
50
+ selection?: ModelSelection | ModelDocumentSelection;
51
51
  }): void;
52
52
  /**
53
53
  * If the user keeps <kbd>Backspace</kbd> or <kbd>Delete</kbd> key pressed, the content of the current
@@ -7,13 +7,13 @@
7
7
  */
8
8
  import { Command } from '@ckeditor/ckeditor5-core';
9
9
  import { count } from '@ckeditor/ckeditor5-utils';
10
- import ChangeBuffer from './utils/changebuffer.js';
10
+ import { TypingChangeBuffer } from './utils/changebuffer.js';
11
11
  // @if CK_DEBUG_TYPING // const { _buildLogMessage } = require( '@ckeditor/ckeditor5-engine/src/dev-utils/utils.js' );
12
12
  /**
13
13
  * The delete command. Used by the {@link module:typing/delete~Delete delete feature} to handle the <kbd>Delete</kbd> and
14
14
  * <kbd>Backspace</kbd> keys.
15
15
  */
16
- export default class DeleteCommand extends Command {
16
+ export class DeleteCommand extends Command {
17
17
  /**
18
18
  * The directionality of the delete describing in what direction it should
19
19
  * consume the content when the selection is collapsed.
@@ -32,7 +32,7 @@ export default class DeleteCommand extends Command {
32
32
  constructor(editor, direction) {
33
33
  super(editor);
34
34
  this.direction = direction;
35
- this._buffer = new ChangeBuffer(editor.model, editor.config.get('typing.undoStep'));
35
+ this._buffer = new TypingChangeBuffer(editor.model, editor.config.get('typing.undoStep'));
36
36
  // Since this command may execute on different selectable than selection, it should be checked directly in execute block.
37
37
  this._isEnabledBasedOnSelection = false;
38
38
  }
@@ -50,7 +50,7 @@ export default class DeleteCommand extends Command {
50
50
  * @param options The command options.
51
51
  * @param options.unit See {@link module:engine/model/utils/modifyselection~modifySelection}'s options.
52
52
  * @param options.sequence A number describing which subsequent delete event it is without the key being released.
53
- * See the {@link module:engine/view/document~Document#event:delete} event data.
53
+ * See the {@link module:engine/view/document~ViewDocument#event:delete} event data.
54
54
  * @param options.selection Selection to remove. If not set, current model selection will be used.
55
55
  */
56
56
  execute(options = {}) {
@@ -2,11 +2,13 @@
2
2
  * @license Copyright (c) 2003-2025, 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
- import { DomEventData, Observer, type BubblingEvent, type ViewDocumentSelection, type ViewSelection, type EditingView } from '@ckeditor/ckeditor5-engine';
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~Document#event:delete} event.
7
+ * Delete observer introduces the {@link module:engine/view/document~ViewDocument#event:delete} event.
8
+ *
9
+ * @internal
8
10
  */
9
- export default class DeleteObserver extends Observer {
11
+ export declare class DeleteObserver extends Observer {
10
12
  /**
11
13
  * @inheritDoc
12
14
  */
@@ -26,14 +28,14 @@ export default class DeleteObserver extends Observer {
26
28
  * Note: This event is fired by the {@link module:typing/deleteobserver~DeleteObserver delete observer}
27
29
  * (usually registered by the {@link module:typing/delete~Delete delete feature}).
28
30
  *
29
- * @eventName module:engine/view/document~Document#delete
31
+ * @eventName module:engine/view/document~ViewDocument#delete
30
32
  * @param data The event data.
31
33
  */
32
34
  export type ViewDocumentDeleteEvent = BubblingEvent<{
33
35
  name: 'delete';
34
36
  args: [data: DeleteEventData];
35
37
  }>;
36
- export interface DeleteEventData extends DomEventData<InputEvent> {
38
+ export interface DeleteEventData extends ViewDocumentDomEventData<InputEvent> {
37
39
  /**
38
40
  * The direction in which the deletion should happen.
39
41
  */
@@ -6,7 +6,7 @@
6
6
  * @module typing/deleteobserver
7
7
  */
8
8
  import { env, keyCodes, isInsideCombinedSymbol, isInsideEmojiSequence, isInsideSurrogatePair } from '@ckeditor/ckeditor5-utils';
9
- import { BubblingEventInfo, DomEventData, Observer } from '@ckeditor/ckeditor5-engine';
9
+ import { BubblingEventInfo, ViewDocumentDomEventData, Observer } from '@ckeditor/ckeditor5-engine';
10
10
  const DELETE_CHARACTER = 'character';
11
11
  const DELETE_WORD = 'word';
12
12
  const DELETE_CODE_POINT = 'codePoint';
@@ -93,9 +93,11 @@ const DELETE_EVENT_TYPES = {
93
93
  }
94
94
  };
95
95
  /**
96
- * Delete observer introduces the {@link module:engine/view/document~Document#event:delete} event.
96
+ * Delete observer introduces the {@link module:engine/view/document~ViewDocument#event:delete} event.
97
+ *
98
+ * @internal
97
99
  */
98
- export default class DeleteObserver extends Observer {
100
+ export class DeleteObserver extends Observer {
99
101
  /**
100
102
  * @inheritDoc
101
103
  */
@@ -146,7 +148,7 @@ export default class DeleteObserver extends Observer {
146
148
  }
147
149
  }
148
150
  const eventInfo = new BubblingEventInfo(document, 'delete', targetRanges[0]);
149
- document.fire(eventInfo, new DomEventData(view, domEvent, deleteData));
151
+ document.fire(eventInfo, new ViewDocumentDomEventData(view, domEvent, deleteData));
150
152
  // Stop the beforeinput event if `delete` event was stopped.
151
153
  // https://github.com/ckeditor/ckeditor5/issues/753
152
154
  if (eventInfo.stop.called) {
@@ -195,7 +197,7 @@ function enableChromeWorkaround(observer) {
195
197
  direction: getDeleteDirection(keyCode),
196
198
  selectionToRemove: selection
197
199
  };
198
- document.fire(eventInfo, new DomEventData(view, domEvent, deleteData));
200
+ document.fire(eventInfo, new ViewDocumentDomEventData(view, domEvent, deleteData));
199
201
  }
200
202
  });
201
203
  document.on('beforeinput', (evt, { inputType }) => {
package/src/index.d.ts CHANGED
@@ -5,21 +5,22 @@
5
5
  /**
6
6
  * @module typing
7
7
  */
8
- export { default as Typing } from './typing.js';
9
- export { default as Input } from './input.js';
10
- export { default as Delete } from './delete.js';
11
- export { default as TextWatcher } from './textwatcher.js';
12
- export { default as TwoStepCaretMovement } from './twostepcaretmovement.js';
13
- export { default as TextTransformation } from './texttransformation.js';
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
14
  export type { TextTransformationConfig } from './typingconfig.js';
15
- export { default as inlineHighlight } from './utils/inlinehighlight.js';
16
- export { default as findAttributeRange, findAttributeRangeBound } from './utils/findattributerange.js';
17
- export { default as getLastTextLine, type LastTextLineData } from './utils/getlasttextline.js';
18
- export { default as InsertTextCommand, type InsertTextCommandExecuteEvent } from './inserttextcommand.js';
19
- export type { default as DeleteCommand } from './deletecommand.js';
20
- export type { TypingConfig } 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';
21
23
  export type { ViewDocumentDeleteEvent } from './deleteobserver.js';
22
- export type { ViewDocumentInsertTextEvent, InsertTextEventData } from './inserttextobserver.js';
23
- export type { TextWatcherMatchedEvent } from './textwatcher.js';
24
- export type { TextWatcherMatchedDataEvent } from './textwatcher.js';
24
+ export type { ViewDocumentInsertTextEvent, InsertTextEventData, InsertTextObserver } from './inserttextobserver.js';
25
+ export type { TextWatcherMatchedEvent, TextWatcherMatchedDataEvent, TextWatcherMatchedTypingDataEventData, TextWatcherMatchedTypingSelectionEvent, TextWatcherMatchedTypingSelectionEventData, TextWatcherUnmatchedTypingEvent } from './textwatcher.js';
25
26
  import './augmentation.js';
package/src/index.js CHANGED
@@ -5,14 +5,17 @@
5
5
  /**
6
6
  * @module typing
7
7
  */
8
- export { default as Typing } from './typing.js';
9
- export { default as Input } from './input.js';
10
- export { default as Delete } from './delete.js';
11
- export { default as TextWatcher } from './textwatcher.js';
12
- export { default as TwoStepCaretMovement } from './twostepcaretmovement.js';
13
- export { default as TextTransformation } from './texttransformation.js';
14
- export { default as inlineHighlight } from './utils/inlinehighlight.js';
15
- export { default as findAttributeRange, findAttributeRangeBound } from './utils/findattributerange.js';
16
- export { default as getLastTextLine } from './utils/getlasttextline.js';
17
- export { default as InsertTextCommand } from './inserttextcommand.js';
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 { inlineHighlight } from './utils/inlinehighlight.js';
15
+ export { findAttributeRange, findAttributeRangeBound } from './utils/findattributerange.js';
16
+ export { getLastTextLine } from './utils/getlasttextline.js';
17
+ export { TypingChangeBuffer } from './utils/changebuffer.js';
18
+ export { InsertTextCommand } from './inserttextcommand.js';
19
+ export { DeleteCommand } from './deletecommand.js';
20
+ export { DeleteObserver as _DeleteObserver } from './deleteobserver.js';
18
21
  import './augmentation.js';
package/src/input.d.ts CHANGED
@@ -9,7 +9,7 @@ import { Plugin } from '@ckeditor/ckeditor5-core';
9
9
  /**
10
10
  * Handles text input coming from the keyboard or other input methods.
11
11
  */
12
- export default class Input extends Plugin {
12
+ export declare class Input extends Plugin {
13
13
  /**
14
14
  * The queue of `insertText` command executions that are waiting for the DOM to get updated after beforeinput event.
15
15
  */
package/src/input.js CHANGED
@@ -7,15 +7,15 @@
7
7
  */
8
8
  import { Plugin } from '@ckeditor/ckeditor5-core';
9
9
  import { env } from '@ckeditor/ckeditor5-utils';
10
- import InsertTextCommand from './inserttextcommand.js';
11
- import InsertTextObserver from './inserttextobserver.js';
12
- import { LiveRange, _tryFixingModelRange } from '@ckeditor/ckeditor5-engine';
10
+ import { InsertTextCommand } from './inserttextcommand.js';
11
+ import { InsertTextObserver } from './inserttextobserver.js';
12
+ import { ModelLiveRange, _tryFixingModelRange } from '@ckeditor/ckeditor5-engine';
13
13
  import { debounce } from 'es-toolkit/compat';
14
14
  // @if CK_DEBUG_TYPING // const { _debouncedLine, _buildLogMessage } = require( '@ckeditor/ckeditor5-engine/src/dev-utils/utils.js' );
15
15
  /**
16
16
  * Handles text input coming from the keyboard or other input methods.
17
17
  */
18
- export default class Input extends Plugin {
18
+ export class Input extends Plugin {
19
19
  /**
20
20
  * The queue of `insertText` command executions that are waiting for the DOM to get updated after beforeinput event.
21
21
  */
@@ -332,7 +332,7 @@ class TypingQueue {
332
332
  if (commandData.selection) {
333
333
  commandLiveData.selectionRanges = [];
334
334
  for (const range of commandData.selection.getRanges()) {
335
- commandLiveData.selectionRanges.push(LiveRange.fromRange(range));
335
+ commandLiveData.selectionRanges.push(ModelLiveRange.fromRange(range));
336
336
  // Keep reference to the model element for later mutation checks.
337
337
  this._affectedElements.add(range.start.parent);
338
338
  }
@@ -453,7 +453,7 @@ function deleteSelectionContent(model, insertTextCommand) {
453
453
  buffer.unlock();
454
454
  }
455
455
  /**
456
- * Detaches a LiveRange and returns the static range from it.
456
+ * Detaches a ModelLiveRange and returns the static range from it.
457
457
  */
458
458
  function detachLiveRange(liveRange) {
459
459
  const range = liveRange.toRange();
@@ -6,12 +6,12 @@
6
6
  * @module typing/inserttextcommand
7
7
  */
8
8
  import { Command, type Editor } from '@ckeditor/ckeditor5-core';
9
- import ChangeBuffer from './utils/changebuffer.js';
10
- import type { DocumentSelection, Range, Selection } from '@ckeditor/ckeditor5-engine';
9
+ import { TypingChangeBuffer } from './utils/changebuffer.js';
10
+ import type { ModelDocumentSelection, ModelRange, ModelSelection } from '@ckeditor/ckeditor5-engine';
11
11
  /**
12
12
  * The insert text command. Used by the {@link module:typing/input~Input input feature} to handle typing.
13
13
  */
14
- export default class InsertTextCommand extends Command {
14
+ export declare class InsertTextCommand extends Command {
15
15
  /**
16
16
  * Typing's change buffer used to group subsequent changes into batches.
17
17
  */
@@ -26,7 +26,7 @@ export default class InsertTextCommand extends Command {
26
26
  /**
27
27
  * The current change buffer.
28
28
  */
29
- get buffer(): ChangeBuffer;
29
+ get buffer(): TypingChangeBuffer;
30
30
  /**
31
31
  * @inheritDoc
32
32
  */
@@ -57,16 +57,16 @@ export interface InsertTextCommandOptions {
57
57
  * Inserting a text into a selection deletes the current content within selection ranges. If the selection is not specified,
58
58
  * the current selection in the model will be used instead.
59
59
  */
60
- selection?: Selection | DocumentSelection;
60
+ selection?: ModelSelection | ModelDocumentSelection;
61
61
  /**
62
62
  * The range in which the text is inserted. Defaults to the first range in the current selection.
63
63
  */
64
- range?: Range;
64
+ range?: ModelRange;
65
65
  /**
66
66
  * The range where the selection should be placed after the insertion.
67
67
  * If not specified, the selection will be placed right after the inserted text.
68
68
  */
69
- resultRange?: Range;
69
+ resultRange?: ModelRange;
70
70
  }
71
71
  export interface InsertTextCommandExecuteEvent {
72
72
  name: 'execute';
@@ -6,11 +6,11 @@
6
6
  * @module typing/inserttextcommand
7
7
  */
8
8
  import { Command } from '@ckeditor/ckeditor5-core';
9
- import ChangeBuffer from './utils/changebuffer.js';
9
+ import { TypingChangeBuffer } from './utils/changebuffer.js';
10
10
  /**
11
11
  * The insert text command. Used by the {@link module:typing/input~Input input feature} to handle typing.
12
12
  */
13
- export default class InsertTextCommand extends Command {
13
+ export class InsertTextCommand extends Command {
14
14
  /**
15
15
  * Typing's change buffer used to group subsequent changes into batches.
16
16
  */
@@ -23,7 +23,7 @@ export default class InsertTextCommand extends Command {
23
23
  */
24
24
  constructor(editor, undoStepSize) {
25
25
  super(editor);
26
- this._buffer = new ChangeBuffer(editor.model, undoStepSize);
26
+ this._buffer = new TypingChangeBuffer(editor.model, undoStepSize);
27
27
  // Since this command may execute on different selectable than selection, it should be checked directly in execute block.
28
28
  this._isEnabledBasedOnSelection = false;
29
29
  }
@@ -68,7 +68,7 @@ export default class InsertTextCommand extends Command {
68
68
  model.enqueueChange(this._buffer.batch, writer => {
69
69
  this._buffer.lock();
70
70
  // Store selection attributes before deleting old content to preserve formatting and link.
71
- // This unifies the behavior between DocumentSelection and Selection provided as input option.
71
+ // This unifies the behavior between ModelDocumentSelection and Selection provided as input option.
72
72
  const selectionAttributes = Array.from(doc.selection.getAttributes());
73
73
  model.deleteContent(selection);
74
74
  if (text) {
@@ -2,11 +2,11 @@
2
2
  * @license Copyright (c) 2003-2025, 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
- import { DomEventData, Observer, FocusObserver, type EditingView, type ViewDocumentSelection, type ViewSelection } from '@ckeditor/ckeditor5-engine';
5
+ import { ViewDocumentDomEventData, Observer, FocusObserver, type EditingView, type ViewDocumentSelection, type ViewSelection } from '@ckeditor/ckeditor5-engine';
6
6
  /**
7
- * Text insertion observer introduces the {@link module:engine/view/document~Document#event:insertText} event.
7
+ * Text insertion observer introduces the {@link module:engine/view/document~ViewDocument#event:insertText} event.
8
8
  */
9
- export default class InsertTextObserver extends Observer {
9
+ export declare class InsertTextObserver extends Observer {
10
10
  /**
11
11
  * Instance of the focus observer. Insert text observer calls
12
12
  * {@link module:engine/view/observer/focusobserver~FocusObserver#flush} to mark the latest focus change as complete.
@@ -30,19 +30,19 @@ export default class InsertTextObserver extends Observer {
30
30
  * editing view document.
31
31
  *
32
32
  * **Note**: This event will **not** fire for keystrokes such as <kbd>Delete</kbd> or <kbd>Enter</kbd>.
33
- * They have dedicated events, see {@link module:engine/view/document~Document#event:delete} and
34
- * {@link module:engine/view/document~Document#event:enter} to learn more.
33
+ * They have dedicated events, see {@link module:engine/view/document~ViewDocument#event:delete} and
34
+ * {@link module:engine/view/document~ViewDocument#event:enter} to learn more.
35
35
  *
36
36
  * **Note**: This event is fired by the {@link module:typing/inserttextobserver~InsertTextObserver input feature}.
37
37
  *
38
- * @eventName module:engine/view/document~Document#insertText
38
+ * @eventName module:engine/view/document~ViewDocument#insertText
39
39
  * @param data The event data.
40
40
  */
41
41
  export type ViewDocumentInsertTextEvent = {
42
42
  name: 'insertText';
43
43
  args: [data: InsertTextEventData];
44
44
  };
45
- export interface InsertTextEventData extends DomEventData {
45
+ export interface InsertTextEventData extends ViewDocumentDomEventData {
46
46
  /**
47
47
  * The text to be inserted.
48
48
  */
@@ -56,9 +56,9 @@ export interface InsertTextEventData extends DomEventData {
56
56
  * A flag indicating that event was fired during composition.
57
57
  *
58
58
  * Corresponds to the
59
- * {@link module:engine/view/document~Document#event:compositionstart},
60
- * {@link module:engine/view/document~Document#event:compositionupdate},
61
- * and {@link module:engine/view/document~Document#event:compositionend } trio.
59
+ * {@link module:engine/view/document~ViewDocument#event:compositionstart},
60
+ * {@link module:engine/view/document~ViewDocument#event:compositionupdate},
61
+ * and {@link module:engine/view/document~ViewDocument#event:compositionend } trio.
62
62
  */
63
63
  isComposing?: boolean;
64
64
  }
@@ -6,7 +6,7 @@
6
6
  * @module typing/inserttextobserver
7
7
  */
8
8
  import { env, EventInfo } from '@ckeditor/ckeditor5-utils';
9
- import { DomEventData, Observer, FocusObserver } from '@ckeditor/ckeditor5-engine';
9
+ import { ViewDocumentDomEventData, Observer, FocusObserver } from '@ckeditor/ckeditor5-engine';
10
10
  // @if CK_DEBUG_TYPING // const { _buildLogMessage } = require( '@ckeditor/ckeditor5-engine/src/dev-utils/utils.js' );
11
11
  const TYPING_INPUT_TYPES = [
12
12
  // For collapsed range:
@@ -25,9 +25,9 @@ const TYPING_INPUT_TYPES_ANDROID = [
25
25
  'insertCompositionText'
26
26
  ];
27
27
  /**
28
- * Text insertion observer introduces the {@link module:engine/view/document~Document#event:insertText} event.
28
+ * Text insertion observer introduces the {@link module:engine/view/document~ViewDocument#event:insertText} event.
29
29
  */
30
- export default class InsertTextObserver extends Observer {
30
+ export class InsertTextObserver extends Observer {
31
31
  /**
32
32
  * Instance of the focus observer. Insert text observer calls
33
33
  * {@link module:engine/view/observer/focusobserver~FocusObserver#flush} to mark the latest focus change as complete.
@@ -56,7 +56,7 @@ export default class InsertTextObserver extends Observer {
56
56
  // so the selection is in the focused element).
57
57
  this.focusObserver.flush();
58
58
  const eventInfo = new EventInfo(viewDocument, 'insertText');
59
- viewDocument.fire(eventInfo, new DomEventData(view, domEvent, {
59
+ viewDocument.fire(eventInfo, new ViewDocumentDomEventData(view, domEvent, {
60
60
  text,
61
61
  selection: view.createSelection(targetRanges),
62
62
  isComposing
@@ -94,7 +94,7 @@ export default class InsertTextObserver extends Observer {
94
94
  // 2. The last moment before it's locked is the `compositionstart` event.
95
95
  // 3. The `SelectionObserver` is listening for `compositionstart` event and immediately converts
96
96
  // the selection. Handle this at the low priority so after the rendering is blocked.
97
- viewDocument.fire('insertText', new DomEventData(view, domEvent, {
97
+ viewDocument.fire('insertText', new ViewDocumentDomEventData(view, domEvent, {
98
98
  text: data,
99
99
  isComposing: true
100
100
  }));
@@ -9,7 +9,7 @@ import { Plugin, type Editor } from '@ckeditor/ckeditor5-core';
9
9
  /**
10
10
  * The text transformation plugin.
11
11
  */
12
- export default class TextTransformation extends Plugin {
12
+ export declare class TextTransformation extends Plugin {
13
13
  /**
14
14
  * @inheritDoc
15
15
  */
@@ -6,7 +6,7 @@
6
6
  * @module typing/texttransformation
7
7
  */
8
8
  import { Plugin } from '@ckeditor/ckeditor5-core';
9
- import TextWatcher from './textwatcher.js';
9
+ import { TextWatcher } from './textwatcher.js';
10
10
  import { escapeRegExp } from 'es-toolkit/compat';
11
11
  // All named transformations.
12
12
  const TRANSFORMATIONS = {
@@ -61,7 +61,7 @@ const DEFAULT_TRANSFORMATIONS = [
61
61
  /**
62
62
  * The text transformation plugin.
63
63
  */
64
- export default class TextTransformation extends Plugin {
64
+ export class TextTransformation extends Plugin {
65
65
  /**
66
66
  * @inheritDoc
67
67
  */
@@ -2,7 +2,7 @@
2
2
  * @license Copyright (c) 2003-2025, 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
- import type { Batch, Model, Range } from '@ckeditor/ckeditor5-engine';
5
+ import type { Batch, Model, ModelRange } from '@ckeditor/ckeditor5-engine';
6
6
  declare const TextWatcher_base: {
7
7
  new (): import("@ckeditor/ckeditor5-utils").Observable;
8
8
  prototype: import("@ckeditor/ckeditor5-utils").Observable;
@@ -14,7 +14,7 @@ declare const TextWatcher_base: {
14
14
  * {@link module:typing/textwatcher~TextWatcher#event:matched:selection `matched:selection`} and
15
15
  * {@link module:typing/textwatcher~TextWatcher#event:unmatched `unmatched`} events on typing or selection changes.
16
16
  */
17
- export default class TextWatcher extends /* #__PURE__ */ TextWatcher_base {
17
+ export declare class TextWatcher extends /* #__PURE__ */ TextWatcher_base {
18
18
  /**
19
19
  * The editor's model.
20
20
  */
@@ -78,7 +78,7 @@ export type TextWatcherMatchedEvent<TCallbackResult extends Record<string, unkno
78
78
  args: [
79
79
  {
80
80
  text: string;
81
- range: Range;
81
+ range: ModelRange;
82
82
  batch?: Batch;
83
83
  } & TCallbackResult
84
84
  ];
@@ -92,9 +92,9 @@ export type TextWatcherMatchedEvent<TCallbackResult extends Record<string, unkno
92
92
  */
93
93
  export type TextWatcherMatchedDataEvent<TCallbackResult extends Record<string, unknown>> = {
94
94
  name: 'matched:data';
95
- args: [data: TextWatcherMatchedDataEventData & TCallbackResult];
95
+ args: [data: TextWatcherMatchedTypingDataEventData & TCallbackResult];
96
96
  };
97
- export interface TextWatcherMatchedDataEventData {
97
+ export interface TextWatcherMatchedTypingDataEventData {
98
98
  /**
99
99
  * The full text before selection to which the regexp was applied.
100
100
  */
@@ -102,7 +102,7 @@ export interface TextWatcherMatchedDataEventData {
102
102
  /**
103
103
  * The range representing the position of the `data.text`.
104
104
  */
105
- range: Range;
105
+ range: ModelRange;
106
106
  batch: Batch;
107
107
  }
108
108
  /**
@@ -112,11 +112,11 @@ export interface TextWatcherMatchedDataEventData {
112
112
  * @param data Event data.
113
113
  * @param data.testResult The additional data returned from the {@link module:typing/textwatcher~TextWatcher#testCallback}.
114
114
  */
115
- export type TextWatcherMatchedSelectionEvent<TCallbackResult extends Record<string, unknown>> = {
115
+ export type TextWatcherMatchedTypingSelectionEvent<TCallbackResult extends Record<string, unknown>> = {
116
116
  name: 'matched:selection';
117
- args: [data: TextWatcherMatchedSelectionEventData & TCallbackResult];
117
+ args: [data: TextWatcherMatchedTypingSelectionEventData & TCallbackResult];
118
118
  };
119
- export interface TextWatcherMatchedSelectionEventData {
119
+ export interface TextWatcherMatchedTypingSelectionEventData {
120
120
  /**
121
121
  * The full text before selection.
122
122
  */
@@ -124,14 +124,14 @@ export interface TextWatcherMatchedSelectionEventData {
124
124
  /**
125
125
  * The range representing the position of the `data.text`.
126
126
  */
127
- range: Range;
127
+ range: ModelRange;
128
128
  }
129
129
  /**
130
130
  * Fired whenever the text does not match anymore. Fired only when the text watcher found a match.
131
131
  *
132
132
  * @eventName ~TextWatcher#unmatched
133
133
  */
134
- export type TextWatcherUnmatchedEvent = {
134
+ export type TextWatcherUnmatchedTypingEvent = {
135
135
  name: 'unmatched';
136
136
  args: [];
137
137
  };
@@ -6,7 +6,7 @@
6
6
  * @module typing/textwatcher
7
7
  */
8
8
  import { ObservableMixin } from '@ckeditor/ckeditor5-utils';
9
- import getLastTextLine from './utils/getlasttextline.js';
9
+ import { getLastTextLine } from './utils/getlasttextline.js';
10
10
  /**
11
11
  * The text watcher feature.
12
12
  *
@@ -14,7 +14,7 @@ import getLastTextLine from './utils/getlasttextline.js';
14
14
  * {@link module:typing/textwatcher~TextWatcher#event:matched:selection `matched:selection`} and
15
15
  * {@link module:typing/textwatcher~TextWatcher#event:unmatched `unmatched`} events on typing or selection changes.
16
16
  */
17
- export default class TextWatcher extends /* #__PURE__ */ ObservableMixin() {
17
+ export class TextWatcher extends /* #__PURE__ */ ObservableMixin() {
18
18
  /**
19
19
  * The editor's model.
20
20
  */