@ckeditor/ckeditor5-typing 0.0.0-internal-20241017.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.
Files changed (61) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/LICENSE.md +21 -0
  3. package/README.md +22 -0
  4. package/ckeditor5-metadata.json +11 -0
  5. package/dist/augmentation.d.ts +31 -0
  6. package/dist/delete.d.ts +40 -0
  7. package/dist/deletecommand.d.ts +87 -0
  8. package/dist/deleteobserver.d.ts +59 -0
  9. package/dist/index-content.css +4 -0
  10. package/dist/index-editor.css +4 -0
  11. package/dist/index.css +4 -0
  12. package/dist/index.d.ts +29 -0
  13. package/dist/index.js +2490 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/input.d.ts +37 -0
  16. package/dist/inserttextcommand.d.ts +80 -0
  17. package/dist/inserttextobserver.d.ts +59 -0
  18. package/dist/texttransformation.d.ts +41 -0
  19. package/dist/textwatcher.d.ts +142 -0
  20. package/dist/twostepcaretmovement.d.ts +240 -0
  21. package/dist/typing.d.ts +31 -0
  22. package/dist/typingconfig.d.ts +208 -0
  23. package/dist/utils/changebuffer.d.ts +107 -0
  24. package/dist/utils/findattributerange.d.ts +37 -0
  25. package/dist/utils/getlasttextline.d.ts +53 -0
  26. package/dist/utils/inlinehighlight.d.ts +37 -0
  27. package/package.json +40 -0
  28. package/src/augmentation.d.ts +27 -0
  29. package/src/augmentation.js +5 -0
  30. package/src/delete.d.ts +36 -0
  31. package/src/delete.js +88 -0
  32. package/src/deletecommand.d.ts +83 -0
  33. package/src/deletecommand.js +201 -0
  34. package/src/deleteobserver.d.ts +55 -0
  35. package/src/deleteobserver.js +260 -0
  36. package/src/index.d.ts +25 -0
  37. package/src/index.js +18 -0
  38. package/src/input.d.ts +33 -0
  39. package/src/input.js +422 -0
  40. package/src/inserttextcommand.d.ts +76 -0
  41. package/src/inserttextcommand.js +83 -0
  42. package/src/inserttextobserver.d.ts +55 -0
  43. package/src/inserttextobserver.js +102 -0
  44. package/src/texttransformation.d.ts +37 -0
  45. package/src/texttransformation.js +234 -0
  46. package/src/textwatcher.d.ts +138 -0
  47. package/src/textwatcher.js +105 -0
  48. package/src/twostepcaretmovement.d.ts +236 -0
  49. package/src/twostepcaretmovement.js +628 -0
  50. package/src/typing.d.ts +27 -0
  51. package/src/typing.js +33 -0
  52. package/src/typingconfig.d.ts +204 -0
  53. package/src/typingconfig.js +5 -0
  54. package/src/utils/changebuffer.d.ts +103 -0
  55. package/src/utils/changebuffer.js +123 -0
  56. package/src/utils/findattributerange.d.ts +33 -0
  57. package/src/utils/findattributerange.js +41 -0
  58. package/src/utils/getlasttextline.d.ts +49 -0
  59. package/src/utils/getlasttextline.js +43 -0
  60. package/src/utils/inlinehighlight.d.ts +33 -0
  61. package/src/utils/inlinehighlight.js +74 -0
@@ -0,0 +1,37 @@
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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module typing/input
11
+ */
12
+ import { Plugin } from '@ckeditor/ckeditor5-core';
13
+ /**
14
+ * Handles text input coming from the keyboard or other input methods.
15
+ */
16
+ export default class Input extends Plugin {
17
+ /**
18
+ * The queue of `insertText` command executions that are waiting for the DOM to get updated after beforeinput event.
19
+ */
20
+ private _compositionQueue;
21
+ /**
22
+ * @inheritDoc
23
+ */
24
+ static get pluginName(): "Input";
25
+ /**
26
+ * @inheritDoc
27
+ */
28
+ static get isOfficialPlugin(): true;
29
+ /**
30
+ * @inheritDoc
31
+ */
32
+ init(): void;
33
+ /**
34
+ * @inheritDoc
35
+ */
36
+ destroy(): void;
37
+ }
@@ -0,0 +1,80 @@
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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module typing/inserttextcommand
11
+ */
12
+ import { Command, type Editor } from '@ckeditor/ckeditor5-core';
13
+ import ChangeBuffer from './utils/changebuffer.js';
14
+ import type { DocumentSelection, Range, Selection } from '@ckeditor/ckeditor5-engine';
15
+ /**
16
+ * The insert text command. Used by the {@link module:typing/input~Input input feature} to handle typing.
17
+ */
18
+ export default class InsertTextCommand extends Command {
19
+ /**
20
+ * Typing's change buffer used to group subsequent changes into batches.
21
+ */
22
+ private readonly _buffer;
23
+ /**
24
+ * Creates an instance of the command.
25
+ *
26
+ * @param undoStepSize The maximum number of atomic changes
27
+ * which can be contained in one batch in the command buffer.
28
+ */
29
+ constructor(editor: Editor, undoStepSize: number);
30
+ /**
31
+ * The current change buffer.
32
+ */
33
+ get buffer(): ChangeBuffer;
34
+ /**
35
+ * @inheritDoc
36
+ */
37
+ destroy(): void;
38
+ /**
39
+ * Executes the input command. It replaces the content within the given range with the given text.
40
+ * Replacing is a two step process, first the content within the range is removed and then the new text is inserted
41
+ * at the beginning of the range (which after the removal is a collapsed range).
42
+ *
43
+ * @fires execute
44
+ * @param options The command options.
45
+ */
46
+ execute(options?: InsertTextCommandOptions): void;
47
+ }
48
+ /**
49
+ * Interface with parameters for executing InsertTextCommand.
50
+ *
51
+ * Both `range` and `selection` parameters are used for defining selection but should not be used together.
52
+ * If both are defined, only `selection` will be considered.
53
+ */
54
+ export interface InsertTextCommandOptions {
55
+ /**
56
+ * The text to be inserted.
57
+ */
58
+ text?: string;
59
+ /**
60
+ * The selection in which the text is inserted.
61
+ * Inserting a text into a selection deletes the current content within selection ranges. If the selection is not specified,
62
+ * the current selection in the model will be used instead.
63
+ */
64
+ selection?: Selection | DocumentSelection;
65
+ /**
66
+ * The range in which the text is inserted. Defaults to the first range in the current selection.
67
+ */
68
+ range?: Range;
69
+ /**
70
+ * The range where the selection should be placed after the insertion.
71
+ * If not specified, the selection will be placed right after the inserted text.
72
+ */
73
+ resultRange?: Range;
74
+ }
75
+ export interface InsertTextCommandExecuteEvent {
76
+ name: 'execute';
77
+ args: [
78
+ data: [options: InsertTextCommandOptions]
79
+ ];
80
+ }
@@ -0,0 +1,59 @@
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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ import { DomEventData, Observer, FocusObserver, type EditingView, type ViewDocumentSelection, type ViewSelection } from '@ckeditor/ckeditor5-engine';
10
+ /**
11
+ * Text insertion observer introduces the {@link module:engine/view/document~Document#event:insertText} event.
12
+ */
13
+ export default class InsertTextObserver extends Observer {
14
+ /**
15
+ * Instance of the focus observer. Insert text observer calls
16
+ * {@link module:engine/view/observer/focusobserver~FocusObserver#flush} to mark the latest focus change as complete.
17
+ */
18
+ readonly focusObserver: FocusObserver;
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ constructor(view: EditingView);
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ observe(): void;
27
+ /**
28
+ * @inheritDoc
29
+ */
30
+ stopObserving(): void;
31
+ }
32
+ /**
33
+ * Event fired when the user types text, for instance presses <kbd>A</kbd> or <kbd>?</kbd> in the
34
+ * editing view document.
35
+ *
36
+ * **Note**: This event will **not** fire for keystrokes such as <kbd>Delete</kbd> or <kbd>Enter</kbd>.
37
+ * They have dedicated events, see {@link module:engine/view/document~Document#event:delete} and
38
+ * {@link module:engine/view/document~Document#event:enter} to learn more.
39
+ *
40
+ * **Note**: This event is fired by the {@link module:typing/inserttextobserver~InsertTextObserver input feature}.
41
+ *
42
+ * @eventName module:engine/view/document~Document#insertText
43
+ * @param data The event data.
44
+ */
45
+ export type ViewDocumentInsertTextEvent = {
46
+ name: 'insertText';
47
+ args: [data: InsertTextEventData];
48
+ };
49
+ export interface InsertTextEventData extends DomEventData {
50
+ /**
51
+ * The text to be inserted.
52
+ */
53
+ text: string;
54
+ /**
55
+ * The selection into which the text should be inserted.
56
+ * If not specified, the insertion should occur at the current view selection.
57
+ */
58
+ selection?: ViewSelection | ViewDocumentSelection;
59
+ }
@@ -0,0 +1,41 @@
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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module typing/texttransformation
11
+ */
12
+ import { Plugin, type Editor } from '@ckeditor/ckeditor5-core';
13
+ /**
14
+ * The text transformation plugin.
15
+ */
16
+ export default class TextTransformation extends Plugin {
17
+ /**
18
+ * @inheritDoc
19
+ */
20
+ static get requires(): readonly ["Delete", "Input"];
21
+ /**
22
+ * @inheritDoc
23
+ */
24
+ static get pluginName(): "TextTransformation";
25
+ /**
26
+ * @inheritDoc
27
+ */
28
+ static get isOfficialPlugin(): true;
29
+ /**
30
+ * @inheritDoc
31
+ */
32
+ constructor(editor: Editor);
33
+ /**
34
+ * @inheritDoc
35
+ */
36
+ init(): void;
37
+ /**
38
+ * Create new TextWatcher listening to the editor for typing and selection events.
39
+ */
40
+ private _enableTransformationWatchers;
41
+ }
@@ -0,0 +1,142 @@
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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ import type { Batch, Model, Range } from '@ckeditor/ckeditor5-engine';
10
+ declare const TextWatcher_base: {
11
+ new (): import("@ckeditor/ckeditor5-utils").Observable;
12
+ prototype: import("@ckeditor/ckeditor5-utils").Observable;
13
+ };
14
+ /**
15
+ * The text watcher feature.
16
+ *
17
+ * Fires the {@link module:typing/textwatcher~TextWatcher#event:matched:data `matched:data`},
18
+ * {@link module:typing/textwatcher~TextWatcher#event:matched:selection `matched:selection`} and
19
+ * {@link module:typing/textwatcher~TextWatcher#event:unmatched `unmatched`} events on typing or selection changes.
20
+ */
21
+ export default class TextWatcher extends /* #__PURE__ */ TextWatcher_base {
22
+ /**
23
+ * The editor's model.
24
+ */
25
+ readonly model: Model;
26
+ /**
27
+ * The function used to match the text.
28
+ *
29
+ * The test callback can return 3 values:
30
+ *
31
+ * * `false` if there is no match,
32
+ * * `true` if there is a match,
33
+ * * an object if there is a match and we want to pass some additional information to the {@link #event:matched:data} event.
34
+ */
35
+ testCallback: (text: string) => unknown;
36
+ /**
37
+ * Whether there is a match currently.
38
+ */
39
+ private _hasMatch;
40
+ /**
41
+ * Flag indicating whether the `TextWatcher` instance is enabled or disabled.
42
+ * A disabled TextWatcher will not evaluate text.
43
+ *
44
+ * To disable TextWatcher:
45
+ *
46
+ * ```ts
47
+ * const watcher = new TextWatcher( editor.model, testCallback );
48
+ *
49
+ * // After this a testCallback will not be called.
50
+ * watcher.isEnabled = false;
51
+ * ```
52
+ */
53
+ isEnabled: boolean;
54
+ /**
55
+ * Creates a text watcher instance.
56
+ *
57
+ * @param testCallback See {@link module:typing/textwatcher~TextWatcher#testCallback}.
58
+ */
59
+ constructor(model: Model, testCallback: (text: string) => unknown);
60
+ /**
61
+ * Flag indicating whether there is a match currently.
62
+ */
63
+ get hasMatch(): boolean;
64
+ /**
65
+ * Starts listening to the editor for typing and selection events.
66
+ */
67
+ private _startListening;
68
+ /**
69
+ * Checks the editor content for matched text.
70
+ *
71
+ * @fires matched:data
72
+ * @fires matched:selection
73
+ * @fires unmatched
74
+ *
75
+ * @param suffix A suffix used for generating the event name.
76
+ * @param data Data object for event.
77
+ */
78
+ private _evaluateTextBeforeSelection;
79
+ }
80
+ export type TextWatcherMatchedEvent<TCallbackResult extends Record<string, unknown> = Record<string, unknown>> = {
81
+ name: 'matched' | 'matched:data' | 'matched:selection';
82
+ args: [
83
+ {
84
+ text: string;
85
+ range: Range;
86
+ batch?: Batch;
87
+ } & TCallbackResult
88
+ ];
89
+ };
90
+ /**
91
+ * Fired whenever the text watcher found a match for data changes.
92
+ *
93
+ * @eventName ~TextWatcher#matched:data
94
+ * @param data Event data.
95
+ * @param data.testResult The additional data returned from the {@link module:typing/textwatcher~TextWatcher#testCallback}.
96
+ */
97
+ export type TextWatcherMatchedDataEvent<TCallbackResult extends Record<string, unknown>> = {
98
+ name: 'matched:data';
99
+ args: [data: TextWatcherMatchedDataEventData & TCallbackResult];
100
+ };
101
+ export interface TextWatcherMatchedDataEventData {
102
+ /**
103
+ * The full text before selection to which the regexp was applied.
104
+ */
105
+ text: string;
106
+ /**
107
+ * The range representing the position of the `data.text`.
108
+ */
109
+ range: Range;
110
+ batch: Batch;
111
+ }
112
+ /**
113
+ * Fired whenever the text watcher found a match for selection changes.
114
+ *
115
+ * @eventName ~TextWatcher#matched:selection
116
+ * @param data Event data.
117
+ * @param data.testResult The additional data returned from the {@link module:typing/textwatcher~TextWatcher#testCallback}.
118
+ */
119
+ export type TextWatcherMatchedSelectionEvent<TCallbackResult extends Record<string, unknown>> = {
120
+ name: 'matched:selection';
121
+ args: [data: TextWatcherMatchedSelectionEventData & TCallbackResult];
122
+ };
123
+ export interface TextWatcherMatchedSelectionEventData {
124
+ /**
125
+ * The full text before selection.
126
+ */
127
+ text: string;
128
+ /**
129
+ * The range representing the position of the `data.text`.
130
+ */
131
+ range: Range;
132
+ }
133
+ /**
134
+ * Fired whenever the text does not match anymore. Fired only when the text watcher found a match.
135
+ *
136
+ * @eventName ~TextWatcher#unmatched
137
+ */
138
+ export type TextWatcherUnmatchedEvent = {
139
+ name: 'unmatched';
140
+ args: [];
141
+ };
142
+ export {};
@@ -0,0 +1,240 @@
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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module typing/twostepcaretmovement
11
+ */
12
+ import { Plugin, type Editor } from '@ckeditor/ckeditor5-core';
13
+ /**
14
+ * This plugin enables the two-step caret (phantom) movement behavior for
15
+ * {@link module:typing/twostepcaretmovement~TwoStepCaretMovement#registerAttribute registered attributes}
16
+ * on arrow right (<kbd>→</kbd>) and left (<kbd>←</kbd>) key press.
17
+ *
18
+ * Thanks to this (phantom) caret movement the user is able to type before/after as well as at the
19
+ * beginning/end of an attribute.
20
+ *
21
+ * **Note:** This plugin support right–to–left (Arabic, Hebrew, etc.) content by mirroring its behavior
22
+ * but for the sake of simplicity examples showcase only left–to–right use–cases.
23
+ *
24
+ * # Forward movement
25
+ *
26
+ * ## "Entering" an attribute:
27
+ *
28
+ * When this plugin is enabled and registered for the `a` attribute and the selection is right before it
29
+ * (at the attribute boundary), pressing the right arrow key will not move the selection but update its
30
+ * attributes accordingly:
31
+ *
32
+ * * When enabled:
33
+ *
34
+ * ```xml
35
+ * foo{}<$text a="true">bar</$text>
36
+ * ```
37
+ *
38
+ * <kbd>→</kbd>
39
+ *
40
+ * ```xml
41
+ * foo<$text a="true">{}bar</$text>
42
+ * ```
43
+ *
44
+ * * When disabled:
45
+ *
46
+ * ```xml
47
+ * foo{}<$text a="true">bar</$text>
48
+ * ```
49
+ *
50
+ * <kbd>→</kbd>
51
+ *
52
+ * ```xml
53
+ * foo<$text a="true">b{}ar</$text>
54
+ * ```
55
+ *
56
+ *
57
+ * ## "Leaving" an attribute:
58
+ *
59
+ * * When enabled:
60
+ *
61
+ * ```xml
62
+ * <$text a="true">bar{}</$text>baz
63
+ * ```
64
+ *
65
+ * <kbd>→</kbd>
66
+ *
67
+ * ```xml
68
+ * <$text a="true">bar</$text>{}baz
69
+ * ```
70
+ *
71
+ * * When disabled:
72
+ *
73
+ * ```xml
74
+ * <$text a="true">bar{}</$text>baz
75
+ * ```
76
+ *
77
+ * <kbd>→</kbd>
78
+ *
79
+ * ```xml
80
+ * <$text a="true">bar</$text>b{}az
81
+ * ```
82
+ *
83
+ * # Backward movement
84
+ *
85
+ * * When enabled:
86
+ *
87
+ * ```xml
88
+ * <$text a="true">bar</$text>{}baz
89
+ * ```
90
+ *
91
+ * <kbd>←</kbd>
92
+ *
93
+ * ```xml
94
+ * <$text a="true">bar{}</$text>baz
95
+ * ```
96
+ *
97
+ * * When disabled:
98
+ *
99
+ * ```xml
100
+ * <$text a="true">bar</$text>{}baz
101
+ * ```
102
+ *
103
+ * <kbd>←</kbd>
104
+ *
105
+ * ```xml
106
+ * <$text a="true">ba{}r</$text>b{}az
107
+ * ```
108
+ *
109
+ * # Multiple attributes
110
+ *
111
+ * * When enabled and many attributes starts or ends at the same position:
112
+ *
113
+ * ```xml
114
+ * <$text a="true" b="true">bar</$text>{}baz
115
+ * ```
116
+ *
117
+ * <kbd>←</kbd>
118
+ *
119
+ * ```xml
120
+ * <$text a="true" b="true">bar{}</$text>baz
121
+ * ```
122
+ *
123
+ * * When enabled and one procedes another:
124
+ *
125
+ * ```xml
126
+ * <$text a="true">bar</$text><$text b="true">{}bar</$text>
127
+ * ```
128
+ *
129
+ * <kbd>←</kbd>
130
+ *
131
+ * ```xml
132
+ * <$text a="true">bar{}</$text><$text b="true">bar</$text>
133
+ * ```
134
+ *
135
+ */
136
+ export default class TwoStepCaretMovement extends Plugin {
137
+ /**
138
+ * A set of attributes to handle.
139
+ */
140
+ private attributes;
141
+ /**
142
+ * The current UID of the overridden gravity, as returned by
143
+ * {@link module:engine/model/writer~Writer#overrideSelectionGravity}.
144
+ */
145
+ private _overrideUid;
146
+ /**
147
+ * A flag indicating that the automatic gravity restoration should not happen upon the next
148
+ * gravity restoration.
149
+ * {@link module:engine/model/selection~Selection#event:change:range} event.
150
+ */
151
+ private _isNextGravityRestorationSkipped;
152
+ /**
153
+ * @inheritDoc
154
+ */
155
+ static get pluginName(): "TwoStepCaretMovement";
156
+ /**
157
+ * @inheritDoc
158
+ */
159
+ static get isOfficialPlugin(): true;
160
+ /**
161
+ * @inheritDoc
162
+ */
163
+ constructor(editor: Editor);
164
+ /**
165
+ * @inheritDoc
166
+ */
167
+ init(): void;
168
+ /**
169
+ * Registers a given attribute for the two-step caret movement.
170
+ *
171
+ * @param attribute Name of the attribute to handle.
172
+ */
173
+ registerAttribute(attribute: string): void;
174
+ /**
175
+ * Updates the document selection and the view according to the two–step caret movement state
176
+ * when moving **forwards**. Executed upon `keypress` in the {@link module:engine/view/view~View}.
177
+ *
178
+ * @param data Data of the key press.
179
+ * @returns `true` when the handler prevented caret movement.
180
+ */
181
+ private _handleForwardMovement;
182
+ /**
183
+ * Updates the document selection and the view according to the two–step caret movement state
184
+ * when moving **backwards**. Executed upon `keypress` in the {@link module:engine/view/view~View}.
185
+ *
186
+ * @param data Data of the key press.
187
+ * @returns `true` when the handler prevented caret movement
188
+ */
189
+ private _handleBackwardMovement;
190
+ /**
191
+ * Starts listening to {@link module:engine/view/document~Document#event:mousedown} and
192
+ * {@link module:engine/view/document~Document#event:selectionChange} and puts the selection before/after a 2-step node
193
+ * if clicked at the beginning/ending of the 2-step node.
194
+ *
195
+ * The purpose of this action is to allow typing around the 2-step node directly after a click.
196
+ *
197
+ * See https://github.com/ckeditor/ckeditor5/issues/1016.
198
+ */
199
+ private _enableClickingAfterNode;
200
+ /**
201
+ * Starts listening to {@link module:engine/model/model~Model#event:insertContent} and corrects the model
202
+ * selection attributes if the selection is at the end of a two-step node after inserting the content.
203
+ *
204
+ * The purpose of this action is to improve the overall UX because the user is no longer "trapped" by the
205
+ * two-step attribute of the selection, and they can type a "clean" (`linkHref`–less) text right away.
206
+ *
207
+ * See https://github.com/ckeditor/ckeditor5/issues/6053.
208
+ */
209
+ private _enableInsertContentSelectionAttributesFixer;
210
+ /**
211
+ * Starts listening to {@link module:engine/model/model~Model#deleteContent} and checks whether
212
+ * removing a content right after the tow-step attribute.
213
+ *
214
+ * If so, the selection should not preserve the two-step attribute. However, if
215
+ * the {@link module:typing/twostepcaretmovement~TwoStepCaretMovement} plugin is active and
216
+ * the selection has the two-step attribute due to overridden gravity (at the end), the two-step attribute should stay untouched.
217
+ *
218
+ * The purpose of this action is to allow removing the link text and keep the selection outside the link.
219
+ *
220
+ * See https://github.com/ckeditor/ckeditor5/issues/7521.
221
+ */
222
+ private _handleDeleteContentAfterNode;
223
+ /**
224
+ * `true` when the gravity is overridden for the plugin.
225
+ */
226
+ private get _isGravityOverridden();
227
+ /**
228
+ * Overrides the gravity using the {@link module:engine/model/writer~Writer model writer}
229
+ * and stores the information about this fact in the {@link #_overrideUid}.
230
+ *
231
+ * A shorthand for {@link module:engine/model/writer~Writer#overrideSelectionGravity}.
232
+ */
233
+ private _overrideGravity;
234
+ /**
235
+ * Restores the gravity using the {@link module:engine/model/writer~Writer model writer}.
236
+ *
237
+ * A shorthand for {@link module:engine/model/writer~Writer#restoreSelectionGravity}.
238
+ */
239
+ private _restoreGravity;
240
+ }
@@ -0,0 +1,31 @@
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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module typing/typing
11
+ */
12
+ import { Plugin } from '@ckeditor/ckeditor5-core';
13
+ import Input from './input.js';
14
+ import Delete from './delete.js';
15
+ /**
16
+ * The typing feature. It handles typing.
17
+ *
18
+ * This is a "glue" plugin which loads the {@link module:typing/input~Input} and {@link module:typing/delete~Delete}
19
+ * plugins.
20
+ */
21
+ export default class Typing extends Plugin {
22
+ static get requires(): readonly [typeof Input, typeof Delete];
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ static get pluginName(): "Typing";
27
+ /**
28
+ * @inheritDoc
29
+ */
30
+ static get isOfficialPlugin(): true;
31
+ }