scrapbox-insert-text-2
code:script.js
import {scrapboxDOM} from '../scrapbox-dom-accessor/script.js';
import {sleep} from '../sleep/script.js';
export async function insertText(text, {wait = 1} = {}) {
const cursor = scrapboxDOM.textInput;
cursor.focus();
cursor.value = text;
const uiEvent = document.createEvent('UIEvent');
uiEvent.initEvent('input', true, false);
cursor.dispatchEvent(uiEvent);
await sleep(wait);
}