diff --git a/src/main.ts b/src/main.ts index 112c130..2eee23f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -373,14 +373,18 @@ ${editor.getDoc().getSelection()} if (ev.defaultPrevented || ev.detail > 1 || ev.shiftKey) return; try { - const pos = editor.posAtDOM(admonitionElement); - editor.focus(); - editor.dispatch({ - selection: { - head: pos, - anchor: pos - } - }); + setTimeout(() => { + try { + const pos = editor.posAtDOM(admonitionElement); + editor.focus(); + editor.dispatch({ + selection: { + head: pos, + anchor: pos + } + }); + } catch (e) {} + }, 10); } catch (e) {} }); }