@tiptap/vue-2 2.26.0 → 2.26.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/index.cjs CHANGED
@@ -54,7 +54,7 @@ const BubbleMenu = {
54
54
  },
55
55
  },
56
56
  render(createElement) {
57
- return createElement('div', { style: { visibility: 'hidden' } }, this.$slots.default);
57
+ return createElement('div', {}, this.$slots.default);
58
58
  },
59
59
  beforeDestroy() {
60
60
  this.editor.unregisterPlugin(this.pluginKey);
@@ -162,7 +162,7 @@ const FloatingMenu = {
162
162
  },
163
163
  },
164
164
  render(createElement) {
165
- return createElement('div', { style: { visibility: 'hidden' } }, this.$slots.default);
165
+ return createElement('div', {}, this.$slots.default);
166
166
  },
167
167
  beforeDestroy() {
168
168
  this.editor.unregisterPlugin(this.pluginKey);
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/BubbleMenu.ts","../src/Editor.ts","../src/EditorContent.ts","../src/FloatingMenu.ts","../src/NodeViewContent.ts","../src/NodeViewWrapper.ts","../src/VueRenderer.ts","../src/VueNodeViewRenderer.ts"],"sourcesContent":["import { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport Vue, { Component, CreateElement, PropType } from 'vue'\n\nexport interface BubbleMenuInterface extends Vue {\n pluginKey: BubbleMenuPluginProps['pluginKey'],\n editor: BubbleMenuPluginProps['editor'],\n tippyOptions: BubbleMenuPluginProps['tippyOptions'],\n updateDelay: BubbleMenuPluginProps['updateDelay'],\n shouldShow: BubbleMenuPluginProps['shouldShow'],\n}\n\nexport const BubbleMenu: Component = {\n name: 'BubbleMenu',\n\n props: {\n pluginKey: {\n type: [String, Object as PropType<Exclude<BubbleMenuPluginProps['pluginKey'], string>>],\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 },\n\n tippyOptions: {\n type: Object as PropType<BubbleMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<BubbleMenuPluginProps['shouldShow'], null>>,\n default: null,\n },\n },\n\n watch: {\n editor: {\n immediate: true,\n handler(this: BubbleMenuInterface, editor: BubbleMenuPluginProps['editor']) {\n if (!editor) {\n return\n }\n\n this.$nextTick(() => {\n editor.registerPlugin(BubbleMenuPlugin({\n updateDelay: this.updateDelay,\n editor,\n element: this.$el as HTMLElement,\n pluginKey: this.pluginKey,\n shouldShow: this.shouldShow,\n tippyOptions: this.tippyOptions,\n }))\n })\n },\n },\n },\n\n render(this: BubbleMenuInterface, createElement: CreateElement) {\n return createElement('div', { style: { visibility: 'hidden' } }, this.$slots.default)\n },\n\n beforeDestroy(this: BubbleMenuInterface) {\n this.editor.unregisterPlugin(this.pluginKey)\n },\n}\n","import { Editor as CoreEditor } from '@tiptap/core'\nimport Vue from 'vue'\n\nexport class Editor extends CoreEditor {\n public contentComponent: Vue | null = null\n}\n","import Vue, { Component, CreateElement, PropType } from 'vue'\n\nimport { Editor } from './Editor.js'\n\nexport interface EditorContentInterface extends Vue {\n editor: Editor,\n}\n\nexport const EditorContent: Component = {\n name: 'EditorContent',\n\n props: {\n editor: {\n default: null,\n type: Object as PropType<Editor>,\n },\n },\n\n watch: {\n editor: {\n immediate: true,\n handler(this: EditorContentInterface, editor: Editor) {\n if (editor && editor.options.element) {\n this.$nextTick(() => {\n const element = this.$el\n\n if (!element || !editor.options.element.firstChild) {\n return\n }\n\n element.append(...editor.options.element.childNodes)\n editor.contentComponent = this\n\n editor.setOptions({\n element,\n })\n\n editor.createNodeViews()\n })\n }\n },\n },\n },\n\n render(createElement: CreateElement) {\n return createElement('div')\n },\n\n beforeDestroy(this: EditorContentInterface) {\n const { editor } = this\n\n if (!editor) {\n return\n }\n\n if (!editor.isDestroyed) {\n editor.view.setProps({\n nodeViews: {},\n })\n }\n\n editor.contentComponent = null\n\n if (!editor.options.element.firstChild) {\n return\n }\n\n const newElement = document.createElement('div')\n\n newElement.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element: newElement,\n })\n },\n}\n","import { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport Vue, { Component, CreateElement, PropType } from 'vue'\n\nexport interface FloatingMenuInterface extends Vue {\n pluginKey: FloatingMenuPluginProps['pluginKey'],\n tippyOptions: FloatingMenuPluginProps['tippyOptions'],\n editor: FloatingMenuPluginProps['editor'],\n shouldShow: FloatingMenuPluginProps['shouldShow'],\n}\n\nexport const FloatingMenu: Component = {\n name: 'FloatingMenu',\n\n props: {\n pluginKey: {\n type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],\n default: 'floatingMenu',\n },\n\n editor: {\n type: Object as PropType<FloatingMenuPluginProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<FloatingMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<FloatingMenuPluginProps['shouldShow'], null>>,\n default: null,\n },\n },\n\n watch: {\n editor: {\n immediate: true,\n handler(this: FloatingMenuInterface, editor: FloatingMenuPluginProps['editor']) {\n if (!editor) {\n return\n }\n\n this.$nextTick(() => {\n editor.registerPlugin(FloatingMenuPlugin({\n pluginKey: this.pluginKey,\n editor,\n element: this.$el as HTMLElement,\n tippyOptions: this.tippyOptions,\n shouldShow: this.shouldShow,\n }))\n })\n },\n },\n },\n\n render(this: FloatingMenuInterface, createElement: CreateElement) {\n return createElement('div', { style: { visibility: 'hidden' } }, this.$slots.default)\n },\n\n beforeDestroy(this: FloatingMenuInterface) {\n this.editor.unregisterPlugin(this.pluginKey)\n },\n}\n","import Vue, { Component, CreateElement } from 'vue'\n\nexport interface NodeViewContentInterface extends Vue {\n as: string,\n}\n\nexport const NodeViewContent: Component = {\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n render(this: NodeViewContentInterface, createElement: CreateElement) {\n return createElement(this.as, {\n style: {\n whiteSpace: 'pre-wrap',\n },\n attrs: {\n 'data-node-view-content': '',\n },\n })\n },\n}\n","import Vue, { Component, CreateElement } from 'vue'\n\nexport interface NodeViewWrapperInterface extends Vue {\n as: string,\n decorationClasses: {\n value: string,\n },\n onDragStart: () => void,\n}\n\nexport const NodeViewWrapper: Component = {\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n inject: ['onDragStart', 'decorationClasses'],\n\n render(this: NodeViewWrapperInterface, createElement: CreateElement) {\n return createElement(\n this.as,\n {\n class: this.decorationClasses.value,\n style: {\n whiteSpace: 'normal',\n },\n attrs: {\n 'data-node-view-wrapper': '',\n },\n on: {\n dragstart: this.onDragStart,\n },\n },\n this.$slots.default,\n )\n },\n}\n","import Vue from 'vue'\nimport { VueConstructor } from 'vue/types/umd'\n\n/**\n * The VueRenderer class is responsible for rendering a Vue component as a ProseMirror node view.\n */\nexport class VueRenderer {\n ref!: Vue\n\n constructor(component: Vue | VueConstructor, props: any) {\n const Component = (typeof component === 'function') ? component : Vue.extend(component)\n\n this.ref = new Component(props).$mount()\n }\n\n get element(): Element {\n return this.ref.$el\n }\n\n updateProps(props: Record<string, any> = {}): void {\n if (!this.ref.$props) {\n return\n }\n\n // prevents `Avoid mutating a prop directly` error message\n // Fix: `VueNodeViewRenderer` change vue Constructor `config.silent` not working\n const currentVueConstructor = this.ref.$props.editor?.contentComponent?.$options._base ?? Vue // eslint-disable-line\n const originalSilent = currentVueConstructor.config.silent\n\n currentVueConstructor.config.silent = true\n\n Object\n .entries(props)\n .forEach(([key, value]) => {\n this.ref.$props[key] = value\n })\n\n currentVueConstructor.config.silent = originalSilent\n }\n\n destroy(): void {\n this.ref.$destroy()\n }\n}\n","import {\n DecorationWithType,\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererOptions,\n} from '@tiptap/core'\nimport { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { Decoration, DecorationSource, NodeView as ProseMirrorNodeView } from '@tiptap/pm/view'\nimport Vue from 'vue'\nimport { VueConstructor } from 'vue/types/umd'\nimport { booleanProp, functionProp, objectProp } from 'vue-ts-types'\n\nimport { Editor } from './Editor.js'\nimport { VueRenderer } from './VueRenderer.js'\n\nexport const nodeViewProps = {\n editor: objectProp<NodeViewProps['editor']>().required,\n node: objectProp<NodeViewProps['node']>().required,\n decorations: objectProp<NodeViewProps['decorations']>().required,\n selected: booleanProp().required,\n extension: objectProp<NodeViewProps['extension']>().required,\n getPos: functionProp<NodeViewProps['getPos']>().required,\n updateAttributes: functionProp<NodeViewProps['updateAttributes']>().required,\n deleteNode: functionProp<NodeViewProps['deleteNode']>().required,\n}\n\nexport interface VueNodeViewRendererOptions extends NodeViewRendererOptions {\n update:\n | ((props: {\n oldNode: ProseMirrorNode;\n oldDecorations: readonly Decoration[];\n oldInnerDecorations: DecorationSource;\n newNode: ProseMirrorNode;\n newDecorations: readonly Decoration[];\n innerDecorations: DecorationSource;\n updateProps: () => void;\n }) => boolean)\n | null;\n}\n\nclass VueNodeView extends NodeView<Vue | VueConstructor, Editor, VueNodeViewRendererOptions> {\n renderer!: VueRenderer\n\n decorationClasses!: {\n value: string;\n }\n\n mount() {\n const props = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations as DecorationWithType[],\n innerDecorations: this.innerDecorations,\n view: this.view,\n selected: false,\n extension: this.extension,\n HTMLAttributes: this.HTMLAttributes,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n deleteNode: () => this.deleteNode(),\n } satisfies NodeViewProps\n\n const onDragStart = this.onDragStart.bind(this)\n\n this.decorationClasses = Vue.observable({\n value: this.getDecorationClasses(),\n })\n\n // @ts-ignore\n const vue = this.editor.contentComponent?.$options._base ?? Vue; // eslint-disable-line\n\n const Component = vue.extend(this.component).extend({\n props: Object.keys(props),\n provide: () => {\n return {\n onDragStart,\n decorationClasses: this.decorationClasses,\n }\n },\n })\n\n this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this)\n this.editor.on('selectionUpdate', this.handleSelectionUpdate)\n\n this.renderer = new VueRenderer(Component, {\n parent: this.editor.contentComponent,\n propsData: props,\n })\n }\n\n /**\n * Return the DOM element.\n * This is the element that will be used to display the node view.\n */\n get dom() {\n if (!this.renderer.element.hasAttribute('data-node-view-wrapper')) {\n throw Error('Please use the NodeViewWrapper component for your node view.')\n }\n\n return this.renderer.element as HTMLElement\n }\n\n /**\n * Return the content DOM element.\n * This is the element that will be used to display the rich-text content of the node.\n */\n get contentDOM() {\n if (this.node.isLeaf) {\n return null\n }\n\n const contentElement = this.dom.querySelector('[data-node-view-content]')\n\n return (contentElement || this.dom) as HTMLElement | null\n }\n\n /**\n * On editor selection update, check if the node is selected.\n * If it is, call `selectNode`, otherwise call `deselectNode`.\n */\n handleSelectionUpdate() {\n const { from, to } = this.editor.state.selection\n const pos = this.getPos()\n\n if (typeof pos !== 'number') {\n return\n }\n\n if (from <= pos && to >= pos + this.node.nodeSize) {\n if (this.renderer.ref.$props.selected) {\n return\n }\n\n this.selectNode()\n } else {\n if (!this.renderer.ref.$props.selected) {\n return\n }\n\n this.deselectNode()\n }\n }\n\n /**\n * On update, update the React component.\n * To prevent unnecessary updates, the `update` option can be used.\n */\n update(\n node: ProseMirrorNode,\n decorations: readonly Decoration[],\n innerDecorations: DecorationSource,\n ): boolean {\n const rerenderComponent = (props?: Record<string, any>) => {\n this.decorationClasses.value = this.getDecorationClasses()\n this.renderer.updateProps(props)\n }\n\n if (typeof this.options.update === 'function') {\n const oldNode = this.node\n const oldDecorations = this.decorations\n const oldInnerDecorations = this.innerDecorations\n\n this.node = node\n this.decorations = decorations\n this.innerDecorations = innerDecorations\n\n return this.options.update({\n oldNode,\n oldDecorations,\n newNode: node,\n newDecorations: decorations,\n oldInnerDecorations,\n innerDecorations,\n updateProps: () => rerenderComponent({ node, decorations, innerDecorations }),\n })\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (node === this.node && this.decorations === decorations && this.innerDecorations === innerDecorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n this.innerDecorations = innerDecorations\n\n rerenderComponent({ node, decorations, innerDecorations })\n\n return true\n }\n\n /**\n * Select the node.\n * Add the `selected` prop and the `ProseMirror-selectednode` class.\n */\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n this.renderer.element.classList.add('ProseMirror-selectednode')\n }\n\n /**\n * Deselect the node.\n * Remove the `selected` prop and the `ProseMirror-selectednode` class.\n */\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n this.renderer.element.classList.remove('ProseMirror-selectednode')\n }\n\n getDecorationClasses() {\n return (\n this.decorations\n // @ts-ignore\n .map(item => item.type.attrs.class)\n .flat()\n .join(' ')\n )\n }\n\n destroy() {\n this.renderer.destroy()\n this.editor.off('selectionUpdate', this.handleSelectionUpdate)\n }\n}\n\nexport function VueNodeViewRenderer(\n component: Vue | VueConstructor,\n options?: Partial<VueNodeViewRendererOptions>,\n): NodeViewRenderer {\n return props => {\n // try to get the parent component\n // this is important for vue devtools to show the component hierarchy correctly\n // maybe it’s `undefined` because <editor-content> isn’t rendered yet\n if (!(props.editor as Editor).contentComponent) {\n return {} as unknown as ProseMirrorNodeView\n }\n\n return new VueNodeView(component, props, options)\n }\n}\n"],"names":["BubbleMenuPlugin","CoreEditor","FloatingMenuPlugin","Vue","objectProp","booleanProp","functionProp","NodeView"],"mappings":";;;;;;;;;;;;AAWa,MAAA,UAAU,GAAc;AACnC,IAAA,IAAI,EAAE,YAAY;AAElB,IAAA,KAAK,EAAE;AACL,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,CAAC,MAAM,EAAE,MAAuE,CAAC;AACvF,YAAA,OAAO,EAAE,YAAY;AACtB,SAAA;AAED,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAmD;AACzD,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AAED,QAAA,WAAW,EAAE;AACX,YAAA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SAAS,CAAC,MAAM,CAAC,0BAA0B,CAAC;;IAGpE,oBAAoB,GAAA;QAClB,QACE,IAAI,CAAC;;AAEF,aAAA,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK;AACjC,aAAA,IAAI;AACJ,aAAA,IAAI,CAAC,GAAG,CAAC;;IAIhB,OAAO,GAAA;AACL,QAAA,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE;QACvB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,iBAAiB,EAAE,IAAI,CAAC,qBAAqB,CAAC;;AAEjE;AAEe,SAAA,mBAAmB,CACjC,SAA+B,EAC/B,OAA6C,EAAA;IAE7C,OAAO,KAAK,IAAG;;;;AAIb,QAAA,IAAI,CAAE,KAAK,CAAC,MAAiB,CAAC,gBAAgB,EAAE;AAC9C,YAAA,OAAO,EAAoC;;QAG7C,OAAO,IAAI,WAAW,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC;AACnD,KAAC;AACH;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../src/BubbleMenu.ts","../src/Editor.ts","../src/EditorContent.ts","../src/FloatingMenu.ts","../src/NodeViewContent.ts","../src/NodeViewWrapper.ts","../src/VueRenderer.ts","../src/VueNodeViewRenderer.ts"],"sourcesContent":["import { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport Vue, { Component, CreateElement, PropType } from 'vue'\n\nexport interface BubbleMenuInterface extends Vue {\n pluginKey: BubbleMenuPluginProps['pluginKey'],\n editor: BubbleMenuPluginProps['editor'],\n tippyOptions: BubbleMenuPluginProps['tippyOptions'],\n updateDelay: BubbleMenuPluginProps['updateDelay'],\n shouldShow: BubbleMenuPluginProps['shouldShow'],\n}\n\nexport const BubbleMenu: Component = {\n name: 'BubbleMenu',\n\n props: {\n pluginKey: {\n type: [String, Object as PropType<Exclude<BubbleMenuPluginProps['pluginKey'], string>>],\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 },\n\n tippyOptions: {\n type: Object as PropType<BubbleMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<BubbleMenuPluginProps['shouldShow'], null>>,\n default: null,\n },\n },\n\n watch: {\n editor: {\n immediate: true,\n handler(this: BubbleMenuInterface, editor: BubbleMenuPluginProps['editor']) {\n if (!editor) {\n return\n }\n\n this.$nextTick(() => {\n editor.registerPlugin(BubbleMenuPlugin({\n updateDelay: this.updateDelay,\n editor,\n element: this.$el as HTMLElement,\n pluginKey: this.pluginKey,\n shouldShow: this.shouldShow,\n tippyOptions: this.tippyOptions,\n }))\n })\n },\n },\n },\n\n render(this: BubbleMenuInterface, createElement: CreateElement) {\n return createElement('div', {}, this.$slots.default)\n },\n\n beforeDestroy(this: BubbleMenuInterface) {\n this.editor.unregisterPlugin(this.pluginKey)\n },\n}\n","import { Editor as CoreEditor } from '@tiptap/core'\nimport Vue from 'vue'\n\nexport class Editor extends CoreEditor {\n public contentComponent: Vue | null = null\n}\n","import Vue, { Component, CreateElement, PropType } from 'vue'\n\nimport { Editor } from './Editor.js'\n\nexport interface EditorContentInterface extends Vue {\n editor: Editor,\n}\n\nexport const EditorContent: Component = {\n name: 'EditorContent',\n\n props: {\n editor: {\n default: null,\n type: Object as PropType<Editor>,\n },\n },\n\n watch: {\n editor: {\n immediate: true,\n handler(this: EditorContentInterface, editor: Editor) {\n if (editor && editor.options.element) {\n this.$nextTick(() => {\n const element = this.$el\n\n if (!element || !editor.options.element.firstChild) {\n return\n }\n\n element.append(...editor.options.element.childNodes)\n editor.contentComponent = this\n\n editor.setOptions({\n element,\n })\n\n editor.createNodeViews()\n })\n }\n },\n },\n },\n\n render(createElement: CreateElement) {\n return createElement('div')\n },\n\n beforeDestroy(this: EditorContentInterface) {\n const { editor } = this\n\n if (!editor) {\n return\n }\n\n if (!editor.isDestroyed) {\n editor.view.setProps({\n nodeViews: {},\n })\n }\n\n editor.contentComponent = null\n\n if (!editor.options.element.firstChild) {\n return\n }\n\n const newElement = document.createElement('div')\n\n newElement.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element: newElement,\n })\n },\n}\n","import { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport Vue, { Component, CreateElement, PropType } from 'vue'\n\nexport interface FloatingMenuInterface extends Vue {\n pluginKey: FloatingMenuPluginProps['pluginKey'],\n tippyOptions: FloatingMenuPluginProps['tippyOptions'],\n editor: FloatingMenuPluginProps['editor'],\n shouldShow: FloatingMenuPluginProps['shouldShow'],\n}\n\nexport const FloatingMenu: Component = {\n name: 'FloatingMenu',\n\n props: {\n pluginKey: {\n type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],\n default: 'floatingMenu',\n },\n\n editor: {\n type: Object as PropType<FloatingMenuPluginProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<FloatingMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<FloatingMenuPluginProps['shouldShow'], null>>,\n default: null,\n },\n },\n\n watch: {\n editor: {\n immediate: true,\n handler(this: FloatingMenuInterface, editor: FloatingMenuPluginProps['editor']) {\n if (!editor) {\n return\n }\n\n this.$nextTick(() => {\n editor.registerPlugin(FloatingMenuPlugin({\n pluginKey: this.pluginKey,\n editor,\n element: this.$el as HTMLElement,\n tippyOptions: this.tippyOptions,\n shouldShow: this.shouldShow,\n }))\n })\n },\n },\n },\n\n render(this: FloatingMenuInterface, createElement: CreateElement) {\n return createElement('div', {}, this.$slots.default)\n },\n\n beforeDestroy(this: FloatingMenuInterface) {\n this.editor.unregisterPlugin(this.pluginKey)\n },\n}\n","import Vue, { Component, CreateElement } from 'vue'\n\nexport interface NodeViewContentInterface extends Vue {\n as: string,\n}\n\nexport const NodeViewContent: Component = {\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n render(this: NodeViewContentInterface, createElement: CreateElement) {\n return createElement(this.as, {\n style: {\n whiteSpace: 'pre-wrap',\n },\n attrs: {\n 'data-node-view-content': '',\n },\n })\n },\n}\n","import Vue, { Component, CreateElement } from 'vue'\n\nexport interface NodeViewWrapperInterface extends Vue {\n as: string,\n decorationClasses: {\n value: string,\n },\n onDragStart: () => void,\n}\n\nexport const NodeViewWrapper: Component = {\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n inject: ['onDragStart', 'decorationClasses'],\n\n render(this: NodeViewWrapperInterface, createElement: CreateElement) {\n return createElement(\n this.as,\n {\n class: this.decorationClasses.value,\n style: {\n whiteSpace: 'normal',\n },\n attrs: {\n 'data-node-view-wrapper': '',\n },\n on: {\n dragstart: this.onDragStart,\n },\n },\n this.$slots.default,\n )\n },\n}\n","import Vue from 'vue'\nimport { VueConstructor } from 'vue/types/umd'\n\n/**\n * The VueRenderer class is responsible for rendering a Vue component as a ProseMirror node view.\n */\nexport class VueRenderer {\n ref!: Vue\n\n constructor(component: Vue | VueConstructor, props: any) {\n const Component = (typeof component === 'function') ? component : Vue.extend(component)\n\n this.ref = new Component(props).$mount()\n }\n\n get element(): Element {\n return this.ref.$el\n }\n\n updateProps(props: Record<string, any> = {}): void {\n if (!this.ref.$props) {\n return\n }\n\n // prevents `Avoid mutating a prop directly` error message\n // Fix: `VueNodeViewRenderer` change vue Constructor `config.silent` not working\n const currentVueConstructor = this.ref.$props.editor?.contentComponent?.$options._base ?? Vue // eslint-disable-line\n const originalSilent = currentVueConstructor.config.silent\n\n currentVueConstructor.config.silent = true\n\n Object\n .entries(props)\n .forEach(([key, value]) => {\n this.ref.$props[key] = value\n })\n\n currentVueConstructor.config.silent = originalSilent\n }\n\n destroy(): void {\n this.ref.$destroy()\n }\n}\n","import {\n DecorationWithType,\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererOptions,\n} from '@tiptap/core'\nimport { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { Decoration, DecorationSource, NodeView as ProseMirrorNodeView } from '@tiptap/pm/view'\nimport Vue from 'vue'\nimport { VueConstructor } from 'vue/types/umd'\nimport { booleanProp, functionProp, objectProp } from 'vue-ts-types'\n\nimport { Editor } from './Editor.js'\nimport { VueRenderer } from './VueRenderer.js'\n\nexport const nodeViewProps = {\n editor: objectProp<NodeViewProps['editor']>().required,\n node: objectProp<NodeViewProps['node']>().required,\n decorations: objectProp<NodeViewProps['decorations']>().required,\n selected: booleanProp().required,\n extension: objectProp<NodeViewProps['extension']>().required,\n getPos: functionProp<NodeViewProps['getPos']>().required,\n updateAttributes: functionProp<NodeViewProps['updateAttributes']>().required,\n deleteNode: functionProp<NodeViewProps['deleteNode']>().required,\n}\n\nexport interface VueNodeViewRendererOptions extends NodeViewRendererOptions {\n update:\n | ((props: {\n oldNode: ProseMirrorNode;\n oldDecorations: readonly Decoration[];\n oldInnerDecorations: DecorationSource;\n newNode: ProseMirrorNode;\n newDecorations: readonly Decoration[];\n innerDecorations: DecorationSource;\n updateProps: () => void;\n }) => boolean)\n | null;\n}\n\nclass VueNodeView extends NodeView<Vue | VueConstructor, Editor, VueNodeViewRendererOptions> {\n renderer!: VueRenderer\n\n decorationClasses!: {\n value: string;\n }\n\n mount() {\n const props = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations as DecorationWithType[],\n innerDecorations: this.innerDecorations,\n view: this.view,\n selected: false,\n extension: this.extension,\n HTMLAttributes: this.HTMLAttributes,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n deleteNode: () => this.deleteNode(),\n } satisfies NodeViewProps\n\n const onDragStart = this.onDragStart.bind(this)\n\n this.decorationClasses = Vue.observable({\n value: this.getDecorationClasses(),\n })\n\n // @ts-ignore\n const vue = this.editor.contentComponent?.$options._base ?? Vue; // eslint-disable-line\n\n const Component = vue.extend(this.component).extend({\n props: Object.keys(props),\n provide: () => {\n return {\n onDragStart,\n decorationClasses: this.decorationClasses,\n }\n },\n })\n\n this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this)\n this.editor.on('selectionUpdate', this.handleSelectionUpdate)\n\n this.renderer = new VueRenderer(Component, {\n parent: this.editor.contentComponent,\n propsData: props,\n })\n }\n\n /**\n * Return the DOM element.\n * This is the element that will be used to display the node view.\n */\n get dom() {\n if (!this.renderer.element.hasAttribute('data-node-view-wrapper')) {\n throw Error('Please use the NodeViewWrapper component for your node view.')\n }\n\n return this.renderer.element as HTMLElement\n }\n\n /**\n * Return the content DOM element.\n * This is the element that will be used to display the rich-text content of the node.\n */\n get contentDOM() {\n if (this.node.isLeaf) {\n return null\n }\n\n const contentElement = this.dom.querySelector('[data-node-view-content]')\n\n return (contentElement || this.dom) as HTMLElement | null\n }\n\n /**\n * On editor selection update, check if the node is selected.\n * If it is, call `selectNode`, otherwise call `deselectNode`.\n */\n handleSelectionUpdate() {\n const { from, to } = this.editor.state.selection\n const pos = this.getPos()\n\n if (typeof pos !== 'number') {\n return\n }\n\n if (from <= pos && to >= pos + this.node.nodeSize) {\n if (this.renderer.ref.$props.selected) {\n return\n }\n\n this.selectNode()\n } else {\n if (!this.renderer.ref.$props.selected) {\n return\n }\n\n this.deselectNode()\n }\n }\n\n /**\n * On update, update the React component.\n * To prevent unnecessary updates, the `update` option can be used.\n */\n update(\n node: ProseMirrorNode,\n decorations: readonly Decoration[],\n innerDecorations: DecorationSource,\n ): boolean {\n const rerenderComponent = (props?: Record<string, any>) => {\n this.decorationClasses.value = this.getDecorationClasses()\n this.renderer.updateProps(props)\n }\n\n if (typeof this.options.update === 'function') {\n const oldNode = this.node\n const oldDecorations = this.decorations\n const oldInnerDecorations = this.innerDecorations\n\n this.node = node\n this.decorations = decorations\n this.innerDecorations = innerDecorations\n\n return this.options.update({\n oldNode,\n oldDecorations,\n newNode: node,\n newDecorations: decorations,\n oldInnerDecorations,\n innerDecorations,\n updateProps: () => rerenderComponent({ node, decorations, innerDecorations }),\n })\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (node === this.node && this.decorations === decorations && this.innerDecorations === innerDecorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n this.innerDecorations = innerDecorations\n\n rerenderComponent({ node, decorations, innerDecorations })\n\n return true\n }\n\n /**\n * Select the node.\n * Add the `selected` prop and the `ProseMirror-selectednode` class.\n */\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n this.renderer.element.classList.add('ProseMirror-selectednode')\n }\n\n /**\n * Deselect the node.\n * Remove the `selected` prop and the `ProseMirror-selectednode` class.\n */\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n this.renderer.element.classList.remove('ProseMirror-selectednode')\n }\n\n getDecorationClasses() {\n return (\n this.decorations\n // @ts-ignore\n .map(item => item.type.attrs.class)\n .flat()\n .join(' ')\n )\n }\n\n destroy() {\n this.renderer.destroy()\n this.editor.off('selectionUpdate', this.handleSelectionUpdate)\n }\n}\n\nexport function VueNodeViewRenderer(\n component: Vue | VueConstructor,\n options?: Partial<VueNodeViewRendererOptions>,\n): NodeViewRenderer {\n return props => {\n // try to get the parent component\n // this is important for vue devtools to show the component hierarchy correctly\n // maybe it’s `undefined` because <editor-content> isn’t rendered yet\n if (!(props.editor as Editor).contentComponent) {\n return {} as unknown as ProseMirrorNodeView\n }\n\n return new VueNodeView(component, props, options)\n }\n}\n"],"names":["BubbleMenuPlugin","CoreEditor","FloatingMenuPlugin","Vue","objectProp","booleanProp","functionProp","NodeView"],"mappings":";;;;;;;;;;;;AAWa,MAAA,UAAU,GAAc;AACnC,IAAA,IAAI,EAAE,YAAY;AAElB,IAAA,KAAK,EAAE;AACL,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,CAAC,MAAM,EAAE,MAAuE,CAAC;AACvF,YAAA,OAAO,EAAE,YAAY;AACtB,SAAA;AAED,QAAA,MAAM,EAAE;AACN,YAAA,IAAI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C,SAAS,CAAC,MAAM,CAAC,0BAA0B,CAAC;;IAGpE,oBAAoB,GAAA;QAClB,QACE,IAAI,CAAC;;AAEF,aAAA,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK;AACjC,aAAA,IAAI;AACJ,aAAA,IAAI,CAAC,GAAG,CAAC;;IAIhB,OAAO,GAAA;AACL,QAAA,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE;QACvB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,iBAAiB,EAAE,IAAI,CAAC,qBAAqB,CAAC;;AAEjE;AAEe,SAAA,mBAAmB,CACjC,SAA+B,EAC/B,OAA6C,EAAA;IAE7C,OAAO,KAAK,IAAG;;;;AAIb,QAAA,IAAI,CAAE,KAAK,CAAC,MAAiB,CAAC,gBAAgB,EAAE;AAC9C,YAAA,OAAO,EAAoC;;QAG7C,OAAO,IAAI,WAAW,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC;AACnD,KAAC;AACH;;;;;;;;;;;;;;;;;;"}
package/dist/index.js CHANGED
@@ -49,7 +49,7 @@ const BubbleMenu = {
49
49
  },
50
50
  },
51
51
  render(createElement) {
52
- return createElement('div', { style: { visibility: 'hidden' } }, this.$slots.default);
52
+ return createElement('div', {}, this.$slots.default);
53
53
  },
54
54
  beforeDestroy() {
55
55
  this.editor.unregisterPlugin(this.pluginKey);
@@ -157,7 +157,7 @@ const FloatingMenu = {
157
157
  },
158
158
  },
159
159
  render(createElement) {
160
- return createElement('div', { style: { visibility: 'hidden' } }, this.$slots.default);
160
+ return createElement('div', {}, this.$slots.default);
161
161
  },
162
162
  beforeDestroy() {
163
163
  this.editor.unregisterPlugin(this.pluginKey);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/BubbleMenu.ts","../src/Editor.ts","../src/EditorContent.ts","../src/FloatingMenu.ts","../src/NodeViewContent.ts","../src/NodeViewWrapper.ts","../src/VueRenderer.ts","../src/VueNodeViewRenderer.ts"],"sourcesContent":["import { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport Vue, { Component, CreateElement, PropType } from 'vue'\n\nexport interface BubbleMenuInterface extends Vue {\n pluginKey: BubbleMenuPluginProps['pluginKey'],\n editor: BubbleMenuPluginProps['editor'],\n tippyOptions: BubbleMenuPluginProps['tippyOptions'],\n updateDelay: BubbleMenuPluginProps['updateDelay'],\n shouldShow: BubbleMenuPluginProps['shouldShow'],\n}\n\nexport const BubbleMenu: Component = {\n name: 'BubbleMenu',\n\n props: {\n pluginKey: {\n type: [String, Object as PropType<Exclude<BubbleMenuPluginProps['pluginKey'], string>>],\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 },\n\n tippyOptions: {\n type: Object as PropType<BubbleMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<BubbleMenuPluginProps['shouldShow'], null>>,\n default: null,\n },\n },\n\n watch: {\n editor: {\n immediate: true,\n handler(this: BubbleMenuInterface, editor: BubbleMenuPluginProps['editor']) {\n if (!editor) {\n return\n }\n\n this.$nextTick(() => {\n editor.registerPlugin(BubbleMenuPlugin({\n updateDelay: this.updateDelay,\n editor,\n element: this.$el as HTMLElement,\n pluginKey: this.pluginKey,\n shouldShow: this.shouldShow,\n tippyOptions: this.tippyOptions,\n }))\n })\n },\n },\n },\n\n render(this: BubbleMenuInterface, createElement: CreateElement) {\n return createElement('div', { style: { visibility: 'hidden' } }, this.$slots.default)\n },\n\n beforeDestroy(this: BubbleMenuInterface) {\n this.editor.unregisterPlugin(this.pluginKey)\n },\n}\n","import { Editor as CoreEditor } from '@tiptap/core'\nimport Vue from 'vue'\n\nexport class Editor extends CoreEditor {\n public contentComponent: Vue | null = null\n}\n","import Vue, { Component, CreateElement, PropType } from 'vue'\n\nimport { Editor } from './Editor.js'\n\nexport interface EditorContentInterface extends Vue {\n editor: Editor,\n}\n\nexport const EditorContent: Component = {\n name: 'EditorContent',\n\n props: {\n editor: {\n default: null,\n type: Object as PropType<Editor>,\n },\n },\n\n watch: {\n editor: {\n immediate: true,\n handler(this: EditorContentInterface, editor: Editor) {\n if (editor && editor.options.element) {\n this.$nextTick(() => {\n const element = this.$el\n\n if (!element || !editor.options.element.firstChild) {\n return\n }\n\n element.append(...editor.options.element.childNodes)\n editor.contentComponent = this\n\n editor.setOptions({\n element,\n })\n\n editor.createNodeViews()\n })\n }\n },\n },\n },\n\n render(createElement: CreateElement) {\n return createElement('div')\n },\n\n beforeDestroy(this: EditorContentInterface) {\n const { editor } = this\n\n if (!editor) {\n return\n }\n\n if (!editor.isDestroyed) {\n editor.view.setProps({\n nodeViews: {},\n })\n }\n\n editor.contentComponent = null\n\n if (!editor.options.element.firstChild) {\n return\n }\n\n const newElement = document.createElement('div')\n\n newElement.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element: newElement,\n })\n },\n}\n","import { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport Vue, { Component, CreateElement, PropType } from 'vue'\n\nexport interface FloatingMenuInterface extends Vue {\n pluginKey: FloatingMenuPluginProps['pluginKey'],\n tippyOptions: FloatingMenuPluginProps['tippyOptions'],\n editor: FloatingMenuPluginProps['editor'],\n shouldShow: FloatingMenuPluginProps['shouldShow'],\n}\n\nexport const FloatingMenu: Component = {\n name: 'FloatingMenu',\n\n props: {\n pluginKey: {\n type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],\n default: 'floatingMenu',\n },\n\n editor: {\n type: Object as PropType<FloatingMenuPluginProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<FloatingMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<FloatingMenuPluginProps['shouldShow'], null>>,\n default: null,\n },\n },\n\n watch: {\n editor: {\n immediate: true,\n handler(this: FloatingMenuInterface, editor: FloatingMenuPluginProps['editor']) {\n if (!editor) {\n return\n }\n\n this.$nextTick(() => {\n editor.registerPlugin(FloatingMenuPlugin({\n pluginKey: this.pluginKey,\n editor,\n element: this.$el as HTMLElement,\n tippyOptions: this.tippyOptions,\n shouldShow: this.shouldShow,\n }))\n })\n },\n },\n },\n\n render(this: FloatingMenuInterface, createElement: CreateElement) {\n return createElement('div', { style: { visibility: 'hidden' } }, this.$slots.default)\n },\n\n beforeDestroy(this: FloatingMenuInterface) {\n this.editor.unregisterPlugin(this.pluginKey)\n },\n}\n","import Vue, { Component, CreateElement } from 'vue'\n\nexport interface NodeViewContentInterface extends Vue {\n as: string,\n}\n\nexport const NodeViewContent: Component = {\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n render(this: NodeViewContentInterface, createElement: CreateElement) {\n return createElement(this.as, {\n style: {\n whiteSpace: 'pre-wrap',\n },\n attrs: {\n 'data-node-view-content': '',\n },\n })\n },\n}\n","import Vue, { Component, CreateElement } from 'vue'\n\nexport interface NodeViewWrapperInterface extends Vue {\n as: string,\n decorationClasses: {\n value: string,\n },\n onDragStart: () => void,\n}\n\nexport const NodeViewWrapper: Component = {\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n inject: ['onDragStart', 'decorationClasses'],\n\n render(this: NodeViewWrapperInterface, createElement: CreateElement) {\n return createElement(\n this.as,\n {\n class: this.decorationClasses.value,\n style: {\n whiteSpace: 'normal',\n },\n attrs: {\n 'data-node-view-wrapper': '',\n },\n on: {\n dragstart: this.onDragStart,\n },\n },\n this.$slots.default,\n )\n },\n}\n","import Vue from 'vue'\nimport { VueConstructor } from 'vue/types/umd'\n\n/**\n * The VueRenderer class is responsible for rendering a Vue component as a ProseMirror node view.\n */\nexport class VueRenderer {\n ref!: Vue\n\n constructor(component: Vue | VueConstructor, props: any) {\n const Component = (typeof component === 'function') ? component : Vue.extend(component)\n\n this.ref = new Component(props).$mount()\n }\n\n get element(): Element {\n return this.ref.$el\n }\n\n updateProps(props: Record<string, any> = {}): void {\n if (!this.ref.$props) {\n return\n }\n\n // prevents `Avoid mutating a prop directly` error message\n // Fix: `VueNodeViewRenderer` change vue Constructor `config.silent` not working\n const currentVueConstructor = this.ref.$props.editor?.contentComponent?.$options._base ?? Vue // eslint-disable-line\n const originalSilent = currentVueConstructor.config.silent\n\n currentVueConstructor.config.silent = true\n\n Object\n .entries(props)\n .forEach(([key, value]) => {\n this.ref.$props[key] = value\n })\n\n currentVueConstructor.config.silent = originalSilent\n }\n\n destroy(): void {\n this.ref.$destroy()\n }\n}\n","import {\n DecorationWithType,\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererOptions,\n} from '@tiptap/core'\nimport { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { Decoration, DecorationSource, NodeView as ProseMirrorNodeView } from '@tiptap/pm/view'\nimport Vue from 'vue'\nimport { VueConstructor } from 'vue/types/umd'\nimport { booleanProp, functionProp, objectProp } from 'vue-ts-types'\n\nimport { Editor } from './Editor.js'\nimport { VueRenderer } from './VueRenderer.js'\n\nexport const nodeViewProps = {\n editor: objectProp<NodeViewProps['editor']>().required,\n node: objectProp<NodeViewProps['node']>().required,\n decorations: objectProp<NodeViewProps['decorations']>().required,\n selected: booleanProp().required,\n extension: objectProp<NodeViewProps['extension']>().required,\n getPos: functionProp<NodeViewProps['getPos']>().required,\n updateAttributes: functionProp<NodeViewProps['updateAttributes']>().required,\n deleteNode: functionProp<NodeViewProps['deleteNode']>().required,\n}\n\nexport interface VueNodeViewRendererOptions extends NodeViewRendererOptions {\n update:\n | ((props: {\n oldNode: ProseMirrorNode;\n oldDecorations: readonly Decoration[];\n oldInnerDecorations: DecorationSource;\n newNode: ProseMirrorNode;\n newDecorations: readonly Decoration[];\n innerDecorations: DecorationSource;\n updateProps: () => void;\n }) => boolean)\n | null;\n}\n\nclass VueNodeView extends NodeView<Vue | VueConstructor, Editor, VueNodeViewRendererOptions> {\n renderer!: VueRenderer\n\n decorationClasses!: {\n value: string;\n }\n\n mount() {\n const props = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations as DecorationWithType[],\n innerDecorations: this.innerDecorations,\n view: this.view,\n selected: false,\n extension: this.extension,\n HTMLAttributes: this.HTMLAttributes,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n deleteNode: () => this.deleteNode(),\n } satisfies NodeViewProps\n\n const onDragStart = this.onDragStart.bind(this)\n\n this.decorationClasses = Vue.observable({\n value: this.getDecorationClasses(),\n })\n\n // @ts-ignore\n const vue = this.editor.contentComponent?.$options._base ?? Vue; // eslint-disable-line\n\n const Component = vue.extend(this.component).extend({\n props: Object.keys(props),\n provide: () => {\n return {\n onDragStart,\n decorationClasses: this.decorationClasses,\n }\n },\n })\n\n this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this)\n this.editor.on('selectionUpdate', this.handleSelectionUpdate)\n\n this.renderer = new VueRenderer(Component, {\n parent: this.editor.contentComponent,\n propsData: props,\n })\n }\n\n /**\n * Return the DOM element.\n * This is the element that will be used to display the node view.\n */\n get dom() {\n if (!this.renderer.element.hasAttribute('data-node-view-wrapper')) {\n throw Error('Please use the NodeViewWrapper component for your node view.')\n }\n\n return this.renderer.element as HTMLElement\n }\n\n /**\n * Return the content DOM element.\n * This is the element that will be used to display the rich-text content of the node.\n */\n get contentDOM() {\n if (this.node.isLeaf) {\n return null\n }\n\n const contentElement = this.dom.querySelector('[data-node-view-content]')\n\n return (contentElement || this.dom) as HTMLElement | null\n }\n\n /**\n * On editor selection update, check if the node is selected.\n * If it is, call `selectNode`, otherwise call `deselectNode`.\n */\n handleSelectionUpdate() {\n const { from, to } = this.editor.state.selection\n const pos = this.getPos()\n\n if (typeof pos !== 'number') {\n return\n }\n\n if (from <= pos && to >= pos + this.node.nodeSize) {\n if (this.renderer.ref.$props.selected) {\n return\n }\n\n this.selectNode()\n } else {\n if (!this.renderer.ref.$props.selected) {\n return\n }\n\n this.deselectNode()\n }\n }\n\n /**\n * On update, update the React component.\n * To prevent unnecessary updates, the `update` option can be used.\n */\n update(\n node: ProseMirrorNode,\n decorations: readonly Decoration[],\n innerDecorations: DecorationSource,\n ): boolean {\n const rerenderComponent = (props?: Record<string, any>) => {\n this.decorationClasses.value = this.getDecorationClasses()\n this.renderer.updateProps(props)\n }\n\n if (typeof this.options.update === 'function') {\n const oldNode = this.node\n const oldDecorations = this.decorations\n const oldInnerDecorations = this.innerDecorations\n\n this.node = node\n this.decorations = decorations\n this.innerDecorations = innerDecorations\n\n return this.options.update({\n oldNode,\n oldDecorations,\n newNode: node,\n newDecorations: decorations,\n oldInnerDecorations,\n innerDecorations,\n updateProps: () => rerenderComponent({ node, decorations, innerDecorations }),\n })\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (node === this.node && this.decorations === decorations && this.innerDecorations === innerDecorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n this.innerDecorations = innerDecorations\n\n rerenderComponent({ node, decorations, innerDecorations })\n\n return true\n }\n\n /**\n * Select the node.\n * Add the `selected` prop and the `ProseMirror-selectednode` class.\n */\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n this.renderer.element.classList.add('ProseMirror-selectednode')\n }\n\n /**\n * Deselect the node.\n * Remove the `selected` prop and the `ProseMirror-selectednode` class.\n */\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n this.renderer.element.classList.remove('ProseMirror-selectednode')\n }\n\n getDecorationClasses() {\n return (\n this.decorations\n // @ts-ignore\n .map(item => item.type.attrs.class)\n .flat()\n .join(' ')\n )\n }\n\n destroy() {\n this.renderer.destroy()\n this.editor.off('selectionUpdate', this.handleSelectionUpdate)\n }\n}\n\nexport function VueNodeViewRenderer(\n component: Vue | VueConstructor,\n options?: Partial<VueNodeViewRendererOptions>,\n): NodeViewRenderer {\n return props => {\n // try to get the parent component\n // this is important for vue devtools to show the component hierarchy correctly\n // maybe it’s `undefined` because <editor-content> isn’t rendered yet\n if (!(props.editor as Editor).contentComponent) {\n return {} as unknown as ProseMirrorNodeView\n }\n\n return new VueNodeView(component, props, options)\n }\n}\n"],"names":["CoreEditor"],"mappings":";;;;;;;AAWa,MAAA,UAAU,GAAc;AACnC,IAAA,IAAI,EAAE,YAAY;AAElB,IAAA,KAAK,EAAE;AACL,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,CAAC,MAAM,EAAE,MAAuE,CAAC;AACvF,YAAA,OAAO,EAAE,YAAY;AACtB,SAAA;AAED,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAmD;AACzD,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AAED,QAAA,WAAW,EAAE;AACX,YAAA,IAAI,EAAE,MAAwD;AAC/D,SAAA;AAED,QAAA,YAAY,EAAE;AACZ,YAAA,IAAI,EAAE,MAAyD;AAC/D,YAAA,OAAO,EAAE,OAAO,EAAE,CAAC;AACpB,SAAA;AAED,QAAA,UAAU,EAAE;AACV,YAAA,IAAI,EAAE,QAAwE;AAC9E,YAAA,OAAO,EAAE,IAAI;AACd,SAAA;AACF,KAAA;AAED,IAAA,KAAK,EAAE;AACL,QAAA,MAAM,EAAE;AACN,YAAA,SAAS,EAAE,IAAI;AACf,YAAA,OAAO,CAA4B,MAAuC,EAAA;gBACxE,IAAI,CAAC,MAAM,EAAE;oBACX;;AAGF,gBAAA,IAAI,CAAC,SAAS,CAAC,MAAK;AAClB,oBAAA,MAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC;wBACrC,WAAW,EAAE,IAAI,CAAC,WAAW;wBAC7B,MAAM;wBACN,OAAO,EAAE,IAAI,CAAC,GAAkB;wBAChC,SAAS,EAAE,IAAI,CAAC,SAAS;wBACzB,UAAU,EAAE,IAAI,CAAC,UAAU;wBAC3B,YAAY,EAAE,IAAI,CAAC,YAAY;AAChC,qBAAA,CAAC,CAAC;AACL,iBAAC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AAiB,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,gBAAgB,EAAE,CAAC;AAE1D,QAAA,OAAO,IAAI;;AAGb;;;AAGG;IACH,UAAU,GAAA;AACR,QAAA,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;AACxB,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,0BAA0B,CAAC;;AAGjE;;;AAGG;IACH,YAAY,GAAA;AACV,QAAA,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;AACxB,YAAA,QAAQ,EAAE,KAAK;AAChB,SAAA,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,0BAA0B,CAAC;;IAGpE,oBAAoB,GAAA;QAClB,QACE,IAAI,CAAC;;AAEF,aAAA,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK;AACjC,aAAA,IAAI;AACJ,aAAA,IAAI,CAAC,GAAG,CAAC;;IAIhB,OAAO,GAAA;AACL,QAAA,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE;QACvB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,iBAAiB,EAAE,IAAI,CAAC,qBAAqB,CAAC;;AAEjE;AAEe,SAAA,mBAAmB,CACjC,SAA+B,EAC/B,OAA6C,EAAA;IAE7C,OAAO,KAAK,IAAG;;;;AAIb,QAAA,IAAI,CAAE,KAAK,CAAC,MAAiB,CAAC,gBAAgB,EAAE;AAC9C,YAAA,OAAO,EAAoC;;QAG7C,OAAO,IAAI,WAAW,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC;AACnD,KAAC;AACH;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/BubbleMenu.ts","../src/Editor.ts","../src/EditorContent.ts","../src/FloatingMenu.ts","../src/NodeViewContent.ts","../src/NodeViewWrapper.ts","../src/VueRenderer.ts","../src/VueNodeViewRenderer.ts"],"sourcesContent":["import { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport Vue, { Component, CreateElement, PropType } from 'vue'\n\nexport interface BubbleMenuInterface extends Vue {\n pluginKey: BubbleMenuPluginProps['pluginKey'],\n editor: BubbleMenuPluginProps['editor'],\n tippyOptions: BubbleMenuPluginProps['tippyOptions'],\n updateDelay: BubbleMenuPluginProps['updateDelay'],\n shouldShow: BubbleMenuPluginProps['shouldShow'],\n}\n\nexport const BubbleMenu: Component = {\n name: 'BubbleMenu',\n\n props: {\n pluginKey: {\n type: [String, Object as PropType<Exclude<BubbleMenuPluginProps['pluginKey'], string>>],\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 },\n\n tippyOptions: {\n type: Object as PropType<BubbleMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<BubbleMenuPluginProps['shouldShow'], null>>,\n default: null,\n },\n },\n\n watch: {\n editor: {\n immediate: true,\n handler(this: BubbleMenuInterface, editor: BubbleMenuPluginProps['editor']) {\n if (!editor) {\n return\n }\n\n this.$nextTick(() => {\n editor.registerPlugin(BubbleMenuPlugin({\n updateDelay: this.updateDelay,\n editor,\n element: this.$el as HTMLElement,\n pluginKey: this.pluginKey,\n shouldShow: this.shouldShow,\n tippyOptions: this.tippyOptions,\n }))\n })\n },\n },\n },\n\n render(this: BubbleMenuInterface, createElement: CreateElement) {\n return createElement('div', {}, this.$slots.default)\n },\n\n beforeDestroy(this: BubbleMenuInterface) {\n this.editor.unregisterPlugin(this.pluginKey)\n },\n}\n","import { Editor as CoreEditor } from '@tiptap/core'\nimport Vue from 'vue'\n\nexport class Editor extends CoreEditor {\n public contentComponent: Vue | null = null\n}\n","import Vue, { Component, CreateElement, PropType } from 'vue'\n\nimport { Editor } from './Editor.js'\n\nexport interface EditorContentInterface extends Vue {\n editor: Editor,\n}\n\nexport const EditorContent: Component = {\n name: 'EditorContent',\n\n props: {\n editor: {\n default: null,\n type: Object as PropType<Editor>,\n },\n },\n\n watch: {\n editor: {\n immediate: true,\n handler(this: EditorContentInterface, editor: Editor) {\n if (editor && editor.options.element) {\n this.$nextTick(() => {\n const element = this.$el\n\n if (!element || !editor.options.element.firstChild) {\n return\n }\n\n element.append(...editor.options.element.childNodes)\n editor.contentComponent = this\n\n editor.setOptions({\n element,\n })\n\n editor.createNodeViews()\n })\n }\n },\n },\n },\n\n render(createElement: CreateElement) {\n return createElement('div')\n },\n\n beforeDestroy(this: EditorContentInterface) {\n const { editor } = this\n\n if (!editor) {\n return\n }\n\n if (!editor.isDestroyed) {\n editor.view.setProps({\n nodeViews: {},\n })\n }\n\n editor.contentComponent = null\n\n if (!editor.options.element.firstChild) {\n return\n }\n\n const newElement = document.createElement('div')\n\n newElement.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element: newElement,\n })\n },\n}\n","import { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport Vue, { Component, CreateElement, PropType } from 'vue'\n\nexport interface FloatingMenuInterface extends Vue {\n pluginKey: FloatingMenuPluginProps['pluginKey'],\n tippyOptions: FloatingMenuPluginProps['tippyOptions'],\n editor: FloatingMenuPluginProps['editor'],\n shouldShow: FloatingMenuPluginProps['shouldShow'],\n}\n\nexport const FloatingMenu: Component = {\n name: 'FloatingMenu',\n\n props: {\n pluginKey: {\n type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],\n default: 'floatingMenu',\n },\n\n editor: {\n type: Object as PropType<FloatingMenuPluginProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<FloatingMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<FloatingMenuPluginProps['shouldShow'], null>>,\n default: null,\n },\n },\n\n watch: {\n editor: {\n immediate: true,\n handler(this: FloatingMenuInterface, editor: FloatingMenuPluginProps['editor']) {\n if (!editor) {\n return\n }\n\n this.$nextTick(() => {\n editor.registerPlugin(FloatingMenuPlugin({\n pluginKey: this.pluginKey,\n editor,\n element: this.$el as HTMLElement,\n tippyOptions: this.tippyOptions,\n shouldShow: this.shouldShow,\n }))\n })\n },\n },\n },\n\n render(this: FloatingMenuInterface, createElement: CreateElement) {\n return createElement('div', {}, this.$slots.default)\n },\n\n beforeDestroy(this: FloatingMenuInterface) {\n this.editor.unregisterPlugin(this.pluginKey)\n },\n}\n","import Vue, { Component, CreateElement } from 'vue'\n\nexport interface NodeViewContentInterface extends Vue {\n as: string,\n}\n\nexport const NodeViewContent: Component = {\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n render(this: NodeViewContentInterface, createElement: CreateElement) {\n return createElement(this.as, {\n style: {\n whiteSpace: 'pre-wrap',\n },\n attrs: {\n 'data-node-view-content': '',\n },\n })\n },\n}\n","import Vue, { Component, CreateElement } from 'vue'\n\nexport interface NodeViewWrapperInterface extends Vue {\n as: string,\n decorationClasses: {\n value: string,\n },\n onDragStart: () => void,\n}\n\nexport const NodeViewWrapper: Component = {\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n inject: ['onDragStart', 'decorationClasses'],\n\n render(this: NodeViewWrapperInterface, createElement: CreateElement) {\n return createElement(\n this.as,\n {\n class: this.decorationClasses.value,\n style: {\n whiteSpace: 'normal',\n },\n attrs: {\n 'data-node-view-wrapper': '',\n },\n on: {\n dragstart: this.onDragStart,\n },\n },\n this.$slots.default,\n )\n },\n}\n","import Vue from 'vue'\nimport { VueConstructor } from 'vue/types/umd'\n\n/**\n * The VueRenderer class is responsible for rendering a Vue component as a ProseMirror node view.\n */\nexport class VueRenderer {\n ref!: Vue\n\n constructor(component: Vue | VueConstructor, props: any) {\n const Component = (typeof component === 'function') ? component : Vue.extend(component)\n\n this.ref = new Component(props).$mount()\n }\n\n get element(): Element {\n return this.ref.$el\n }\n\n updateProps(props: Record<string, any> = {}): void {\n if (!this.ref.$props) {\n return\n }\n\n // prevents `Avoid mutating a prop directly` error message\n // Fix: `VueNodeViewRenderer` change vue Constructor `config.silent` not working\n const currentVueConstructor = this.ref.$props.editor?.contentComponent?.$options._base ?? Vue // eslint-disable-line\n const originalSilent = currentVueConstructor.config.silent\n\n currentVueConstructor.config.silent = true\n\n Object\n .entries(props)\n .forEach(([key, value]) => {\n this.ref.$props[key] = value\n })\n\n currentVueConstructor.config.silent = originalSilent\n }\n\n destroy(): void {\n this.ref.$destroy()\n }\n}\n","import {\n DecorationWithType,\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererOptions,\n} from '@tiptap/core'\nimport { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { Decoration, DecorationSource, NodeView as ProseMirrorNodeView } from '@tiptap/pm/view'\nimport Vue from 'vue'\nimport { VueConstructor } from 'vue/types/umd'\nimport { booleanProp, functionProp, objectProp } from 'vue-ts-types'\n\nimport { Editor } from './Editor.js'\nimport { VueRenderer } from './VueRenderer.js'\n\nexport const nodeViewProps = {\n editor: objectProp<NodeViewProps['editor']>().required,\n node: objectProp<NodeViewProps['node']>().required,\n decorations: objectProp<NodeViewProps['decorations']>().required,\n selected: booleanProp().required,\n extension: objectProp<NodeViewProps['extension']>().required,\n getPos: functionProp<NodeViewProps['getPos']>().required,\n updateAttributes: functionProp<NodeViewProps['updateAttributes']>().required,\n deleteNode: functionProp<NodeViewProps['deleteNode']>().required,\n}\n\nexport interface VueNodeViewRendererOptions extends NodeViewRendererOptions {\n update:\n | ((props: {\n oldNode: ProseMirrorNode;\n oldDecorations: readonly Decoration[];\n oldInnerDecorations: DecorationSource;\n newNode: ProseMirrorNode;\n newDecorations: readonly Decoration[];\n innerDecorations: DecorationSource;\n updateProps: () => void;\n }) => boolean)\n | null;\n}\n\nclass VueNodeView extends NodeView<Vue | VueConstructor, Editor, VueNodeViewRendererOptions> {\n renderer!: VueRenderer\n\n decorationClasses!: {\n value: string;\n }\n\n mount() {\n const props = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations as DecorationWithType[],\n innerDecorations: this.innerDecorations,\n view: this.view,\n selected: false,\n extension: this.extension,\n HTMLAttributes: this.HTMLAttributes,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n deleteNode: () => this.deleteNode(),\n } satisfies NodeViewProps\n\n const onDragStart = this.onDragStart.bind(this)\n\n this.decorationClasses = Vue.observable({\n value: this.getDecorationClasses(),\n })\n\n // @ts-ignore\n const vue = this.editor.contentComponent?.$options._base ?? Vue; // eslint-disable-line\n\n const Component = vue.extend(this.component).extend({\n props: Object.keys(props),\n provide: () => {\n return {\n onDragStart,\n decorationClasses: this.decorationClasses,\n }\n },\n })\n\n this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this)\n this.editor.on('selectionUpdate', this.handleSelectionUpdate)\n\n this.renderer = new VueRenderer(Component, {\n parent: this.editor.contentComponent,\n propsData: props,\n })\n }\n\n /**\n * Return the DOM element.\n * This is the element that will be used to display the node view.\n */\n get dom() {\n if (!this.renderer.element.hasAttribute('data-node-view-wrapper')) {\n throw Error('Please use the NodeViewWrapper component for your node view.')\n }\n\n return this.renderer.element as HTMLElement\n }\n\n /**\n * Return the content DOM element.\n * This is the element that will be used to display the rich-text content of the node.\n */\n get contentDOM() {\n if (this.node.isLeaf) {\n return null\n }\n\n const contentElement = this.dom.querySelector('[data-node-view-content]')\n\n return (contentElement || this.dom) as HTMLElement | null\n }\n\n /**\n * On editor selection update, check if the node is selected.\n * If it is, call `selectNode`, otherwise call `deselectNode`.\n */\n handleSelectionUpdate() {\n const { from, to } = this.editor.state.selection\n const pos = this.getPos()\n\n if (typeof pos !== 'number') {\n return\n }\n\n if (from <= pos && to >= pos + this.node.nodeSize) {\n if (this.renderer.ref.$props.selected) {\n return\n }\n\n this.selectNode()\n } else {\n if (!this.renderer.ref.$props.selected) {\n return\n }\n\n this.deselectNode()\n }\n }\n\n /**\n * On update, update the React component.\n * To prevent unnecessary updates, the `update` option can be used.\n */\n update(\n node: ProseMirrorNode,\n decorations: readonly Decoration[],\n innerDecorations: DecorationSource,\n ): boolean {\n const rerenderComponent = (props?: Record<string, any>) => {\n this.decorationClasses.value = this.getDecorationClasses()\n this.renderer.updateProps(props)\n }\n\n if (typeof this.options.update === 'function') {\n const oldNode = this.node\n const oldDecorations = this.decorations\n const oldInnerDecorations = this.innerDecorations\n\n this.node = node\n this.decorations = decorations\n this.innerDecorations = innerDecorations\n\n return this.options.update({\n oldNode,\n oldDecorations,\n newNode: node,\n newDecorations: decorations,\n oldInnerDecorations,\n innerDecorations,\n updateProps: () => rerenderComponent({ node, decorations, innerDecorations }),\n })\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (node === this.node && this.decorations === decorations && this.innerDecorations === innerDecorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n this.innerDecorations = innerDecorations\n\n rerenderComponent({ node, decorations, innerDecorations })\n\n return true\n }\n\n /**\n * Select the node.\n * Add the `selected` prop and the `ProseMirror-selectednode` class.\n */\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n this.renderer.element.classList.add('ProseMirror-selectednode')\n }\n\n /**\n * Deselect the node.\n * Remove the `selected` prop and the `ProseMirror-selectednode` class.\n */\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n this.renderer.element.classList.remove('ProseMirror-selectednode')\n }\n\n getDecorationClasses() {\n return (\n this.decorations\n // @ts-ignore\n .map(item => item.type.attrs.class)\n .flat()\n .join(' ')\n )\n }\n\n destroy() {\n this.renderer.destroy()\n this.editor.off('selectionUpdate', this.handleSelectionUpdate)\n }\n}\n\nexport function VueNodeViewRenderer(\n component: Vue | VueConstructor,\n options?: Partial<VueNodeViewRendererOptions>,\n): NodeViewRenderer {\n return props => {\n // try to get the parent component\n // this is important for vue devtools to show the component hierarchy correctly\n // maybe it’s `undefined` because <editor-content> isn’t rendered yet\n if (!(props.editor as Editor).contentComponent) {\n return {} as unknown as ProseMirrorNodeView\n }\n\n return new VueNodeView(component, props, options)\n }\n}\n"],"names":["CoreEditor"],"mappings":";;;;;;;AAWa,MAAA,UAAU,GAAc;AACnC,IAAA,IAAI,EAAE,YAAY;AAElB,IAAA,KAAK,EAAE;AACL,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,CAAC,MAAM,EAAE,MAAuE,CAAC;AACvF,YAAA,OAAO,EAAE,YAAY;AACtB,SAAA;AAED,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAmD;AACzD,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AAED,QAAA,WAAW,EAAE;AACX,YAAA,IAAI,EAAE,MAAwD;AAC/D,SAAA;AAED,QAAA,YAAY,EAAE;AACZ,YAAA,IAAI,EAAE,MAAyD;AAC/D,YAAA,OAAO,EAAE,OAAO,EAAE,CAAC;AACpB,SAAA;AAED,QAAA,UAAU,EAAE;AACV,YAAA,IAAI,EAAE,QAAwE;AAC9E,YAAA,OAAO,EAAE,IAAI;AACd,SAAA;AACF,KAAA;AAED,IAAA,KAAK,EAAE;AACL,QAAA,MAAM,EAAE;AACN,YAAA,SAAS,EAAE,IAAI;AACf,YAAA,OAAO,CAA4B,MAAuC,EAAA;gBACxE,IAAI,CAAC,MAAM,EAAE;oBACX;;AAGF,gBAAA,IAAI,CAAC,SAAS,CAAC,MAAK;AAClB,oBAAA,MAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC;wBACrC,WAAW,EAAE,IAAI,CAAC,WAAW;wBAC7B,MAAM;wBACN,OAAO,EAAE,IAAI,CAAC,GAAkB;wBAChC,SAAS,EAAE,IAAI,CAAC,SAAS;wBACzB,UAAU,EAAE,IAAI,CAAC,UAAU;wBAC3B,YAAY,EAAE,IAAI,CAAC,YAAY;AAChC,qBAAA,CAAC,CAAC;AACL,iBAAC,CAAC;aACH;AACF,SAAA;A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AU,GAAA;AACR,QAAA,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;AACxB,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,0BAA0B,CAAC;;AAGjE;;;AAGG;IACH,YAAY,GAAA;AACV,QAAA,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;AACxB,YAAA,QAAQ,EAAE,KAAK;AAChB,SAAA,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,0BAA0B,CAAC;;IAGpE,oBAAoB,GAAA;QAClB,QACE,IAAI,CAAC;;AAEF,aAAA,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK;AACjC,aAAA,IAAI;AACJ,aAAA,IAAI,CAAC,GAAG,CAAC;;IAIhB,OAAO,GAAA;AACL,QAAA,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE;QACvB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,iBAAiB,EAAE,IAAI,CAAC,qBAAqB,CAAC;;AAEjE;AAEe,SAAA,mBAAmB,CACjC,SAA+B,EAC/B,OAA6C,EAAA;IAE7C,OAAO,KAAK,IAAG;;;;AAIb,QAAA,IAAI,CAAE,KAAK,CAAC,MAAiB,CAAC,gBAAgB,EAAE;AAC9C,YAAA,OAAO,EAAoC;;QAG7C,OAAO,IAAI,WAAW,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC;AACnD,KAAC;AACH;;;;"}
package/dist/index.umd.js CHANGED
@@ -48,7 +48,7 @@
48
48
  },
49
49
  },
50
50
  render(createElement) {
51
- return createElement('div', { style: { visibility: 'hidden' } }, this.$slots.default);
51
+ return createElement('div', {}, this.$slots.default);
52
52
  },
53
53
  beforeDestroy() {
54
54
  this.editor.unregisterPlugin(this.pluginKey);
@@ -156,7 +156,7 @@
156
156
  },
157
157
  },
158
158
  render(createElement) {
159
- return createElement('div', { style: { visibility: 'hidden' } }, this.$slots.default);
159
+ return createElement('div', {}, this.$slots.default);
160
160
  },
161
161
  beforeDestroy() {
162
162
  this.editor.unregisterPlugin(this.pluginKey);
@@ -1 +1 @@
1
- {"version":3,"file":"index.umd.js","sources":["../src/BubbleMenu.ts","../src/Editor.ts","../src/EditorContent.ts","../src/FloatingMenu.ts","../src/NodeViewContent.ts","../src/NodeViewWrapper.ts","../src/VueRenderer.ts","../src/VueNodeViewRenderer.ts"],"sourcesContent":["import { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport Vue, { Component, CreateElement, PropType } from 'vue'\n\nexport interface BubbleMenuInterface extends Vue {\n pluginKey: BubbleMenuPluginProps['pluginKey'],\n editor: BubbleMenuPluginProps['editor'],\n tippyOptions: BubbleMenuPluginProps['tippyOptions'],\n updateDelay: BubbleMenuPluginProps['updateDelay'],\n shouldShow: BubbleMenuPluginProps['shouldShow'],\n}\n\nexport const BubbleMenu: Component = {\n name: 'BubbleMenu',\n\n props: {\n pluginKey: {\n type: [String, Object as PropType<Exclude<BubbleMenuPluginProps['pluginKey'], string>>],\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 },\n\n tippyOptions: {\n type: Object as PropType<BubbleMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<BubbleMenuPluginProps['shouldShow'], null>>,\n default: null,\n },\n },\n\n watch: {\n editor: {\n immediate: true,\n handler(this: BubbleMenuInterface, editor: BubbleMenuPluginProps['editor']) {\n if (!editor) {\n return\n }\n\n this.$nextTick(() => {\n editor.registerPlugin(BubbleMenuPlugin({\n updateDelay: this.updateDelay,\n editor,\n element: this.$el as HTMLElement,\n pluginKey: this.pluginKey,\n shouldShow: this.shouldShow,\n tippyOptions: this.tippyOptions,\n }))\n })\n },\n },\n },\n\n render(this: BubbleMenuInterface, createElement: CreateElement) {\n return createElement('div', { style: { visibility: 'hidden' } }, this.$slots.default)\n },\n\n beforeDestroy(this: BubbleMenuInterface) {\n this.editor.unregisterPlugin(this.pluginKey)\n },\n}\n","import { Editor as CoreEditor } from '@tiptap/core'\nimport Vue from 'vue'\n\nexport class Editor extends CoreEditor {\n public contentComponent: Vue | null = null\n}\n","import Vue, { Component, CreateElement, PropType } from 'vue'\n\nimport { Editor } from './Editor.js'\n\nexport interface EditorContentInterface extends Vue {\n editor: Editor,\n}\n\nexport const EditorContent: Component = {\n name: 'EditorContent',\n\n props: {\n editor: {\n default: null,\n type: Object as PropType<Editor>,\n },\n },\n\n watch: {\n editor: {\n immediate: true,\n handler(this: EditorContentInterface, editor: Editor) {\n if (editor && editor.options.element) {\n this.$nextTick(() => {\n const element = this.$el\n\n if (!element || !editor.options.element.firstChild) {\n return\n }\n\n element.append(...editor.options.element.childNodes)\n editor.contentComponent = this\n\n editor.setOptions({\n element,\n })\n\n editor.createNodeViews()\n })\n }\n },\n },\n },\n\n render(createElement: CreateElement) {\n return createElement('div')\n },\n\n beforeDestroy(this: EditorContentInterface) {\n const { editor } = this\n\n if (!editor) {\n return\n }\n\n if (!editor.isDestroyed) {\n editor.view.setProps({\n nodeViews: {},\n })\n }\n\n editor.contentComponent = null\n\n if (!editor.options.element.firstChild) {\n return\n }\n\n const newElement = document.createElement('div')\n\n newElement.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element: newElement,\n })\n },\n}\n","import { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport Vue, { Component, CreateElement, PropType } from 'vue'\n\nexport interface FloatingMenuInterface extends Vue {\n pluginKey: FloatingMenuPluginProps['pluginKey'],\n tippyOptions: FloatingMenuPluginProps['tippyOptions'],\n editor: FloatingMenuPluginProps['editor'],\n shouldShow: FloatingMenuPluginProps['shouldShow'],\n}\n\nexport const FloatingMenu: Component = {\n name: 'FloatingMenu',\n\n props: {\n pluginKey: {\n type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],\n default: 'floatingMenu',\n },\n\n editor: {\n type: Object as PropType<FloatingMenuPluginProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<FloatingMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<FloatingMenuPluginProps['shouldShow'], null>>,\n default: null,\n },\n },\n\n watch: {\n editor: {\n immediate: true,\n handler(this: FloatingMenuInterface, editor: FloatingMenuPluginProps['editor']) {\n if (!editor) {\n return\n }\n\n this.$nextTick(() => {\n editor.registerPlugin(FloatingMenuPlugin({\n pluginKey: this.pluginKey,\n editor,\n element: this.$el as HTMLElement,\n tippyOptions: this.tippyOptions,\n shouldShow: this.shouldShow,\n }))\n })\n },\n },\n },\n\n render(this: FloatingMenuInterface, createElement: CreateElement) {\n return createElement('div', { style: { visibility: 'hidden' } }, this.$slots.default)\n },\n\n beforeDestroy(this: FloatingMenuInterface) {\n this.editor.unregisterPlugin(this.pluginKey)\n },\n}\n","import Vue, { Component, CreateElement } from 'vue'\n\nexport interface NodeViewContentInterface extends Vue {\n as: string,\n}\n\nexport const NodeViewContent: Component = {\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n render(this: NodeViewContentInterface, createElement: CreateElement) {\n return createElement(this.as, {\n style: {\n whiteSpace: 'pre-wrap',\n },\n attrs: {\n 'data-node-view-content': '',\n },\n })\n },\n}\n","import Vue, { Component, CreateElement } from 'vue'\n\nexport interface NodeViewWrapperInterface extends Vue {\n as: string,\n decorationClasses: {\n value: string,\n },\n onDragStart: () => void,\n}\n\nexport const NodeViewWrapper: Component = {\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n inject: ['onDragStart', 'decorationClasses'],\n\n render(this: NodeViewWrapperInterface, createElement: CreateElement) {\n return createElement(\n this.as,\n {\n class: this.decorationClasses.value,\n style: {\n whiteSpace: 'normal',\n },\n attrs: {\n 'data-node-view-wrapper': '',\n },\n on: {\n dragstart: this.onDragStart,\n },\n },\n this.$slots.default,\n )\n },\n}\n","import Vue from 'vue'\nimport { VueConstructor } from 'vue/types/umd'\n\n/**\n * The VueRenderer class is responsible for rendering a Vue component as a ProseMirror node view.\n */\nexport class VueRenderer {\n ref!: Vue\n\n constructor(component: Vue | VueConstructor, props: any) {\n const Component = (typeof component === 'function') ? component : Vue.extend(component)\n\n this.ref = new Component(props).$mount()\n }\n\n get element(): Element {\n return this.ref.$el\n }\n\n updateProps(props: Record<string, any> = {}): void {\n if (!this.ref.$props) {\n return\n }\n\n // prevents `Avoid mutating a prop directly` error message\n // Fix: `VueNodeViewRenderer` change vue Constructor `config.silent` not working\n const currentVueConstructor = this.ref.$props.editor?.contentComponent?.$options._base ?? Vue // eslint-disable-line\n const originalSilent = currentVueConstructor.config.silent\n\n currentVueConstructor.config.silent = true\n\n Object\n .entries(props)\n .forEach(([key, value]) => {\n this.ref.$props[key] = value\n })\n\n currentVueConstructor.config.silent = originalSilent\n }\n\n destroy(): void {\n this.ref.$destroy()\n }\n}\n","import {\n DecorationWithType,\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererOptions,\n} from '@tiptap/core'\nimport { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { Decoration, DecorationSource, NodeView as ProseMirrorNodeView } from '@tiptap/pm/view'\nimport Vue from 'vue'\nimport { VueConstructor } from 'vue/types/umd'\nimport { booleanProp, functionProp, objectProp } from 'vue-ts-types'\n\nimport { Editor } from './Editor.js'\nimport { VueRenderer } from './VueRenderer.js'\n\nexport const nodeViewProps = {\n editor: objectProp<NodeViewProps['editor']>().required,\n node: objectProp<NodeViewProps['node']>().required,\n decorations: objectProp<NodeViewProps['decorations']>().required,\n selected: booleanProp().required,\n extension: objectProp<NodeViewProps['extension']>().required,\n getPos: functionProp<NodeViewProps['getPos']>().required,\n updateAttributes: functionProp<NodeViewProps['updateAttributes']>().required,\n deleteNode: functionProp<NodeViewProps['deleteNode']>().required,\n}\n\nexport interface VueNodeViewRendererOptions extends NodeViewRendererOptions {\n update:\n | ((props: {\n oldNode: ProseMirrorNode;\n oldDecorations: readonly Decoration[];\n oldInnerDecorations: DecorationSource;\n newNode: ProseMirrorNode;\n newDecorations: readonly Decoration[];\n innerDecorations: DecorationSource;\n updateProps: () => void;\n }) => boolean)\n | null;\n}\n\nclass VueNodeView extends NodeView<Vue | VueConstructor, Editor, VueNodeViewRendererOptions> {\n renderer!: VueRenderer\n\n decorationClasses!: {\n value: string;\n }\n\n mount() {\n const props = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations as DecorationWithType[],\n innerDecorations: this.innerDecorations,\n view: this.view,\n selected: false,\n extension: this.extension,\n HTMLAttributes: this.HTMLAttributes,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n deleteNode: () => this.deleteNode(),\n } satisfies NodeViewProps\n\n const onDragStart = this.onDragStart.bind(this)\n\n this.decorationClasses = Vue.observable({\n value: this.getDecorationClasses(),\n })\n\n // @ts-ignore\n const vue = this.editor.contentComponent?.$options._base ?? Vue; // eslint-disable-line\n\n const Component = vue.extend(this.component).extend({\n props: Object.keys(props),\n provide: () => {\n return {\n onDragStart,\n decorationClasses: this.decorationClasses,\n }\n },\n })\n\n this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this)\n this.editor.on('selectionUpdate', this.handleSelectionUpdate)\n\n this.renderer = new VueRenderer(Component, {\n parent: this.editor.contentComponent,\n propsData: props,\n })\n }\n\n /**\n * Return the DOM element.\n * This is the element that will be used to display the node view.\n */\n get dom() {\n if (!this.renderer.element.hasAttribute('data-node-view-wrapper')) {\n throw Error('Please use the NodeViewWrapper component for your node view.')\n }\n\n return this.renderer.element as HTMLElement\n }\n\n /**\n * Return the content DOM element.\n * This is the element that will be used to display the rich-text content of the node.\n */\n get contentDOM() {\n if (this.node.isLeaf) {\n return null\n }\n\n const contentElement = this.dom.querySelector('[data-node-view-content]')\n\n return (contentElement || this.dom) as HTMLElement | null\n }\n\n /**\n * On editor selection update, check if the node is selected.\n * If it is, call `selectNode`, otherwise call `deselectNode`.\n */\n handleSelectionUpdate() {\n const { from, to } = this.editor.state.selection\n const pos = this.getPos()\n\n if (typeof pos !== 'number') {\n return\n }\n\n if (from <= pos && to >= pos + this.node.nodeSize) {\n if (this.renderer.ref.$props.selected) {\n return\n }\n\n this.selectNode()\n } else {\n if (!this.renderer.ref.$props.selected) {\n return\n }\n\n this.deselectNode()\n }\n }\n\n /**\n * On update, update the React component.\n * To prevent unnecessary updates, the `update` option can be used.\n */\n update(\n node: ProseMirrorNode,\n decorations: readonly Decoration[],\n innerDecorations: DecorationSource,\n ): boolean {\n const rerenderComponent = (props?: Record<string, any>) => {\n this.decorationClasses.value = this.getDecorationClasses()\n this.renderer.updateProps(props)\n }\n\n if (typeof this.options.update === 'function') {\n const oldNode = this.node\n const oldDecorations = this.decorations\n const oldInnerDecorations = this.innerDecorations\n\n this.node = node\n this.decorations = decorations\n this.innerDecorations = innerDecorations\n\n return this.options.update({\n oldNode,\n oldDecorations,\n newNode: node,\n newDecorations: decorations,\n oldInnerDecorations,\n innerDecorations,\n updateProps: () => rerenderComponent({ node, decorations, innerDecorations }),\n })\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (node === this.node && this.decorations === decorations && this.innerDecorations === innerDecorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n this.innerDecorations = innerDecorations\n\n rerenderComponent({ node, decorations, innerDecorations })\n\n return true\n }\n\n /**\n * Select the node.\n * Add the `selected` prop and the `ProseMirror-selectednode` class.\n */\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n this.renderer.element.classList.add('ProseMirror-selectednode')\n }\n\n /**\n * Deselect the node.\n * Remove the `selected` prop and the `ProseMirror-selectednode` class.\n */\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n this.renderer.element.classList.remove('ProseMirror-selectednode')\n }\n\n getDecorationClasses() {\n return (\n this.decorations\n // @ts-ignore\n .map(item => item.type.attrs.class)\n .flat()\n .join(' ')\n )\n }\n\n destroy() {\n this.renderer.destroy()\n this.editor.off('selectionUpdate', this.handleSelectionUpdate)\n }\n}\n\nexport function VueNodeViewRenderer(\n component: Vue | VueConstructor,\n options?: Partial<VueNodeViewRendererOptions>,\n): NodeViewRenderer {\n return props => {\n // try to get the parent component\n // this is important for vue devtools to show the component hierarchy correctly\n // maybe it’s `undefined` because <editor-content> isn’t rendered yet\n if (!(props.editor as Editor).contentComponent) {\n return {} as unknown as ProseMirrorNodeView\n }\n\n return new VueNodeView(component, props, options)\n }\n}\n"],"names":["BubbleMenuPlugin","CoreEditor","FloatingMenuPlugin","objectProp","booleanProp","functionProp","NodeView"],"mappings":";;;;;;AAWa,QAAA,UAAU,GAAc;EACnC,IAAA,IAAI,EAAE,YAAY;EAElB,IAAA,KAAK,EAAE;EACL,QAAA,SAAS,EAAE;EACT,YAAA,IAAI,EAAE,CAAC,MAAM,EAAE,MAAuE,CAAC;EACvF,YAAA,OAAO,EAAE,YAAY;EACtB,SAAA;EAED,QAAA,MAAM,EAAE;EACN,YAAA,IAAI,EAAE,MAAmD;EACzD,YAAA,QAAQ,EAAE,IAAI;EACf,SAAA;EAED,QAAA,WAAW,EAAE;EACX,YAAA,IAAI,EAAE,MAAwD;EAC/D,SAAA;EAED,QAAA,YAAY,EAAE;EACZ,YAAA,IAAI,EAAE,MAAyD;EAC/D,YAAA,OAAO,EAAE,OAAO,EAAE,CAAC;EACpB,SAAA;EAED,QAAA,UAAU,EAAE;EACV,YAAA,IAAI,EAAE,QAAwE;EAC9E,YAAA,OAAO,EAAE,IAAI;EACd,SAAA;EACF,KAAA;EAED,IAAA,KAAK,EAAE;EACL,QAAA,MAAM,EAAE;EACN,YAAA,SAAS,EAAE,IAAI;EACf,YAAA,OAAO,CAA4B,MAAuC,EAAA;kBACxE,IAAI,CAA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,mBAAmB,CACjC,SAA+B,EAC/B,OAA6C,EAAA;MAE7C,OAAO,KAAK,IAAG;;;;EAIb,QAAA,IAAI,CAAE,KAAK,CAAC,MAAiB,CAAC,gBAAgB,EAAE;EAC9C,YAAA,OAAO,EAAoC;;UAG7C,OAAO,IAAI,WAAW,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC;EACnD,KAAC;EACH;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.umd.js","sources":["../src/BubbleMenu.ts","../src/Editor.ts","../src/EditorContent.ts","../src/FloatingMenu.ts","../src/NodeViewContent.ts","../src/NodeViewWrapper.ts","../src/VueRenderer.ts","../src/VueNodeViewRenderer.ts"],"sourcesContent":["import { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport Vue, { Component, CreateElement, PropType } from 'vue'\n\nexport interface BubbleMenuInterface extends Vue {\n pluginKey: BubbleMenuPluginProps['pluginKey'],\n editor: BubbleMenuPluginProps['editor'],\n tippyOptions: BubbleMenuPluginProps['tippyOptions'],\n updateDelay: BubbleMenuPluginProps['updateDelay'],\n shouldShow: BubbleMenuPluginProps['shouldShow'],\n}\n\nexport const BubbleMenu: Component = {\n name: 'BubbleMenu',\n\n props: {\n pluginKey: {\n type: [String, Object as PropType<Exclude<BubbleMenuPluginProps['pluginKey'], string>>],\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 },\n\n tippyOptions: {\n type: Object as PropType<BubbleMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<BubbleMenuPluginProps['shouldShow'], null>>,\n default: null,\n },\n },\n\n watch: {\n editor: {\n immediate: true,\n handler(this: BubbleMenuInterface, editor: BubbleMenuPluginProps['editor']) {\n if (!editor) {\n return\n }\n\n this.$nextTick(() => {\n editor.registerPlugin(BubbleMenuPlugin({\n updateDelay: this.updateDelay,\n editor,\n element: this.$el as HTMLElement,\n pluginKey: this.pluginKey,\n shouldShow: this.shouldShow,\n tippyOptions: this.tippyOptions,\n }))\n })\n },\n },\n },\n\n render(this: BubbleMenuInterface, createElement: CreateElement) {\n return createElement('div', {}, this.$slots.default)\n },\n\n beforeDestroy(this: BubbleMenuInterface) {\n this.editor.unregisterPlugin(this.pluginKey)\n },\n}\n","import { Editor as CoreEditor } from '@tiptap/core'\nimport Vue from 'vue'\n\nexport class Editor extends CoreEditor {\n public contentComponent: Vue | null = null\n}\n","import Vue, { Component, CreateElement, PropType } from 'vue'\n\nimport { Editor } from './Editor.js'\n\nexport interface EditorContentInterface extends Vue {\n editor: Editor,\n}\n\nexport const EditorContent: Component = {\n name: 'EditorContent',\n\n props: {\n editor: {\n default: null,\n type: Object as PropType<Editor>,\n },\n },\n\n watch: {\n editor: {\n immediate: true,\n handler(this: EditorContentInterface, editor: Editor) {\n if (editor && editor.options.element) {\n this.$nextTick(() => {\n const element = this.$el\n\n if (!element || !editor.options.element.firstChild) {\n return\n }\n\n element.append(...editor.options.element.childNodes)\n editor.contentComponent = this\n\n editor.setOptions({\n element,\n })\n\n editor.createNodeViews()\n })\n }\n },\n },\n },\n\n render(createElement: CreateElement) {\n return createElement('div')\n },\n\n beforeDestroy(this: EditorContentInterface) {\n const { editor } = this\n\n if (!editor) {\n return\n }\n\n if (!editor.isDestroyed) {\n editor.view.setProps({\n nodeViews: {},\n })\n }\n\n editor.contentComponent = null\n\n if (!editor.options.element.firstChild) {\n return\n }\n\n const newElement = document.createElement('div')\n\n newElement.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element: newElement,\n })\n },\n}\n","import { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport Vue, { Component, CreateElement, PropType } from 'vue'\n\nexport interface FloatingMenuInterface extends Vue {\n pluginKey: FloatingMenuPluginProps['pluginKey'],\n tippyOptions: FloatingMenuPluginProps['tippyOptions'],\n editor: FloatingMenuPluginProps['editor'],\n shouldShow: FloatingMenuPluginProps['shouldShow'],\n}\n\nexport const FloatingMenu: Component = {\n name: 'FloatingMenu',\n\n props: {\n pluginKey: {\n type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],\n default: 'floatingMenu',\n },\n\n editor: {\n type: Object as PropType<FloatingMenuPluginProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<FloatingMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<FloatingMenuPluginProps['shouldShow'], null>>,\n default: null,\n },\n },\n\n watch: {\n editor: {\n immediate: true,\n handler(this: FloatingMenuInterface, editor: FloatingMenuPluginProps['editor']) {\n if (!editor) {\n return\n }\n\n this.$nextTick(() => {\n editor.registerPlugin(FloatingMenuPlugin({\n pluginKey: this.pluginKey,\n editor,\n element: this.$el as HTMLElement,\n tippyOptions: this.tippyOptions,\n shouldShow: this.shouldShow,\n }))\n })\n },\n },\n },\n\n render(this: FloatingMenuInterface, createElement: CreateElement) {\n return createElement('div', {}, this.$slots.default)\n },\n\n beforeDestroy(this: FloatingMenuInterface) {\n this.editor.unregisterPlugin(this.pluginKey)\n },\n}\n","import Vue, { Component, CreateElement } from 'vue'\n\nexport interface NodeViewContentInterface extends Vue {\n as: string,\n}\n\nexport const NodeViewContent: Component = {\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n render(this: NodeViewContentInterface, createElement: CreateElement) {\n return createElement(this.as, {\n style: {\n whiteSpace: 'pre-wrap',\n },\n attrs: {\n 'data-node-view-content': '',\n },\n })\n },\n}\n","import Vue, { Component, CreateElement } from 'vue'\n\nexport interface NodeViewWrapperInterface extends Vue {\n as: string,\n decorationClasses: {\n value: string,\n },\n onDragStart: () => void,\n}\n\nexport const NodeViewWrapper: Component = {\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n inject: ['onDragStart', 'decorationClasses'],\n\n render(this: NodeViewWrapperInterface, createElement: CreateElement) {\n return createElement(\n this.as,\n {\n class: this.decorationClasses.value,\n style: {\n whiteSpace: 'normal',\n },\n attrs: {\n 'data-node-view-wrapper': '',\n },\n on: {\n dragstart: this.onDragStart,\n },\n },\n this.$slots.default,\n )\n },\n}\n","import Vue from 'vue'\nimport { VueConstructor } from 'vue/types/umd'\n\n/**\n * The VueRenderer class is responsible for rendering a Vue component as a ProseMirror node view.\n */\nexport class VueRenderer {\n ref!: Vue\n\n constructor(component: Vue | VueConstructor, props: any) {\n const Component = (typeof component === 'function') ? component : Vue.extend(component)\n\n this.ref = new Component(props).$mount()\n }\n\n get element(): Element {\n return this.ref.$el\n }\n\n updateProps(props: Record<string, any> = {}): void {\n if (!this.ref.$props) {\n return\n }\n\n // prevents `Avoid mutating a prop directly` error message\n // Fix: `VueNodeViewRenderer` change vue Constructor `config.silent` not working\n const currentVueConstructor = this.ref.$props.editor?.contentComponent?.$options._base ?? Vue // eslint-disable-line\n const originalSilent = currentVueConstructor.config.silent\n\n currentVueConstructor.config.silent = true\n\n Object\n .entries(props)\n .forEach(([key, value]) => {\n this.ref.$props[key] = value\n })\n\n currentVueConstructor.config.silent = originalSilent\n }\n\n destroy(): void {\n this.ref.$destroy()\n }\n}\n","import {\n DecorationWithType,\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererOptions,\n} from '@tiptap/core'\nimport { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { Decoration, DecorationSource, NodeView as ProseMirrorNodeView } from '@tiptap/pm/view'\nimport Vue from 'vue'\nimport { VueConstructor } from 'vue/types/umd'\nimport { booleanProp, functionProp, objectProp } from 'vue-ts-types'\n\nimport { Editor } from './Editor.js'\nimport { VueRenderer } from './VueRenderer.js'\n\nexport const nodeViewProps = {\n editor: objectProp<NodeViewProps['editor']>().required,\n node: objectProp<NodeViewProps['node']>().required,\n decorations: objectProp<NodeViewProps['decorations']>().required,\n selected: booleanProp().required,\n extension: objectProp<NodeViewProps['extension']>().required,\n getPos: functionProp<NodeViewProps['getPos']>().required,\n updateAttributes: functionProp<NodeViewProps['updateAttributes']>().required,\n deleteNode: functionProp<NodeViewProps['deleteNode']>().required,\n}\n\nexport interface VueNodeViewRendererOptions extends NodeViewRendererOptions {\n update:\n | ((props: {\n oldNode: ProseMirrorNode;\n oldDecorations: readonly Decoration[];\n oldInnerDecorations: DecorationSource;\n newNode: ProseMirrorNode;\n newDecorations: readonly Decoration[];\n innerDecorations: DecorationSource;\n updateProps: () => void;\n }) => boolean)\n | null;\n}\n\nclass VueNodeView extends NodeView<Vue | VueConstructor, Editor, VueNodeViewRendererOptions> {\n renderer!: VueRenderer\n\n decorationClasses!: {\n value: string;\n }\n\n mount() {\n const props = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations as DecorationWithType[],\n innerDecorations: this.innerDecorations,\n view: this.view,\n selected: false,\n extension: this.extension,\n HTMLAttributes: this.HTMLAttributes,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n deleteNode: () => this.deleteNode(),\n } satisfies NodeViewProps\n\n const onDragStart = this.onDragStart.bind(this)\n\n this.decorationClasses = Vue.observable({\n value: this.getDecorationClasses(),\n })\n\n // @ts-ignore\n const vue = this.editor.contentComponent?.$options._base ?? Vue; // eslint-disable-line\n\n const Component = vue.extend(this.component).extend({\n props: Object.keys(props),\n provide: () => {\n return {\n onDragStart,\n decorationClasses: this.decorationClasses,\n }\n },\n })\n\n this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this)\n this.editor.on('selectionUpdate', this.handleSelectionUpdate)\n\n this.renderer = new VueRenderer(Component, {\n parent: this.editor.contentComponent,\n propsData: props,\n })\n }\n\n /**\n * Return the DOM element.\n * This is the element that will be used to display the node view.\n */\n get dom() {\n if (!this.renderer.element.hasAttribute('data-node-view-wrapper')) {\n throw Error('Please use the NodeViewWrapper component for your node view.')\n }\n\n return this.renderer.element as HTMLElement\n }\n\n /**\n * Return the content DOM element.\n * This is the element that will be used to display the rich-text content of the node.\n */\n get contentDOM() {\n if (this.node.isLeaf) {\n return null\n }\n\n const contentElement = this.dom.querySelector('[data-node-view-content]')\n\n return (contentElement || this.dom) as HTMLElement | null\n }\n\n /**\n * On editor selection update, check if the node is selected.\n * If it is, call `selectNode`, otherwise call `deselectNode`.\n */\n handleSelectionUpdate() {\n const { from, to } = this.editor.state.selection\n const pos = this.getPos()\n\n if (typeof pos !== 'number') {\n return\n }\n\n if (from <= pos && to >= pos + this.node.nodeSize) {\n if (this.renderer.ref.$props.selected) {\n return\n }\n\n this.selectNode()\n } else {\n if (!this.renderer.ref.$props.selected) {\n return\n }\n\n this.deselectNode()\n }\n }\n\n /**\n * On update, update the React component.\n * To prevent unnecessary updates, the `update` option can be used.\n */\n update(\n node: ProseMirrorNode,\n decorations: readonly Decoration[],\n innerDecorations: DecorationSource,\n ): boolean {\n const rerenderComponent = (props?: Record<string, any>) => {\n this.decorationClasses.value = this.getDecorationClasses()\n this.renderer.updateProps(props)\n }\n\n if (typeof this.options.update === 'function') {\n const oldNode = this.node\n const oldDecorations = this.decorations\n const oldInnerDecorations = this.innerDecorations\n\n this.node = node\n this.decorations = decorations\n this.innerDecorations = innerDecorations\n\n return this.options.update({\n oldNode,\n oldDecorations,\n newNode: node,\n newDecorations: decorations,\n oldInnerDecorations,\n innerDecorations,\n updateProps: () => rerenderComponent({ node, decorations, innerDecorations }),\n })\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (node === this.node && this.decorations === decorations && this.innerDecorations === innerDecorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n this.innerDecorations = innerDecorations\n\n rerenderComponent({ node, decorations, innerDecorations })\n\n return true\n }\n\n /**\n * Select the node.\n * Add the `selected` prop and the `ProseMirror-selectednode` class.\n */\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n this.renderer.element.classList.add('ProseMirror-selectednode')\n }\n\n /**\n * Deselect the node.\n * Remove the `selected` prop and the `ProseMirror-selectednode` class.\n */\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n this.renderer.element.classList.remove('ProseMirror-selectednode')\n }\n\n getDecorationClasses() {\n return (\n this.decorations\n // @ts-ignore\n .map(item => item.type.attrs.class)\n .flat()\n .join(' ')\n )\n }\n\n destroy() {\n this.renderer.destroy()\n this.editor.off('selectionUpdate', this.handleSelectionUpdate)\n }\n}\n\nexport function VueNodeViewRenderer(\n component: Vue | VueConstructor,\n options?: Partial<VueNodeViewRendererOptions>,\n): NodeViewRenderer {\n return props => {\n // try to get the parent component\n // this is important for vue devtools to show the component hierarchy correctly\n // maybe it’s `undefined` because <editor-content> isn’t rendered yet\n if (!(props.editor as Editor).contentComponent) {\n return {} as unknown as ProseMirrorNodeView\n }\n\n return new VueNodeView(component, props, options)\n }\n}\n"],"names":["BubbleMenuPlugin","CoreEditor","FloatingMenuPlugin","objectProp","booleanProp","functionProp","NodeView"],"mappings":";;;;;;AAWa,QAAA,UAAU,GAAc;EACnC,IAAA,IAAI,EAAE,YAAY;EAElB,IAAA,KAAK,EAAE;EACL,QAAA,SAAS,EAAE;EACT,YAAA,IAAI,EAAE,CAAC,MAAM,EAAE,MAAuE,CAAC;EACvF,YAAA,OAAO,EAAE,YAAY;EACtB,SAAA;EAED,QAAA,MAAM,EAAE;EACN,YAAA,IAAI,EAAE,MAAmD;EACzD,YAAA,QAAQ,EAAE,IAAI;EACf,SAAA;EAED,QAAA,WAAW,EAAE;EACX,YAAA,IAAI,EAAE,MAAwD;EAC/D,SAAA;EAED,QAAA,YAAY,EAAE;EACZ,YAAA,IAAI,EAAE,MAAyD;EAC/D,YAAA,OAAO,EAAE,OAAO,EAAE,CAAC;EACpB,SAAA;EAED,QAAA,UAAU,EAAE;EACV,YAAA,IAAI,EAAE,QAAwE;EAC9E,YAAA,OAAO,EAAE,IAAI;EACd,SAAA;EACF,KAAA;EAED,IAAA,KAAK,EAAE;EACL,QAAA,MAAM,EAAE;EACN,YAAA,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,SAA+B,EAC/B,OAA6C,EAAA;MAE7C,OAAO,KAAK,IAAG;;;;EAIb,QAAA,IAAI,CAAE,KAAK,CAAC,MAAiB,CAAC,gBAAgB,EAAE;EAC9C,YAAA,OAAO,EAAoC;;UAG7C,OAAO,IAAI,WAAW,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC;EACnD,KAAC;EACH;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiptap/vue-2",
3
3
  "description": "Vue components for tiptap",
4
- "version": "2.26.0",
4
+ "version": "2.26.2",
5
5
  "homepage": "https://tiptap.dev",
6
6
  "keywords": [
7
7
  "tiptap",
@@ -29,13 +29,13 @@
29
29
  "dist"
30
30
  ],
31
31
  "dependencies": {
32
- "@tiptap/extension-bubble-menu": "^2.26.0",
33
- "@tiptap/extension-floating-menu": "^2.26.0",
32
+ "@tiptap/extension-bubble-menu": "^2.26.2",
33
+ "@tiptap/extension-floating-menu": "^2.26.2",
34
34
  "vue-ts-types": "1.6.2"
35
35
  },
36
36
  "devDependencies": {
37
- "@tiptap/core": "^2.26.0",
38
- "@tiptap/pm": "^2.26.0",
37
+ "@tiptap/core": "^2.26.2",
38
+ "@tiptap/pm": "^2.26.2",
39
39
  "vue": "^2.6.0"
40
40
  },
41
41
  "peerDependencies": {
package/src/BubbleMenu.ts CHANGED
@@ -61,7 +61,7 @@ export const BubbleMenu: Component = {
61
61
  },
62
62
 
63
63
  render(this: BubbleMenuInterface, createElement: CreateElement) {
64
- return createElement('div', { style: { visibility: 'hidden' } }, this.$slots.default)
64
+ return createElement('div', {}, this.$slots.default)
65
65
  },
66
66
 
67
67
  beforeDestroy(this: BubbleMenuInterface) {
@@ -55,7 +55,7 @@ export const FloatingMenu: Component = {
55
55
  },
56
56
 
57
57
  render(this: FloatingMenuInterface, createElement: CreateElement) {
58
- return createElement('div', { style: { visibility: 'hidden' } }, this.$slots.default)
58
+ return createElement('div', {}, this.$slots.default)
59
59
  },
60
60
 
61
61
  beforeDestroy(this: FloatingMenuInterface) {