File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 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";
66import { isArray } from "@core/unknownutil/is/array" ;
77import { isNumber } from "@core/unknownutil/is/number" ;
88import { 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 ;
1011
1112export const undo = ( count = 1 ) : void => {
1213 for ( const _ of range ( 0 , count ) ) {
@@ -157,7 +158,7 @@ export const downBlocks = (count = 1): void => {
157158 }
158159} ;
159160
160- export const insertText = async ( text : string ) : Promise < void > => {
161+ export const insertText = ( text : string ) : Promise < void > => {
161162 const cursor = textInput ( ) ;
162163 if ( ! cursor ) {
163164 throw Error ( "#text-input is not ditected." ) ;
@@ -167,5 +168,5 @@ export const insertText = async (text: string): Promise<void> => {
167168
168169 const event = new InputEvent ( "input" , { bubbles : true } ) ;
169170 cursor . dispatchEvent ( event ) ;
170- await delay ( 1 ) ; // 1ms delay to ensure event processing completes
171+ return scrapbox . Page . waitForSave ( ) ;
171172} ;
You can’t perform that action at this time.
0 commit comments