| 1 | <script setup lang="ts"> |
| 2 | import type { DragElementMarkdownSource } from '../composables/useDragElements' |
| 3 | import { onMounted, onUnmounted } from 'vue' |
| 4 | import { useDragElement } from '../composables/useDragElements' |
| 5 | |
| 6 | const props = defineProps<{ |
| 7 | pos?: string |
| 8 | markdownSource?: DragElementMarkdownSource |
| 9 | }>() |
| 10 | |
| 11 | // @ts-expect-error TS6133 container is used as template ref |
| 12 | const { dragId, container, containerStyle, mounted, unmounted, startDragging } = useDragElement(null, props.pos, props.markdownSource) |
| 13 | |
| 14 | onMounted(mounted) |
| 15 | onUnmounted(unmounted) |
| 16 | </script> |
| 17 | |
| 18 | <template> |
| 19 | <div |
| 20 | ref="container" |
| 21 | :data-drag-id="dragId" |
| 22 | :style="containerStyle" |
| 23 | class="p-1" |
| 24 | @dblclick="startDragging" |
| 25 | > |
| 26 | <slot /> |
| 27 | </div> |
| 28 | </template> |
| 29 |