{"version":3,"file":"index.cjs","names":["getText","getTextSerializersFromSchema","flip","shift","offset","arrow","size","autoPlacement","hide","inline","posToDOMRect","Plugin","PluginKey","Extension"],"sources":["../src/floating-menu-plugin.ts","../src/floating-menu.ts","../src/index.ts"],"sourcesContent":["import {\n type Middleware,\n arrow,\n autoPlacement,\n computePosition,\n flip,\n hide,\n inline,\n offset,\n shift,\n size,\n} from '@floating-ui/dom'\nimport type { Editor } from '@tiptap/core'\nimport { getText, getTextSerializersFromSchema, posToDOMRect } from '@tiptap/core'\nimport type { Node as ProsemirrorNode } from '@tiptap/pm/model'\nimport type { EditorState, Transaction } from '@tiptap/pm/state'\nimport { Plugin, PluginKey } from '@tiptap/pm/state'\nimport type { EditorView } from '@tiptap/pm/view'\n\nexport interface FloatingMenuPluginProps {\n /**\n * The plugin key for the floating menu.\n * @default 'floatingMenu'\n */\n pluginKey: PluginKey | string\n\n /**\n * The editor instance.\n * @default null\n */\n editor: Editor\n\n /**\n * The DOM element that contains your menu.\n * @default null\n */\n element: HTMLElement\n\n /**\n * The delay in milliseconds before the menu should be updated.\n * This can be useful to prevent performance issues.\n * @type {number}\n * @default 250\n */\n updateDelay?: number\n\n /**\n * The delay in milliseconds before the menu position should be updated on window resize.\n * This can be useful to prevent performance issues.\n * @type {number}\n * @default 60\n */\n resizeDelay?: number\n\n /**\n * The DOM element to append your menu to. Default is the editor's parent element.\n *\n * Sometimes the menu needs to be appended to a different DOM context due to accessibility, clipping, or z-index issues.\n *\n * @type {HTMLElement}\n * @default null\n */\n appendTo?: HTMLElement | (() => HTMLElement)\n\n /**\n * A function that determines whether the menu should be shown or not.\n * If this function returns `false`, the menu will be hidden, otherwise it will be shown.\n */\n shouldShow?:\n | ((props: {\n editor: Editor\n view: EditorView\n state: EditorState\n oldState?: EditorState\n from: number\n to: number\n }) => boolean)\n | null\n\n /**\n * The options for the floating menu. Those are passed to Floating UI and include options for the placement, offset, flip, shift, arrow, size, autoPlacement,\n * hide, and inline middlewares.\n * @default {}\n * @see https://floating-ui.com/docs/computePosition#options\n */\n options?: {\n strategy?: 'absolute' | 'fixed'\n placement?:\n | 'top'\n | 'right'\n | 'bottom'\n | 'left'\n | 'top-start'\n | 'top-end'\n | 'right-start'\n | 'right-end'\n | 'bottom-start'\n | 'bottom-end'\n | 'left-start'\n | 'left-end'\n offset?: Parameters[0] | boolean\n flip?: Parameters[0] | boolean\n shift?: Parameters[0] | boolean\n arrow?: Parameters[0] | false\n size?: Parameters[0] | boolean\n autoPlacement?: Parameters[0] | boolean\n hide?: Parameters[0] | boolean\n inline?: Parameters[0] | boolean\n\n onShow?: () => void\n onHide?: () => void\n onUpdate?: () => void\n onDestroy?: () => void\n\n /**\n * The scrollable element that should be listened to when updating the position of the floating menu.\n * If not provided, the window will be used.\n * @type {HTMLElement | Window}\n */\n scrollTarget?: HTMLElement | Window\n }\n}\n\nexport type FloatingMenuViewProps = FloatingMenuPluginProps & {\n /**\n * The editor view.\n */\n view: EditorView\n}\n\nexport class FloatingMenuView {\n public editor: Editor\n\n public element: HTMLElement\n\n public view: EditorView\n\n public preventHide = false\n\n public pluginKey: PluginKey | string\n\n /**\n * The delay in milliseconds before the menu should be updated.\n * @default 250\n */\n public updateDelay: number\n\n /**\n * The delay in milliseconds before the menu position should be updated on window resize.\n * @default 60\n */\n public resizeDelay: number\n\n public appendTo: HTMLElement | (() => HTMLElement) | undefined\n\n private updateDebounceTimer: number | undefined\n\n private resizeDebounceTimer: number | undefined\n\n private isVisible = false\n\n private scrollTarget: HTMLElement | Window = window\n\n private getTextContent(node: ProsemirrorNode) {\n return getText(node, { textSerializers: getTextSerializersFromSchema(this.editor.schema) })\n }\n\n public shouldShow: Exclude = ({ view, state }) => {\n const { selection } = state\n const { $anchor, empty } = selection\n const isRootDepth = $anchor.depth === 1\n\n const isEmptyTextBlock =\n $anchor.parent.isTextblock &&\n !$anchor.parent.type.spec.code &&\n !$anchor.parent.textContent &&\n $anchor.parent.childCount === 0 &&\n !this.getTextContent($anchor.parent)\n\n if (\n !view.hasFocus() ||\n !empty ||\n !isRootDepth ||\n !isEmptyTextBlock ||\n !this.editor.isEditable\n ) {\n return false\n }\n\n return true\n }\n\n private floatingUIOptions: NonNullable = {\n strategy: 'absolute',\n placement: 'right',\n offset: 8,\n flip: {},\n shift: {},\n arrow: false,\n size: false,\n autoPlacement: false,\n hide: false,\n inline: false,\n }\n\n get middlewares() {\n const middlewares: Middleware[] = []\n\n if (this.floatingUIOptions.flip) {\n middlewares.push(\n flip(\n typeof this.floatingUIOptions.flip !== 'boolean'\n ? this.floatingUIOptions.flip\n : undefined,\n ),\n )\n }\n\n if (this.floatingUIOptions.shift) {\n middlewares.push(\n shift(\n typeof this.floatingUIOptions.shift !== 'boolean'\n ? this.floatingUIOptions.shift\n : undefined,\n ),\n )\n }\n\n if (this.floatingUIOptions.offset) {\n middlewares.push(\n offset(\n typeof this.floatingUIOptions.offset !== 'boolean'\n ? this.floatingUIOptions.offset\n : undefined,\n ),\n )\n }\n\n if (this.floatingUIOptions.arrow) {\n middlewares.push(arrow(this.floatingUIOptions.arrow))\n }\n\n if (this.floatingUIOptions.size) {\n middlewares.push(\n size(\n typeof this.floatingUIOptions.size !== 'boolean'\n ? this.floatingUIOptions.size\n : undefined,\n ),\n )\n }\n\n if (this.floatingUIOptions.autoPlacement) {\n middlewares.push(\n autoPlacement(\n typeof this.floatingUIOptions.autoPlacement !== 'boolean'\n ? this.floatingUIOptions.autoPlacement\n : undefined,\n ),\n )\n }\n\n if (this.floatingUIOptions.hide) {\n middlewares.push(\n hide(\n typeof this.floatingUIOptions.hide !== 'boolean'\n ? this.floatingUIOptions.hide\n : undefined,\n ),\n )\n }\n\n if (this.floatingUIOptions.inline) {\n middlewares.push(\n inline(\n typeof this.floatingUIOptions.inline !== 'boolean'\n ? this.floatingUIOptions.inline\n : undefined,\n ),\n )\n }\n\n return middlewares\n }\n\n constructor({\n editor,\n element,\n view,\n pluginKey = 'floatingMenu',\n updateDelay = 250,\n resizeDelay = 60,\n options,\n appendTo,\n shouldShow,\n }: FloatingMenuViewProps) {\n this.editor = editor\n this.element = element\n this.view = view\n this.pluginKey = pluginKey\n this.updateDelay = updateDelay\n this.resizeDelay = resizeDelay\n this.appendTo = appendTo\n this.scrollTarget = options?.scrollTarget ?? window\n\n this.floatingUIOptions = {\n ...this.floatingUIOptions,\n ...options,\n }\n\n this.element.tabIndex = 0\n\n if (shouldShow) {\n this.shouldShow = shouldShow\n }\n\n this.element.addEventListener('mousedown', this.mousedownHandler, { capture: true })\n this.editor.on('focus', this.focusHandler)\n this.editor.on('blur', this.blurHandler)\n this.editor.on('transaction', this.transactionHandler)\n window.addEventListener('resize', this.resizeHandler)\n this.scrollTarget.addEventListener('scroll', this.resizeHandler)\n\n this.update(view, view.state)\n\n if (this.getShouldShow()) {\n this.show()\n this.updatePosition()\n }\n }\n\n getShouldShow(oldState?: EditorState) {\n const { state } = this.view\n const { selection } = state\n\n const { ranges } = selection\n const from = Math.min(...ranges.map(range => range.$from.pos))\n const to = Math.max(...ranges.map(range => range.$to.pos))\n\n const shouldShow = this.shouldShow?.({\n editor: this.editor,\n view: this.view,\n state,\n oldState,\n from,\n to,\n })\n\n return shouldShow\n }\n\n updateHandler = (\n view: EditorView,\n selectionChanged: boolean,\n docChanged: boolean,\n oldState?: EditorState,\n ) => {\n const { composing } = view\n\n const isSame = !selectionChanged && !docChanged\n\n if (composing || isSame) {\n return\n }\n\n const shouldShow = this.getShouldShow(oldState)\n\n if (!shouldShow) {\n this.hide()\n\n return\n }\n\n this.updatePosition()\n this.show()\n }\n\n mousedownHandler = () => {\n this.preventHide = true\n }\n\n focusHandler = () => {\n // we use `setTimeout` to make sure `selection` is already updated\n setTimeout(() => this.update(this.editor.view))\n }\n\n blurHandler = ({ event }: { event: FocusEvent }) => {\n if (this.preventHide) {\n this.preventHide = false\n\n return\n }\n\n if (event?.relatedTarget && this.element.parentNode?.contains(event.relatedTarget as Node)) {\n return\n }\n\n if (event?.relatedTarget === this.editor.view.dom) {\n return\n }\n\n this.hide()\n }\n\n /**\n * Handles the transaction event to update the position of the floating menu.\n * This allows external code to trigger a position update via:\n * `editor.view.dispatch(editor.state.tr.setMeta(pluginKey, 'updatePosition'))`\n * The `pluginKey` defaults to `floatingMenu`\n */\n transactionHandler = ({ transaction: tr }: { transaction: Transaction }) => {\n const meta = tr.getMeta(this.pluginKey)\n if (meta === 'updatePosition') {\n this.updatePosition()\n } else if (meta && typeof meta === 'object' && meta.type === 'updateOptions') {\n this.updateOptions(meta.options)\n } else if (meta === 'hide') {\n this.hide()\n } else if (meta === 'show') {\n this.updatePosition()\n this.show()\n }\n }\n\n updateOptions(\n newProps: Partial>,\n ) {\n if (newProps.updateDelay !== undefined) {\n this.updateDelay = newProps.updateDelay\n }\n\n if (newProps.resizeDelay !== undefined) {\n this.resizeDelay = newProps.resizeDelay\n }\n\n if (newProps.appendTo !== undefined) {\n this.appendTo = newProps.appendTo\n }\n\n if (newProps.shouldShow !== undefined) {\n if (newProps.shouldShow) {\n this.shouldShow = newProps.shouldShow\n }\n }\n\n if (newProps.options !== undefined) {\n // Handle scrollTarget change - need to remove old listener and add new one\n // Use nullish coalescing to default to window when scrollTarget is undefined/null\n const newScrollTarget = newProps.options.scrollTarget ?? window\n\n if (newScrollTarget !== this.scrollTarget) {\n this.scrollTarget.removeEventListener('scroll', this.resizeHandler)\n this.scrollTarget = newScrollTarget\n this.scrollTarget.addEventListener('scroll', this.resizeHandler)\n }\n\n this.floatingUIOptions = {\n ...this.floatingUIOptions,\n ...newProps.options,\n }\n }\n }\n\n /**\n * Handles the window resize event to update the position of the floating menu.\n * It uses a debounce mechanism to prevent excessive updates.\n * The delay is defined by the `resizeDelay` property.\n */\n resizeHandler = () => {\n if (this.resizeDebounceTimer) {\n clearTimeout(this.resizeDebounceTimer)\n }\n\n this.resizeDebounceTimer = window.setTimeout(() => {\n this.updatePosition()\n }, this.resizeDelay)\n }\n\n updatePosition() {\n if (!this.view?.dom?.parentNode) {\n return\n }\n\n const { selection } = this.editor.state\n\n const domRect = posToDOMRect(this.view, selection.from, selection.to)\n\n const virtualElement = {\n getBoundingClientRect: () => domRect,\n getClientRects: () => [domRect],\n }\n\n computePosition(virtualElement, this.element, {\n placement: this.floatingUIOptions.placement,\n strategy: this.floatingUIOptions.strategy,\n middleware: this.middlewares,\n }).then(({ x, y, strategy, middlewareData }) => {\n // Handle hide middleware - hide element if reference is hidden or element has escaped\n if (middlewareData.hide?.referenceHidden || middlewareData.hide?.escaped) {\n this.element.style.visibility = 'hidden'\n return\n }\n\n this.element.style.visibility = 'visible'\n this.element.style.width = 'max-content'\n this.element.style.position = strategy\n this.element.style.left = `${x}px`\n this.element.style.top = `${y}px`\n\n if (this.isVisible && this.floatingUIOptions.onUpdate) {\n this.floatingUIOptions.onUpdate()\n }\n })\n }\n\n update(view: EditorView, oldState?: EditorState) {\n const selectionChanged = !oldState?.selection.eq(view.state.selection)\n const docChanged = !oldState?.doc.eq(view.state.doc)\n\n this.updateHandler(view, selectionChanged, docChanged, oldState)\n }\n\n show() {\n if (this.isVisible) {\n return\n }\n\n this.element.style.visibility = 'visible'\n this.element.style.opacity = '1'\n\n // attach to appendTo or editor's parent element\n const appendToElement = typeof this.appendTo === 'function' ? this.appendTo() : this.appendTo\n ;(appendToElement ?? this.view.dom.parentElement)?.appendChild(this.element)\n\n if (this.floatingUIOptions.onShow) {\n this.floatingUIOptions.onShow()\n }\n\n this.isVisible = true\n }\n\n hide() {\n if (!this.isVisible) {\n return\n }\n\n this.element.style.visibility = 'hidden'\n this.element.style.opacity = '0'\n // remove from the parent element\n this.element.remove()\n\n if (this.floatingUIOptions.onHide) {\n this.floatingUIOptions.onHide()\n }\n\n this.isVisible = false\n }\n\n destroy() {\n this.hide()\n this.element.removeEventListener('mousedown', this.mousedownHandler, { capture: true })\n window.removeEventListener('resize', this.resizeHandler)\n this.scrollTarget.removeEventListener('scroll', this.resizeHandler)\n this.editor.off('focus', this.focusHandler)\n this.editor.off('blur', this.blurHandler)\n this.editor.off('transaction', this.transactionHandler)\n\n if (this.floatingUIOptions.onDestroy) {\n this.floatingUIOptions.onDestroy()\n }\n }\n}\n\nexport const FloatingMenuPlugin = (options: FloatingMenuPluginProps) => {\n return new Plugin({\n key:\n typeof options.pluginKey === 'string' ? new PluginKey(options.pluginKey) : options.pluginKey,\n view: view => new FloatingMenuView({ view, ...options }),\n })\n}\n","import { Extension } from '@tiptap/core'\n\nimport type { FloatingMenuPluginProps } from './floating-menu-plugin.js'\nimport { FloatingMenuPlugin } from './floating-menu-plugin.js'\n\nexport type FloatingMenuOptions = Omit & {\n /**\n * The DOM element that contains your menu.\n * @type {HTMLElement}\n * @default null\n */\n element: HTMLElement | null\n}\n\ndeclare module '@tiptap/core' {\n interface Commands {\n floatingMenu: {\n /**\n * Update the position of the floating menu.\n * @example editor.commands.updateFloatingMenuPosition()\n */\n updateFloatingMenuPosition: () => ReturnType\n }\n }\n}\n\n/**\n * This extension allows you to create a floating menu.\n * @see https://tiptap.dev/api/extensions/floating-menu\n */\nexport const FloatingMenu = Extension.create({\n name: 'floatingMenu',\n\n addOptions() {\n return {\n element: null,\n options: {},\n pluginKey: 'floatingMenu',\n updateDelay: undefined,\n resizeDelay: undefined,\n appendTo: undefined,\n shouldShow: null,\n }\n },\n\n addCommands() {\n return {\n updateFloatingMenuPosition:\n () =>\n ({ tr, dispatch }) => {\n if (dispatch) {\n tr.setMeta(this.options.pluginKey, 'updatePosition')\n }\n return true\n },\n }\n },\n\n addProseMirrorPlugins() {\n if (!this.options.element) {\n return []\n }\n\n return [\n FloatingMenuPlugin({\n pluginKey: this.options.pluginKey,\n editor: this.editor,\n element: this.options.element,\n updateDelay: this.options.updateDelay,\n resizeDelay: this.options.resizeDelay,\n options: this.options.options,\n appendTo: this.options.appendTo,\n shouldShow: this.options.shouldShow,\n }),\n ]\n },\n})\n","import { FloatingMenu } from './floating-menu.js'\n\nexport * from './floating-menu.js'\nexport * from './floating-menu-plugin.js'\n\nexport default FloatingMenu\n"],"mappings":";;;;;;;;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