File tree 1 file changed +4
-3
lines changed
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,8 @@ import { textInput } from "./dom.ts";
6
6
import { isArray } from "@core/unknownutil/is/array" ;
7
7
import { isNumber } from "@core/unknownutil/is/number" ;
8
8
import { isString } from "@core/unknownutil/is/string" ;
9
- import { delay } from "@std/async/delay" ;
9
+ import type { Scrapbox } from "@cosense/types/userscript" ;
10
+ declare const scrapbox : Scrapbox ;
10
11
11
12
export const undo = ( count = 1 ) : void => {
12
13
for ( const _ of range ( 0 , count ) ) {
@@ -157,7 +158,7 @@ export const downBlocks = (count = 1): void => {
157
158
}
158
159
} ;
159
160
160
- export const insertText = async ( text : string ) : Promise < void > => {
161
+ export const insertText = ( text : string ) : Promise < void > => {
161
162
const cursor = textInput ( ) ;
162
163
if ( ! cursor ) {
163
164
throw Error ( "#text-input is not ditected." ) ;
@@ -167,5 +168,5 @@ export const insertText = async (text: string): Promise<void> => {
167
168
168
169
const event = new InputEvent ( "input" , { bubbles : true } ) ;
169
170
cursor . dispatchEvent ( event ) ;
170
- await delay ( 1 ) ; // 1ms delay to ensure event processing completes
171
+ return scrapbox . Page . waitForSave ( ) ;
171
172
} ;
You can’t perform that action at this time.
0 commit comments