@tiptap/vue-3 3.5.0 → 3.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/menus/index.cjs +27 -5
- package/dist/menus/index.cjs.map +1 -1
- package/dist/menus/index.d.cts +27 -0
- package/dist/menus/index.d.ts +27 -0
- package/dist/menus/index.js +27 -5
- package/dist/menus/index.js.map +1 -1
- package/package.json +7 -7
- package/src/menus/BubbleMenu.ts +18 -2
- package/src/menus/FloatingMenu.ts +9 -2
package/dist/menus/index.cjs
CHANGED
|
@@ -415,6 +415,10 @@ var BubbleMenu2 = (0, import_vue.defineComponent)({
|
|
|
415
415
|
type: Object,
|
|
416
416
|
default: () => ({})
|
|
417
417
|
},
|
|
418
|
+
appendTo: {
|
|
419
|
+
type: Object,
|
|
420
|
+
default: void 0
|
|
421
|
+
},
|
|
418
422
|
shouldShow: {
|
|
419
423
|
type: Function,
|
|
420
424
|
default: null
|
|
@@ -427,7 +431,16 @@ var BubbleMenu2 = (0, import_vue.defineComponent)({
|
|
|
427
431
|
setup(props, { slots }) {
|
|
428
432
|
const root = (0, import_vue.ref)(null);
|
|
429
433
|
(0, import_vue.onMounted)(() => {
|
|
430
|
-
const {
|
|
434
|
+
const {
|
|
435
|
+
editor,
|
|
436
|
+
options,
|
|
437
|
+
pluginKey,
|
|
438
|
+
resizeDelay,
|
|
439
|
+
appendTo,
|
|
440
|
+
shouldShow,
|
|
441
|
+
getReferencedVirtualElement,
|
|
442
|
+
updateDelay
|
|
443
|
+
} = props;
|
|
431
444
|
if (!root.value) {
|
|
432
445
|
return;
|
|
433
446
|
}
|
|
@@ -441,6 +454,7 @@ var BubbleMenu2 = (0, import_vue.defineComponent)({
|
|
|
441
454
|
options,
|
|
442
455
|
pluginKey,
|
|
443
456
|
resizeDelay,
|
|
457
|
+
appendTo,
|
|
444
458
|
shouldShow,
|
|
445
459
|
getReferencedVirtualElement,
|
|
446
460
|
updateDelay
|
|
@@ -464,7 +478,7 @@ var import_dom2 = require("@floating-ui/dom");
|
|
|
464
478
|
var import_core4 = require("@tiptap/core");
|
|
465
479
|
var import_state2 = require("@tiptap/pm/state");
|
|
466
480
|
var FloatingMenuView = class {
|
|
467
|
-
constructor({ editor, element, view, options, shouldShow }) {
|
|
481
|
+
constructor({ editor, element, view, options, appendTo, shouldShow }) {
|
|
468
482
|
this.preventHide = false;
|
|
469
483
|
this.isVisible = false;
|
|
470
484
|
this.shouldShow = ({ view: view2, state }) => {
|
|
@@ -526,6 +540,7 @@ var FloatingMenuView = class {
|
|
|
526
540
|
this.editor = editor;
|
|
527
541
|
this.element = element;
|
|
528
542
|
this.view = view;
|
|
543
|
+
this.appendTo = appendTo;
|
|
529
544
|
this.floatingUIOptions = {
|
|
530
545
|
...this.floatingUIOptions,
|
|
531
546
|
...options
|
|
@@ -627,13 +642,13 @@ var FloatingMenuView = class {
|
|
|
627
642
|
this.updateHandler(view, selectionChanged, docChanged, oldState);
|
|
628
643
|
}
|
|
629
644
|
show() {
|
|
630
|
-
var _a;
|
|
645
|
+
var _a, _b;
|
|
631
646
|
if (this.isVisible) {
|
|
632
647
|
return;
|
|
633
648
|
}
|
|
634
649
|
this.element.style.visibility = "visible";
|
|
635
650
|
this.element.style.opacity = "1";
|
|
636
|
-
(_a = this.view.dom.parentElement) == null ? void 0 :
|
|
651
|
+
(_b = (_a = this.appendTo) != null ? _a : this.view.dom.parentElement) == null ? void 0 : _b.appendChild(this.element);
|
|
637
652
|
if (this.floatingUIOptions.onShow) {
|
|
638
653
|
this.floatingUIOptions.onShow();
|
|
639
654
|
}
|
|
@@ -674,6 +689,7 @@ var FloatingMenu = import_core3.Extension.create({
|
|
|
674
689
|
element: null,
|
|
675
690
|
options: {},
|
|
676
691
|
pluginKey: "floatingMenu",
|
|
692
|
+
appendTo: void 0,
|
|
677
693
|
shouldShow: null
|
|
678
694
|
};
|
|
679
695
|
},
|
|
@@ -687,6 +703,7 @@ var FloatingMenu = import_core3.Extension.create({
|
|
|
687
703
|
editor: this.editor,
|
|
688
704
|
element: this.options.element,
|
|
689
705
|
options: this.options.options,
|
|
706
|
+
appendTo: this.options.appendTo,
|
|
690
707
|
shouldShow: this.options.shouldShow
|
|
691
708
|
})
|
|
692
709
|
];
|
|
@@ -712,6 +729,10 @@ var FloatingMenu2 = (0, import_vue2.defineComponent)({
|
|
|
712
729
|
type: Object,
|
|
713
730
|
default: () => ({})
|
|
714
731
|
},
|
|
732
|
+
appendTo: {
|
|
733
|
+
type: Object,
|
|
734
|
+
default: void 0
|
|
735
|
+
},
|
|
715
736
|
shouldShow: {
|
|
716
737
|
type: Function,
|
|
717
738
|
default: null
|
|
@@ -720,7 +741,7 @@ var FloatingMenu2 = (0, import_vue2.defineComponent)({
|
|
|
720
741
|
setup(props, { slots }) {
|
|
721
742
|
const root = (0, import_vue2.ref)(null);
|
|
722
743
|
(0, import_vue2.onMounted)(() => {
|
|
723
|
-
const { pluginKey, editor, options, shouldShow } = props;
|
|
744
|
+
const { pluginKey, editor, options, appendTo, shouldShow } = props;
|
|
724
745
|
if (!root.value) {
|
|
725
746
|
return;
|
|
726
747
|
}
|
|
@@ -733,6 +754,7 @@ var FloatingMenu2 = (0, import_vue2.defineComponent)({
|
|
|
733
754
|
editor,
|
|
734
755
|
element: root.value,
|
|
735
756
|
options,
|
|
757
|
+
appendTo,
|
|
736
758
|
shouldShow
|
|
737
759
|
})
|
|
738
760
|
);
|
package/dist/menus/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/menus/index.ts","../../../extension-bubble-menu/src/bubble-menu.ts","../../../extension-bubble-menu/src/bubble-menu-plugin.ts","../../../extension-bubble-menu/src/index.ts","../../src/menus/BubbleMenu.ts","../../../extension-floating-menu/src/floating-menu.ts","../../../extension-floating-menu/src/floating-menu-plugin.ts","../../../extension-floating-menu/src/index.ts","../../src/menus/FloatingMenu.ts"],"sourcesContent":["export * from './BubbleMenu.js'\nexport * from './FloatingMenu.js'\n","import { Extension } from '@tiptap/core'\n\nimport type { BubbleMenuPluginProps } from './bubble-menu-plugin.js'\nimport { BubbleMenuPlugin } from './bubble-menu-plugin.js'\n\nexport type BubbleMenuOptions = Omit<BubbleMenuPluginProps, 'editor' | 'element'> & {\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<ReturnType> {\n bubbleMenu: {\n /**\n * Update the position of the bubble menu. This command is useful to force\n * the bubble menu to update its position in response to certain events\n * (for example, when the bubble menu is resized).\n */\n updateBubbleMenuPosition: () => ReturnType\n }\n }\n}\n\n/**\n * This extension allows you to create a bubble menu.\n * @see https://tiptap.dev/api/extensions/bubble-menu\n */\nexport const BubbleMenu = Extension.create<BubbleMenuOptions>({\n name: 'bubbleMenu',\n\n addOptions() {\n return {\n element: null,\n pluginKey: 'bubbleMenu',\n updateDelay: undefined,\n appendTo: undefined,\n shouldShow: null,\n }\n },\n\n addProseMirrorPlugins() {\n if (!this.options.element) {\n return []\n }\n\n return [\n BubbleMenuPlugin({\n pluginKey: this.options.pluginKey,\n editor: this.editor,\n element: this.options.element,\n updateDelay: this.options.updateDelay,\n options: this.options.options,\n appendTo: this.options.appendTo,\n getReferencedVirtualElement: this.options.getReferencedVirtualElement,\n shouldShow: this.options.shouldShow,\n }),\n ]\n },\n\n addCommands() {\n return {\n updateBubbleMenuPosition:\n () =>\n ({ commands }) => {\n return commands.setMeta('bubbleMenu', 'updatePosition')\n },\n }\n },\n})\n","import {\n type Middleware,\n type VirtualElement,\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 { isTextSelection, posToDOMRect } from '@tiptap/core'\nimport type { EditorState, PluginView, Transaction } from '@tiptap/pm/state'\nimport { NodeSelection, Plugin, PluginKey } from '@tiptap/pm/state'\nimport { CellSelection } from '@tiptap/pm/tables'\nimport type { EditorView } from '@tiptap/pm/view'\n\nfunction combineDOMRects(rect1: DOMRect, rect2: DOMRect): DOMRect {\n const top = Math.min(rect1.top, rect2.top)\n const bottom = Math.max(rect1.bottom, rect2.bottom)\n const left = Math.min(rect1.left, rect2.left)\n const right = Math.max(rect1.right, rect2.right)\n const width = right - left\n const height = bottom - top\n const x = left\n const y = top\n return new DOMRect(x, y, width, height)\n}\n\nexport interface BubbleMenuPluginProps {\n /**\n * The plugin key.\n * @type {PluginKey | string}\n * @default 'bubbleMenu'\n */\n pluginKey: PluginKey | string\n\n /**\n * The editor instance.\n */\n editor: Editor\n\n /**\n * The DOM element that contains your menu.\n * @type {HTMLElement}\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 * 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 element: HTMLElement\n view: EditorView\n state: EditorState\n oldState?: EditorState\n from: number\n to: number\n }) => boolean)\n | null\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\n\n /**\n * A function that returns the virtual element for the menu.\n * This is useful when the menu needs to be positioned relative to a specific DOM element.\n * @type {() => VirtualElement | null}\n * @default Position based on the selection.\n */\n getReferencedVirtualElement?: () => VirtualElement | null\n\n /**\n * The options for the bubble 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<typeof offset>[0] | boolean\n flip?: Parameters<typeof flip>[0] | boolean\n shift?: Parameters<typeof shift>[0] | boolean\n arrow?: Parameters<typeof arrow>[0] | false\n size?: Parameters<typeof size>[0] | boolean\n autoPlacement?: Parameters<typeof autoPlacement>[0] | boolean\n hide?: Parameters<typeof hide>[0] | boolean\n inline?: Parameters<typeof inline>[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 bubble menu.\n * If not provided, the window will be used.\n * @type {HTMLElement | Window}\n */\n scrollTarget?: HTMLElement | Window\n }\n}\n\nexport type BubbleMenuViewProps = BubbleMenuPluginProps & {\n view: EditorView\n}\n\nexport class BubbleMenuView implements PluginView {\n public editor: Editor\n\n public element: HTMLElement\n\n public view: EditorView\n\n public preventHide = false\n\n public updateDelay: number\n\n public resizeDelay: number\n\n public appendTo: HTMLElement | undefined\n\n public getReferencedVirtualElement: (() => VirtualElement | null) | 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 floatingUIOptions: NonNullable<BubbleMenuPluginProps['options']> = {\n strategy: 'absolute',\n placement: 'top',\n offset: 8,\n flip: {},\n shift: {},\n arrow: false,\n size: false,\n autoPlacement: false,\n hide: false,\n inline: false,\n onShow: undefined,\n onHide: undefined,\n onUpdate: undefined,\n onDestroy: undefined,\n }\n\n public shouldShow: Exclude<BubbleMenuPluginProps['shouldShow'], null> = ({ view, state, from, to }) => {\n const { doc, selection } = state\n const { empty } = selection\n\n // Sometime check for `empty` is not enough.\n // Doubleclick an empty paragraph returns a node size of 2.\n // So we check also for an empty text size.\n const isEmptyTextBlock = !doc.textBetween(from, to).length && isTextSelection(state.selection)\n\n // When clicking on a element inside the bubble menu the editor \"blur\" event\n // is called and the bubble menu item is focussed. In this case we should\n // consider the menu as part of the editor and keep showing the menu\n const isChildOfMenu = this.element.contains(document.activeElement)\n\n const hasEditorFocus = view.hasFocus() || isChildOfMenu\n\n if (!hasEditorFocus || empty || isEmptyTextBlock || !this.editor.isEditable) {\n return false\n }\n\n return true\n }\n\n get middlewares() {\n const middlewares: Middleware[] = []\n\n if (this.floatingUIOptions.flip) {\n middlewares.push(flip(typeof this.floatingUIOptions.flip !== 'boolean' ? this.floatingUIOptions.flip : undefined))\n }\n\n if (this.floatingUIOptions.shift) {\n middlewares.push(\n shift(typeof this.floatingUIOptions.shift !== 'boolean' ? this.floatingUIOptions.shift : undefined),\n )\n }\n\n if (this.floatingUIOptions.offset) {\n middlewares.push(\n offset(typeof this.floatingUIOptions.offset !== 'boolean' ? this.floatingUIOptions.offset : undefined),\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(size(typeof this.floatingUIOptions.size !== 'boolean' ? this.floatingUIOptions.size : undefined))\n }\n\n if (this.floatingUIOptions.autoPlacement) {\n middlewares.push(\n autoPlacement(\n typeof this.floatingUIOptions.autoPlacement !== 'boolean' ? this.floatingUIOptions.autoPlacement : undefined,\n ),\n )\n }\n\n if (this.floatingUIOptions.hide) {\n middlewares.push(hide(typeof this.floatingUIOptions.hide !== 'boolean' ? this.floatingUIOptions.hide : undefined))\n }\n\n if (this.floatingUIOptions.inline) {\n middlewares.push(\n inline(typeof this.floatingUIOptions.inline !== 'boolean' ? this.floatingUIOptions.inline : undefined),\n )\n }\n\n return middlewares\n }\n\n private get virtualElement(): VirtualElement | undefined {\n const { selection } = this.editor.state\n\n const referencedVirtualElement = this.getReferencedVirtualElement?.()\n if (referencedVirtualElement) {\n return referencedVirtualElement\n }\n\n const domRect = posToDOMRect(this.view, selection.from, selection.to)\n let virtualElement = {\n getBoundingClientRect: () => domRect,\n getClientRects: () => [domRect],\n }\n\n if (selection instanceof NodeSelection) {\n let node = this.view.nodeDOM(selection.from) as HTMLElement\n\n const nodeViewWrapper = node.dataset.nodeViewWrapper ? node : node.querySelector('[data-node-view-wrapper]')\n\n if (nodeViewWrapper) {\n node = nodeViewWrapper as HTMLElement\n }\n\n if (node) {\n virtualElement = {\n getBoundingClientRect: () => node.getBoundingClientRect(),\n getClientRects: () => [node.getBoundingClientRect()],\n }\n }\n }\n\n // this is a special case for cell selections\n if (selection instanceof CellSelection) {\n const { $anchorCell, $headCell } = selection\n\n const from = $anchorCell ? $anchorCell.pos : $headCell!.pos\n const to = $headCell ? $headCell.pos : $anchorCell!.pos\n\n const fromDOM = this.view.nodeDOM(from)\n const toDOM = this.view.nodeDOM(to)\n\n if (!fromDOM || !toDOM) {\n return\n }\n\n const clientRect =\n fromDOM === toDOM\n ? (fromDOM as HTMLElement).getBoundingClientRect()\n : combineDOMRects(\n (fromDOM as HTMLElement).getBoundingClientRect(),\n (toDOM as HTMLElement).getBoundingClientRect(),\n )\n\n virtualElement = {\n getBoundingClientRect: () => clientRect,\n getClientRects: () => [clientRect],\n }\n }\n\n return virtualElement\n }\n\n constructor({\n editor,\n element,\n view,\n updateDelay = 250,\n resizeDelay = 60,\n shouldShow,\n appendTo,\n getReferencedVirtualElement,\n options,\n }: BubbleMenuViewProps) {\n this.editor = editor\n this.element = element\n this.view = view\n this.updateDelay = updateDelay\n this.resizeDelay = resizeDelay\n this.appendTo = appendTo\n this.scrollTarget = options?.scrollTarget ?? window\n this.getReferencedVirtualElement = getReferencedVirtualElement\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.view.dom.addEventListener('dragstart', this.dragstartHandler)\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 }\n }\n\n mousedownHandler = () => {\n this.preventHide = true\n }\n\n dragstartHandler = () => {\n this.hide()\n }\n\n /**\n * Handles the window resize event to update the position of the bubble 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 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 updatePosition() {\n const virtualElement = this.virtualElement\n\n if (!virtualElement) {\n return\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 }) => {\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 { state } = view\n const hasValidSelection = state.selection.from !== state.selection.to\n\n if (this.updateDelay > 0 && hasValidSelection) {\n this.handleDebouncedUpdate(view, oldState)\n return\n }\n\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 handleDebouncedUpdate = (view: EditorView, oldState?: EditorState) => {\n const selectionChanged = !oldState?.selection.eq(view.state.selection)\n const docChanged = !oldState?.doc.eq(view.state.doc)\n\n if (!selectionChanged && !docChanged) {\n return\n }\n\n if (this.updateDebounceTimer) {\n clearTimeout(this.updateDebounceTimer)\n }\n\n this.updateDebounceTimer = window.setTimeout(() => {\n this.updateHandler(view, selectionChanged, docChanged, oldState)\n }, this.updateDelay)\n }\n\n getShouldShow(oldState?: EditorState) {\n const { state } = this.view\n const { selection } = state\n\n // support for CellSelections\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 element: this.element,\n view: this.view,\n state,\n oldState,\n from,\n to,\n })\n\n return shouldShow\n }\n\n updateHandler = (view: EditorView, selectionChanged: boolean, docChanged: boolean, oldState?: EditorState) => {\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 show() {\n if (this.isVisible) {\n return\n }\n\n this.element.style.visibility = 'visible'\n this.element.style.opacity = '1'\n // attach to appendTo or editor's parent element\n ;(this.appendTo ?? 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 transactionHandler({ transaction: tr }: { transaction: Transaction }) {\n const meta = tr.getMeta('bubbleMenu')\n if (meta === 'updatePosition') {\n this.updatePosition()\n }\n }\n\n destroy() {\n this.hide()\n this.element.removeEventListener('mousedown', this.mousedownHandler, { capture: true })\n this.view.dom.removeEventListener('dragstart', this.dragstartHandler)\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 BubbleMenuPlugin = (options: BubbleMenuPluginProps) => {\n return new Plugin({\n key: typeof options.pluginKey === 'string' ? new PluginKey(options.pluginKey) : options.pluginKey,\n view: view => new BubbleMenuView({ view, ...options }),\n })\n}\n","import { BubbleMenu } from './bubble-menu.js'\n\nexport * from './bubble-menu.js'\nexport * from './bubble-menu-plugin.js'\n\nexport default BubbleMenu\n","import type { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport { BubbleMenuPlugin } from '@tiptap/extension-bubble-menu'\nimport type { PropType } from 'vue'\nimport { defineComponent, h, onBeforeUnmount, onMounted, ref, Teleport } from 'vue'\n\nexport const BubbleMenu = defineComponent({\n name: 'BubbleMenu',\n\n props: {\n pluginKey: {\n type: [String, Object] as PropType<BubbleMenuPluginProps['pluginKey']>,\n default: 'bubbleMenu',\n },\n\n editor: {\n type: Object as PropType<BubbleMenuPluginProps['editor']>,\n required: true,\n },\n\n updateDelay: {\n type: Number as PropType<BubbleMenuPluginProps['updateDelay']>,\n default: undefined,\n },\n\n resizeDelay: {\n type: Number as PropType<BubbleMenuPluginProps['resizeDelay']>,\n default: undefined,\n },\n\n options: {\n type: Object as PropType<BubbleMenuPluginProps['options']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<BubbleMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n\n getReferencedVirtualElement: {\n type: Function as PropType<Exclude<Required<BubbleMenuPluginProps>['getReferencedVirtualElement'], null>>,\n default: undefined,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const { editor, options, pluginKey, resizeDelay, shouldShow, getReferencedVirtualElement, updateDelay } = props\n\n if (!root.value) {\n return\n }\n\n root.value.style.visibility = 'hidden'\n root.value.style.position = 'absolute'\n\n // remove the element from the DOM\n root.value.remove()\n\n editor.registerPlugin(\n BubbleMenuPlugin({\n editor,\n element: root.value as HTMLElement,\n options,\n pluginKey,\n resizeDelay,\n shouldShow,\n getReferencedVirtualElement,\n updateDelay,\n }),\n )\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h(Teleport, { to: 'body' }, h('div', { ref: root }, slots.default?.()))\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<FloatingMenuPluginProps, 'editor' | 'element'> & {\n /**\n * The DOM element that contains your menu.\n * @type {HTMLElement}\n * @default null\n */\n element: HTMLElement | null\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<FloatingMenuOptions>({\n name: 'floatingMenu',\n\n addOptions() {\n return {\n element: null,\n options: {},\n pluginKey: 'floatingMenu',\n shouldShow: null,\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 options: this.options.options,\n shouldShow: this.options.shouldShow,\n }),\n ]\n },\n})\n","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 } 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 * 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<typeof offset>[0] | boolean\n flip?: Parameters<typeof flip>[0] | boolean\n shift?: Parameters<typeof shift>[0] | boolean\n arrow?: Parameters<typeof arrow>[0] | false\n size?: Parameters<typeof size>[0] | boolean\n autoPlacement?: Parameters<typeof autoPlacement>[0] | boolean\n hide?: Parameters<typeof hide>[0] | boolean\n inline?: Parameters<typeof inline>[0] | boolean\n\n onShow?: () => void\n onHide?: () => void\n onUpdate?: () => void\n onDestroy?: () => void\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 private isVisible = false\n\n private getTextContent(node: ProsemirrorNode) {\n return getText(node, { textSerializers: getTextSerializersFromSchema(this.editor.schema) })\n }\n\n public shouldShow: Exclude<FloatingMenuPluginProps['shouldShow'], null> = ({ 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 (!view.hasFocus() || !empty || !isRootDepth || !isEmptyTextBlock || !this.editor.isEditable) {\n return false\n }\n\n return true\n }\n\n private floatingUIOptions: NonNullable<FloatingMenuPluginProps['options']> = {\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(flip(typeof this.floatingUIOptions.flip !== 'boolean' ? this.floatingUIOptions.flip : undefined))\n }\n\n if (this.floatingUIOptions.shift) {\n middlewares.push(\n shift(typeof this.floatingUIOptions.shift !== 'boolean' ? this.floatingUIOptions.shift : undefined),\n )\n }\n\n if (this.floatingUIOptions.offset) {\n middlewares.push(\n offset(typeof this.floatingUIOptions.offset !== 'boolean' ? this.floatingUIOptions.offset : undefined),\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(size(typeof this.floatingUIOptions.size !== 'boolean' ? this.floatingUIOptions.size : undefined))\n }\n\n if (this.floatingUIOptions.autoPlacement) {\n middlewares.push(\n autoPlacement(\n typeof this.floatingUIOptions.autoPlacement !== 'boolean' ? this.floatingUIOptions.autoPlacement : undefined,\n ),\n )\n }\n\n if (this.floatingUIOptions.hide) {\n middlewares.push(hide(typeof this.floatingUIOptions.hide !== 'boolean' ? this.floatingUIOptions.hide : undefined))\n }\n\n if (this.floatingUIOptions.inline) {\n middlewares.push(\n inline(typeof this.floatingUIOptions.inline !== 'boolean' ? this.floatingUIOptions.inline : undefined),\n )\n }\n\n return middlewares\n }\n\n constructor({ editor, element, view, options, shouldShow }: FloatingMenuViewProps) {\n this.editor = editor\n this.element = element\n this.view = view\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\n this.update(view, view.state)\n\n if (this.getShouldShow()) {\n this.show()\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 = (view: EditorView, selectionChanged: boolean, docChanged: boolean, oldState?: EditorState) => {\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 updatePosition() {\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 }) => {\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 // attach to editor's parent element\n 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 this.editor.off('focus', this.focusHandler)\n this.editor.off('blur', this.blurHandler)\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: typeof options.pluginKey === 'string' ? new PluginKey(options.pluginKey) : options.pluginKey,\n view: view => new FloatingMenuView({ view, ...options }),\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","import type { FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport { FloatingMenuPlugin } from '@tiptap/extension-floating-menu'\nimport type { PropType } from 'vue'\nimport { defineComponent, h, onBeforeUnmount, onMounted, ref, Teleport } from 'vue'\n\nexport const FloatingMenu = defineComponent({\n name: 'FloatingMenu',\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],\n type: null,\n default: 'floatingMenu',\n },\n\n editor: {\n type: Object as PropType<FloatingMenuPluginProps['editor']>,\n required: true,\n },\n\n options: {\n type: Object as PropType<FloatingMenuPluginProps['options']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<FloatingMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const { pluginKey, editor, options, shouldShow } = props\n\n if (!root.value) {\n return\n }\n\n root.value.style.visibility = 'hidden'\n root.value.style.position = 'absolute'\n\n // remove the element from the DOM\n root.value.remove()\n\n editor.registerPlugin(\n FloatingMenuPlugin({\n pluginKey,\n editor,\n element: root.value as HTMLElement,\n options,\n shouldShow,\n }),\n )\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h(Teleport, { to: 'body' }, h('div', { ref: root }, slots.default?.()))\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,oBAAAA;AAAA,EAAA,oBAAAC;AAAA;AAAA;;;ACAA,kBAA0B;ACA1B,iBAYO;AAEP,IAAAC,eAA8C;AAE9C,mBAAiD;AACjD,oBAA8B;AAG9B,SAAS,gBAAgB,OAAgB,OAAyB;AAChE,QAAM,MAAM,KAAK,IAAI,MAAM,KAAK,MAAM,GAAG;AACzC,QAAM,SAAS,KAAK,IAAI,MAAM,QAAQ,MAAM,MAAM;AAClD,QAAM,OAAO,KAAK,IAAI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A,EAEN,OAAO;AAAA,IACL,WAAW;AAAA;AAAA;AAAA,MAGT,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,IAEA,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,IACZ;AAAA,IAEA,SAAS;AAAA,MACP,MAAM;AAAA,MACN,SAAS,OAAO,CAAC;AAAA,IACnB;AAAA,IAEA,YAAY;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,EACF;AAAA,EAEA,MAAM,OAAO,EAAE,MAAM,GAAG;AACtB,UAAM,WAAO,iBAAwB,IAAI;AAEzC,+BAAU,MAAM;AACd,YAAM,EAAE,WAAW,QAAQ,SAAS,WAAW,IAAI;AAEnD,UAAI,CAAC,KAAK,OAAO;AACf;AAAA,MACF;AAEA,WAAK,MAAM,MAAM,aAAa;AAC9B,WAAK,MAAM,MAAM,WAAW;AAG5B,WAAK,MAAM,OAAO;AAElB,aAAO;AAAA,QACL,mBAAmB;AAAA,UACjB;AAAA,UACA;AAAA,UACA,SAAS,KAAK;AAAA,UACd;AAAA,UACA;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF,CAAC;AAED,qCAAgB,MAAM;AACpB,YAAM,EAAE,WAAW,OAAO,IAAI;AAE9B,aAAO,iBAAiB,SAAS;AAAA,IACnC,CAAC;AAED,WAAO,MAAG;AAjEd;AAiEiB,gCAAE,sBAAU,EAAE,IAAI,OAAO,OAAG,eAAE,OAAO,EAAE,KAAK,KAAK,IAAG,WAAM,YAAN,8BAAiB,CAAC;AAAA;AAAA,EACrF;AACF,CAAC;","names":["BubbleMenu","FloatingMenu","import_core","view","_a","shouldShow","BubbleMenu","import_core","import_dom","import_state","view","shouldShow","import_vue","FloatingMenu"]}
|
|
1
|
+
{"version":3,"sources":["../../src/menus/index.ts","../../../extension-bubble-menu/src/bubble-menu.ts","../../../extension-bubble-menu/src/bubble-menu-plugin.ts","../../../extension-bubble-menu/src/index.ts","../../src/menus/BubbleMenu.ts","../../../extension-floating-menu/src/floating-menu.ts","../../../extension-floating-menu/src/floating-menu-plugin.ts","../../../extension-floating-menu/src/index.ts","../../src/menus/FloatingMenu.ts"],"sourcesContent":["export * from './BubbleMenu.js'\nexport * from './FloatingMenu.js'\n","import { Extension } from '@tiptap/core'\n\nimport type { BubbleMenuPluginProps } from './bubble-menu-plugin.js'\nimport { BubbleMenuPlugin } from './bubble-menu-plugin.js'\n\nexport type BubbleMenuOptions = Omit<BubbleMenuPluginProps, 'editor' | 'element'> & {\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<ReturnType> {\n bubbleMenu: {\n /**\n * Update the position of the bubble menu. This command is useful to force\n * the bubble menu to update its position in response to certain events\n * (for example, when the bubble menu is resized).\n */\n updateBubbleMenuPosition: () => ReturnType\n }\n }\n}\n\n/**\n * This extension allows you to create a bubble menu.\n * @see https://tiptap.dev/api/extensions/bubble-menu\n */\nexport const BubbleMenu = Extension.create<BubbleMenuOptions>({\n name: 'bubbleMenu',\n\n addOptions() {\n return {\n element: null,\n pluginKey: 'bubbleMenu',\n updateDelay: undefined,\n appendTo: undefined,\n shouldShow: null,\n }\n },\n\n addProseMirrorPlugins() {\n if (!this.options.element) {\n return []\n }\n\n return [\n BubbleMenuPlugin({\n pluginKey: this.options.pluginKey,\n editor: this.editor,\n element: this.options.element,\n updateDelay: this.options.updateDelay,\n options: this.options.options,\n appendTo: this.options.appendTo,\n getReferencedVirtualElement: this.options.getReferencedVirtualElement,\n shouldShow: this.options.shouldShow,\n }),\n ]\n },\n\n addCommands() {\n return {\n updateBubbleMenuPosition:\n () =>\n ({ commands }) => {\n return commands.setMeta('bubbleMenu', 'updatePosition')\n },\n }\n },\n})\n","import {\n type Middleware,\n type VirtualElement,\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 { isTextSelection, posToDOMRect } from '@tiptap/core'\nimport type { EditorState, PluginView, Transaction } from '@tiptap/pm/state'\nimport { NodeSelection, Plugin, PluginKey } from '@tiptap/pm/state'\nimport { CellSelection } from '@tiptap/pm/tables'\nimport type { EditorView } from '@tiptap/pm/view'\n\nfunction combineDOMRects(rect1: DOMRect, rect2: DOMRect): DOMRect {\n const top = Math.min(rect1.top, rect2.top)\n const bottom = Math.max(rect1.bottom, rect2.bottom)\n const left = Math.min(rect1.left, rect2.left)\n const right = Math.max(rect1.right, rect2.right)\n const width = right - left\n const height = bottom - top\n const x = left\n const y = top\n return new DOMRect(x, y, width, height)\n}\n\nexport interface BubbleMenuPluginProps {\n /**\n * The plugin key.\n * @type {PluginKey | string}\n * @default 'bubbleMenu'\n */\n pluginKey: PluginKey | string\n\n /**\n * The editor instance.\n */\n editor: Editor\n\n /**\n * The DOM element that contains your menu.\n * @type {HTMLElement}\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 * 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 element: HTMLElement\n view: EditorView\n state: EditorState\n oldState?: EditorState\n from: number\n to: number\n }) => boolean)\n | null\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\n\n /**\n * A function that returns the virtual element for the menu.\n * This is useful when the menu needs to be positioned relative to a specific DOM element.\n * @type {() => VirtualElement | null}\n * @default Position based on the selection.\n */\n getReferencedVirtualElement?: () => VirtualElement | null\n\n /**\n * The options for the bubble 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<typeof offset>[0] | boolean\n flip?: Parameters<typeof flip>[0] | boolean\n shift?: Parameters<typeof shift>[0] | boolean\n arrow?: Parameters<typeof arrow>[0] | false\n size?: Parameters<typeof size>[0] | boolean\n autoPlacement?: Parameters<typeof autoPlacement>[0] | boolean\n hide?: Parameters<typeof hide>[0] | boolean\n inline?: Parameters<typeof inline>[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 bubble menu.\n * If not provided, the window will be used.\n * @type {HTMLElement | Window}\n */\n scrollTarget?: HTMLElement | Window\n }\n}\n\nexport type BubbleMenuViewProps = BubbleMenuPluginProps & {\n view: EditorView\n}\n\nexport class BubbleMenuView implements PluginView {\n public editor: Editor\n\n public element: HTMLElement\n\n public view: EditorView\n\n public preventHide = false\n\n public updateDelay: number\n\n public resizeDelay: number\n\n public appendTo: HTMLElement | undefined\n\n public getReferencedVirtualElement: (() => VirtualElement | null) | 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 floatingUIOptions: NonNullable<BubbleMenuPluginProps['options']> = {\n strategy: 'absolute',\n placement: 'top',\n offset: 8,\n flip: {},\n shift: {},\n arrow: false,\n size: false,\n autoPlacement: false,\n hide: false,\n inline: false,\n onShow: undefined,\n onHide: undefined,\n onUpdate: undefined,\n onDestroy: undefined,\n }\n\n public shouldShow: Exclude<BubbleMenuPluginProps['shouldShow'], null> = ({ view, state, from, to }) => {\n const { doc, selection } = state\n const { empty } = selection\n\n // Sometime check for `empty` is not enough.\n // Doubleclick an empty paragraph returns a node size of 2.\n // So we check also for an empty text size.\n const isEmptyTextBlock = !doc.textBetween(from, to).length && isTextSelection(state.selection)\n\n // When clicking on a element inside the bubble menu the editor \"blur\" event\n // is called and the bubble menu item is focussed. In this case we should\n // consider the menu as part of the editor and keep showing the menu\n const isChildOfMenu = this.element.contains(document.activeElement)\n\n const hasEditorFocus = view.hasFocus() || isChildOfMenu\n\n if (!hasEditorFocus || empty || isEmptyTextBlock || !this.editor.isEditable) {\n return false\n }\n\n return true\n }\n\n get middlewares() {\n const middlewares: Middleware[] = []\n\n if (this.floatingUIOptions.flip) {\n middlewares.push(flip(typeof this.floatingUIOptions.flip !== 'boolean' ? this.floatingUIOptions.flip : undefined))\n }\n\n if (this.floatingUIOptions.shift) {\n middlewares.push(\n shift(typeof this.floatingUIOptions.shift !== 'boolean' ? this.floatingUIOptions.shift : undefined),\n )\n }\n\n if (this.floatingUIOptions.offset) {\n middlewares.push(\n offset(typeof this.floatingUIOptions.offset !== 'boolean' ? this.floatingUIOptions.offset : undefined),\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(size(typeof this.floatingUIOptions.size !== 'boolean' ? this.floatingUIOptions.size : undefined))\n }\n\n if (this.floatingUIOptions.autoPlacement) {\n middlewares.push(\n autoPlacement(\n typeof this.floatingUIOptions.autoPlacement !== 'boolean' ? this.floatingUIOptions.autoPlacement : undefined,\n ),\n )\n }\n\n if (this.floatingUIOptions.hide) {\n middlewares.push(hide(typeof this.floatingUIOptions.hide !== 'boolean' ? this.floatingUIOptions.hide : undefined))\n }\n\n if (this.floatingUIOptions.inline) {\n middlewares.push(\n inline(typeof this.floatingUIOptions.inline !== 'boolean' ? this.floatingUIOptions.inline : undefined),\n )\n }\n\n return middlewares\n }\n\n private get virtualElement(): VirtualElement | undefined {\n const { selection } = this.editor.state\n\n const referencedVirtualElement = this.getReferencedVirtualElement?.()\n if (referencedVirtualElement) {\n return referencedVirtualElement\n }\n\n const domRect = posToDOMRect(this.view, selection.from, selection.to)\n let virtualElement = {\n getBoundingClientRect: () => domRect,\n getClientRects: () => [domRect],\n }\n\n if (selection instanceof NodeSelection) {\n let node = this.view.nodeDOM(selection.from) as HTMLElement\n\n const nodeViewWrapper = node.dataset.nodeViewWrapper ? node : node.querySelector('[data-node-view-wrapper]')\n\n if (nodeViewWrapper) {\n node = nodeViewWrapper as HTMLElement\n }\n\n if (node) {\n virtualElement = {\n getBoundingClientRect: () => node.getBoundingClientRect(),\n getClientRects: () => [node.getBoundingClientRect()],\n }\n }\n }\n\n // this is a special case for cell selections\n if (selection instanceof CellSelection) {\n const { $anchorCell, $headCell } = selection\n\n const from = $anchorCell ? $anchorCell.pos : $headCell!.pos\n const to = $headCell ? $headCell.pos : $anchorCell!.pos\n\n const fromDOM = this.view.nodeDOM(from)\n const toDOM = this.view.nodeDOM(to)\n\n if (!fromDOM || !toDOM) {\n return\n }\n\n const clientRect =\n fromDOM === toDOM\n ? (fromDOM as HTMLElement).getBoundingClientRect()\n : combineDOMRects(\n (fromDOM as HTMLElement).getBoundingClientRect(),\n (toDOM as HTMLElement).getBoundingClientRect(),\n )\n\n virtualElement = {\n getBoundingClientRect: () => clientRect,\n getClientRects: () => [clientRect],\n }\n }\n\n return virtualElement\n }\n\n constructor({\n editor,\n element,\n view,\n updateDelay = 250,\n resizeDelay = 60,\n shouldShow,\n appendTo,\n getReferencedVirtualElement,\n options,\n }: BubbleMenuViewProps) {\n this.editor = editor\n this.element = element\n this.view = view\n this.updateDelay = updateDelay\n this.resizeDelay = resizeDelay\n this.appendTo = appendTo\n this.scrollTarget = options?.scrollTarget ?? window\n this.getReferencedVirtualElement = getReferencedVirtualElement\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.view.dom.addEventListener('dragstart', this.dragstartHandler)\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 }\n }\n\n mousedownHandler = () => {\n this.preventHide = true\n }\n\n dragstartHandler = () => {\n this.hide()\n }\n\n /**\n * Handles the window resize event to update the position of the bubble 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 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 updatePosition() {\n const virtualElement = this.virtualElement\n\n if (!virtualElement) {\n return\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 }) => {\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 { state } = view\n const hasValidSelection = state.selection.from !== state.selection.to\n\n if (this.updateDelay > 0 && hasValidSelection) {\n this.handleDebouncedUpdate(view, oldState)\n return\n }\n\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 handleDebouncedUpdate = (view: EditorView, oldState?: EditorState) => {\n const selectionChanged = !oldState?.selection.eq(view.state.selection)\n const docChanged = !oldState?.doc.eq(view.state.doc)\n\n if (!selectionChanged && !docChanged) {\n return\n }\n\n if (this.updateDebounceTimer) {\n clearTimeout(this.updateDebounceTimer)\n }\n\n this.updateDebounceTimer = window.setTimeout(() => {\n this.updateHandler(view, selectionChanged, docChanged, oldState)\n }, this.updateDelay)\n }\n\n getShouldShow(oldState?: EditorState) {\n const { state } = this.view\n const { selection } = state\n\n // support for CellSelections\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 element: this.element,\n view: this.view,\n state,\n oldState,\n from,\n to,\n })\n\n return shouldShow\n }\n\n updateHandler = (view: EditorView, selectionChanged: boolean, docChanged: boolean, oldState?: EditorState) => {\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 show() {\n if (this.isVisible) {\n return\n }\n\n this.element.style.visibility = 'visible'\n this.element.style.opacity = '1'\n // attach to appendTo or editor's parent element\n ;(this.appendTo ?? 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 transactionHandler({ transaction: tr }: { transaction: Transaction }) {\n const meta = tr.getMeta('bubbleMenu')\n if (meta === 'updatePosition') {\n this.updatePosition()\n }\n }\n\n destroy() {\n this.hide()\n this.element.removeEventListener('mousedown', this.mousedownHandler, { capture: true })\n this.view.dom.removeEventListener('dragstart', this.dragstartHandler)\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 BubbleMenuPlugin = (options: BubbleMenuPluginProps) => {\n return new Plugin({\n key: typeof options.pluginKey === 'string' ? new PluginKey(options.pluginKey) : options.pluginKey,\n view: view => new BubbleMenuView({ view, ...options }),\n })\n}\n","import { BubbleMenu } from './bubble-menu.js'\n\nexport * from './bubble-menu.js'\nexport * from './bubble-menu-plugin.js'\n\nexport default BubbleMenu\n","import type { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport { BubbleMenuPlugin } from '@tiptap/extension-bubble-menu'\nimport type { PropType } from 'vue'\nimport { defineComponent, h, onBeforeUnmount, onMounted, ref, Teleport } from 'vue'\n\nexport const BubbleMenu = defineComponent({\n name: 'BubbleMenu',\n\n props: {\n pluginKey: {\n type: [String, Object] as PropType<BubbleMenuPluginProps['pluginKey']>,\n default: 'bubbleMenu',\n },\n\n editor: {\n type: Object as PropType<BubbleMenuPluginProps['editor']>,\n required: true,\n },\n\n updateDelay: {\n type: Number as PropType<BubbleMenuPluginProps['updateDelay']>,\n default: undefined,\n },\n\n resizeDelay: {\n type: Number as PropType<BubbleMenuPluginProps['resizeDelay']>,\n default: undefined,\n },\n\n options: {\n type: Object as PropType<BubbleMenuPluginProps['options']>,\n default: () => ({}),\n },\n\n appendTo: {\n type: Object as PropType<BubbleMenuPluginProps['appendTo']>,\n default: undefined,\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<BubbleMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n\n getReferencedVirtualElement: {\n type: Function as PropType<Exclude<Required<BubbleMenuPluginProps>['getReferencedVirtualElement'], null>>,\n default: undefined,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n editor,\n options,\n pluginKey,\n resizeDelay,\n appendTo,\n shouldShow,\n getReferencedVirtualElement,\n updateDelay,\n } = props\n\n if (!root.value) {\n return\n }\n\n root.value.style.visibility = 'hidden'\n root.value.style.position = 'absolute'\n\n // Remove element from DOM; plugin will re-parent it when shown\n root.value.remove()\n\n editor.registerPlugin(\n BubbleMenuPlugin({\n editor,\n element: root.value as HTMLElement,\n options,\n pluginKey,\n resizeDelay,\n appendTo,\n shouldShow,\n getReferencedVirtualElement,\n updateDelay,\n }),\n )\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n // Teleport only instantiates element + slot subtree; plugin controls final placement\n return () => h(Teleport, { to: 'body' }, h('div', { ref: root }, slots.default?.()))\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<FloatingMenuPluginProps, 'editor' | 'element'> & {\n /**\n * The DOM element that contains your menu.\n * @type {HTMLElement}\n * @default null\n */\n element: HTMLElement | null\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<FloatingMenuOptions>({\n name: 'floatingMenu',\n\n addOptions() {\n return {\n element: null,\n options: {},\n pluginKey: 'floatingMenu',\n appendTo: undefined,\n shouldShow: null,\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 options: this.options.options,\n appendTo: this.options.appendTo,\n shouldShow: this.options.shouldShow,\n }),\n ]\n },\n})\n","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 } 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 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\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<typeof offset>[0] | boolean\n flip?: Parameters<typeof flip>[0] | boolean\n shift?: Parameters<typeof shift>[0] | boolean\n arrow?: Parameters<typeof arrow>[0] | false\n size?: Parameters<typeof size>[0] | boolean\n autoPlacement?: Parameters<typeof autoPlacement>[0] | boolean\n hide?: Parameters<typeof hide>[0] | boolean\n inline?: Parameters<typeof inline>[0] | boolean\n\n onShow?: () => void\n onHide?: () => void\n onUpdate?: () => void\n onDestroy?: () => void\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 appendTo: HTMLElement | undefined\n\n public preventHide = false\n\n private isVisible = false\n\n private getTextContent(node: ProsemirrorNode) {\n return getText(node, { textSerializers: getTextSerializersFromSchema(this.editor.schema) })\n }\n\n public shouldShow: Exclude<FloatingMenuPluginProps['shouldShow'], null> = ({ 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 (!view.hasFocus() || !empty || !isRootDepth || !isEmptyTextBlock || !this.editor.isEditable) {\n return false\n }\n\n return true\n }\n\n private floatingUIOptions: NonNullable<FloatingMenuPluginProps['options']> = {\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(flip(typeof this.floatingUIOptions.flip !== 'boolean' ? this.floatingUIOptions.flip : undefined))\n }\n\n if (this.floatingUIOptions.shift) {\n middlewares.push(\n shift(typeof this.floatingUIOptions.shift !== 'boolean' ? this.floatingUIOptions.shift : undefined),\n )\n }\n\n if (this.floatingUIOptions.offset) {\n middlewares.push(\n offset(typeof this.floatingUIOptions.offset !== 'boolean' ? this.floatingUIOptions.offset : undefined),\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(size(typeof this.floatingUIOptions.size !== 'boolean' ? this.floatingUIOptions.size : undefined))\n }\n\n if (this.floatingUIOptions.autoPlacement) {\n middlewares.push(\n autoPlacement(\n typeof this.floatingUIOptions.autoPlacement !== 'boolean' ? this.floatingUIOptions.autoPlacement : undefined,\n ),\n )\n }\n\n if (this.floatingUIOptions.hide) {\n middlewares.push(hide(typeof this.floatingUIOptions.hide !== 'boolean' ? this.floatingUIOptions.hide : undefined))\n }\n\n if (this.floatingUIOptions.inline) {\n middlewares.push(\n inline(typeof this.floatingUIOptions.inline !== 'boolean' ? this.floatingUIOptions.inline : undefined),\n )\n }\n\n return middlewares\n }\n\n constructor({ editor, element, view, options, appendTo, shouldShow }: FloatingMenuViewProps) {\n this.editor = editor\n this.element = element\n this.view = view\n this.appendTo = appendTo\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\n this.update(view, view.state)\n\n if (this.getShouldShow()) {\n this.show()\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 = (view: EditorView, selectionChanged: boolean, docChanged: boolean, oldState?: EditorState) => {\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 updatePosition() {\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 }) => {\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 // attach to appendTo or editor's parent element\n ;(this.appendTo ?? 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 this.editor.off('focus', this.focusHandler)\n this.editor.off('blur', this.blurHandler)\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: typeof options.pluginKey === 'string' ? new PluginKey(options.pluginKey) : options.pluginKey,\n view: view => new FloatingMenuView({ view, ...options }),\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","import type { FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport { FloatingMenuPlugin } from '@tiptap/extension-floating-menu'\nimport type { PropType } from 'vue'\nimport { defineComponent, h, onBeforeUnmount, onMounted, ref, Teleport } from 'vue'\n\nexport const FloatingMenu = defineComponent({\n name: 'FloatingMenu',\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],\n type: null,\n default: 'floatingMenu',\n },\n\n editor: {\n type: Object as PropType<FloatingMenuPluginProps['editor']>,\n required: true,\n },\n\n options: {\n type: Object as PropType<FloatingMenuPluginProps['options']>,\n default: () => ({}),\n },\n\n appendTo: {\n type: Object as PropType<FloatingMenuPluginProps['appendTo']>,\n default: undefined,\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<FloatingMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const { pluginKey, editor, options, appendTo, shouldShow } = props\n\n if (!root.value) {\n return\n }\n\n root.value.style.visibility = 'hidden'\n root.value.style.position = 'absolute'\n\n // Remove element from DOM; plugin will re-parent it when shown\n root.value.remove()\n\n editor.registerPlugin(\n FloatingMenuPlugin({\n pluginKey,\n editor,\n element: root.value as HTMLElement,\n options,\n appendTo,\n shouldShow,\n }),\n )\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n // Teleport only instantiates element + slot subtree; plugin controls final placement\n return () => h(Teleport, { to: 'body' }, h('div', { ref: root }, slots.default?.()))\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,oBAAAA;AAAA,EAAA,oBAAAC;AAAA;AAAA;;;ACAA,kBAA0B;ACA1B,iBAYO;AAEP,IAAAC,eAA8C;AAE9C,mBAAiD;AACjD,oBAA8B;AAG9B,SAAS,gBAAgB,OAAgB,OAAyB;AAChE,QAAM,MAAM,KAAK,IAAI,MAAM,KAAK,MAAM,GAAG;AACzC,QAAM,SAAS,KAAK,IAAI,MAAM,QAAQ,MAAM,MAAM;AAClD,QAAM,OAAO,KAAK,IAAI,MAAM,MAAM,MAAM,IAAI;AAC5C,QAAM,QAAQ,KAAK,IAAI,MAAM,OAAO,MAAM,KAAK;AAC/C,QAAM,QAAQ,QAAQ;AACtB,QAAM,SAAS,SAAS;AACxB,QAAM,IAAI;AACV,QAAM,IAAI;AACV,SAAO,IAAI,QAAQ,GAAG,GAAG,OAAO,MAAM;AACxC;AAwHO,IAAM,iBAAN,MAA2C;EA+KhD,YAAY;IACV;IACA;IACA;IACA,cAAc;IACd,cAAc;IACd;IACA;IACA;IACA;EACF,GAAwB;AAlLxB,SAAO,cAAc;AAcrB,SAAQ,YAAY;AAEpB,SAAQ,eAAqC;AAE7C,SAAQ,oBAAmE;MACzE,UAAU;MACV,WAAW;MACX,QAAQ;MACR,MAAM,CAAC;MACP,OAAO,CAAC;MACR,OAAO;MACP,MAAM;MACN,eAAe;MACf,MAAM;MACN,QAAQ;MACR,QAAQ;MACR,QAAQ;M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A,IACX;AAAA,EACF;AAAA,EAEA,MAAM,OAAO,EAAE,MAAM,GAAG;AACtB,UAAM,WAAO,iBAAwB,IAAI;AAEzC,+BAAU,MAAM;AACd,YAAM,EAAE,WAAW,QAAQ,SAAS,UAAU,WAAW,IAAI;AAE7D,UAAI,CAAC,KAAK,OAAO;AACf;AAAA,MACF;AAEA,WAAK,MAAM,MAAM,aAAa;AAC9B,WAAK,MAAM,MAAM,WAAW;AAG5B,WAAK,MAAM,OAAO;AAElB,aAAO;AAAA,QACL,mBAAmB;AAAA,UACjB;AAAA,UACA;AAAA,UACA,SAAS,KAAK;AAAA,UACd;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF,CAAC;AAED,qCAAgB,MAAM;AACpB,YAAM,EAAE,WAAW,OAAO,IAAI;AAE9B,aAAO,iBAAiB,SAAS;AAAA,IACnC,CAAC;AAGD,WAAO,MAAG;AAxEd;AAwEiB,gCAAE,sBAAU,EAAE,IAAI,OAAO,OAAG,eAAE,OAAO,EAAE,KAAK,KAAK,IAAG,WAAM,YAAN,8BAAiB,CAAC;AAAA;AAAA,EACrF;AACF,CAAC;","names":["BubbleMenu","FloatingMenu","import_core","view","_a","shouldShow","BubbleMenu","import_core","import_dom","import_state","view","shouldShow","import_vue","FloatingMenu"]}
|
package/dist/menus/index.d.cts
CHANGED
|
@@ -132,6 +132,10 @@ declare const BubbleMenu: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
132
132
|
type: PropType<BubbleMenuPluginProps["options"]>;
|
|
133
133
|
default: () => {};
|
|
134
134
|
};
|
|
135
|
+
appendTo: {
|
|
136
|
+
type: PropType<BubbleMenuPluginProps["appendTo"]>;
|
|
137
|
+
default: undefined;
|
|
138
|
+
};
|
|
135
139
|
shouldShow: {
|
|
136
140
|
type: PropType<Exclude<Required<BubbleMenuPluginProps>["shouldShow"], null>>;
|
|
137
141
|
default: null;
|
|
@@ -163,6 +167,10 @@ declare const BubbleMenu: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
163
167
|
type: PropType<BubbleMenuPluginProps["options"]>;
|
|
164
168
|
default: () => {};
|
|
165
169
|
};
|
|
170
|
+
appendTo: {
|
|
171
|
+
type: PropType<BubbleMenuPluginProps["appendTo"]>;
|
|
172
|
+
default: undefined;
|
|
173
|
+
};
|
|
166
174
|
shouldShow: {
|
|
167
175
|
type: PropType<Exclude<Required<BubbleMenuPluginProps>["shouldShow"], null>>;
|
|
168
176
|
default: null;
|
|
@@ -192,6 +200,7 @@ declare const BubbleMenu: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
192
200
|
onDestroy?: () => void;
|
|
193
201
|
scrollTarget?: HTMLElement | Window;
|
|
194
202
|
} | undefined;
|
|
203
|
+
appendTo: HTMLElement | undefined;
|
|
195
204
|
shouldShow: (props: {
|
|
196
205
|
editor: _tiptap_core.Editor;
|
|
197
206
|
element: HTMLElement;
|
|
@@ -220,6 +229,15 @@ interface FloatingMenuPluginProps {
|
|
|
220
229
|
* @default null
|
|
221
230
|
*/
|
|
222
231
|
element: HTMLElement;
|
|
232
|
+
/**
|
|
233
|
+
* The DOM element to append your menu to. Default is the editor's parent element.
|
|
234
|
+
*
|
|
235
|
+
* Sometimes the menu needs to be appended to a different DOM context due to accessibility, clipping, or z-index issues.
|
|
236
|
+
*
|
|
237
|
+
* @type {HTMLElement}
|
|
238
|
+
* @default null
|
|
239
|
+
*/
|
|
240
|
+
appendTo?: HTMLElement;
|
|
223
241
|
/**
|
|
224
242
|
* A function that determines whether the menu should be shown or not.
|
|
225
243
|
* If this function returns `false`, the menu will be hidden, otherwise it will be shown.
|
|
@@ -269,6 +287,10 @@ declare const FloatingMenu: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
269
287
|
type: PropType<FloatingMenuPluginProps["options"]>;
|
|
270
288
|
default: () => {};
|
|
271
289
|
};
|
|
290
|
+
appendTo: {
|
|
291
|
+
type: PropType<FloatingMenuPluginProps["appendTo"]>;
|
|
292
|
+
default: undefined;
|
|
293
|
+
};
|
|
272
294
|
shouldShow: {
|
|
273
295
|
type: PropType<Exclude<Required<FloatingMenuPluginProps>["shouldShow"], null>>;
|
|
274
296
|
default: null;
|
|
@@ -288,6 +310,10 @@ declare const FloatingMenu: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
288
310
|
type: PropType<FloatingMenuPluginProps["options"]>;
|
|
289
311
|
default: () => {};
|
|
290
312
|
};
|
|
313
|
+
appendTo: {
|
|
314
|
+
type: PropType<FloatingMenuPluginProps["appendTo"]>;
|
|
315
|
+
default: undefined;
|
|
316
|
+
};
|
|
291
317
|
shouldShow: {
|
|
292
318
|
type: PropType<Exclude<Required<FloatingMenuPluginProps>["shouldShow"], null>>;
|
|
293
319
|
default: null;
|
|
@@ -310,6 +336,7 @@ declare const FloatingMenu: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
310
336
|
onUpdate?: () => void;
|
|
311
337
|
onDestroy?: () => void;
|
|
312
338
|
} | undefined;
|
|
339
|
+
appendTo: HTMLElement | undefined;
|
|
313
340
|
shouldShow: (props: {
|
|
314
341
|
editor: _tiptap_core.Editor;
|
|
315
342
|
view: EditorView$1;
|
package/dist/menus/index.d.ts
CHANGED
|
@@ -132,6 +132,10 @@ declare const BubbleMenu: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
132
132
|
type: PropType<BubbleMenuPluginProps["options"]>;
|
|
133
133
|
default: () => {};
|
|
134
134
|
};
|
|
135
|
+
appendTo: {
|
|
136
|
+
type: PropType<BubbleMenuPluginProps["appendTo"]>;
|
|
137
|
+
default: undefined;
|
|
138
|
+
};
|
|
135
139
|
shouldShow: {
|
|
136
140
|
type: PropType<Exclude<Required<BubbleMenuPluginProps>["shouldShow"], null>>;
|
|
137
141
|
default: null;
|
|
@@ -163,6 +167,10 @@ declare const BubbleMenu: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
163
167
|
type: PropType<BubbleMenuPluginProps["options"]>;
|
|
164
168
|
default: () => {};
|
|
165
169
|
};
|
|
170
|
+
appendTo: {
|
|
171
|
+
type: PropType<BubbleMenuPluginProps["appendTo"]>;
|
|
172
|
+
default: undefined;
|
|
173
|
+
};
|
|
166
174
|
shouldShow: {
|
|
167
175
|
type: PropType<Exclude<Required<BubbleMenuPluginProps>["shouldShow"], null>>;
|
|
168
176
|
default: null;
|
|
@@ -192,6 +200,7 @@ declare const BubbleMenu: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
192
200
|
onDestroy?: () => void;
|
|
193
201
|
scrollTarget?: HTMLElement | Window;
|
|
194
202
|
} | undefined;
|
|
203
|
+
appendTo: HTMLElement | undefined;
|
|
195
204
|
shouldShow: (props: {
|
|
196
205
|
editor: _tiptap_core.Editor;
|
|
197
206
|
element: HTMLElement;
|
|
@@ -220,6 +229,15 @@ interface FloatingMenuPluginProps {
|
|
|
220
229
|
* @default null
|
|
221
230
|
*/
|
|
222
231
|
element: HTMLElement;
|
|
232
|
+
/**
|
|
233
|
+
* The DOM element to append your menu to. Default is the editor's parent element.
|
|
234
|
+
*
|
|
235
|
+
* Sometimes the menu needs to be appended to a different DOM context due to accessibility, clipping, or z-index issues.
|
|
236
|
+
*
|
|
237
|
+
* @type {HTMLElement}
|
|
238
|
+
* @default null
|
|
239
|
+
*/
|
|
240
|
+
appendTo?: HTMLElement;
|
|
223
241
|
/**
|
|
224
242
|
* A function that determines whether the menu should be shown or not.
|
|
225
243
|
* If this function returns `false`, the menu will be hidden, otherwise it will be shown.
|
|
@@ -269,6 +287,10 @@ declare const FloatingMenu: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
269
287
|
type: PropType<FloatingMenuPluginProps["options"]>;
|
|
270
288
|
default: () => {};
|
|
271
289
|
};
|
|
290
|
+
appendTo: {
|
|
291
|
+
type: PropType<FloatingMenuPluginProps["appendTo"]>;
|
|
292
|
+
default: undefined;
|
|
293
|
+
};
|
|
272
294
|
shouldShow: {
|
|
273
295
|
type: PropType<Exclude<Required<FloatingMenuPluginProps>["shouldShow"], null>>;
|
|
274
296
|
default: null;
|
|
@@ -288,6 +310,10 @@ declare const FloatingMenu: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
288
310
|
type: PropType<FloatingMenuPluginProps["options"]>;
|
|
289
311
|
default: () => {};
|
|
290
312
|
};
|
|
313
|
+
appendTo: {
|
|
314
|
+
type: PropType<FloatingMenuPluginProps["appendTo"]>;
|
|
315
|
+
default: undefined;
|
|
316
|
+
};
|
|
291
317
|
shouldShow: {
|
|
292
318
|
type: PropType<Exclude<Required<FloatingMenuPluginProps>["shouldShow"], null>>;
|
|
293
319
|
default: null;
|
|
@@ -310,6 +336,7 @@ declare const FloatingMenu: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
310
336
|
onUpdate?: () => void;
|
|
311
337
|
onDestroy?: () => void;
|
|
312
338
|
} | undefined;
|
|
339
|
+
appendTo: HTMLElement | undefined;
|
|
313
340
|
shouldShow: (props: {
|
|
314
341
|
editor: _tiptap_core.Editor;
|
|
315
342
|
view: EditorView$1;
|
package/dist/menus/index.js
CHANGED
|
@@ -398,6 +398,10 @@ var BubbleMenu2 = defineComponent({
|
|
|
398
398
|
type: Object,
|
|
399
399
|
default: () => ({})
|
|
400
400
|
},
|
|
401
|
+
appendTo: {
|
|
402
|
+
type: Object,
|
|
403
|
+
default: void 0
|
|
404
|
+
},
|
|
401
405
|
shouldShow: {
|
|
402
406
|
type: Function,
|
|
403
407
|
default: null
|
|
@@ -410,7 +414,16 @@ var BubbleMenu2 = defineComponent({
|
|
|
410
414
|
setup(props, { slots }) {
|
|
411
415
|
const root = ref(null);
|
|
412
416
|
onMounted(() => {
|
|
413
|
-
const {
|
|
417
|
+
const {
|
|
418
|
+
editor,
|
|
419
|
+
options,
|
|
420
|
+
pluginKey,
|
|
421
|
+
resizeDelay,
|
|
422
|
+
appendTo,
|
|
423
|
+
shouldShow,
|
|
424
|
+
getReferencedVirtualElement,
|
|
425
|
+
updateDelay
|
|
426
|
+
} = props;
|
|
414
427
|
if (!root.value) {
|
|
415
428
|
return;
|
|
416
429
|
}
|
|
@@ -424,6 +437,7 @@ var BubbleMenu2 = defineComponent({
|
|
|
424
437
|
options,
|
|
425
438
|
pluginKey,
|
|
426
439
|
resizeDelay,
|
|
440
|
+
appendTo,
|
|
427
441
|
shouldShow,
|
|
428
442
|
getReferencedVirtualElement,
|
|
429
443
|
updateDelay
|
|
@@ -457,7 +471,7 @@ import {
|
|
|
457
471
|
import { getText, getTextSerializersFromSchema, posToDOMRect as posToDOMRect2 } from "@tiptap/core";
|
|
458
472
|
import { Plugin as Plugin2, PluginKey as PluginKey2 } from "@tiptap/pm/state";
|
|
459
473
|
var FloatingMenuView = class {
|
|
460
|
-
constructor({ editor, element, view, options, shouldShow }) {
|
|
474
|
+
constructor({ editor, element, view, options, appendTo, shouldShow }) {
|
|
461
475
|
this.preventHide = false;
|
|
462
476
|
this.isVisible = false;
|
|
463
477
|
this.shouldShow = ({ view: view2, state }) => {
|
|
@@ -519,6 +533,7 @@ var FloatingMenuView = class {
|
|
|
519
533
|
this.editor = editor;
|
|
520
534
|
this.element = element;
|
|
521
535
|
this.view = view;
|
|
536
|
+
this.appendTo = appendTo;
|
|
522
537
|
this.floatingUIOptions = {
|
|
523
538
|
...this.floatingUIOptions,
|
|
524
539
|
...options
|
|
@@ -620,13 +635,13 @@ var FloatingMenuView = class {
|
|
|
620
635
|
this.updateHandler(view, selectionChanged, docChanged, oldState);
|
|
621
636
|
}
|
|
622
637
|
show() {
|
|
623
|
-
var _a;
|
|
638
|
+
var _a, _b;
|
|
624
639
|
if (this.isVisible) {
|
|
625
640
|
return;
|
|
626
641
|
}
|
|
627
642
|
this.element.style.visibility = "visible";
|
|
628
643
|
this.element.style.opacity = "1";
|
|
629
|
-
(_a = this.view.dom.parentElement) == null ? void 0 :
|
|
644
|
+
(_b = (_a = this.appendTo) != null ? _a : this.view.dom.parentElement) == null ? void 0 : _b.appendChild(this.element);
|
|
630
645
|
if (this.floatingUIOptions.onShow) {
|
|
631
646
|
this.floatingUIOptions.onShow();
|
|
632
647
|
}
|
|
@@ -667,6 +682,7 @@ var FloatingMenu = Extension2.create({
|
|
|
667
682
|
element: null,
|
|
668
683
|
options: {},
|
|
669
684
|
pluginKey: "floatingMenu",
|
|
685
|
+
appendTo: void 0,
|
|
670
686
|
shouldShow: null
|
|
671
687
|
};
|
|
672
688
|
},
|
|
@@ -680,6 +696,7 @@ var FloatingMenu = Extension2.create({
|
|
|
680
696
|
editor: this.editor,
|
|
681
697
|
element: this.options.element,
|
|
682
698
|
options: this.options.options,
|
|
699
|
+
appendTo: this.options.appendTo,
|
|
683
700
|
shouldShow: this.options.shouldShow
|
|
684
701
|
})
|
|
685
702
|
];
|
|
@@ -705,6 +722,10 @@ var FloatingMenu2 = defineComponent2({
|
|
|
705
722
|
type: Object,
|
|
706
723
|
default: () => ({})
|
|
707
724
|
},
|
|
725
|
+
appendTo: {
|
|
726
|
+
type: Object,
|
|
727
|
+
default: void 0
|
|
728
|
+
},
|
|
708
729
|
shouldShow: {
|
|
709
730
|
type: Function,
|
|
710
731
|
default: null
|
|
@@ -713,7 +734,7 @@ var FloatingMenu2 = defineComponent2({
|
|
|
713
734
|
setup(props, { slots }) {
|
|
714
735
|
const root = ref2(null);
|
|
715
736
|
onMounted2(() => {
|
|
716
|
-
const { pluginKey, editor, options, shouldShow } = props;
|
|
737
|
+
const { pluginKey, editor, options, appendTo, shouldShow } = props;
|
|
717
738
|
if (!root.value) {
|
|
718
739
|
return;
|
|
719
740
|
}
|
|
@@ -726,6 +747,7 @@ var FloatingMenu2 = defineComponent2({
|
|
|
726
747
|
editor,
|
|
727
748
|
element: root.value,
|
|
728
749
|
options,
|
|
750
|
+
appendTo,
|
|
729
751
|
shouldShow
|
|
730
752
|
})
|
|
731
753
|
);
|
package/dist/menus/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../extension-bubble-menu/src/bubble-menu.ts","../../../extension-bubble-menu/src/bubble-menu-plugin.ts","../../../extension-bubble-menu/src/index.ts","../../src/menus/BubbleMenu.ts","../../../extension-floating-menu/src/floating-menu.ts","../../../extension-floating-menu/src/floating-menu-plugin.ts","../../../extension-floating-menu/src/index.ts","../../src/menus/FloatingMenu.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\n\nimport type { BubbleMenuPluginProps } from './bubble-menu-plugin.js'\nimport { BubbleMenuPlugin } from './bubble-menu-plugin.js'\n\nexport type BubbleMenuOptions = Omit<BubbleMenuPluginProps, 'editor' | 'element'> & {\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<ReturnType> {\n bubbleMenu: {\n /**\n * Update the position of the bubble menu. This command is useful to force\n * the bubble menu to update its position in response to certain events\n * (for example, when the bubble menu is resized).\n */\n updateBubbleMenuPosition: () => ReturnType\n }\n }\n}\n\n/**\n * This extension allows you to create a bubble menu.\n * @see https://tiptap.dev/api/extensions/bubble-menu\n */\nexport const BubbleMenu = Extension.create<BubbleMenuOptions>({\n name: 'bubbleMenu',\n\n addOptions() {\n return {\n element: null,\n pluginKey: 'bubbleMenu',\n updateDelay: undefined,\n appendTo: undefined,\n shouldShow: null,\n }\n },\n\n addProseMirrorPlugins() {\n if (!this.options.element) {\n return []\n }\n\n return [\n BubbleMenuPlugin({\n pluginKey: this.options.pluginKey,\n editor: this.editor,\n element: this.options.element,\n updateDelay: this.options.updateDelay,\n options: this.options.options,\n appendTo: this.options.appendTo,\n getReferencedVirtualElement: this.options.getReferencedVirtualElement,\n shouldShow: this.options.shouldShow,\n }),\n ]\n },\n\n addCommands() {\n return {\n updateBubbleMenuPosition:\n () =>\n ({ commands }) => {\n return commands.setMeta('bubbleMenu', 'updatePosition')\n },\n }\n },\n})\n","import {\n type Middleware,\n type VirtualElement,\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 { isTextSelection, posToDOMRect } from '@tiptap/core'\nimport type { EditorState, PluginView, Transaction } from '@tiptap/pm/state'\nimport { NodeSelection, Plugin, PluginKey } from '@tiptap/pm/state'\nimport { CellSelection } from '@tiptap/pm/tables'\nimport type { EditorView } from '@tiptap/pm/view'\n\nfunction combineDOMRects(rect1: DOMRect, rect2: DOMRect): DOMRect {\n const top = Math.min(rect1.top, rect2.top)\n const bottom = Math.max(rect1.bottom, rect2.bottom)\n const left = Math.min(rect1.left, rect2.left)\n const right = Math.max(rect1.right, rect2.right)\n const width = right - left\n const height = bottom - top\n const x = left\n const y = top\n return new DOMRect(x, y, width, height)\n}\n\nexport interface BubbleMenuPluginProps {\n /**\n * The plugin key.\n * @type {PluginKey | string}\n * @default 'bubbleMenu'\n */\n pluginKey: PluginKey | string\n\n /**\n * The editor instance.\n */\n editor: Editor\n\n /**\n * The DOM element that contains your menu.\n * @type {HTMLElement}\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 * 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 element: HTMLElement\n view: EditorView\n state: EditorState\n oldState?: EditorState\n from: number\n to: number\n }) => boolean)\n | null\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\n\n /**\n * A function that returns the virtual element for the menu.\n * This is useful when the menu needs to be positioned relative to a specific DOM element.\n * @type {() => VirtualElement | null}\n * @default Position based on the selection.\n */\n getReferencedVirtualElement?: () => VirtualElement | null\n\n /**\n * The options for the bubble 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<typeof offset>[0] | boolean\n flip?: Parameters<typeof flip>[0] | boolean\n shift?: Parameters<typeof shift>[0] | boolean\n arrow?: Parameters<typeof arrow>[0] | false\n size?: Parameters<typeof size>[0] | boolean\n autoPlacement?: Parameters<typeof autoPlacement>[0] | boolean\n hide?: Parameters<typeof hide>[0] | boolean\n inline?: Parameters<typeof inline>[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 bubble menu.\n * If not provided, the window will be used.\n * @type {HTMLElement | Window}\n */\n scrollTarget?: HTMLElement | Window\n }\n}\n\nexport type BubbleMenuViewProps = BubbleMenuPluginProps & {\n view: EditorView\n}\n\nexport class BubbleMenuView implements PluginView {\n public editor: Editor\n\n public element: HTMLElement\n\n public view: EditorView\n\n public preventHide = false\n\n public updateDelay: number\n\n public resizeDelay: number\n\n public appendTo: HTMLElement | undefined\n\n public getReferencedVirtualElement: (() => VirtualElement | null) | 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 floatingUIOptions: NonNullable<BubbleMenuPluginProps['options']> = {\n strategy: 'absolute',\n placement: 'top',\n offset: 8,\n flip: {},\n shift: {},\n arrow: false,\n size: false,\n autoPlacement: false,\n hide: false,\n inline: false,\n onShow: undefined,\n onHide: undefined,\n onUpdate: undefined,\n onDestroy: undefined,\n }\n\n public shouldShow: Exclude<BubbleMenuPluginProps['shouldShow'], null> = ({ view, state, from, to }) => {\n const { doc, selection } = state\n const { empty } = selection\n\n // Sometime check for `empty` is not enough.\n // Doubleclick an empty paragraph returns a node size of 2.\n // So we check also for an empty text size.\n const isEmptyTextBlock = !doc.textBetween(from, to).length && isTextSelection(state.selection)\n\n // When clicking on a element inside the bubble menu the editor \"blur\" event\n // is called and the bubble menu item is focussed. In this case we should\n // consider the menu as part of the editor and keep showing the menu\n const isChildOfMenu = this.element.contains(document.activeElement)\n\n const hasEditorFocus = view.hasFocus() || isChildOfMenu\n\n if (!hasEditorFocus || empty || isEmptyTextBlock || !this.editor.isEditable) {\n return false\n }\n\n return true\n }\n\n get middlewares() {\n const middlewares: Middleware[] = []\n\n if (this.floatingUIOptions.flip) {\n middlewares.push(flip(typeof this.floatingUIOptions.flip !== 'boolean' ? this.floatingUIOptions.flip : undefined))\n }\n\n if (this.floatingUIOptions.shift) {\n middlewares.push(\n shift(typeof this.floatingUIOptions.shift !== 'boolean' ? this.floatingUIOptions.shift : undefined),\n )\n }\n\n if (this.floatingUIOptions.offset) {\n middlewares.push(\n offset(typeof this.floatingUIOptions.offset !== 'boolean' ? this.floatingUIOptions.offset : undefined),\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(size(typeof this.floatingUIOptions.size !== 'boolean' ? this.floatingUIOptions.size : undefined))\n }\n\n if (this.floatingUIOptions.autoPlacement) {\n middlewares.push(\n autoPlacement(\n typeof this.floatingUIOptions.autoPlacement !== 'boolean' ? this.floatingUIOptions.autoPlacement : undefined,\n ),\n )\n }\n\n if (this.floatingUIOptions.hide) {\n middlewares.push(hide(typeof this.floatingUIOptions.hide !== 'boolean' ? this.floatingUIOptions.hide : undefined))\n }\n\n if (this.floatingUIOptions.inline) {\n middlewares.push(\n inline(typeof this.floatingUIOptions.inline !== 'boolean' ? this.floatingUIOptions.inline : undefined),\n )\n }\n\n return middlewares\n }\n\n private get virtualElement(): VirtualElement | undefined {\n const { selection } = this.editor.state\n\n const referencedVirtualElement = this.getReferencedVirtualElement?.()\n if (referencedVirtualElement) {\n return referencedVirtualElement\n }\n\n const domRect = posToDOMRect(this.view, selection.from, selection.to)\n let virtualElement = {\n getBoundingClientRect: () => domRect,\n getClientRects: () => [domRect],\n }\n\n if (selection instanceof NodeSelection) {\n let node = this.view.nodeDOM(selection.from) as HTMLElement\n\n const nodeViewWrapper = node.dataset.nodeViewWrapper ? node : node.querySelector('[data-node-view-wrapper]')\n\n if (nodeViewWrapper) {\n node = nodeViewWrapper as HTMLElement\n }\n\n if (node) {\n virtualElement = {\n getBoundingClientRect: () => node.getBoundingClientRect(),\n getClientRects: () => [node.getBoundingClientRect()],\n }\n }\n }\n\n // this is a special case for cell selections\n if (selection instanceof CellSelection) {\n const { $anchorCell, $headCell } = selection\n\n const from = $anchorCell ? $anchorCell.pos : $headCell!.pos\n const to = $headCell ? $headCell.pos : $anchorCell!.pos\n\n const fromDOM = this.view.nodeDOM(from)\n const toDOM = this.view.nodeDOM(to)\n\n if (!fromDOM || !toDOM) {\n return\n }\n\n const clientRect =\n fromDOM === toDOM\n ? (fromDOM as HTMLElement).getBoundingClientRect()\n : combineDOMRects(\n (fromDOM as HTMLElement).getBoundingClientRect(),\n (toDOM as HTMLElement).getBoundingClientRect(),\n )\n\n virtualElement = {\n getBoundingClientRect: () => clientRect,\n getClientRects: () => [clientRect],\n }\n }\n\n return virtualElement\n }\n\n constructor({\n editor,\n element,\n view,\n updateDelay = 250,\n resizeDelay = 60,\n shouldShow,\n appendTo,\n getReferencedVirtualElement,\n options,\n }: BubbleMenuViewProps) {\n this.editor = editor\n this.element = element\n this.view = view\n this.updateDelay = updateDelay\n this.resizeDelay = resizeDelay\n this.appendTo = appendTo\n this.scrollTarget = options?.scrollTarget ?? window\n this.getReferencedVirtualElement = getReferencedVirtualElement\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.view.dom.addEventListener('dragstart', this.dragstartHandler)\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 }\n }\n\n mousedownHandler = () => {\n this.preventHide = true\n }\n\n dragstartHandler = () => {\n this.hide()\n }\n\n /**\n * Handles the window resize event to update the position of the bubble 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 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 updatePosition() {\n const virtualElement = this.virtualElement\n\n if (!virtualElement) {\n return\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 }) => {\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 { state } = view\n const hasValidSelection = state.selection.from !== state.selection.to\n\n if (this.updateDelay > 0 && hasValidSelection) {\n this.handleDebouncedUpdate(view, oldState)\n return\n }\n\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 handleDebouncedUpdate = (view: EditorView, oldState?: EditorState) => {\n const selectionChanged = !oldState?.selection.eq(view.state.selection)\n const docChanged = !oldState?.doc.eq(view.state.doc)\n\n if (!selectionChanged && !docChanged) {\n return\n }\n\n if (this.updateDebounceTimer) {\n clearTimeout(this.updateDebounceTimer)\n }\n\n this.updateDebounceTimer = window.setTimeout(() => {\n this.updateHandler(view, selectionChanged, docChanged, oldState)\n }, this.updateDelay)\n }\n\n getShouldShow(oldState?: EditorState) {\n const { state } = this.view\n const { selection } = state\n\n // support for CellSelections\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 element: this.element,\n view: this.view,\n state,\n oldState,\n from,\n to,\n })\n\n return shouldShow\n }\n\n updateHandler = (view: EditorView, selectionChanged: boolean, docChanged: boolean, oldState?: EditorState) => {\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 show() {\n if (this.isVisible) {\n return\n }\n\n this.element.style.visibility = 'visible'\n this.element.style.opacity = '1'\n // attach to appendTo or editor's parent element\n ;(this.appendTo ?? 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 transactionHandler({ transaction: tr }: { transaction: Transaction }) {\n const meta = tr.getMeta('bubbleMenu')\n if (meta === 'updatePosition') {\n this.updatePosition()\n }\n }\n\n destroy() {\n this.hide()\n this.element.removeEventListener('mousedown', this.mousedownHandler, { capture: true })\n this.view.dom.removeEventListener('dragstart', this.dragstartHandler)\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 BubbleMenuPlugin = (options: BubbleMenuPluginProps) => {\n return new Plugin({\n key: typeof options.pluginKey === 'string' ? new PluginKey(options.pluginKey) : options.pluginKey,\n view: view => new BubbleMenuView({ view, ...options }),\n })\n}\n","import { BubbleMenu } from './bubble-menu.js'\n\nexport * from './bubble-menu.js'\nexport * from './bubble-menu-plugin.js'\n\nexport default BubbleMenu\n","import type { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport { BubbleMenuPlugin } from '@tiptap/extension-bubble-menu'\nimport type { PropType } from 'vue'\nimport { defineComponent, h, onBeforeUnmount, onMounted, ref, Teleport } from 'vue'\n\nexport const BubbleMenu = defineComponent({\n name: 'BubbleMenu',\n\n props: {\n pluginKey: {\n type: [String, Object] as PropType<BubbleMenuPluginProps['pluginKey']>,\n default: 'bubbleMenu',\n },\n\n editor: {\n type: Object as PropType<BubbleMenuPluginProps['editor']>,\n required: true,\n },\n\n updateDelay: {\n type: Number as PropType<BubbleMenuPluginProps['updateDelay']>,\n default: undefined,\n },\n\n resizeDelay: {\n type: Number as PropType<BubbleMenuPluginProps['resizeDelay']>,\n default: undefined,\n },\n\n options: {\n type: Object as PropType<BubbleMenuPluginProps['options']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<BubbleMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n\n getReferencedVirtualElement: {\n type: Function as PropType<Exclude<Required<BubbleMenuPluginProps>['getReferencedVirtualElement'], null>>,\n default: undefined,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const { editor, options, pluginKey, resizeDelay, shouldShow, getReferencedVirtualElement, updateDelay } = props\n\n if (!root.value) {\n return\n }\n\n root.value.style.visibility = 'hidden'\n root.value.style.position = 'absolute'\n\n // remove the element from the DOM\n root.value.remove()\n\n editor.registerPlugin(\n BubbleMenuPlugin({\n editor,\n element: root.value as HTMLElement,\n options,\n pluginKey,\n resizeDelay,\n shouldShow,\n getReferencedVirtualElement,\n updateDelay,\n }),\n )\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h(Teleport, { to: 'body' }, h('div', { ref: root }, slots.default?.()))\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<FloatingMenuPluginProps, 'editor' | 'element'> & {\n /**\n * The DOM element that contains your menu.\n * @type {HTMLElement}\n * @default null\n */\n element: HTMLElement | null\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<FloatingMenuOptions>({\n name: 'floatingMenu',\n\n addOptions() {\n return {\n element: null,\n options: {},\n pluginKey: 'floatingMenu',\n shouldShow: null,\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 options: this.options.options,\n shouldShow: this.options.shouldShow,\n }),\n ]\n },\n})\n","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 } 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 * 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<typeof offset>[0] | boolean\n flip?: Parameters<typeof flip>[0] | boolean\n shift?: Parameters<typeof shift>[0] | boolean\n arrow?: Parameters<typeof arrow>[0] | false\n size?: Parameters<typeof size>[0] | boolean\n autoPlacement?: Parameters<typeof autoPlacement>[0] | boolean\n hide?: Parameters<typeof hide>[0] | boolean\n inline?: Parameters<typeof inline>[0] | boolean\n\n onShow?: () => void\n onHide?: () => void\n onUpdate?: () => void\n onDestroy?: () => void\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 private isVisible = false\n\n private getTextContent(node: ProsemirrorNode) {\n return getText(node, { textSerializers: getTextSerializersFromSchema(this.editor.schema) })\n }\n\n public shouldShow: Exclude<FloatingMenuPluginProps['shouldShow'], null> = ({ 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 (!view.hasFocus() || !empty || !isRootDepth || !isEmptyTextBlock || !this.editor.isEditable) {\n return false\n }\n\n return true\n }\n\n private floatingUIOptions: NonNullable<FloatingMenuPluginProps['options']> = {\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(flip(typeof this.floatingUIOptions.flip !== 'boolean' ? this.floatingUIOptions.flip : undefined))\n }\n\n if (this.floatingUIOptions.shift) {\n middlewares.push(\n shift(typeof this.floatingUIOptions.shift !== 'boolean' ? this.floatingUIOptions.shift : undefined),\n )\n }\n\n if (this.floatingUIOptions.offset) {\n middlewares.push(\n offset(typeof this.floatingUIOptions.offset !== 'boolean' ? this.floatingUIOptions.offset : undefined),\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(size(typeof this.floatingUIOptions.size !== 'boolean' ? this.floatingUIOptions.size : undefined))\n }\n\n if (this.floatingUIOptions.autoPlacement) {\n middlewares.push(\n autoPlacement(\n typeof this.floatingUIOptions.autoPlacement !== 'boolean' ? this.floatingUIOptions.autoPlacement : undefined,\n ),\n )\n }\n\n if (this.floatingUIOptions.hide) {\n middlewares.push(hide(typeof this.floatingUIOptions.hide !== 'boolean' ? this.floatingUIOptions.hide : undefined))\n }\n\n if (this.floatingUIOptions.inline) {\n middlewares.push(\n inline(typeof this.floatingUIOptions.inline !== 'boolean' ? this.floatingUIOptions.inline : undefined),\n )\n }\n\n return middlewares\n }\n\n constructor({ editor, element, view, options, shouldShow }: FloatingMenuViewProps) {\n this.editor = editor\n this.element = element\n this.view = view\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\n this.update(view, view.state)\n\n if (this.getShouldShow()) {\n this.show()\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 = (view: EditorView, selectionChanged: boolean, docChanged: boolean, oldState?: EditorState) => {\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 updatePosition() {\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 }) => {\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 // attach to editor's parent element\n 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 this.editor.off('focus', this.focusHandler)\n this.editor.off('blur', this.blurHandler)\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: typeof options.pluginKey === 'string' ? new PluginKey(options.pluginKey) : options.pluginKey,\n view: view => new FloatingMenuView({ view, ...options }),\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","import type { FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport { FloatingMenuPlugin } from '@tiptap/extension-floating-menu'\nimport type { PropType } from 'vue'\nimport { defineComponent, h, onBeforeUnmount, onMounted, ref, Teleport } from 'vue'\n\nexport const FloatingMenu = defineComponent({\n name: 'FloatingMenu',\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],\n type: null,\n default: 'floatingMenu',\n },\n\n editor: {\n type: Object as PropType<FloatingMenuPluginProps['editor']>,\n required: true,\n },\n\n options: {\n type: Object as PropType<FloatingMenuPluginProps['options']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<FloatingMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const { pluginKey, editor, options, shouldShow } = props\n\n if (!root.value) {\n return\n }\n\n root.value.style.visibility = 'hidden'\n root.value.style.position = 'absolute'\n\n // remove the element from the DOM\n root.value.remove()\n\n editor.registerPlugin(\n FloatingMenuPlugin({\n pluginKey,\n editor,\n element: root.value as HTMLElement,\n options,\n shouldShow,\n }),\n )\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h(Teleport, { to: 'body' }, h('div', { ref: root }, slots.default?.()))\n },\n})\n"],"mappings":";AAAA,SAAS,iBAAiB;ACA1B;EAGE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;OACK;AAEP,SAAS,iBAAiB,oBAAoB;AAE9C,SAAS,eAAe,QAAQ,iBAAiB;AACjD,SAAS,qBAAqB;AAG9B,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aAAO,iBAAiB,SAAS;AAAA,IACnC,CAAC;AAED,WAAO,MAAG;AAjEd;AAiEiB,aAAAD,GAAEI,WAAU,EAAE,IAAI,OAAO,GAAGJ,GAAE,OAAO,EAAE,KAAK,KAAK,IAAG,WAAM,YAAN,8BAAiB,CAAC;AAAA;AAAA,EACrF;AACF,CAAC;","names":["view","_a","shouldShow","BubbleMenu","Extension","arrow","autoPlacement","computePosition","flip","hide","inline","offset","shift","size","posToDOMRect","Plugin","PluginKey","view","shouldShow","defineComponent","h","onBeforeUnmount","onMounted","ref","Teleport","FloatingMenu"]}
|
|
1
|
+
{"version":3,"sources":["../../../extension-bubble-menu/src/bubble-menu.ts","../../../extension-bubble-menu/src/bubble-menu-plugin.ts","../../../extension-bubble-menu/src/index.ts","../../src/menus/BubbleMenu.ts","../../../extension-floating-menu/src/floating-menu.ts","../../../extension-floating-menu/src/floating-menu-plugin.ts","../../../extension-floating-menu/src/index.ts","../../src/menus/FloatingMenu.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\n\nimport type { BubbleMenuPluginProps } from './bubble-menu-plugin.js'\nimport { BubbleMenuPlugin } from './bubble-menu-plugin.js'\n\nexport type BubbleMenuOptions = Omit<BubbleMenuPluginProps, 'editor' | 'element'> & {\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<ReturnType> {\n bubbleMenu: {\n /**\n * Update the position of the bubble menu. This command is useful to force\n * the bubble menu to update its position in response to certain events\n * (for example, when the bubble menu is resized).\n */\n updateBubbleMenuPosition: () => ReturnType\n }\n }\n}\n\n/**\n * This extension allows you to create a bubble menu.\n * @see https://tiptap.dev/api/extensions/bubble-menu\n */\nexport const BubbleMenu = Extension.create<BubbleMenuOptions>({\n name: 'bubbleMenu',\n\n addOptions() {\n return {\n element: null,\n pluginKey: 'bubbleMenu',\n updateDelay: undefined,\n appendTo: undefined,\n shouldShow: null,\n }\n },\n\n addProseMirrorPlugins() {\n if (!this.options.element) {\n return []\n }\n\n return [\n BubbleMenuPlugin({\n pluginKey: this.options.pluginKey,\n editor: this.editor,\n element: this.options.element,\n updateDelay: this.options.updateDelay,\n options: this.options.options,\n appendTo: this.options.appendTo,\n getReferencedVirtualElement: this.options.getReferencedVirtualElement,\n shouldShow: this.options.shouldShow,\n }),\n ]\n },\n\n addCommands() {\n return {\n updateBubbleMenuPosition:\n () =>\n ({ commands }) => {\n return commands.setMeta('bubbleMenu', 'updatePosition')\n },\n }\n },\n})\n","import {\n type Middleware,\n type VirtualElement,\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 { isTextSelection, posToDOMRect } from '@tiptap/core'\nimport type { EditorState, PluginView, Transaction } from '@tiptap/pm/state'\nimport { NodeSelection, Plugin, PluginKey } from '@tiptap/pm/state'\nimport { CellSelection } from '@tiptap/pm/tables'\nimport type { EditorView } from '@tiptap/pm/view'\n\nfunction combineDOMRects(rect1: DOMRect, rect2: DOMRect): DOMRect {\n const top = Math.min(rect1.top, rect2.top)\n const bottom = Math.max(rect1.bottom, rect2.bottom)\n const left = Math.min(rect1.left, rect2.left)\n const right = Math.max(rect1.right, rect2.right)\n const width = right - left\n const height = bottom - top\n const x = left\n const y = top\n return new DOMRect(x, y, width, height)\n}\n\nexport interface BubbleMenuPluginProps {\n /**\n * The plugin key.\n * @type {PluginKey | string}\n * @default 'bubbleMenu'\n */\n pluginKey: PluginKey | string\n\n /**\n * The editor instance.\n */\n editor: Editor\n\n /**\n * The DOM element that contains your menu.\n * @type {HTMLElement}\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 * 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 element: HTMLElement\n view: EditorView\n state: EditorState\n oldState?: EditorState\n from: number\n to: number\n }) => boolean)\n | null\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\n\n /**\n * A function that returns the virtual element for the menu.\n * This is useful when the menu needs to be positioned relative to a specific DOM element.\n * @type {() => VirtualElement | null}\n * @default Position based on the selection.\n */\n getReferencedVirtualElement?: () => VirtualElement | null\n\n /**\n * The options for the bubble 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<typeof offset>[0] | boolean\n flip?: Parameters<typeof flip>[0] | boolean\n shift?: Parameters<typeof shift>[0] | boolean\n arrow?: Parameters<typeof arrow>[0] | false\n size?: Parameters<typeof size>[0] | boolean\n autoPlacement?: Parameters<typeof autoPlacement>[0] | boolean\n hide?: Parameters<typeof hide>[0] | boolean\n inline?: Parameters<typeof inline>[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 bubble menu.\n * If not provided, the window will be used.\n * @type {HTMLElement | Window}\n */\n scrollTarget?: HTMLElement | Window\n }\n}\n\nexport type BubbleMenuViewProps = BubbleMenuPluginProps & {\n view: EditorView\n}\n\nexport class BubbleMenuView implements PluginView {\n public editor: Editor\n\n public element: HTMLElement\n\n public view: EditorView\n\n public preventHide = false\n\n public updateDelay: number\n\n public resizeDelay: number\n\n public appendTo: HTMLElement | undefined\n\n public getReferencedVirtualElement: (() => VirtualElement | null) | 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 floatingUIOptions: NonNullable<BubbleMenuPluginProps['options']> = {\n strategy: 'absolute',\n placement: 'top',\n offset: 8,\n flip: {},\n shift: {},\n arrow: false,\n size: false,\n autoPlacement: false,\n hide: false,\n inline: false,\n onShow: undefined,\n onHide: undefined,\n onUpdate: undefined,\n onDestroy: undefined,\n }\n\n public shouldShow: Exclude<BubbleMenuPluginProps['shouldShow'], null> = ({ view, state, from, to }) => {\n const { doc, selection } = state\n const { empty } = selection\n\n // Sometime check for `empty` is not enough.\n // Doubleclick an empty paragraph returns a node size of 2.\n // So we check also for an empty text size.\n const isEmptyTextBlock = !doc.textBetween(from, to).length && isTextSelection(state.selection)\n\n // When clicking on a element inside the bubble menu the editor \"blur\" event\n // is called and the bubble menu item is focussed. In this case we should\n // consider the menu as part of the editor and keep showing the menu\n const isChildOfMenu = this.element.contains(document.activeElement)\n\n const hasEditorFocus = view.hasFocus() || isChildOfMenu\n\n if (!hasEditorFocus || empty || isEmptyTextBlock || !this.editor.isEditable) {\n return false\n }\n\n return true\n }\n\n get middlewares() {\n const middlewares: Middleware[] = []\n\n if (this.floatingUIOptions.flip) {\n middlewares.push(flip(typeof this.floatingUIOptions.flip !== 'boolean' ? this.floatingUIOptions.flip : undefined))\n }\n\n if (this.floatingUIOptions.shift) {\n middlewares.push(\n shift(typeof this.floatingUIOptions.shift !== 'boolean' ? this.floatingUIOptions.shift : undefined),\n )\n }\n\n if (this.floatingUIOptions.offset) {\n middlewares.push(\n offset(typeof this.floatingUIOptions.offset !== 'boolean' ? this.floatingUIOptions.offset : undefined),\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(size(typeof this.floatingUIOptions.size !== 'boolean' ? this.floatingUIOptions.size : undefined))\n }\n\n if (this.floatingUIOptions.autoPlacement) {\n middlewares.push(\n autoPlacement(\n typeof this.floatingUIOptions.autoPlacement !== 'boolean' ? this.floatingUIOptions.autoPlacement : undefined,\n ),\n )\n }\n\n if (this.floatingUIOptions.hide) {\n middlewares.push(hide(typeof this.floatingUIOptions.hide !== 'boolean' ? this.floatingUIOptions.hide : undefined))\n }\n\n if (this.floatingUIOptions.inline) {\n middlewares.push(\n inline(typeof this.floatingUIOptions.inline !== 'boolean' ? this.floatingUIOptions.inline : undefined),\n )\n }\n\n return middlewares\n }\n\n private get virtualElement(): VirtualElement | undefined {\n const { selection } = this.editor.state\n\n const referencedVirtualElement = this.getReferencedVirtualElement?.()\n if (referencedVirtualElement) {\n return referencedVirtualElement\n }\n\n const domRect = posToDOMRect(this.view, selection.from, selection.to)\n let virtualElement = {\n getBoundingClientRect: () => domRect,\n getClientRects: () => [domRect],\n }\n\n if (selection instanceof NodeSelection) {\n let node = this.view.nodeDOM(selection.from) as HTMLElement\n\n const nodeViewWrapper = node.dataset.nodeViewWrapper ? node : node.querySelector('[data-node-view-wrapper]')\n\n if (nodeViewWrapper) {\n node = nodeViewWrapper as HTMLElement\n }\n\n if (node) {\n virtualElement = {\n getBoundingClientRect: () => node.getBoundingClientRect(),\n getClientRects: () => [node.getBoundingClientRect()],\n }\n }\n }\n\n // this is a special case for cell selections\n if (selection instanceof CellSelection) {\n const { $anchorCell, $headCell } = selection\n\n const from = $anchorCell ? $anchorCell.pos : $headCell!.pos\n const to = $headCell ? $headCell.pos : $anchorCell!.pos\n\n const fromDOM = this.view.nodeDOM(from)\n const toDOM = this.view.nodeDOM(to)\n\n if (!fromDOM || !toDOM) {\n return\n }\n\n const clientRect =\n fromDOM === toDOM\n ? (fromDOM as HTMLElement).getBoundingClientRect()\n : combineDOMRects(\n (fromDOM as HTMLElement).getBoundingClientRect(),\n (toDOM as HTMLElement).getBoundingClientRect(),\n )\n\n virtualElement = {\n getBoundingClientRect: () => clientRect,\n getClientRects: () => [clientRect],\n }\n }\n\n return virtualElement\n }\n\n constructor({\n editor,\n element,\n view,\n updateDelay = 250,\n resizeDelay = 60,\n shouldShow,\n appendTo,\n getReferencedVirtualElement,\n options,\n }: BubbleMenuViewProps) {\n this.editor = editor\n this.element = element\n this.view = view\n this.updateDelay = updateDelay\n this.resizeDelay = resizeDelay\n this.appendTo = appendTo\n this.scrollTarget = options?.scrollTarget ?? window\n this.getReferencedVirtualElement = getReferencedVirtualElement\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.view.dom.addEventListener('dragstart', this.dragstartHandler)\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 }\n }\n\n mousedownHandler = () => {\n this.preventHide = true\n }\n\n dragstartHandler = () => {\n this.hide()\n }\n\n /**\n * Handles the window resize event to update the position of the bubble 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 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 updatePosition() {\n const virtualElement = this.virtualElement\n\n if (!virtualElement) {\n return\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 }) => {\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 { state } = view\n const hasValidSelection = state.selection.from !== state.selection.to\n\n if (this.updateDelay > 0 && hasValidSelection) {\n this.handleDebouncedUpdate(view, oldState)\n return\n }\n\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 handleDebouncedUpdate = (view: EditorView, oldState?: EditorState) => {\n const selectionChanged = !oldState?.selection.eq(view.state.selection)\n const docChanged = !oldState?.doc.eq(view.state.doc)\n\n if (!selectionChanged && !docChanged) {\n return\n }\n\n if (this.updateDebounceTimer) {\n clearTimeout(this.updateDebounceTimer)\n }\n\n this.updateDebounceTimer = window.setTimeout(() => {\n this.updateHandler(view, selectionChanged, docChanged, oldState)\n }, this.updateDelay)\n }\n\n getShouldShow(oldState?: EditorState) {\n const { state } = this.view\n const { selection } = state\n\n // support for CellSelections\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 element: this.element,\n view: this.view,\n state,\n oldState,\n from,\n to,\n })\n\n return shouldShow\n }\n\n updateHandler = (view: EditorView, selectionChanged: boolean, docChanged: boolean, oldState?: EditorState) => {\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 show() {\n if (this.isVisible) {\n return\n }\n\n this.element.style.visibility = 'visible'\n this.element.style.opacity = '1'\n // attach to appendTo or editor's parent element\n ;(this.appendTo ?? 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 transactionHandler({ transaction: tr }: { transaction: Transaction }) {\n const meta = tr.getMeta('bubbleMenu')\n if (meta === 'updatePosition') {\n this.updatePosition()\n }\n }\n\n destroy() {\n this.hide()\n this.element.removeEventListener('mousedown', this.mousedownHandler, { capture: true })\n this.view.dom.removeEventListener('dragstart', this.dragstartHandler)\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 BubbleMenuPlugin = (options: BubbleMenuPluginProps) => {\n return new Plugin({\n key: typeof options.pluginKey === 'string' ? new PluginKey(options.pluginKey) : options.pluginKey,\n view: view => new BubbleMenuView({ view, ...options }),\n })\n}\n","import { BubbleMenu } from './bubble-menu.js'\n\nexport * from './bubble-menu.js'\nexport * from './bubble-menu-plugin.js'\n\nexport default BubbleMenu\n","import type { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport { BubbleMenuPlugin } from '@tiptap/extension-bubble-menu'\nimport type { PropType } from 'vue'\nimport { defineComponent, h, onBeforeUnmount, onMounted, ref, Teleport } from 'vue'\n\nexport const BubbleMenu = defineComponent({\n name: 'BubbleMenu',\n\n props: {\n pluginKey: {\n type: [String, Object] as PropType<BubbleMenuPluginProps['pluginKey']>,\n default: 'bubbleMenu',\n },\n\n editor: {\n type: Object as PropType<BubbleMenuPluginProps['editor']>,\n required: true,\n },\n\n updateDelay: {\n type: Number as PropType<BubbleMenuPluginProps['updateDelay']>,\n default: undefined,\n },\n\n resizeDelay: {\n type: Number as PropType<BubbleMenuPluginProps['resizeDelay']>,\n default: undefined,\n },\n\n options: {\n type: Object as PropType<BubbleMenuPluginProps['options']>,\n default: () => ({}),\n },\n\n appendTo: {\n type: Object as PropType<BubbleMenuPluginProps['appendTo']>,\n default: undefined,\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<BubbleMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n\n getReferencedVirtualElement: {\n type: Function as PropType<Exclude<Required<BubbleMenuPluginProps>['getReferencedVirtualElement'], null>>,\n default: undefined,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n editor,\n options,\n pluginKey,\n resizeDelay,\n appendTo,\n shouldShow,\n getReferencedVirtualElement,\n updateDelay,\n } = props\n\n if (!root.value) {\n return\n }\n\n root.value.style.visibility = 'hidden'\n root.value.style.position = 'absolute'\n\n // Remove element from DOM; plugin will re-parent it when shown\n root.value.remove()\n\n editor.registerPlugin(\n BubbleMenuPlugin({\n editor,\n element: root.value as HTMLElement,\n options,\n pluginKey,\n resizeDelay,\n appendTo,\n shouldShow,\n getReferencedVirtualElement,\n updateDelay,\n }),\n )\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n // Teleport only instantiates element + slot subtree; plugin controls final placement\n return () => h(Teleport, { to: 'body' }, h('div', { ref: root }, slots.default?.()))\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<FloatingMenuPluginProps, 'editor' | 'element'> & {\n /**\n * The DOM element that contains your menu.\n * @type {HTMLElement}\n * @default null\n */\n element: HTMLElement | null\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<FloatingMenuOptions>({\n name: 'floatingMenu',\n\n addOptions() {\n return {\n element: null,\n options: {},\n pluginKey: 'floatingMenu',\n appendTo: undefined,\n shouldShow: null,\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 options: this.options.options,\n appendTo: this.options.appendTo,\n shouldShow: this.options.shouldShow,\n }),\n ]\n },\n})\n","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 } 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 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\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<typeof offset>[0] | boolean\n flip?: Parameters<typeof flip>[0] | boolean\n shift?: Parameters<typeof shift>[0] | boolean\n arrow?: Parameters<typeof arrow>[0] | false\n size?: Parameters<typeof size>[0] | boolean\n autoPlacement?: Parameters<typeof autoPlacement>[0] | boolean\n hide?: Parameters<typeof hide>[0] | boolean\n inline?: Parameters<typeof inline>[0] | boolean\n\n onShow?: () => void\n onHide?: () => void\n onUpdate?: () => void\n onDestroy?: () => void\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 appendTo: HTMLElement | undefined\n\n public preventHide = false\n\n private isVisible = false\n\n private getTextContent(node: ProsemirrorNode) {\n return getText(node, { textSerializers: getTextSerializersFromSchema(this.editor.schema) })\n }\n\n public shouldShow: Exclude<FloatingMenuPluginProps['shouldShow'], null> = ({ 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 (!view.hasFocus() || !empty || !isRootDepth || !isEmptyTextBlock || !this.editor.isEditable) {\n return false\n }\n\n return true\n }\n\n private floatingUIOptions: NonNullable<FloatingMenuPluginProps['options']> = {\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(flip(typeof this.floatingUIOptions.flip !== 'boolean' ? this.floatingUIOptions.flip : undefined))\n }\n\n if (this.floatingUIOptions.shift) {\n middlewares.push(\n shift(typeof this.floatingUIOptions.shift !== 'boolean' ? this.floatingUIOptions.shift : undefined),\n )\n }\n\n if (this.floatingUIOptions.offset) {\n middlewares.push(\n offset(typeof this.floatingUIOptions.offset !== 'boolean' ? this.floatingUIOptions.offset : undefined),\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(size(typeof this.floatingUIOptions.size !== 'boolean' ? this.floatingUIOptions.size : undefined))\n }\n\n if (this.floatingUIOptions.autoPlacement) {\n middlewares.push(\n autoPlacement(\n typeof this.floatingUIOptions.autoPlacement !== 'boolean' ? this.floatingUIOptions.autoPlacement : undefined,\n ),\n )\n }\n\n if (this.floatingUIOptions.hide) {\n middlewares.push(hide(typeof this.floatingUIOptions.hide !== 'boolean' ? this.floatingUIOptions.hide : undefined))\n }\n\n if (this.floatingUIOptions.inline) {\n middlewares.push(\n inline(typeof this.floatingUIOptions.inline !== 'boolean' ? this.floatingUIOptions.inline : undefined),\n )\n }\n\n return middlewares\n }\n\n constructor({ editor, element, view, options, appendTo, shouldShow }: FloatingMenuViewProps) {\n this.editor = editor\n this.element = element\n this.view = view\n this.appendTo = appendTo\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\n this.update(view, view.state)\n\n if (this.getShouldShow()) {\n this.show()\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 = (view: EditorView, selectionChanged: boolean, docChanged: boolean, oldState?: EditorState) => {\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 updatePosition() {\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 }) => {\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 // attach to appendTo or editor's parent element\n ;(this.appendTo ?? 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 this.editor.off('focus', this.focusHandler)\n this.editor.off('blur', this.blurHandler)\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: typeof options.pluginKey === 'string' ? new PluginKey(options.pluginKey) : options.pluginKey,\n view: view => new FloatingMenuView({ view, ...options }),\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","import type { FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport { FloatingMenuPlugin } from '@tiptap/extension-floating-menu'\nimport type { PropType } from 'vue'\nimport { defineComponent, h, onBeforeUnmount, onMounted, ref, Teleport } from 'vue'\n\nexport const FloatingMenu = defineComponent({\n name: 'FloatingMenu',\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],\n type: null,\n default: 'floatingMenu',\n },\n\n editor: {\n type: Object as PropType<FloatingMenuPluginProps['editor']>,\n required: true,\n },\n\n options: {\n type: Object as PropType<FloatingMenuPluginProps['options']>,\n default: () => ({}),\n },\n\n appendTo: {\n type: Object as PropType<FloatingMenuPluginProps['appendTo']>,\n default: undefined,\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<FloatingMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const { pluginKey, editor, options, appendTo, shouldShow } = props\n\n if (!root.value) {\n return\n }\n\n root.value.style.visibility = 'hidden'\n root.value.style.position = 'absolute'\n\n // Remove element from DOM; plugin will re-parent it when shown\n root.value.remove()\n\n editor.registerPlugin(\n FloatingMenuPlugin({\n pluginKey,\n editor,\n element: root.value as HTMLElement,\n options,\n appendTo,\n shouldShow,\n }),\n )\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n // Teleport only instantiates element + slot subtree; plugin controls final placement\n return () => h(Teleport, { to: 'body' }, h('div', { ref: root }, slots.default?.()))\n },\n})\n"],"mappings":";AAAA,SAAS,iBAAiB;ACA1B;EAGE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;OACK;AAEP,SAAS,iBAAiB,oBAAoB;AAE9C,SAAS,eAAe,QAAQ,iBAAiB;AACjD,SAAS,qBAAqB;AAG9B,SAAS,gBAAgB,OAAgB,OAAyB;AAChE,QAAM,MAAM,KAAK,IAAI,MAAM,KAAK,MAAM,GAAG;AACzC,QAAM,SAAS,KAAK,IAAI,MAAM,QAAQ,MAAM,MAAM;AAClD,QAAM,OAAO,KAAK,IAAI,MAAM,MAAM,MAAM,IAAI;AAC5C,QAAM,QAAQ,KAAK,IAAI,MAAM,OAAO,MAAM,KAAK;AAC/C,QAAM,QAAQ,QAAQ;A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,OAAO,IAAI;AAE9B,aAAO,iBAAiB,SAAS;AAAA,IACnC,CAAC;AAGD,WAAO,MAAG;AAxEd;AAwEiB,aAAAD,GAAEI,WAAU,EAAE,IAAI,OAAO,GAAGJ,GAAE,OAAO,EAAE,KAAK,KAAK,IAAG,WAAM,YAAN,8BAAiB,CAAC;AAAA;AAAA,EACrF;AACF,CAAC;","names":["view","_a","shouldShow","BubbleMenu","Extension","arrow","autoPlacement","computePosition","flip","hide","inline","offset","shift","size","posToDOMRect","Plugin","PluginKey","view","shouldShow","defineComponent","h","onBeforeUnmount","onMounted","ref","Teleport","FloatingMenu"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiptap/vue-3",
|
|
3
3
|
"description": "Vue components for tiptap",
|
|
4
|
-
"version": "3.5.
|
|
4
|
+
"version": "3.5.2",
|
|
5
5
|
"homepage": "https://tiptap.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiptap",
|
|
@@ -40,18 +40,18 @@
|
|
|
40
40
|
],
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"vue": "^3.5.13",
|
|
43
|
-
"@tiptap/core": "^3.5.
|
|
44
|
-
"@tiptap/pm": "^3.5.
|
|
43
|
+
"@tiptap/core": "^3.5.2",
|
|
44
|
+
"@tiptap/pm": "^3.5.2"
|
|
45
45
|
},
|
|
46
46
|
"optionalDependencies": {
|
|
47
|
-
"@tiptap/extension-bubble-menu": "^3.5.
|
|
48
|
-
"@tiptap/extension-floating-menu": "^3.5.
|
|
47
|
+
"@tiptap/extension-bubble-menu": "^3.5.2",
|
|
48
|
+
"@tiptap/extension-floating-menu": "^3.5.2"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"vue": "^3.0.0",
|
|
52
52
|
"@floating-ui/dom": "^1.0.0",
|
|
53
|
-
"@tiptap/core": "^3.5.
|
|
54
|
-
"@tiptap/pm": "^3.5.
|
|
53
|
+
"@tiptap/core": "^3.5.2",
|
|
54
|
+
"@tiptap/pm": "^3.5.2"
|
|
55
55
|
},
|
|
56
56
|
"repository": {
|
|
57
57
|
"type": "git",
|
package/src/menus/BubbleMenu.ts
CHANGED
|
@@ -32,6 +32,11 @@ export const BubbleMenu = defineComponent({
|
|
|
32
32
|
default: () => ({}),
|
|
33
33
|
},
|
|
34
34
|
|
|
35
|
+
appendTo: {
|
|
36
|
+
type: Object as PropType<BubbleMenuPluginProps['appendTo']>,
|
|
37
|
+
default: undefined,
|
|
38
|
+
},
|
|
39
|
+
|
|
35
40
|
shouldShow: {
|
|
36
41
|
type: Function as PropType<Exclude<Required<BubbleMenuPluginProps>['shouldShow'], null>>,
|
|
37
42
|
default: null,
|
|
@@ -47,7 +52,16 @@ export const BubbleMenu = defineComponent({
|
|
|
47
52
|
const root = ref<HTMLElement | null>(null)
|
|
48
53
|
|
|
49
54
|
onMounted(() => {
|
|
50
|
-
const {
|
|
55
|
+
const {
|
|
56
|
+
editor,
|
|
57
|
+
options,
|
|
58
|
+
pluginKey,
|
|
59
|
+
resizeDelay,
|
|
60
|
+
appendTo,
|
|
61
|
+
shouldShow,
|
|
62
|
+
getReferencedVirtualElement,
|
|
63
|
+
updateDelay,
|
|
64
|
+
} = props
|
|
51
65
|
|
|
52
66
|
if (!root.value) {
|
|
53
67
|
return
|
|
@@ -56,7 +70,7 @@ export const BubbleMenu = defineComponent({
|
|
|
56
70
|
root.value.style.visibility = 'hidden'
|
|
57
71
|
root.value.style.position = 'absolute'
|
|
58
72
|
|
|
59
|
-
//
|
|
73
|
+
// Remove element from DOM; plugin will re-parent it when shown
|
|
60
74
|
root.value.remove()
|
|
61
75
|
|
|
62
76
|
editor.registerPlugin(
|
|
@@ -66,6 +80,7 @@ export const BubbleMenu = defineComponent({
|
|
|
66
80
|
options,
|
|
67
81
|
pluginKey,
|
|
68
82
|
resizeDelay,
|
|
83
|
+
appendTo,
|
|
69
84
|
shouldShow,
|
|
70
85
|
getReferencedVirtualElement,
|
|
71
86
|
updateDelay,
|
|
@@ -79,6 +94,7 @@ export const BubbleMenu = defineComponent({
|
|
|
79
94
|
editor.unregisterPlugin(pluginKey)
|
|
80
95
|
})
|
|
81
96
|
|
|
97
|
+
// Teleport only instantiates element + slot subtree; plugin controls final placement
|
|
82
98
|
return () => h(Teleport, { to: 'body' }, h('div', { ref: root }, slots.default?.()))
|
|
83
99
|
},
|
|
84
100
|
})
|
|
@@ -24,6 +24,11 @@ export const FloatingMenu = defineComponent({
|
|
|
24
24
|
default: () => ({}),
|
|
25
25
|
},
|
|
26
26
|
|
|
27
|
+
appendTo: {
|
|
28
|
+
type: Object as PropType<FloatingMenuPluginProps['appendTo']>,
|
|
29
|
+
default: undefined,
|
|
30
|
+
},
|
|
31
|
+
|
|
27
32
|
shouldShow: {
|
|
28
33
|
type: Function as PropType<Exclude<Required<FloatingMenuPluginProps>['shouldShow'], null>>,
|
|
29
34
|
default: null,
|
|
@@ -34,7 +39,7 @@ export const FloatingMenu = defineComponent({
|
|
|
34
39
|
const root = ref<HTMLElement | null>(null)
|
|
35
40
|
|
|
36
41
|
onMounted(() => {
|
|
37
|
-
const { pluginKey, editor, options, shouldShow } = props
|
|
42
|
+
const { pluginKey, editor, options, appendTo, shouldShow } = props
|
|
38
43
|
|
|
39
44
|
if (!root.value) {
|
|
40
45
|
return
|
|
@@ -43,7 +48,7 @@ export const FloatingMenu = defineComponent({
|
|
|
43
48
|
root.value.style.visibility = 'hidden'
|
|
44
49
|
root.value.style.position = 'absolute'
|
|
45
50
|
|
|
46
|
-
//
|
|
51
|
+
// Remove element from DOM; plugin will re-parent it when shown
|
|
47
52
|
root.value.remove()
|
|
48
53
|
|
|
49
54
|
editor.registerPlugin(
|
|
@@ -52,6 +57,7 @@ export const FloatingMenu = defineComponent({
|
|
|
52
57
|
editor,
|
|
53
58
|
element: root.value as HTMLElement,
|
|
54
59
|
options,
|
|
60
|
+
appendTo,
|
|
55
61
|
shouldShow,
|
|
56
62
|
}),
|
|
57
63
|
)
|
|
@@ -63,6 +69,7 @@ export const FloatingMenu = defineComponent({
|
|
|
63
69
|
editor.unregisterPlugin(pluginKey)
|
|
64
70
|
})
|
|
65
71
|
|
|
72
|
+
// Teleport only instantiates element + slot subtree; plugin controls final placement
|
|
66
73
|
return () => h(Teleport, { to: 'body' }, h('div', { ref: root }, slots.default?.()))
|
|
67
74
|
},
|
|
68
75
|
})
|