@rtif-sdk/web 1.0.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.
- package/LICENSE +21 -0
- package/README.md +67 -0
- package/dist/block-drag-handler.d.ts +189 -0
- package/dist/block-drag-handler.d.ts.map +1 -0
- package/dist/block-drag-handler.js +745 -0
- package/dist/block-drag-handler.js.map +1 -0
- package/dist/block-renderer.d.ts +402 -0
- package/dist/block-renderer.d.ts.map +1 -0
- package/dist/block-renderer.js +424 -0
- package/dist/block-renderer.js.map +1 -0
- package/dist/clipboard.d.ts +178 -0
- package/dist/clipboard.d.ts.map +1 -0
- package/dist/clipboard.js +432 -0
- package/dist/clipboard.js.map +1 -0
- package/dist/command-bus.d.ts +113 -0
- package/dist/command-bus.d.ts.map +1 -0
- package/dist/command-bus.js +70 -0
- package/dist/command-bus.js.map +1 -0
- package/dist/composition.d.ts +220 -0
- package/dist/composition.d.ts.map +1 -0
- package/dist/composition.js +271 -0
- package/dist/composition.js.map +1 -0
- package/dist/content-extraction.d.ts +69 -0
- package/dist/content-extraction.d.ts.map +1 -0
- package/dist/content-extraction.js +228 -0
- package/dist/content-extraction.js.map +1 -0
- package/dist/content-handler-file.d.ts +40 -0
- package/dist/content-handler-file.d.ts.map +1 -0
- package/dist/content-handler-file.js +91 -0
- package/dist/content-handler-file.js.map +1 -0
- package/dist/content-handler-image.d.ts +82 -0
- package/dist/content-handler-image.d.ts.map +1 -0
- package/dist/content-handler-image.js +120 -0
- package/dist/content-handler-image.js.map +1 -0
- package/dist/content-handler-url.d.ts +129 -0
- package/dist/content-handler-url.d.ts.map +1 -0
- package/dist/content-handler-url.js +244 -0
- package/dist/content-handler-url.js.map +1 -0
- package/dist/content-handlers.d.ts +67 -0
- package/dist/content-handlers.d.ts.map +1 -0
- package/dist/content-handlers.js +263 -0
- package/dist/content-handlers.js.map +1 -0
- package/dist/content-pipeline.d.ts +383 -0
- package/dist/content-pipeline.d.ts.map +1 -0
- package/dist/content-pipeline.js +232 -0
- package/dist/content-pipeline.js.map +1 -0
- package/dist/cursor-nav.d.ts +149 -0
- package/dist/cursor-nav.d.ts.map +1 -0
- package/dist/cursor-nav.js +230 -0
- package/dist/cursor-nav.js.map +1 -0
- package/dist/cursor-rect.d.ts +65 -0
- package/dist/cursor-rect.d.ts.map +1 -0
- package/dist/cursor-rect.js +98 -0
- package/dist/cursor-rect.js.map +1 -0
- package/dist/drop-indicator.d.ts +108 -0
- package/dist/drop-indicator.d.ts.map +1 -0
- package/dist/drop-indicator.js +236 -0
- package/dist/drop-indicator.js.map +1 -0
- package/dist/editor.d.ts +41 -0
- package/dist/editor.d.ts.map +1 -0
- package/dist/editor.js +710 -0
- package/dist/editor.js.map +1 -0
- package/dist/floating-toolbar.d.ts +93 -0
- package/dist/floating-toolbar.d.ts.map +1 -0
- package/dist/floating-toolbar.js +159 -0
- package/dist/floating-toolbar.js.map +1 -0
- package/dist/index.d.ts +62 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +119 -0
- package/dist/index.js.map +1 -0
- package/dist/input-bridge.d.ts +273 -0
- package/dist/input-bridge.d.ts.map +1 -0
- package/dist/input-bridge.js +884 -0
- package/dist/input-bridge.js.map +1 -0
- package/dist/link-popover.d.ts +38 -0
- package/dist/link-popover.d.ts.map +1 -0
- package/dist/link-popover.js +278 -0
- package/dist/link-popover.js.map +1 -0
- package/dist/mark-renderer.d.ts +275 -0
- package/dist/mark-renderer.d.ts.map +1 -0
- package/dist/mark-renderer.js +210 -0
- package/dist/mark-renderer.js.map +1 -0
- package/dist/perf.d.ts +145 -0
- package/dist/perf.d.ts.map +1 -0
- package/dist/perf.js +260 -0
- package/dist/perf.js.map +1 -0
- package/dist/plugin-kit.d.ts +265 -0
- package/dist/plugin-kit.d.ts.map +1 -0
- package/dist/plugin-kit.js +234 -0
- package/dist/plugin-kit.js.map +1 -0
- package/dist/plugins/alignment-plugin.d.ts +68 -0
- package/dist/plugins/alignment-plugin.d.ts.map +1 -0
- package/dist/plugins/alignment-plugin.js +98 -0
- package/dist/plugins/alignment-plugin.js.map +1 -0
- package/dist/plugins/block-utils.d.ts +113 -0
- package/dist/plugins/block-utils.d.ts.map +1 -0
- package/dist/plugins/block-utils.js +191 -0
- package/dist/plugins/block-utils.js.map +1 -0
- package/dist/plugins/blockquote-plugin.d.ts +39 -0
- package/dist/plugins/blockquote-plugin.d.ts.map +1 -0
- package/dist/plugins/blockquote-plugin.js +88 -0
- package/dist/plugins/blockquote-plugin.js.map +1 -0
- package/dist/plugins/bold-plugin.d.ts +37 -0
- package/dist/plugins/bold-plugin.d.ts.map +1 -0
- package/dist/plugins/bold-plugin.js +48 -0
- package/dist/plugins/bold-plugin.js.map +1 -0
- package/dist/plugins/callout-plugin.d.ts +100 -0
- package/dist/plugins/callout-plugin.d.ts.map +1 -0
- package/dist/plugins/callout-plugin.js +200 -0
- package/dist/plugins/callout-plugin.js.map +1 -0
- package/dist/plugins/code-block-plugin.d.ts +62 -0
- package/dist/plugins/code-block-plugin.d.ts.map +1 -0
- package/dist/plugins/code-block-plugin.js +176 -0
- package/dist/plugins/code-block-plugin.js.map +1 -0
- package/dist/plugins/code-plugin.d.ts +37 -0
- package/dist/plugins/code-plugin.d.ts.map +1 -0
- package/dist/plugins/code-plugin.js +48 -0
- package/dist/plugins/code-plugin.js.map +1 -0
- package/dist/plugins/embed-plugin.d.ts +90 -0
- package/dist/plugins/embed-plugin.d.ts.map +1 -0
- package/dist/plugins/embed-plugin.js +147 -0
- package/dist/plugins/embed-plugin.js.map +1 -0
- package/dist/plugins/font-family-plugin.d.ts +58 -0
- package/dist/plugins/font-family-plugin.d.ts.map +1 -0
- package/dist/plugins/font-family-plugin.js +57 -0
- package/dist/plugins/font-family-plugin.js.map +1 -0
- package/dist/plugins/font-size-plugin.d.ts +57 -0
- package/dist/plugins/font-size-plugin.d.ts.map +1 -0
- package/dist/plugins/font-size-plugin.js +56 -0
- package/dist/plugins/font-size-plugin.js.map +1 -0
- package/dist/plugins/heading-plugin.d.ts +52 -0
- package/dist/plugins/heading-plugin.d.ts.map +1 -0
- package/dist/plugins/heading-plugin.js +114 -0
- package/dist/plugins/heading-plugin.js.map +1 -0
- package/dist/plugins/hr-plugin.d.ts +33 -0
- package/dist/plugins/hr-plugin.d.ts.map +1 -0
- package/dist/plugins/hr-plugin.js +75 -0
- package/dist/plugins/hr-plugin.js.map +1 -0
- package/dist/plugins/image-plugin.d.ts +115 -0
- package/dist/plugins/image-plugin.d.ts.map +1 -0
- package/dist/plugins/image-plugin.js +199 -0
- package/dist/plugins/image-plugin.js.map +1 -0
- package/dist/plugins/indent-plugin.d.ts +62 -0
- package/dist/plugins/indent-plugin.d.ts.map +1 -0
- package/dist/plugins/indent-plugin.js +128 -0
- package/dist/plugins/indent-plugin.js.map +1 -0
- package/dist/plugins/index.d.ts +45 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +42 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/italic-plugin.d.ts +37 -0
- package/dist/plugins/italic-plugin.d.ts.map +1 -0
- package/dist/plugins/italic-plugin.js +48 -0
- package/dist/plugins/italic-plugin.js.map +1 -0
- package/dist/plugins/link-plugin.d.ts +129 -0
- package/dist/plugins/link-plugin.d.ts.map +1 -0
- package/dist/plugins/link-plugin.js +212 -0
- package/dist/plugins/link-plugin.js.map +1 -0
- package/dist/plugins/list-plugin.d.ts +53 -0
- package/dist/plugins/list-plugin.d.ts.map +1 -0
- package/dist/plugins/list-plugin.js +309 -0
- package/dist/plugins/list-plugin.js.map +1 -0
- package/dist/plugins/mark-utils.d.ts +173 -0
- package/dist/plugins/mark-utils.d.ts.map +1 -0
- package/dist/plugins/mark-utils.js +425 -0
- package/dist/plugins/mark-utils.js.map +1 -0
- package/dist/plugins/mention-plugin.d.ts +191 -0
- package/dist/plugins/mention-plugin.d.ts.map +1 -0
- package/dist/plugins/mention-plugin.js +295 -0
- package/dist/plugins/mention-plugin.js.map +1 -0
- package/dist/plugins/strikethrough-plugin.d.ts +37 -0
- package/dist/plugins/strikethrough-plugin.d.ts.map +1 -0
- package/dist/plugins/strikethrough-plugin.js +48 -0
- package/dist/plugins/strikethrough-plugin.js.map +1 -0
- package/dist/plugins/text-color-plugin.d.ts +57 -0
- package/dist/plugins/text-color-plugin.d.ts.map +1 -0
- package/dist/plugins/text-color-plugin.js +56 -0
- package/dist/plugins/text-color-plugin.js.map +1 -0
- package/dist/plugins/underline-plugin.d.ts +37 -0
- package/dist/plugins/underline-plugin.d.ts.map +1 -0
- package/dist/plugins/underline-plugin.js +48 -0
- package/dist/plugins/underline-plugin.js.map +1 -0
- package/dist/presets.d.ts +95 -0
- package/dist/presets.d.ts.map +1 -0
- package/dist/presets.js +159 -0
- package/dist/presets.js.map +1 -0
- package/dist/renderer.d.ts +125 -0
- package/dist/renderer.d.ts.map +1 -0
- package/dist/renderer.js +415 -0
- package/dist/renderer.js.map +1 -0
- package/dist/scroll-to-cursor.d.ts +25 -0
- package/dist/scroll-to-cursor.d.ts.map +1 -0
- package/dist/scroll-to-cursor.js +59 -0
- package/dist/scroll-to-cursor.js.map +1 -0
- package/dist/selection-sync.d.ts +159 -0
- package/dist/selection-sync.d.ts.map +1 -0
- package/dist/selection-sync.js +527 -0
- package/dist/selection-sync.js.map +1 -0
- package/dist/shortcut-handler.d.ts +98 -0
- package/dist/shortcut-handler.d.ts.map +1 -0
- package/dist/shortcut-handler.js +155 -0
- package/dist/shortcut-handler.js.map +1 -0
- package/dist/toolbar.d.ts +103 -0
- package/dist/toolbar.d.ts.map +1 -0
- package/dist/toolbar.js +134 -0
- package/dist/toolbar.js.map +1 -0
- package/dist/trigger-manager.d.ts +205 -0
- package/dist/trigger-manager.d.ts.map +1 -0
- package/dist/trigger-manager.js +466 -0
- package/dist/trigger-manager.js.map +1 -0
- package/dist/types.d.ts +216 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +30 -0
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* InputBridge — translates DOM `beforeinput` events into RTIF engine operations.
|
|
3
|
+
*
|
|
4
|
+
* This module is the core of the "controlled contenteditable" approach.
|
|
5
|
+
* It intercepts `beforeinput` events, prevents default browser behavior for
|
|
6
|
+
* most input types, and dispatches the corresponding RTIF operations through
|
|
7
|
+
* the injected dependencies.
|
|
8
|
+
*
|
|
9
|
+
* During IME composition, composition-related input types are passed through
|
|
10
|
+
* to the browser so that native composition rendering works correctly.
|
|
11
|
+
* The composition handler (separate module) emits RTIF operations on commit.
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
import type { Document, Selection, Operation } from '@rtif-sdk/core';
|
|
16
|
+
/**
|
|
17
|
+
* Injected dependencies for the InputBridge.
|
|
18
|
+
*
|
|
19
|
+
* The bridge does not import the engine directly. Instead, the parent module
|
|
20
|
+
* wires these callbacks at construction time, keeping the bridge testable
|
|
21
|
+
* and decoupled from the engine's concrete class.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* const deps: InputBridgeDeps = {
|
|
26
|
+
* getSelection: () => engine.state.selection,
|
|
27
|
+
* getDoc: () => engine.state.doc,
|
|
28
|
+
* dispatch: (ops) => engine.dispatch(ops),
|
|
29
|
+
* undo: () => engine.undo(),
|
|
30
|
+
* redo: () => engine.redo(),
|
|
31
|
+
* isComposing: () => compositionHandler.isComposing(),
|
|
32
|
+
* isReadOnly: () => config.readOnly ?? false,
|
|
33
|
+
* generateBlockId: () => crypto.randomUUID(),
|
|
34
|
+
* };
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export interface InputBridgeDeps {
|
|
38
|
+
/** Get the current RTIF selection from the engine. */
|
|
39
|
+
readonly getSelection: () => Selection;
|
|
40
|
+
/** Get the current document from the engine. */
|
|
41
|
+
readonly getDoc: () => Document;
|
|
42
|
+
/** Dispatch one or more operations to the engine. */
|
|
43
|
+
readonly dispatch: (ops: Operation | Operation[]) => void;
|
|
44
|
+
/** Trigger undo on the engine. */
|
|
45
|
+
readonly undo: () => void;
|
|
46
|
+
/** Trigger redo on the engine. */
|
|
47
|
+
readonly redo: () => void;
|
|
48
|
+
/** Check whether an IME composition session is currently active. */
|
|
49
|
+
readonly isComposing: () => boolean;
|
|
50
|
+
/** Check whether the editor is in read-only mode. */
|
|
51
|
+
readonly isReadOnly: () => boolean;
|
|
52
|
+
/** Generate a unique block ID for `split_block` operations. */
|
|
53
|
+
readonly generateBlockId: () => string;
|
|
54
|
+
/**
|
|
55
|
+
* Get pending marks from the engine.
|
|
56
|
+
* When pending marks exist, inserted text should have those marks applied.
|
|
57
|
+
* Returns empty object if no pending marks.
|
|
58
|
+
*/
|
|
59
|
+
readonly getPendingMarks?: () => Record<string, unknown>;
|
|
60
|
+
/**
|
|
61
|
+
* Clear pending marks on the engine after they've been consumed.
|
|
62
|
+
*/
|
|
63
|
+
readonly clearPendingMarks?: () => void;
|
|
64
|
+
/**
|
|
65
|
+
* Find the range of an atomic mark containing the given offset.
|
|
66
|
+
* Returns the absolute offset and count of the mark range, or null
|
|
67
|
+
* if the offset is not inside an atomic mark.
|
|
68
|
+
*/
|
|
69
|
+
readonly findAtomicMarkRange?: (offset: number) => {
|
|
70
|
+
offset: number;
|
|
71
|
+
count: number;
|
|
72
|
+
} | null;
|
|
73
|
+
/**
|
|
74
|
+
* Check whether a block type is atomic (non-editable, e.g., HR, image, embed).
|
|
75
|
+
* Used to prevent corrupt state when backspace/delete would merge into an atomic block.
|
|
76
|
+
*/
|
|
77
|
+
readonly isAtomicBlock?: (blockType: string) => boolean;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Find the offset of the word boundary before the given local offset in block text.
|
|
81
|
+
*
|
|
82
|
+
* A "word character" is any character matching `\w` (alphanumeric + underscore).
|
|
83
|
+
* The algorithm: first skip any non-word characters (punctuation, whitespace),
|
|
84
|
+
* then skip word characters. The result is the start of the word.
|
|
85
|
+
*
|
|
86
|
+
* @param blockText - The full text of the block
|
|
87
|
+
* @param localOffset - The current cursor position within the block (0-indexed)
|
|
88
|
+
* @returns The local offset of the word boundary (always <= localOffset)
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```ts
|
|
92
|
+
* findWordBoundaryBackward('hello world', 11); // => 6 (start of "world")
|
|
93
|
+
* findWordBoundaryBackward('hello world', 5); // => 0 (start of "hello")
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
export declare function findWordBoundaryBackward(blockText: string, localOffset: number): number;
|
|
97
|
+
/**
|
|
98
|
+
* Find the offset of the word boundary after the given local offset in block text.
|
|
99
|
+
*
|
|
100
|
+
* The algorithm: first skip word characters, then skip non-word characters
|
|
101
|
+
* (whitespace, punctuation). The result is the position after the word
|
|
102
|
+
* and its trailing whitespace.
|
|
103
|
+
*
|
|
104
|
+
* @param blockText - The full text of the block
|
|
105
|
+
* @param localOffset - The current cursor position within the block (0-indexed)
|
|
106
|
+
* @returns The local offset of the word boundary (always >= localOffset)
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```ts
|
|
110
|
+
* findWordBoundaryForward('hello world', 0); // => 6 (after "hello ")
|
|
111
|
+
* findWordBoundaryForward('hello world', 6); // => 11 (after "world")
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
export declare function findWordBoundaryForward(blockText: string, localOffset: number): number;
|
|
115
|
+
/**
|
|
116
|
+
* Compute the operations needed to delete a selection range.
|
|
117
|
+
*
|
|
118
|
+
* For single-block selections, returns a single `delete_text`. For cross-block
|
|
119
|
+
* selections, composes `delete_text` and `merge_block` operations that the
|
|
120
|
+
* engine can apply sequentially.
|
|
121
|
+
*
|
|
122
|
+
* The algorithm works forward through the blocks:
|
|
123
|
+
* 1. Delete the tail of the start block (from startLocalOffset to end).
|
|
124
|
+
* 2. For each subsequent block up to and including the end block:
|
|
125
|
+
* a. Merge it into the previous block.
|
|
126
|
+
* b. Delete the appropriate text (all text for intermediate blocks,
|
|
127
|
+
* or endLocalOffset characters for the end block).
|
|
128
|
+
*
|
|
129
|
+
* After each merge, the text from the merged block appears at the position
|
|
130
|
+
* where the start block's tail was deleted, so all delete offsets are the
|
|
131
|
+
* same absolute offset (the start of the selection).
|
|
132
|
+
*
|
|
133
|
+
* @param doc - The current document
|
|
134
|
+
* @param selection - The selection to delete (may be forward or backward)
|
|
135
|
+
* @returns Array of operations to dispatch. Empty if selection is collapsed.
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```ts
|
|
139
|
+
* // Single-block selection
|
|
140
|
+
* const ops = deleteSelectionOps(doc, { anchor: { offset: 2 }, focus: { offset: 7 } });
|
|
141
|
+
* // => [{ type: 'delete_text', offset: 2, count: 5 }]
|
|
142
|
+
*
|
|
143
|
+
* // Cross-block selection
|
|
144
|
+
* const ops = deleteSelectionOps(doc, { anchor: { offset: 3 }, focus: { offset: 8 } });
|
|
145
|
+
* // => [delete_text, merge_block, delete_text, ...]
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
export declare function deleteSelectionOps(doc: Document, selection: Selection): Operation[];
|
|
149
|
+
/**
|
|
150
|
+
* The InputBridge intercepts DOM `beforeinput` events on a contenteditable
|
|
151
|
+
* element and translates them into RTIF operations.
|
|
152
|
+
*
|
|
153
|
+
* This is the "controlled contenteditable" approach: most input types are
|
|
154
|
+
* prevented and handled through the RTIF engine, while IME composition
|
|
155
|
+
* events are passed through to the browser for native rendering.
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```ts
|
|
159
|
+
* const bridge = new InputBridge(root, {
|
|
160
|
+
* getSelection: () => engine.state.selection,
|
|
161
|
+
* getDoc: () => engine.state.doc,
|
|
162
|
+
* dispatch: (ops) => engine.dispatch(ops),
|
|
163
|
+
* undo: () => engine.undo(),
|
|
164
|
+
* redo: () => engine.redo(),
|
|
165
|
+
* isComposing: () => compositionHandler.isComposing(),
|
|
166
|
+
* isReadOnly: () => false,
|
|
167
|
+
* generateBlockId: () => crypto.randomUUID(),
|
|
168
|
+
* });
|
|
169
|
+
* bridge.attach();
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
export declare class InputBridge {
|
|
173
|
+
private readonly _root;
|
|
174
|
+
private readonly _deps;
|
|
175
|
+
private _attached;
|
|
176
|
+
/**
|
|
177
|
+
* Bound reference to the beforeinput handler so we can add/remove
|
|
178
|
+
* the same function reference.
|
|
179
|
+
*/
|
|
180
|
+
private readonly _boundHandler;
|
|
181
|
+
constructor(root: HTMLElement, deps: InputBridgeDeps);
|
|
182
|
+
/**
|
|
183
|
+
* Attach the `beforeinput` event listener to the root element.
|
|
184
|
+
*
|
|
185
|
+
* Safe to call multiple times — only one listener is registered.
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* ```ts
|
|
189
|
+
* bridge.attach();
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
attach(): void;
|
|
193
|
+
/**
|
|
194
|
+
* Remove the `beforeinput` event listener from the root element.
|
|
195
|
+
*
|
|
196
|
+
* Safe to call without a prior `attach()`.
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* ```ts
|
|
200
|
+
* bridge.detach();
|
|
201
|
+
* ```
|
|
202
|
+
*/
|
|
203
|
+
detach(): void;
|
|
204
|
+
/**
|
|
205
|
+
* Handle a `beforeinput` event by translating its `inputType` into
|
|
206
|
+
* RTIF operations.
|
|
207
|
+
*
|
|
208
|
+
* This method is public for testing. In production it is called by the
|
|
209
|
+
* bound event listener installed via `attach()`.
|
|
210
|
+
*
|
|
211
|
+
* @param e - The InputEvent from the `beforeinput` event
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* ```ts
|
|
215
|
+
* // Typically called via the event listener, but can be called directly:
|
|
216
|
+
* bridge.handleBeforeInput(inputEvent);
|
|
217
|
+
* ```
|
|
218
|
+
*/
|
|
219
|
+
handleBeforeInput(e: InputEvent): void;
|
|
220
|
+
/**
|
|
221
|
+
* Handle `insertText` and `insertCompositionText` (when not composing).
|
|
222
|
+
*
|
|
223
|
+
* When pending marks are present (e.g., user toggled bold with collapsed cursor),
|
|
224
|
+
* appends a `set_span_marks` operation after the `insert_text` to apply those
|
|
225
|
+
* marks to the newly inserted text, then clears the pending marks.
|
|
226
|
+
*/
|
|
227
|
+
private _handleInsertText;
|
|
228
|
+
/**
|
|
229
|
+
* Handle `insertLineBreak` (Shift+Enter).
|
|
230
|
+
* Inserts a newline character within the current block (soft line break).
|
|
231
|
+
*/
|
|
232
|
+
private _handleInsertLineBreak;
|
|
233
|
+
/**
|
|
234
|
+
* Handle `insertParagraph` (Enter key).
|
|
235
|
+
*/
|
|
236
|
+
private _handleSplitBlock;
|
|
237
|
+
/**
|
|
238
|
+
* Handle `deleteContentBackward` (Backspace, 1 character).
|
|
239
|
+
*/
|
|
240
|
+
private _handleDeleteBackward;
|
|
241
|
+
/**
|
|
242
|
+
* Handle `deleteContentForward` (Delete key, 1 character).
|
|
243
|
+
*/
|
|
244
|
+
private _handleDeleteForward;
|
|
245
|
+
/**
|
|
246
|
+
* Handle `deleteWordBackward` (Ctrl/Option + Backspace).
|
|
247
|
+
*/
|
|
248
|
+
private _handleDeleteWordBackward;
|
|
249
|
+
/**
|
|
250
|
+
* Handle `deleteWordForward` (Ctrl/Option + Delete).
|
|
251
|
+
*/
|
|
252
|
+
private _handleDeleteWordForward;
|
|
253
|
+
/**
|
|
254
|
+
* Handle `deleteSoftLineBackward` and `deleteHardLineBackward`
|
|
255
|
+
* (Cmd+Backspace on Mac).
|
|
256
|
+
*/
|
|
257
|
+
private _handleDeleteLineBackward;
|
|
258
|
+
/**
|
|
259
|
+
* Handle `deleteSoftLineForward` and `deleteHardLineForward`
|
|
260
|
+
* (Cmd+Delete on Mac).
|
|
261
|
+
*/
|
|
262
|
+
private _handleDeleteLineForward;
|
|
263
|
+
/**
|
|
264
|
+
* Handle `insertReplacementText` (spellcheck/autocorrect acceptance).
|
|
265
|
+
*
|
|
266
|
+
* Reads the replacement text from `e.dataTransfer` or `e.data`, and
|
|
267
|
+
* the target range from `e.getTargetRanges()`. Falls back to treating
|
|
268
|
+
* the current selection as the target range if target ranges are
|
|
269
|
+
* unavailable.
|
|
270
|
+
*/
|
|
271
|
+
private _handleInsertReplacement;
|
|
272
|
+
}
|
|
273
|
+
//# sourceMappingURL=input-bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-bridge.d.ts","sourceRoot":"","sources":["../src/input-bridge.ts"],"names":[],"mappings":"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"}
|