@tiptap/vue-2 2.5.8 → 3.0.0-next.0
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 +15 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -5
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +15 -5
- package/dist/index.umd.js.map +1 -1
- package/dist/packages/core/src/Extension.d.ts +1 -1
- package/dist/packages/core/src/Mark.d.ts +1 -1
- package/dist/packages/core/src/Node.d.ts +1 -1
- package/dist/packages/core/src/style.d.ts +1 -1
- package/dist/packages/extension-bubble-menu/src/bubble-menu-plugin.d.ts +35 -12
- package/dist/packages/extension-floating-menu/src/floating-menu-plugin.d.ts +29 -14
- package/dist/packages/vue-2/src/BubbleMenu.d.ts +2 -1
- package/dist/packages/vue-2/src/FloatingMenu.d.ts +1 -1
- package/package.json +7 -7
- package/src/BubbleMenu.ts +16 -5
- package/src/FloatingMenu.ts +9 -4
package/dist/index.cjs
CHANGED
|
@@ -24,9 +24,12 @@ const BubbleMenu = {
|
|
|
24
24
|
updateDelay: {
|
|
25
25
|
type: Number,
|
|
26
26
|
},
|
|
27
|
-
|
|
27
|
+
options: {
|
|
28
28
|
type: Object,
|
|
29
|
-
default:
|
|
29
|
+
default: {},
|
|
30
|
+
},
|
|
31
|
+
resizeDelay: {
|
|
32
|
+
type: Number,
|
|
30
33
|
},
|
|
31
34
|
shouldShow: {
|
|
32
35
|
type: Function,
|
|
@@ -40,14 +43,18 @@ const BubbleMenu = {
|
|
|
40
43
|
if (!editor) {
|
|
41
44
|
return;
|
|
42
45
|
}
|
|
46
|
+
this.$el.style.visibility = 'hidden';
|
|
47
|
+
this.$el.style.position = 'absolute';
|
|
48
|
+
this.$el.remove();
|
|
43
49
|
this.$nextTick(() => {
|
|
44
50
|
editor.registerPlugin(extensionBubbleMenu.BubbleMenuPlugin({
|
|
45
51
|
updateDelay: this.updateDelay,
|
|
52
|
+
resizeDelay: this.resizeDelay,
|
|
53
|
+
options: this.options,
|
|
46
54
|
editor,
|
|
47
55
|
element: this.$el,
|
|
48
56
|
pluginKey: this.pluginKey,
|
|
49
57
|
shouldShow: this.shouldShow,
|
|
50
|
-
tippyOptions: this.tippyOptions,
|
|
51
58
|
}));
|
|
52
59
|
});
|
|
53
60
|
},
|
|
@@ -133,7 +140,7 @@ const FloatingMenu = {
|
|
|
133
140
|
type: Object,
|
|
134
141
|
required: true,
|
|
135
142
|
},
|
|
136
|
-
|
|
143
|
+
options: {
|
|
137
144
|
type: Object,
|
|
138
145
|
default: () => ({}),
|
|
139
146
|
},
|
|
@@ -149,12 +156,15 @@ const FloatingMenu = {
|
|
|
149
156
|
if (!editor) {
|
|
150
157
|
return;
|
|
151
158
|
}
|
|
159
|
+
this.$el.style.visibility = 'hidden';
|
|
160
|
+
this.$el.style.position = 'absolute';
|
|
161
|
+
this.$el.remove();
|
|
152
162
|
this.$nextTick(() => {
|
|
153
163
|
editor.registerPlugin(extensionFloatingMenu.FloatingMenuPlugin({
|
|
154
164
|
pluginKey: this.pluginKey,
|
|
155
165
|
editor,
|
|
156
166
|
element: this.$el,
|
|
157
|
-
|
|
167
|
+
options: this.options,
|
|
158
168
|
shouldShow: this.shouldShow,
|
|
159
169
|
}));
|
|
160
170
|
});
|
package/dist/index.cjs.map
CHANGED
|
@@ -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: Function,\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 NodeViewRendererProps,\n} from '@tiptap/core'\nimport { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { Decoration, 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: Decoration[]\n newNode: ProseMirrorNode\n newDecorations: Decoration[]\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: NodeViewProps = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations,\n selected: false,\n extension: this.extension,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n deleteNode: () => this.deleteNode(),\n }\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.renderer = new VueRenderer(Component, {\n parent: this.editor.contentComponent,\n propsData: props,\n })\n }\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 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 update(node: ProseMirrorNode, decorations: DecorationWithType[]) {\n const updateProps = (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\n this.node = node\n this.decorations = decorations\n\n return this.options.update({\n oldNode,\n oldDecorations,\n newNode: node,\n newDecorations: decorations,\n updateProps: () => updateProps({ node, decorations }),\n })\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (node === this.node && this.decorations === decorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n\n updateProps({ node, decorations })\n\n return true\n }\n\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n this.renderer.element.classList.add('ProseMirror-selectednode')\n }\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 }\n}\n\nexport function VueNodeViewRenderer(\n component: Vue | VueConstructor,\n options?: Partial<VueNodeViewRendererOptions>,\n): NodeViewRenderer {\n return (props: NodeViewRendererProps) => {\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 {}\n }\n\n return new VueNodeView(component, props, options) as unknown as ProseMirrorNodeView\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,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,OAAM;iBACP;AAED,gBAAA,IAAI,CAAC,SAAS,CAAC,MAAK;AAClB,oBAAA,MAAM,CAAC,cAAc,CAACA,oCAAgB,CAAC;wBACrC,WAAW,EAAE,IAAI,CAAC,WAAW;wBAC7B,MAAM;wBACN,OAAO,EAAE,IAAI,CAAC,GAAkB;wBAChC,SAAS,EAAE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b,aAAA,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;AAClC,aAAA,IAAI,EAAE;AACN,aAAA,IAAI,CAAC,GAAG,CAAC,EACb;KACF;IAED,OAAO,GAAA;AACL,QAAA,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAA;KACxB;AACF,CAAA;AAEe,SAAA,mBAAmB,CACjC,SAA+B,EAC/B,OAA6C,EAAA;IAE7C,OAAO,CAAC,KAA4B,KAAI;;;;AAItC,QAAA,IAAI,CAAE,KAAK,CAAC,MAAiB,CAAC,gBAAgB,EAAE;AAC9C,YAAA,OAAO,EAAE,CAAA;SACV;QAED,OAAO,IAAI,WAAW,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAmC,CAAA;AACrF,KAAC,CAAA;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 updateDelay: BubbleMenuPluginProps['updateDelay'],\n resizeDelay: BubbleMenuPluginProps['resizeDelay'],\n shouldShow: BubbleMenuPluginProps['shouldShow'],\n options: BubbleMenuPluginProps['options'],\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 options: {\n type: Object as PropType<BubbleMenuPluginProps['options']>,\n default: {},\n },\n\n resizeDelay: {\n type: Number as PropType<BubbleMenuPluginProps['resizeDelay']>,\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.$el as HTMLElement).style.visibility = 'hidden';\n (this.$el as HTMLElement).style.position = 'absolute'\n\n this.$el.remove()\n\n this.$nextTick(() => {\n editor.registerPlugin(BubbleMenuPlugin({\n updateDelay: this.updateDelay,\n resizeDelay: this.resizeDelay,\n options: this.options,\n editor,\n element: this.$el as HTMLElement,\n pluginKey: this.pluginKey,\n shouldShow: this.shouldShow,\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 options: FloatingMenuPluginProps['options'],\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 options: {\n type: Object as PropType<FloatingMenuPluginProps['options']>,\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.$el as HTMLElement).style.visibility = 'hidden';\n (this.$el as HTMLElement).style.position = 'absolute'\n\n this.$el.remove()\n\n this.$nextTick(() => {\n editor.registerPlugin(FloatingMenuPlugin({\n pluginKey: this.pluginKey,\n editor,\n element: this.$el as HTMLElement,\n options: this.options,\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: Function,\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 NodeViewRendererProps,\n} from '@tiptap/core'\nimport { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { Decoration, 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: Decoration[]\n newNode: ProseMirrorNode\n newDecorations: Decoration[]\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: NodeViewProps = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations,\n selected: false,\n extension: this.extension,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n deleteNode: () => this.deleteNode(),\n }\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.renderer = new VueRenderer(Component, {\n parent: this.editor.contentComponent,\n propsData: props,\n })\n }\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 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 update(node: ProseMirrorNode, decorations: DecorationWithType[]) {\n const updateProps = (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\n this.node = node\n this.decorations = decorations\n\n return this.options.update({\n oldNode,\n oldDecorations,\n newNode: node,\n newDecorations: decorations,\n updateProps: () => updateProps({ node, decorations }),\n })\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (node === this.node && this.decorations === decorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n\n updateProps({ node, decorations })\n\n return true\n }\n\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n this.renderer.element.classList.add('ProseMirror-selectednode')\n }\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 }\n}\n\nexport function VueNodeViewRenderer(\n component: Vue | VueConstructor,\n options?: Partial<VueNodeViewRendererOptions>,\n): NodeViewRenderer {\n return (props: NodeViewRendererProps) => {\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 {}\n }\n\n return new VueNodeView(component, props, options) as unknown as ProseMirrorNodeView\n }\n}\n"],"names":["BubbleMenuPlugin","CoreEditor","FloatingMenuPlugin","Vue","objectProp","booleanProp","functionProp","NodeView"],"mappings":";;;;;;;;;;;;AAYa,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,OAAO,EAAE;AACP,YAAA,IAAI,EAAE,MAAoD;AAC1D,YAAA,OAAO,EAAE,EAAE;AACZ,SAAA;AAED,QAAA,WAAW,EAAE;AACX,YAAA,IAAI,EAAE,MAAwD;AAC/D,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,OAAM;iBACP;gBAEA,IAAI,CAAC,GAAmB,CAAC,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAC;gBACrD,IAAI,CAAC,GAAmB,CAAC,KAAK,CAAC,QAAQ,GAAG,UAAU,CAAA;AAErD,gBAAA,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAA;AAEjB,gBAAA,IAAI,CAAC,SAAS,CAAC,MAAK;AAClB,oBAAA,MA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,SAAA,CAAC,CAAA;QACF,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAA;KAChE;IAED,YAAY,GAAA;AACV,QAAA,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;AACxB,YAAA,QAAQ,EAAE,KAAK;AAChB,SAAA,CAAC,CAAA;QACF,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAA;KACnE;IAED,oBAAoB,GAAA;QAClB,QACE,IAAI,CAAC,WAAW;;AAEb,aAAA,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;AAClC,aAAA,IAAI,EAAE;AACN,aAAA,IAAI,CAAC,GAAG,CAAC,EACb;KACF;IAED,OAAO,GAAA;AACL,QAAA,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAA;KACxB;AACF,CAAA;AAEe,SAAA,mBAAmB,CACjC,SAA+B,EAC/B,OAA6C,EAAA;IAE7C,OAAO,CAAC,KAA4B,KAAI;;;;AAItC,QAAA,IAAI,CAAE,KAAK,CAAC,MAAiB,CAAC,gBAAgB,EAAE;AAC9C,YAAA,OAAO,EAAE,CAAA;SACV;QAED,OAAO,IAAI,WAAW,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAmC,CAAA;AACrF,KAAC,CAAA;AACH;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -19,9 +19,12 @@ const BubbleMenu = {
|
|
|
19
19
|
updateDelay: {
|
|
20
20
|
type: Number,
|
|
21
21
|
},
|
|
22
|
-
|
|
22
|
+
options: {
|
|
23
23
|
type: Object,
|
|
24
|
-
default:
|
|
24
|
+
default: {},
|
|
25
|
+
},
|
|
26
|
+
resizeDelay: {
|
|
27
|
+
type: Number,
|
|
25
28
|
},
|
|
26
29
|
shouldShow: {
|
|
27
30
|
type: Function,
|
|
@@ -35,14 +38,18 @@ const BubbleMenu = {
|
|
|
35
38
|
if (!editor) {
|
|
36
39
|
return;
|
|
37
40
|
}
|
|
41
|
+
this.$el.style.visibility = 'hidden';
|
|
42
|
+
this.$el.style.position = 'absolute';
|
|
43
|
+
this.$el.remove();
|
|
38
44
|
this.$nextTick(() => {
|
|
39
45
|
editor.registerPlugin(BubbleMenuPlugin({
|
|
40
46
|
updateDelay: this.updateDelay,
|
|
47
|
+
resizeDelay: this.resizeDelay,
|
|
48
|
+
options: this.options,
|
|
41
49
|
editor,
|
|
42
50
|
element: this.$el,
|
|
43
51
|
pluginKey: this.pluginKey,
|
|
44
52
|
shouldShow: this.shouldShow,
|
|
45
|
-
tippyOptions: this.tippyOptions,
|
|
46
53
|
}));
|
|
47
54
|
});
|
|
48
55
|
},
|
|
@@ -128,7 +135,7 @@ const FloatingMenu = {
|
|
|
128
135
|
type: Object,
|
|
129
136
|
required: true,
|
|
130
137
|
},
|
|
131
|
-
|
|
138
|
+
options: {
|
|
132
139
|
type: Object,
|
|
133
140
|
default: () => ({}),
|
|
134
141
|
},
|
|
@@ -144,12 +151,15 @@ const FloatingMenu = {
|
|
|
144
151
|
if (!editor) {
|
|
145
152
|
return;
|
|
146
153
|
}
|
|
154
|
+
this.$el.style.visibility = 'hidden';
|
|
155
|
+
this.$el.style.position = 'absolute';
|
|
156
|
+
this.$el.remove();
|
|
147
157
|
this.$nextTick(() => {
|
|
148
158
|
editor.registerPlugin(FloatingMenuPlugin({
|
|
149
159
|
pluginKey: this.pluginKey,
|
|
150
160
|
editor,
|
|
151
161
|
element: this.$el,
|
|
152
|
-
|
|
162
|
+
options: this.options,
|
|
153
163
|
shouldShow: this.shouldShow,
|
|
154
164
|
}));
|
|
155
165
|
});
|
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: Function,\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 NodeViewRendererProps,\n} from '@tiptap/core'\nimport { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { Decoration, 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: Decoration[]\n newNode: ProseMirrorNode\n newDecorations: Decoration[]\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: NodeViewProps = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations,\n selected: false,\n extension: this.extension,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n deleteNode: () => this.deleteNode(),\n }\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.renderer = new VueRenderer(Component, {\n parent: this.editor.contentComponent,\n propsData: props,\n })\n }\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 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 update(node: ProseMirrorNode, decorations: DecorationWithType[]) {\n const updateProps = (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\n this.node = node\n this.decorations = decorations\n\n return this.options.update({\n oldNode,\n oldDecorations,\n newNode: node,\n newDecorations: decorations,\n updateProps: () => updateProps({ node, decorations }),\n })\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (node === this.node && this.decorations === decorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n\n updateProps({ node, decorations })\n\n return true\n }\n\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n this.renderer.element.classList.add('ProseMirror-selectednode')\n }\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 }\n}\n\nexport function VueNodeViewRenderer(\n component: Vue | VueConstructor,\n options?: Partial<VueNodeViewRendererOptions>,\n): NodeViewRenderer {\n return (props: NodeViewRendererProps) => {\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 {}\n }\n\n return new VueNodeView(component, props, options) as unknown as ProseMirrorNodeView\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,OA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EAAE,KAAK;AAChB,SAAA,CAAC,CAAA;QACF,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAA;KACnE;IAED,oBAAoB,GAAA;QAClB,QACE,IAAI,CAAC,WAAW;;AAEb,aAAA,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;AAClC,aAAA,IAAI,EAAE;AACN,aAAA,IAAI,CAAC,GAAG,CAAC,EACb;KACF;IAED,OAAO,GAAA;AACL,QAAA,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAA;KACxB;AACF,CAAA;AAEe,SAAA,mBAAmB,CACjC,SAA+B,EAC/B,OAA6C,EAAA;IAE7C,OAAO,CAAC,KAA4B,KAAI;;;;AAItC,QAAA,IAAI,CAAE,KAAK,CAAC,MAAiB,CAAC,gBAAgB,EAAE;AAC9C,YAAA,OAAO,EAAE,CAAA;SACV;QAED,OAAO,IAAI,WAAW,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAmC,CAAA;AACrF,KAAC,CAAA;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 updateDelay: BubbleMenuPluginProps['updateDelay'],\n resizeDelay: BubbleMenuPluginProps['resizeDelay'],\n shouldShow: BubbleMenuPluginProps['shouldShow'],\n options: BubbleMenuPluginProps['options'],\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 options: {\n type: Object as PropType<BubbleMenuPluginProps['options']>,\n default: {},\n },\n\n resizeDelay: {\n type: Number as PropType<BubbleMenuPluginProps['resizeDelay']>,\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.$el as HTMLElement).style.visibility = 'hidden';\n (this.$el as HTMLElement).style.position = 'absolute'\n\n this.$el.remove()\n\n this.$nextTick(() => {\n editor.registerPlugin(BubbleMenuPlugin({\n updateDelay: this.updateDelay,\n resizeDelay: this.resizeDelay,\n options: this.options,\n editor,\n element: this.$el as HTMLElement,\n pluginKey: this.pluginKey,\n shouldShow: this.shouldShow,\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 options: FloatingMenuPluginProps['options'],\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 options: {\n type: Object as PropType<FloatingMenuPluginProps['options']>,\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.$el as HTMLElement).style.visibility = 'hidden';\n (this.$el as HTMLElement).style.position = 'absolute'\n\n this.$el.remove()\n\n this.$nextTick(() => {\n editor.registerPlugin(FloatingMenuPlugin({\n pluginKey: this.pluginKey,\n editor,\n element: this.$el as HTMLElement,\n options: this.options,\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: Function,\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 NodeViewRendererProps,\n} from '@tiptap/core'\nimport { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { Decoration, 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: Decoration[]\n newNode: ProseMirrorNode\n newDecorations: Decoration[]\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: NodeViewProps = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations,\n selected: false,\n extension: this.extension,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n deleteNode: () => this.deleteNode(),\n }\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.renderer = new VueRenderer(Component, {\n parent: this.editor.contentComponent,\n propsData: props,\n })\n }\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 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 update(node: ProseMirrorNode, decorations: DecorationWithType[]) {\n const updateProps = (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\n this.node = node\n this.decorations = decorations\n\n return this.options.update({\n oldNode,\n oldDecorations,\n newNode: node,\n newDecorations: decorations,\n updateProps: () => updateProps({ node, decorations }),\n })\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (node === this.node && this.decorations === decorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n\n updateProps({ node, decorations })\n\n return true\n }\n\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n this.renderer.element.classList.add('ProseMirror-selectednode')\n }\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 }\n}\n\nexport function VueNodeViewRenderer(\n component: Vue | VueConstructor,\n options?: Partial<VueNodeViewRendererOptions>,\n): NodeViewRenderer {\n return (props: NodeViewRendererProps) => {\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 {}\n }\n\n return new VueNodeView(component, props, options) as unknown as ProseMirrorNodeView\n }\n}\n"],"names":["CoreEditor"],"mappings":";;;;;;;AAYa,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,OAAO,EAAE;AACP,YAAA,IAAI,EAAE,MAAoD;AAC1D,YAAA,OAAO,EAAE,EAAE;AACZ,SAAA;AAED,QAAA,WAAW,EAAE;AACX,YAAA,IAAI,EAAE,MAAwD;AAC/D,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,OAAM;iBACP;gBAEA,IAAI,CAAC,GAAmB,CAAC,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAC;gBACrD,IAAI,CAAC,GAAmB,CAAC,KAAK,CAAC,QAAQ,GAAG,UAAU,CAAA;AAErD,gBAAA,IAAI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I,CAAC,QAAQ,CAAC,WAAW,CAAC;AACxB,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA,CAAC,CAAA;QACF,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAA;KAChE;IAED,YAAY,GAAA;AACV,QAAA,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;AACxB,YAAA,QAAQ,EAAE,KAAK;AAChB,SAAA,CAAC,CAAA;QACF,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAA;KACnE;IAED,oBAAoB,GAAA;QAClB,QACE,IAAI,CAAC,WAAW;;AAEb,aAAA,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;AAClC,aAAA,IAAI,EAAE;AACN,aAAA,IAAI,CAAC,GAAG,CAAC,EACb;KACF;IAED,OAAO,GAAA;AACL,QAAA,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAA;KACxB;AACF,CAAA;AAEe,SAAA,mBAAmB,CACjC,SAA+B,EAC/B,OAA6C,EAAA;IAE7C,OAAO,CAAC,KAA4B,KAAI;;;;AAItC,QAAA,IAAI,CAAE,KAAK,CAAC,MAAiB,CAAC,gBAAgB,EAAE;AAC9C,YAAA,OAAO,EAAE,CAAA;SACV;QAED,OAAO,IAAI,WAAW,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAmC,CAAA;AACrF,KAAC,CAAA;AACH;;;;"}
|
package/dist/index.umd.js
CHANGED
|
@@ -18,9 +18,12 @@
|
|
|
18
18
|
updateDelay: {
|
|
19
19
|
type: Number,
|
|
20
20
|
},
|
|
21
|
-
|
|
21
|
+
options: {
|
|
22
22
|
type: Object,
|
|
23
|
-
default:
|
|
23
|
+
default: {},
|
|
24
|
+
},
|
|
25
|
+
resizeDelay: {
|
|
26
|
+
type: Number,
|
|
24
27
|
},
|
|
25
28
|
shouldShow: {
|
|
26
29
|
type: Function,
|
|
@@ -34,14 +37,18 @@
|
|
|
34
37
|
if (!editor) {
|
|
35
38
|
return;
|
|
36
39
|
}
|
|
40
|
+
this.$el.style.visibility = 'hidden';
|
|
41
|
+
this.$el.style.position = 'absolute';
|
|
42
|
+
this.$el.remove();
|
|
37
43
|
this.$nextTick(() => {
|
|
38
44
|
editor.registerPlugin(extensionBubbleMenu.BubbleMenuPlugin({
|
|
39
45
|
updateDelay: this.updateDelay,
|
|
46
|
+
resizeDelay: this.resizeDelay,
|
|
47
|
+
options: this.options,
|
|
40
48
|
editor,
|
|
41
49
|
element: this.$el,
|
|
42
50
|
pluginKey: this.pluginKey,
|
|
43
51
|
shouldShow: this.shouldShow,
|
|
44
|
-
tippyOptions: this.tippyOptions,
|
|
45
52
|
}));
|
|
46
53
|
});
|
|
47
54
|
},
|
|
@@ -127,7 +134,7 @@
|
|
|
127
134
|
type: Object,
|
|
128
135
|
required: true,
|
|
129
136
|
},
|
|
130
|
-
|
|
137
|
+
options: {
|
|
131
138
|
type: Object,
|
|
132
139
|
default: () => ({}),
|
|
133
140
|
},
|
|
@@ -143,12 +150,15 @@
|
|
|
143
150
|
if (!editor) {
|
|
144
151
|
return;
|
|
145
152
|
}
|
|
153
|
+
this.$el.style.visibility = 'hidden';
|
|
154
|
+
this.$el.style.position = 'absolute';
|
|
155
|
+
this.$el.remove();
|
|
146
156
|
this.$nextTick(() => {
|
|
147
157
|
editor.registerPlugin(extensionFloatingMenu.FloatingMenuPlugin({
|
|
148
158
|
pluginKey: this.pluginKey,
|
|
149
159
|
editor,
|
|
150
160
|
element: this.$el,
|
|
151
|
-
|
|
161
|
+
options: this.options,
|
|
152
162
|
shouldShow: this.shouldShow,
|
|
153
163
|
}));
|
|
154
164
|
});
|
package/dist/index.umd.js.map
CHANGED
|
@@ -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: Function,\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 NodeViewRendererProps,\n} from '@tiptap/core'\nimport { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { Decoration, 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: Decoration[]\n newNode: ProseMirrorNode\n newDecorations: Decoration[]\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: NodeViewProps = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations,\n selected: false,\n extension: this.extension,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n deleteNode: () => this.deleteNode(),\n }\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.renderer = new VueRenderer(Component, {\n parent: this.editor.contentComponent,\n propsData: props,\n })\n }\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 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 update(node: ProseMirrorNode, decorations: DecorationWithType[]) {\n const updateProps = (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\n this.node = node\n this.decorations = decorations\n\n return this.options.update({\n oldNode,\n oldDecorations,\n newNode: node,\n newDecorations: decorations,\n updateProps: () => updateProps({ node, decorations }),\n })\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (node === this.node && this.decorations === decorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n\n updateProps({ node, decorations })\n\n return true\n }\n\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n this.renderer.element.classList.add('ProseMirror-selectednode')\n }\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 }\n}\n\nexport function VueNodeViewRenderer(\n component: Vue | VueConstructor,\n options?: Partial<VueNodeViewRendererOptions>,\n): NodeViewRenderer {\n return (props: NodeViewRendererProps) => {\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 {}\n }\n\n return new VueNodeView(component, props, options) as unknown as ProseMirrorNodeView\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,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A0B,CAAC,CAAA;OAChE;MAED,YAAY,GAAA;EACV,QAAA,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;EACxB,YAAA,QAAQ,EAAE,KAAK;EAChB,SAAA,CAAC,CAAA;UACF,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAA;OACnE;MAED,oBAAoB,GAAA;UAClB,QACE,IAAI,CAAC,WAAW;;EAEb,aAAA,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;EAClC,aAAA,IAAI,EAAE;EACN,aAAA,IAAI,CAAC,GAAG,CAAC,EACb;OACF;MAED,OAAO,GAAA;EACL,QAAA,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAA;OACxB;EACF,CAAA;EAEe,SAAA,mBAAmB,CACjC,SAA+B,EAC/B,OAA6C,EAAA;MAE7C,OAAO,CAAC,KAA4B,KAAI;;;;EAItC,QAAA,IAAI,CAAE,KAAK,CAAC,MAAiB,CAAC,gBAAgB,EAAE;EAC9C,YAAA,OAAO,EAAE,CAAA;WACV;UAED,OAAO,IAAI,WAAW,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAmC,CAAA;EACrF,KAAC,CAAA;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 updateDelay: BubbleMenuPluginProps['updateDelay'],\n resizeDelay: BubbleMenuPluginProps['resizeDelay'],\n shouldShow: BubbleMenuPluginProps['shouldShow'],\n options: BubbleMenuPluginProps['options'],\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 options: {\n type: Object as PropType<BubbleMenuPluginProps['options']>,\n default: {},\n },\n\n resizeDelay: {\n type: Number as PropType<BubbleMenuPluginProps['resizeDelay']>,\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.$el as HTMLElement).style.visibility = 'hidden';\n (this.$el as HTMLElement).style.position = 'absolute'\n\n this.$el.remove()\n\n this.$nextTick(() => {\n editor.registerPlugin(BubbleMenuPlugin({\n updateDelay: this.updateDelay,\n resizeDelay: this.resizeDelay,\n options: this.options,\n editor,\n element: this.$el as HTMLElement,\n pluginKey: this.pluginKey,\n shouldShow: this.shouldShow,\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 options: FloatingMenuPluginProps['options'],\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 options: {\n type: Object as PropType<FloatingMenuPluginProps['options']>,\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.$el as HTMLElement).style.visibility = 'hidden';\n (this.$el as HTMLElement).style.position = 'absolute'\n\n this.$el.remove()\n\n this.$nextTick(() => {\n editor.registerPlugin(FloatingMenuPlugin({\n pluginKey: this.pluginKey,\n editor,\n element: this.$el as HTMLElement,\n options: this.options,\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: Function,\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 NodeViewRendererProps,\n} from '@tiptap/core'\nimport { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { Decoration, 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: Decoration[]\n newNode: ProseMirrorNode\n newDecorations: Decoration[]\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: NodeViewProps = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations,\n selected: false,\n extension: this.extension,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n deleteNode: () => this.deleteNode(),\n }\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.renderer = new VueRenderer(Component, {\n parent: this.editor.contentComponent,\n propsData: props,\n })\n }\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 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 update(node: ProseMirrorNode, decorations: DecorationWithType[]) {\n const updateProps = (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\n this.node = node\n this.decorations = decorations\n\n return this.options.update({\n oldNode,\n oldDecorations,\n newNode: node,\n newDecorations: decorations,\n updateProps: () => updateProps({ node, decorations }),\n })\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (node === this.node && this.decorations === decorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n\n updateProps({ node, decorations })\n\n return true\n }\n\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n this.renderer.element.classList.add('ProseMirror-selectednode')\n }\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 }\n}\n\nexport function VueNodeViewRenderer(\n component: Vue | VueConstructor,\n options?: Partial<VueNodeViewRendererOptions>,\n): NodeViewRenderer {\n return (props: NodeViewRendererProps) => {\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 {}\n }\n\n return new VueNodeView(component, props, options) as unknown as ProseMirrorNodeView\n }\n}\n"],"names":["BubbleMenuPlugin","CoreEditor","FloatingMenuPlugin","objectProp","booleanProp","functionProp","NodeView"],"mappings":";;;;;;AAYa,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,OAAO,EAAE;EACP,YAAA,IAAI,EAAE,MAAoD;EAC1D,YAAA,OAAO,EAAE,EAAE;EACZ,SAAA;EAED,QAAA,WAAW,EAAE;EACX,YAAA,IAAI,EAAE,MAAwD;EAC/D,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,CAAC,MA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ension<Options = any, Storage = any> {
|
|
|
338
338
|
config: ExtensionConfig;
|
|
339
339
|
constructor(config?: Partial<ExtensionConfig<Options, Storage>>);
|
|
340
340
|
static create<O = any, S = any>(config?: Partial<ExtensionConfig<O, S>>): Extension<O, S>;
|
|
341
|
-
configure(options?: Partial<Options>): Extension<
|
|
341
|
+
configure(options?: Partial<Options>): Extension<Options, Storage>;
|
|
342
342
|
extend<ExtendedOptions = Options, ExtendedStorage = Storage>(extendedConfig?: Partial<ExtensionConfig<ExtendedOptions, ExtendedStorage>>): Extension<ExtendedOptions, ExtendedStorage>;
|
|
343
343
|
}
|
|
@@ -442,7 +442,7 @@ export declare class Mark<Options = any, Storage = any> {
|
|
|
442
442
|
config: MarkConfig;
|
|
443
443
|
constructor(config?: Partial<MarkConfig<Options, Storage>>);
|
|
444
444
|
static create<O = any, S = any>(config?: Partial<MarkConfig<O, S>>): Mark<O, S>;
|
|
445
|
-
configure(options?: Partial<Options>): Mark<
|
|
445
|
+
configure(options?: Partial<Options>): Mark<Options, Storage>;
|
|
446
446
|
extend<ExtendedOptions = Options, ExtendedStorage = Storage>(extendedConfig?: Partial<MarkConfig<ExtendedOptions, ExtendedStorage>>): Mark<ExtendedOptions, ExtendedStorage>;
|
|
447
447
|
static handleExit({ editor, mark }: {
|
|
448
448
|
editor: Editor;
|
|
@@ -606,6 +606,6 @@ export declare class Node<Options = any, Storage = any> {
|
|
|
606
606
|
config: NodeConfig;
|
|
607
607
|
constructor(config?: Partial<NodeConfig<Options, Storage>>);
|
|
608
608
|
static create<O = any, S = any>(config?: Partial<NodeConfig<O, S>>): Node<O, S>;
|
|
609
|
-
configure(options?: Partial<Options>): Node<
|
|
609
|
+
configure(options?: Partial<Options>): Node<Options, Storage>;
|
|
610
610
|
extend<ExtendedOptions = Options, ExtendedStorage = Storage>(extendedConfig?: Partial<NodeConfig<ExtendedOptions, ExtendedStorage>>): Node<ExtendedOptions, ExtendedStorage>;
|
|
611
611
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const style = ".ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: \"liga\" 0; /* the above doesn't seem to work in Edge */\n}\n\n.ProseMirror [contenteditable=\"false\"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable=\"false\"] [contenteditable=\"true\"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 1px !important;\n height: 1px !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: \"\";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}
|
|
1
|
+
export declare const style = ".ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: \"liga\" 0; /* the above doesn't seem to work in Edge */\n}\n\n.ProseMirror [contenteditable=\"false\"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable=\"false\"] [contenteditable=\"true\"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 1px !important;\n height: 1px !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: \"\";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { type ArrowOptions, type AutoPlacementOptions, type FlipOptions, type HideOptions, type InlineOptions, type OffsetOptions, type Placement, type ShiftOptions, type SizeOptions, type Strategy } from '@floating-ui/dom';
|
|
1
2
|
import { Editor } from '@tiptap/core';
|
|
2
3
|
import { EditorState, Plugin, PluginKey } from '@tiptap/pm/state';
|
|
3
4
|
import { EditorView } from '@tiptap/pm/view';
|
|
4
|
-
import { Instance, Props } from 'tippy.js';
|
|
5
5
|
export interface BubbleMenuPluginProps {
|
|
6
6
|
/**
|
|
7
7
|
* The plugin key.
|
|
@@ -19,11 +19,6 @@ export interface BubbleMenuPluginProps {
|
|
|
19
19
|
* @default null
|
|
20
20
|
*/
|
|
21
21
|
element: HTMLElement;
|
|
22
|
-
/**
|
|
23
|
-
* The options for the tippy.js instance.
|
|
24
|
-
* @see https://atomiks.github.io/tippyjs/v6/all-props/
|
|
25
|
-
*/
|
|
26
|
-
tippyOptions?: Partial<Props>;
|
|
27
22
|
/**
|
|
28
23
|
* The delay in milliseconds before the menu should be updated.
|
|
29
24
|
* This can be useful to prevent performance issues.
|
|
@@ -31,11 +26,18 @@ export interface BubbleMenuPluginProps {
|
|
|
31
26
|
* @default 250
|
|
32
27
|
*/
|
|
33
28
|
updateDelay?: number;
|
|
29
|
+
/**
|
|
30
|
+
* The delay in milliseconds before the menu position should be updated on window resize.
|
|
31
|
+
* This can be useful to prevent performance issues.
|
|
32
|
+
* @type {number}
|
|
33
|
+
* @default 60
|
|
34
|
+
*/
|
|
35
|
+
resizeDelay?: number;
|
|
34
36
|
/**
|
|
35
37
|
* A function that determines whether the menu should be shown or not.
|
|
36
38
|
* If this function returns `false`, the menu will be hidden, otherwise it will be shown.
|
|
37
39
|
*/
|
|
38
|
-
shouldShow
|
|
40
|
+
shouldShow: ((props: {
|
|
39
41
|
editor: Editor;
|
|
40
42
|
view: EditorView;
|
|
41
43
|
state: EditorState;
|
|
@@ -43,6 +45,21 @@ export interface BubbleMenuPluginProps {
|
|
|
43
45
|
from: number;
|
|
44
46
|
to: number;
|
|
45
47
|
}) => boolean) | null;
|
|
48
|
+
/**
|
|
49
|
+
* FloatingUI options.
|
|
50
|
+
*/
|
|
51
|
+
options?: {
|
|
52
|
+
strategy?: Strategy;
|
|
53
|
+
placement?: Placement;
|
|
54
|
+
offset?: OffsetOptions | boolean;
|
|
55
|
+
flip?: FlipOptions | boolean;
|
|
56
|
+
shift?: ShiftOptions | boolean;
|
|
57
|
+
arrow?: ArrowOptions | false;
|
|
58
|
+
size?: SizeOptions | boolean;
|
|
59
|
+
autoPlacement?: AutoPlacementOptions | boolean;
|
|
60
|
+
hide?: HideOptions | boolean;
|
|
61
|
+
inline?: InlineOptions | boolean;
|
|
62
|
+
};
|
|
46
63
|
}
|
|
47
64
|
export type BubbleMenuViewProps = BubbleMenuPluginProps & {
|
|
48
65
|
view: EditorView;
|
|
@@ -52,22 +69,28 @@ export declare class BubbleMenuView {
|
|
|
52
69
|
element: HTMLElement;
|
|
53
70
|
view: EditorView;
|
|
54
71
|
preventHide: boolean;
|
|
55
|
-
tippy: Instance | undefined;
|
|
56
|
-
tippyOptions?: Partial<Props>;
|
|
57
72
|
updateDelay: number;
|
|
73
|
+
resizeDelay: number;
|
|
58
74
|
private updateDebounceTimer;
|
|
75
|
+
private resizeDebounceTimer;
|
|
76
|
+
private floatingUIOptions;
|
|
59
77
|
shouldShow: Exclude<BubbleMenuPluginProps['shouldShow'], null>;
|
|
60
|
-
|
|
78
|
+
get middlewares(): {
|
|
79
|
+
name: string;
|
|
80
|
+
options?: any;
|
|
81
|
+
fn: (state: import("@floating-ui/dom").MiddlewareState) => import("@floating-ui/core").MiddlewareReturn | Promise<import("@floating-ui/core").MiddlewareReturn>;
|
|
82
|
+
}[];
|
|
83
|
+
constructor({ editor, element, view, updateDelay, resizeDelay, shouldShow, options, }: BubbleMenuViewProps);
|
|
61
84
|
mousedownHandler: () => void;
|
|
62
85
|
dragstartHandler: () => void;
|
|
63
86
|
focusHandler: () => void;
|
|
64
87
|
blurHandler: ({ event }: {
|
|
65
88
|
event: FocusEvent;
|
|
66
89
|
}) => void;
|
|
67
|
-
|
|
68
|
-
createTooltip(): void;
|
|
90
|
+
updatePosition(): void;
|
|
69
91
|
update(view: EditorView, oldState?: EditorState): void;
|
|
70
92
|
handleDebouncedUpdate: (view: EditorView, oldState?: EditorState) => void;
|
|
93
|
+
getShouldShow(oldState?: EditorState): boolean;
|
|
71
94
|
updateHandler: (view: EditorView, selectionChanged: boolean, docChanged: boolean, oldState?: EditorState) => void;
|
|
72
95
|
show(): void;
|
|
73
96
|
hide(): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { type ArrowOptions, type AutoPlacementOptions, type FlipOptions, type HideOptions, type InlineOptions, type OffsetOptions, type Placement, type ShiftOptions, type SizeOptions, type Strategy } from '@floating-ui/dom';
|
|
1
2
|
import { Editor } from '@tiptap/core';
|
|
2
3
|
import { EditorState, Plugin, PluginKey } from '@tiptap/pm/state';
|
|
3
4
|
import { EditorView } from '@tiptap/pm/view';
|
|
4
|
-
import { Instance, Props } from 'tippy.js';
|
|
5
5
|
export interface FloatingMenuPluginProps {
|
|
6
6
|
/**
|
|
7
7
|
* The plugin key for the floating menu.
|
|
@@ -18,23 +18,33 @@ export interface FloatingMenuPluginProps {
|
|
|
18
18
|
* @default null
|
|
19
19
|
*/
|
|
20
20
|
element: HTMLElement;
|
|
21
|
-
/**
|
|
22
|
-
* The options for the tippy instance.
|
|
23
|
-
* @default {}
|
|
24
|
-
* @see https://atomiks.github.io/tippyjs/v6/all-props/
|
|
25
|
-
*/
|
|
26
|
-
tippyOptions?: Partial<Props>;
|
|
27
21
|
/**
|
|
28
22
|
* A function that determines whether the menu should be shown or not.
|
|
29
23
|
* If this function returns `false`, the menu will be hidden, otherwise it will be shown.
|
|
30
|
-
* @default null
|
|
31
24
|
*/
|
|
32
|
-
shouldShow
|
|
25
|
+
shouldShow: ((props: {
|
|
33
26
|
editor: Editor;
|
|
34
27
|
view: EditorView;
|
|
35
28
|
state: EditorState;
|
|
36
29
|
oldState?: EditorState;
|
|
30
|
+
from: number;
|
|
31
|
+
to: number;
|
|
37
32
|
}) => boolean) | null;
|
|
33
|
+
/**
|
|
34
|
+
* FloatingUI options.
|
|
35
|
+
*/
|
|
36
|
+
options?: {
|
|
37
|
+
strategy?: Strategy;
|
|
38
|
+
placement?: Placement;
|
|
39
|
+
offset?: OffsetOptions | boolean;
|
|
40
|
+
flip?: FlipOptions | boolean;
|
|
41
|
+
shift?: ShiftOptions | boolean;
|
|
42
|
+
arrow?: ArrowOptions | false;
|
|
43
|
+
size?: SizeOptions | boolean;
|
|
44
|
+
autoPlacement?: AutoPlacementOptions | boolean;
|
|
45
|
+
hide?: HideOptions | boolean;
|
|
46
|
+
inline?: InlineOptions | boolean;
|
|
47
|
+
};
|
|
38
48
|
}
|
|
39
49
|
export type FloatingMenuViewProps = FloatingMenuPluginProps & {
|
|
40
50
|
/**
|
|
@@ -47,17 +57,22 @@ export declare class FloatingMenuView {
|
|
|
47
57
|
element: HTMLElement;
|
|
48
58
|
view: EditorView;
|
|
49
59
|
preventHide: boolean;
|
|
50
|
-
tippy: Instance | undefined;
|
|
51
|
-
tippyOptions?: Partial<Props>;
|
|
52
60
|
shouldShow: Exclude<FloatingMenuPluginProps['shouldShow'], null>;
|
|
53
|
-
|
|
61
|
+
private floatingUIOptions;
|
|
62
|
+
get middlewares(): {
|
|
63
|
+
name: string;
|
|
64
|
+
options?: any;
|
|
65
|
+
fn: (state: import("@floating-ui/dom").MiddlewareState) => import("@floating-ui/core").MiddlewareReturn | Promise<import("@floating-ui/core").MiddlewareReturn>;
|
|
66
|
+
}[];
|
|
67
|
+
constructor({ editor, element, view, options, shouldShow, }: FloatingMenuViewProps);
|
|
68
|
+
getShouldShow(oldState?: EditorState): boolean;
|
|
69
|
+
updateHandler: (view: EditorView, selectionChanged: boolean, docChanged: boolean, oldState?: EditorState) => void;
|
|
54
70
|
mousedownHandler: () => void;
|
|
55
71
|
focusHandler: () => void;
|
|
56
72
|
blurHandler: ({ event }: {
|
|
57
73
|
event: FocusEvent;
|
|
58
74
|
}) => void;
|
|
59
|
-
|
|
60
|
-
createTooltip(): void;
|
|
75
|
+
updatePosition(): void;
|
|
61
76
|
update(view: EditorView, oldState?: EditorState): void;
|
|
62
77
|
show(): void;
|
|
63
78
|
hide(): void;
|
|
@@ -3,8 +3,9 @@ import Vue, { Component } from 'vue';
|
|
|
3
3
|
export interface BubbleMenuInterface extends Vue {
|
|
4
4
|
pluginKey: BubbleMenuPluginProps['pluginKey'];
|
|
5
5
|
editor: BubbleMenuPluginProps['editor'];
|
|
6
|
-
tippyOptions: BubbleMenuPluginProps['tippyOptions'];
|
|
7
6
|
updateDelay: BubbleMenuPluginProps['updateDelay'];
|
|
7
|
+
resizeDelay: BubbleMenuPluginProps['resizeDelay'];
|
|
8
8
|
shouldShow: BubbleMenuPluginProps['shouldShow'];
|
|
9
|
+
options: BubbleMenuPluginProps['options'];
|
|
9
10
|
}
|
|
10
11
|
export declare const BubbleMenu: Component;
|
|
@@ -2,7 +2,7 @@ import { FloatingMenuPluginProps } from '@tiptap/extension-floating-menu';
|
|
|
2
2
|
import Vue, { Component } from 'vue';
|
|
3
3
|
export interface FloatingMenuInterface extends Vue {
|
|
4
4
|
pluginKey: FloatingMenuPluginProps['pluginKey'];
|
|
5
|
-
|
|
5
|
+
options: FloatingMenuPluginProps['options'];
|
|
6
6
|
editor: FloatingMenuPluginProps['editor'];
|
|
7
7
|
shouldShow: FloatingMenuPluginProps['shouldShow'];
|
|
8
8
|
}
|
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": "
|
|
4
|
+
"version": "3.0.0-next.0",
|
|
5
5
|
"homepage": "https://tiptap.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiptap",
|
|
@@ -29,18 +29,18 @@
|
|
|
29
29
|
"dist"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@tiptap/extension-bubble-menu": "^
|
|
33
|
-
"@tiptap/extension-floating-menu": "^
|
|
32
|
+
"@tiptap/extension-bubble-menu": "^3.0.0-next.0",
|
|
33
|
+
"@tiptap/extension-floating-menu": "^3.0.0-next.0",
|
|
34
34
|
"vue-ts-types": "^1.6.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@tiptap/core": "^
|
|
38
|
-
"@tiptap/pm": "^
|
|
37
|
+
"@tiptap/core": "^3.0.0-next.0",
|
|
38
|
+
"@tiptap/pm": "^3.0.0-next.0",
|
|
39
39
|
"vue": "^2.6.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@tiptap/core": "^
|
|
43
|
-
"@tiptap/pm": "^
|
|
42
|
+
"@tiptap/core": "^3.0.0-next.0",
|
|
43
|
+
"@tiptap/pm": "^3.0.0-next.0",
|
|
44
44
|
"vue": "^2.6.0"
|
|
45
45
|
},
|
|
46
46
|
"repository": {
|
package/src/BubbleMenu.ts
CHANGED
|
@@ -4,9 +4,10 @@ import Vue, { Component, CreateElement, PropType } from 'vue'
|
|
|
4
4
|
export interface BubbleMenuInterface extends Vue {
|
|
5
5
|
pluginKey: BubbleMenuPluginProps['pluginKey'],
|
|
6
6
|
editor: BubbleMenuPluginProps['editor'],
|
|
7
|
-
tippyOptions: BubbleMenuPluginProps['tippyOptions'],
|
|
8
7
|
updateDelay: BubbleMenuPluginProps['updateDelay'],
|
|
8
|
+
resizeDelay: BubbleMenuPluginProps['resizeDelay'],
|
|
9
9
|
shouldShow: BubbleMenuPluginProps['shouldShow'],
|
|
10
|
+
options: BubbleMenuPluginProps['options'],
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
export const BubbleMenu: Component = {
|
|
@@ -27,9 +28,13 @@ export const BubbleMenu: Component = {
|
|
|
27
28
|
type: Number as PropType<BubbleMenuPluginProps['updateDelay']>,
|
|
28
29
|
},
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
type: Object as PropType<BubbleMenuPluginProps['
|
|
32
|
-
default:
|
|
31
|
+
options: {
|
|
32
|
+
type: Object as PropType<BubbleMenuPluginProps['options']>,
|
|
33
|
+
default: {},
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
resizeDelay: {
|
|
37
|
+
type: Number as PropType<BubbleMenuPluginProps['resizeDelay']>,
|
|
33
38
|
},
|
|
34
39
|
|
|
35
40
|
shouldShow: {
|
|
@@ -46,14 +51,20 @@ export const BubbleMenu: Component = {
|
|
|
46
51
|
return
|
|
47
52
|
}
|
|
48
53
|
|
|
54
|
+
(this.$el as HTMLElement).style.visibility = 'hidden';
|
|
55
|
+
(this.$el as HTMLElement).style.position = 'absolute'
|
|
56
|
+
|
|
57
|
+
this.$el.remove()
|
|
58
|
+
|
|
49
59
|
this.$nextTick(() => {
|
|
50
60
|
editor.registerPlugin(BubbleMenuPlugin({
|
|
51
61
|
updateDelay: this.updateDelay,
|
|
62
|
+
resizeDelay: this.resizeDelay,
|
|
63
|
+
options: this.options,
|
|
52
64
|
editor,
|
|
53
65
|
element: this.$el as HTMLElement,
|
|
54
66
|
pluginKey: this.pluginKey,
|
|
55
67
|
shouldShow: this.shouldShow,
|
|
56
|
-
tippyOptions: this.tippyOptions,
|
|
57
68
|
}))
|
|
58
69
|
})
|
|
59
70
|
},
|
package/src/FloatingMenu.ts
CHANGED
|
@@ -3,7 +3,7 @@ import Vue, { Component, CreateElement, PropType } from 'vue'
|
|
|
3
3
|
|
|
4
4
|
export interface FloatingMenuInterface extends Vue {
|
|
5
5
|
pluginKey: FloatingMenuPluginProps['pluginKey'],
|
|
6
|
-
|
|
6
|
+
options: FloatingMenuPluginProps['options'],
|
|
7
7
|
editor: FloatingMenuPluginProps['editor'],
|
|
8
8
|
shouldShow: FloatingMenuPluginProps['shouldShow'],
|
|
9
9
|
}
|
|
@@ -22,8 +22,8 @@ export const FloatingMenu: Component = {
|
|
|
22
22
|
required: true,
|
|
23
23
|
},
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
type: Object as PropType<FloatingMenuPluginProps['
|
|
25
|
+
options: {
|
|
26
|
+
type: Object as PropType<FloatingMenuPluginProps['options']>,
|
|
27
27
|
default: () => ({}),
|
|
28
28
|
},
|
|
29
29
|
|
|
@@ -41,12 +41,17 @@ export const FloatingMenu: Component = {
|
|
|
41
41
|
return
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
(this.$el as HTMLElement).style.visibility = 'hidden';
|
|
45
|
+
(this.$el as HTMLElement).style.position = 'absolute'
|
|
46
|
+
|
|
47
|
+
this.$el.remove()
|
|
48
|
+
|
|
44
49
|
this.$nextTick(() => {
|
|
45
50
|
editor.registerPlugin(FloatingMenuPlugin({
|
|
46
51
|
pluginKey: this.pluginKey,
|
|
47
52
|
editor,
|
|
48
53
|
element: this.$el as HTMLElement,
|
|
49
|
-
|
|
54
|
+
options: this.options,
|
|
50
55
|
shouldShow: this.shouldShow,
|
|
51
56
|
}))
|
|
52
57
|
})
|