2025-11-01 16:18:29 +01:00
|
|
|
<script lang="ts">
|
2025-11-24 01:00:50 +01:00
|
|
|
import type { Icon } from '@lucide/svelte';
|
|
|
|
|
import type { Snippet } from 'svelte';
|
|
|
|
|
import { NodeViewWrapper } from 'svelte-tiptap';
|
2025-11-01 16:18:29 +01:00
|
|
|
|
2025-11-24 01:00:50 +01:00
|
|
|
interface Props {
|
|
|
|
|
icon?: typeof Icon;
|
|
|
|
|
title?: string;
|
|
|
|
|
onClick?: () => void;
|
|
|
|
|
class?: string;
|
|
|
|
|
children?: Snippet<[]>;
|
|
|
|
|
}
|
2025-11-01 16:18:29 +01:00
|
|
|
|
2025-11-24 01:00:50 +01:00
|
|
|
const { icon, title, onClick, class: className = '', children }: Props = $props();
|
2025-11-01 16:18:29 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<NodeViewWrapper
|
2025-11-24 01:00:50 +01:00
|
|
|
as="div"
|
|
|
|
|
contenteditable="false"
|
|
|
|
|
class={`media-placeholder ${className}`}
|
|
|
|
|
onclick={onClick}
|
|
|
|
|
style="user-select: none;"
|
2025-11-01 16:18:29 +01:00
|
|
|
>
|
2025-11-24 01:00:50 +01:00
|
|
|
{#if !children && icon && title}
|
|
|
|
|
{@const Icon = icon}
|
|
|
|
|
<Icon />
|
|
|
|
|
<div contenteditable="false">{title}</div>
|
|
|
|
|
{/if}
|
|
|
|
|
{@render children?.()}
|
2025-11-01 16:18:29 +01:00
|
|
|
</NodeViewWrapper>
|