{#if activeImage && mathjaxElement} { placeHandle(false); await resetHandle(); }} on:moveoutend={async () => { placeHandle(true); await resetHandle(); }} on:tab={async () => { // Instead of resetting on blur, we reset on tab // Otherwise, when clicking from Mathjax element to another, // the user has to click twice (focus is called before blur?) await resetHandle(); }} let:editor={mathjaxEditor} > { placeHandle(true); await resetHandle(); }} /> { isBlock = false; await updateBlockAttribute(); positionOverlay(); positionFloating(); }} on:setblock={async () => { isBlock = true; await updateBlockAttribute(); positionOverlay(); positionFloating(); }} on:delete={async () => { placeCaretAfter(activeImage); activeImage.remove(); await resetHandle(); }} on:surround={async ({ detail }) => { const editor = await mathjaxEditor.editor; const { prefix, suffix } = detail; editor.replaceSelection( prefix + editor.getSelection() + suffix, ); }} /> {/if}