{"version":3,"file":"index.cjs","names":["defineComponent","ref","PluginKey","BubbleMenuPlugin","defineComponent","ref","PluginKey","FloatingMenuPlugin"],"sources":["../../src/menus/BubbleMenu.ts","../../src/menus/FloatingMenu.ts"],"sourcesContent":["import type { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport { BubbleMenuPlugin } from '@tiptap/extension-bubble-menu'\nimport { PluginKey } from '@tiptap/pm/state'\nimport type { PropType } from 'vue'\nimport { defineComponent, h, nextTick, onBeforeUnmount, onMounted, ref } from 'vue'\n\nexport const BubbleMenu = defineComponent({\n name: 'BubbleMenu',\n\n inheritAttrs: false,\n\n props: {\n pluginKey: {\n type: [String, Object] as PropType,\n default: undefined,\n },\n\n editor: {\n type: Object as PropType,\n required: true,\n },\n\n updateDelay: {\n type: Number as PropType,\n default: undefined,\n },\n\n resizeDelay: {\n type: Number as PropType,\n default: undefined,\n },\n\n options: {\n type: Object as PropType,\n default: () => ({}),\n },\n\n appendTo: {\n type: [Object, Function] as PropType,\n default: undefined,\n },\n\n shouldShow: {\n type: Function as PropType['shouldShow'], null>>,\n default: null,\n },\n\n getReferencedVirtualElement: {\n type: Function as PropType<\n Exclude['getReferencedVirtualElement'], null>\n >,\n default: undefined,\n },\n },\n\n setup(props, { slots, attrs }) {\n const root = ref(null)\n const resolvedPluginKey = props.pluginKey ?? new PluginKey('bubbleMenu')\n\n onMounted(() => {\n const {\n editor,\n options,\n resizeDelay,\n appendTo,\n shouldShow,\n getReferencedVirtualElement,\n updateDelay,\n } = props\n\n const el = root.value\n\n if (!el) {\n return\n }\n\n el.style.visibility = 'hidden'\n el.style.position = 'absolute'\n\n // Remove element from DOM; plugin will re-parent it when shown\n el.remove()\n\n nextTick(() => {\n editor.registerPlugin(\n BubbleMenuPlugin({\n editor,\n element: el,\n options,\n pluginKey: resolvedPluginKey,\n resizeDelay,\n appendTo,\n shouldShow,\n getReferencedVirtualElement,\n updateDelay,\n }),\n )\n })\n })\n\n onBeforeUnmount(() => {\n const { editor } = props\n\n editor.unregisterPlugin(resolvedPluginKey)\n })\n\n // Vue owns this element; attrs are applied reactively by Vue\n // Plugin re-parents it when showing the menu\n return () => h('div', { ref: root, ...attrs }, slots.default?.())\n },\n})\n","import type { FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport { FloatingMenuPlugin } from '@tiptap/extension-floating-menu'\nimport { PluginKey } from '@tiptap/pm/state'\nimport type { PropType } from 'vue'\nimport { defineComponent, h, onBeforeUnmount, onMounted, ref } from 'vue'\n\nexport const FloatingMenu = defineComponent({\n name: 'FloatingMenu',\n\n inheritAttrs: false,\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType>],\n type: null,\n default: undefined,\n },\n\n editor: {\n type: Object as PropType,\n required: true,\n },\n\n updateDelay: {\n type: Number as PropType,\n default: undefined,\n },\n\n resizeDelay: {\n type: Number as PropType,\n default: undefined,\n },\n\n options: {\n type: Object as PropType,\n default: () => ({}),\n },\n\n appendTo: {\n type: [Object, Function] as PropType,\n default: undefined,\n },\n\n shouldShow: {\n type: Function as PropType['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots, attrs }) {\n const root = ref(null)\n const resolvedPluginKey = props.pluginKey ?? new PluginKey('floatingMenu')\n\n onMounted(() => {\n const { editor, updateDelay, resizeDelay, options, appendTo, shouldShow } = props\n\n const el = root.value\n\n if (!el) {\n return\n }\n\n el.style.visibility = 'hidden'\n el.style.position = 'absolute'\n\n // Remove element from DOM; plugin will re-parent it when shown\n el.remove()\n\n editor.registerPlugin(\n FloatingMenuPlugin({\n pluginKey: resolvedPluginKey,\n editor,\n element: el,\n updateDelay,\n resizeDelay,\n options,\n appendTo,\n shouldShow,\n }),\n )\n })\n\n onBeforeUnmount(() => {\n const { editor } = props\n\n editor.unregisterPlugin(resolvedPluginKey)\n })\n\n // Vue owns this element; attrs are applied reactively by Vue\n // Plugin re-parents it when showing the menu\n return () => h('div', { ref: root, ...attrs }, slots.default?.())\n },\n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