your personal website on atproto - mirror blento.app
at small-event-card-fixes 28 lines 598 B view raw
1<script lang="ts"> 2 import type { NodeViewProps } from '@tiptap/core'; 3 import { onMount } from 'svelte'; 4 import { NodeViewWrapper } from 'svelte-tiptap'; 5 6 let props: NodeViewProps = $props(); 7 8 onMount(() => { 9 const pos = props.getPos(); 10 if (pos == null) return; 11 12 props.deleteNode(); 13 props.editor 14 .chain() 15 .focus() 16 .insertContentAt(pos, [ 17 { 18 type: 'image', 19 attrs: { src: props.node.attrs.preview, alt: 'image', title: 'image' } 20 } 21 ]) 22 .run(); 23 }); 24</script> 25 26<NodeViewWrapper> 27 <img src={props.node.attrs.preview} alt="Upload preview" /> 28</NodeViewWrapper>