{#if activeImage && mathjaxElement}
{
placeHandle(false);
resetHandle();
}}
on:moveoutend={() => {
placeHandle(true);
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?)
resetHandle();
}}
let:editor={mathjaxEditor}
>
{
placeHandle(true);
resetHandle();
}}
/>
{
isBlock = false;
await updateBlockAttribute();
positionOverlay();
positionFloating();
}}
on:setblock={async () => {
isBlock = true;
await updateBlockAttribute();
positionOverlay();
positionFloating();
}}
on:delete={async () => {
placeCaretAfter(activeImage);
mathjaxElement?.remove();
clear();
}}
on:surround={async ({ detail }) => {
const editor = await mathjaxEditor.editor;
const { prefix, suffix } = detail;
editor.replaceSelection(
prefix + editor.getSelection() + suffix,
);
}}
/>
{/if}