@tiptap/vue-3 2.0.0-beta.90 → 2.0.0-beta.91

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.
@@ -5,37 +5,37 @@ import { Node as ProseMirrorNode } from 'prosemirror-model';
5
5
  export declare const nodeViewProps: {
6
6
  editor: {
7
7
  type: PropType<import("@tiptap/core").Editor>;
8
- required: boolean;
8
+ required: true;
9
9
  };
10
10
  node: {
11
11
  type: PropType<ProseMirrorNode<any>>;
12
- required: boolean;
12
+ required: true;
13
13
  };
14
14
  decorations: {
15
15
  type: PropType<Decoration<{
16
16
  [key: string]: any;
17
17
  }>[]>;
18
- required: boolean;
18
+ required: true;
19
19
  };
20
20
  selected: {
21
21
  type: PropType<boolean>;
22
- required: boolean;
22
+ required: true;
23
23
  };
24
24
  extension: {
25
25
  type: PropType<import("@tiptap/core").Node<any, any>>;
26
- required: boolean;
26
+ required: true;
27
27
  };
28
28
  getPos: {
29
29
  type: PropType<() => number>;
30
- required: boolean;
30
+ required: true;
31
31
  };
32
32
  updateAttributes: {
33
33
  type: PropType<(attributes: Record<string, any>) => void>;
34
- required: boolean;
34
+ required: true;
35
35
  };
36
36
  deleteNode: {
37
37
  type: PropType<() => void>;
38
- required: boolean;
38
+ required: true;
39
39
  };
40
40
  };
41
41
  export interface VueNodeViewRendererOptions extends NodeViewRendererOptions {
@@ -331,6 +331,10 @@ class VueNodeView extends core.NodeView {
331
331
  // @ts-ignore
332
332
  // eslint-disable-next-line
333
333
  __scopeId: this.component.__scopeId,
334
+ // add support for CSS Modules
335
+ // @ts-ignore
336
+ // eslint-disable-next-line
337
+ __cssModules: this.component.__cssModules,
334
338
  });
335
339
  this.renderer = new VueRenderer(extendedComponent, {
336
340
  editor: this.editor,
@@ -1 +1 @@
1
- {"version":3,"file":"tiptap-vue-3.cjs.js","sources":["../src/BubbleMenu.ts","../src/Editor.ts","../src/EditorContent.ts","../src/FloatingMenu.ts","../src/useEditor.ts","../src/VueRenderer.ts","../src/VueNodeViewRenderer.ts","../src/NodeViewWrapper.ts","../src/NodeViewContent.ts"],"sourcesContent":["import {\n h,\n ref,\n PropType,\n onMounted,\n onBeforeUnmount,\n defineComponent,\n} from 'vue'\nimport { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\n\nexport const BubbleMenu = defineComponent({\n name: 'BubbleMenu',\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType<Exclude<BubbleMenuPluginProps['pluginKey'], string>>],\n type: null,\n default: 'bubbleMenu',\n },\n\n editor: {\n type: Object as PropType<BubbleMenuPluginProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<BubbleMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<BubbleMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n pluginKey,\n editor,\n tippyOptions,\n shouldShow,\n } = props\n\n editor.registerPlugin(BubbleMenuPlugin({\n pluginKey,\n editor,\n element: root.value as HTMLElement,\n tippyOptions,\n shouldShow,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h('div', { ref: root }, slots.default?.())\n },\n})\n","import { EditorState, Plugin, PluginKey } from 'prosemirror-state'\nimport { Editor as CoreEditor, EditorOptions } from '@tiptap/core'\nimport {\n markRaw,\n Ref,\n customRef,\n ComponentInternalInstance,\n ComponentPublicInstance,\n reactive,\n} from 'vue'\nimport { VueRenderer } from './VueRenderer'\n\nfunction useDebouncedRef<T>(value: T) {\n return customRef<T>((track, trigger) => {\n return {\n get() {\n track()\n return value\n },\n set(newValue) {\n // update state\n value = newValue\n\n // update view as soon as possible\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n trigger()\n })\n })\n },\n }\n })\n}\n\nexport type ContentComponent = ComponentInternalInstance & {\n ctx: ComponentPublicInstance,\n}\n\nexport class Editor extends CoreEditor {\n private reactiveState: Ref<EditorState>\n\n private reactiveExtensionStorage: Ref<Record<string, any>>\n\n public vueRenderers = reactive<Map<string, VueRenderer>>(new Map())\n\n public contentComponent: ContentComponent | null = null\n\n constructor(options: Partial<EditorOptions> = {}) {\n super(options)\n\n this.reactiveState = useDebouncedRef(this.view.state)\n this.reactiveExtensionStorage = useDebouncedRef(this.extensionStorage)\n\n this.on('transaction', () => {\n this.reactiveState.value = this.view.state\n this.reactiveExtensionStorage.value = this.extensionStorage\n })\n\n return markRaw(this)\n }\n\n get state() {\n return this.reactiveState\n ? this.reactiveState.value\n : this.view.state\n }\n\n get storage() {\n return this.reactiveExtensionStorage\n ? this.reactiveExtensionStorage.value\n : super.storage\n }\n\n /**\n * Register a ProseMirror plugin.\n */\n public registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]): void {\n super.registerPlugin(plugin, handlePlugins)\n this.reactiveState.value = this.view.state\n }\n\n /**\n * Unregister a ProseMirror plugin.\n */\n public unregisterPlugin(nameOrPluginKey: string | PluginKey): void {\n super.unregisterPlugin(nameOrPluginKey)\n this.reactiveState.value = this.view.state\n }\n}\n","import {\n h,\n ref,\n Ref,\n unref,\n Teleport,\n PropType,\n defineComponent,\n DefineComponent,\n watchEffect,\n nextTick,\n onBeforeUnmount,\n getCurrentInstance,\n} from 'vue'\nimport { Editor } from './Editor'\n\nexport const EditorContent = defineComponent({\n name: 'EditorContent',\n\n props: {\n editor: {\n default: null,\n type: Object as PropType<Editor>,\n },\n },\n\n setup(props) {\n const rootEl: Ref<Element | undefined> = ref()\n const instance = getCurrentInstance()\n\n watchEffect(() => {\n const editor = props.editor\n\n if (editor && editor.options.element && rootEl.value) {\n nextTick(() => {\n if (!rootEl.value || !editor.options.element.firstChild) {\n return\n }\n\n const element = unref(rootEl.value)\n\n rootEl.value.append(...editor.options.element.childNodes)\n\n // @ts-ignore\n editor.contentComponent = instance.ctx._\n\n editor.setOptions({\n element,\n })\n\n editor.createNodeViews()\n })\n }\n })\n\n onBeforeUnmount(() => {\n const editor = props.editor\n\n if (!editor) {\n return\n }\n\n // destroy nodeviews before vue removes dom element\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 return { rootEl }\n },\n\n render() {\n const vueRenderers: any[] = []\n\n if (this.editor) {\n this.editor.vueRenderers.forEach(vueRenderer => {\n const node = h(\n Teleport,\n {\n to: vueRenderer.teleportElement,\n key: vueRenderer.id,\n },\n h(\n vueRenderer.component as DefineComponent,\n {\n ref: vueRenderer.id,\n ...vueRenderer.props,\n },\n ),\n )\n\n vueRenderers.push(node)\n })\n }\n\n return h(\n 'div',\n {\n ref: (el: any) => { this.rootEl = el },\n },\n ...vueRenderers,\n )\n },\n})\n","import {\n h,\n ref,\n PropType,\n onMounted,\n onBeforeUnmount,\n defineComponent,\n} from 'vue'\nimport { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\n\nexport const FloatingMenu = defineComponent({\n name: 'FloatingMenu',\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],\n type: null,\n default: 'floatingMenu',\n },\n\n editor: {\n type: Object as PropType<FloatingMenuPluginProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<FloatingMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<FloatingMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n pluginKey,\n editor,\n tippyOptions,\n shouldShow,\n } = props\n\n editor.registerPlugin(FloatingMenuPlugin({\n pluginKey,\n editor,\n element: root.value as HTMLElement,\n tippyOptions,\n shouldShow,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h('div', { ref: root }, slots.default?.())\n },\n})\n","import { onMounted, onBeforeUnmount, shallowRef } from 'vue'\nimport { EditorOptions } from '@tiptap/core'\nimport { Editor } from './Editor'\n\nexport const useEditor = (options: Partial<EditorOptions> = {}) => {\n const editor = shallowRef<Editor>()\n\n onMounted(() => {\n editor.value = new Editor(options)\n })\n\n onBeforeUnmount(() => {\n editor.value?.destroy()\n })\n\n return editor\n}\n","import { reactive, markRaw, Component } from 'vue'\nimport { Editor } from '@tiptap/core'\nimport { Editor as ExtendedEditor } from './Editor'\n\nexport interface VueRendererOptions {\n editor: Editor,\n props?: Record<string, any>,\n}\n\nexport class VueRenderer {\n id: string\n\n editor: ExtendedEditor\n\n component: Component\n\n teleportElement: Element\n\n element: Element\n\n props: Record<string, any>\n\n constructor(component: Component, { props = {}, editor }: VueRendererOptions) {\n this.id = Math.floor(Math.random() * 0xFFFFFFFF).toString()\n this.editor = editor as ExtendedEditor\n this.component = markRaw(component)\n this.teleportElement = document.createElement('div')\n this.element = this.teleportElement\n this.props = reactive(props)\n this.editor.vueRenderers.set(this.id, this)\n\n if (this.editor.contentComponent) {\n this.editor.contentComponent.update()\n\n if (this.teleportElement.children.length !== 1) {\n throw Error('VueRenderer doesn’t support multiple child elements.')\n }\n\n this.element = this.teleportElement.firstElementChild as Element\n }\n }\n\n get ref(): any {\n return this.editor.contentComponent?.refs[this.id]\n }\n\n updateProps(props: Record<string, any> = {}): void {\n Object\n .entries(props)\n .forEach(([key, value]) => {\n this.props[key] = value\n })\n }\n\n destroy(): void {\n this.editor.vueRenderers.delete(this.id)\n }\n}\n","import {\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererProps,\n NodeViewRendererOptions,\n} from '@tiptap/core'\nimport {\n ref,\n Ref,\n provide,\n PropType,\n Component,\n defineComponent,\n} from 'vue'\nimport { Decoration, NodeView as ProseMirrorNodeView } from 'prosemirror-view'\nimport { Node as ProseMirrorNode } from 'prosemirror-model'\nimport { Editor } from './Editor'\nimport { VueRenderer } from './VueRenderer'\n\nexport const nodeViewProps = {\n editor: {\n type: Object as PropType<NodeViewProps['editor']>,\n required: true,\n },\n node: {\n type: Object as PropType<NodeViewProps['node']>,\n required: true,\n },\n decorations: {\n type: Object as PropType<NodeViewProps['decorations']>,\n required: true,\n },\n selected: {\n type: Boolean as PropType<NodeViewProps['selected']>,\n required: true,\n },\n extension: {\n type: Object as PropType<NodeViewProps['extension']>,\n required: true,\n },\n getPos: {\n type: Function as PropType<NodeViewProps['getPos']>,\n required: true,\n },\n updateAttributes: {\n type: Function as PropType<NodeViewProps['updateAttributes']>,\n required: true,\n },\n deleteNode: {\n type: Function as PropType<NodeViewProps['deleteNode']>,\n required: true,\n },\n}\n\nexport interface VueNodeViewRendererOptions extends NodeViewRendererOptions {\n update: ((props: {\n oldNode: ProseMirrorNode,\n oldDecorations: Decoration[],\n newNode: ProseMirrorNode,\n newDecorations: Decoration[],\n updateProps: () => void,\n }) => boolean) | null,\n}\n\nclass VueNodeView extends NodeView<Component, Editor, VueNodeViewRendererOptions> {\n\n renderer!: VueRenderer\n\n decorationClasses!: Ref<string>\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 = ref(this.getDecorationClasses())\n\n const extendedComponent = defineComponent({\n extends: { ...this.component },\n props: Object.keys(props),\n template: (this.component as any).template,\n setup: reactiveProps => {\n provide('onDragStart', onDragStart)\n provide('decorationClasses', this.decorationClasses)\n\n return (this.component as any).setup?.(reactiveProps, {\n expose: () => undefined,\n })\n },\n // add support for scoped styles\n // @ts-ignore\n // eslint-disable-next-line\n __scopeId: this.component.__scopeId,\n })\n\n this.renderer = new VueRenderer(extendedComponent, {\n editor: this.editor,\n 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\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\n }\n\n update(node: ProseMirrorNode, decorations: Decoration[]) {\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 }\n\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n }\n\n getDecorationClasses() {\n return this.decorations\n // @ts-ignore\n .map(item => item.type.attrs.class)\n .flat()\n .join(' ')\n }\n\n destroy() {\n this.renderer.destroy()\n }\n\n}\n\nexport function VueNodeViewRenderer(component: Component, options?: Partial<VueNodeViewRendererOptions>): 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 ProseMirrorNodeView\n }\n}\n","import { h, defineComponent } from 'vue'\n\nexport const NodeViewWrapper = defineComponent({\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n inject: ['onDragStart', 'decorationClasses'],\n\n render() {\n return h(\n this.as, {\n // @ts-ignore\n class: this.decorationClasses.value,\n style: {\n whiteSpace: 'normal',\n },\n 'data-node-view-wrapper': '',\n // @ts-ignore (https://github.com/vuejs/vue-next/issues/3031)\n onDragstart: this.onDragStart,\n },\n this.$slots.default?.(),\n )\n },\n})\n","import { h, defineComponent } from 'vue'\n\nexport const NodeViewContent = defineComponent({\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n render() {\n return h(\n this.as, {\n style: {\n whiteSpace: 'pre-wrap',\n },\n 'data-node-view-content': '',\n },\n )\n },\n})\n"],"names":["defineComponent","ref","onMounted","BubbleMenuPlugin","onBeforeUnmount","h","customRef","CoreEditor","reactive","markRaw","getCurrentInstance","watchEffect","nextTick","unref","Teleport","FloatingMenuPlugin","shallowRef","NodeView","provide"],"mappings":";;;;;;;;;MAUa,UAAU,GAAGA,mBAAe,CAAC;IACxC,IAAI,EAAE,YAAY;IAElB,KAAK,EAAE;QACL,SAAS,EAAE;;;YAGT,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,YAAY;SACtB;QAED,MAAM,EAAE;YACN,IAAI,EAAE,MAAmD;YACzD,QAAQ,EAAE,IAAI;SACf;QAED,YAAY,EAAE;YACZ,IAAI,EAAE,MAAyD;YAC/D,OAAO,EAAE,OAAO,EAAE,CAAC;SACpB;QAED,UAAU,EAAE;YACV,IAAI,EAAE,QAAkF;YACxF,OAAO,EAAE,IAAI;SACd;KACF;IAED,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE;QACpB,MAAM,IAAI,GAAGC,OAAG,CAAqB,IAAI,CAAC,CAAA;QAE1CC,aAAS,CAAC;YACR,MAAM,EACJ,SAAS,EACT,MAAM,EACN,YAAY,EACZ,UAAU,GACX,GAAG,KAAK,C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AED,OAAO,IAAI,WAAW,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAwB,CAAA;KACzE,CAAA;AACH;;MC1Ma,eAAe,GAAGlB,mBAAe,CAAC;IAC7C,KAAK,EAAE;QACL,EAAE,EAAE;YACF,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,KAAK;SACf;KACF;IAED,MAAM,EAAE,CAAC,aAAa,EAAE,mBAAmB,CAAC;IAE5C,MAAM;;QACJ,OAAOK,KAAC,CACN,IAAI,CAAC,EAAE,EAAE;;YAEP,KAAK,EAAE,IAAI,CAAC,iBAAiB,CAAC,KAAK;YACnC,KAAK,EAAE;gBACL,UAAU,EAAE,QAAQ;aACrB;YACD,wBAAwB,EAAE,EAAE;;YAE5B,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,EACD,MAAA,MAAA,IAAI,CAAC,MAAM,EAAC,OAAO,kDAAI,CACxB,CAAA;KACF;CACF;;MCzBY,eAAe,GAAGL,mBAAe,CAAC;IAC7C,KAAK,EAAE;QACL,EAAE,EAAE;YACF,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,KAAK;SACf;KACF;IAED,MAAM;QACJ,OAAOK,KAAC,CACN,IAAI,CAAC,EAAE,EAAE;YACP,KAAK,EAAE;gBACL,UAAU,EAAE,UAAU;aACvB;YACD,wBAAwB,EAAE,EAAE;SAC7B,CACF,CAAA;KACF;CACF;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"tiptap-vue-3.cjs.js","sources":["../src/BubbleMenu.ts","../src/Editor.ts","../src/EditorContent.ts","../src/FloatingMenu.ts","../src/useEditor.ts","../src/VueRenderer.ts","../src/VueNodeViewRenderer.ts","../src/NodeViewWrapper.ts","../src/NodeViewContent.ts"],"sourcesContent":["import {\n h,\n ref,\n PropType,\n onMounted,\n onBeforeUnmount,\n defineComponent,\n} from 'vue'\nimport { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\n\nexport const BubbleMenu = defineComponent({\n name: 'BubbleMenu',\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType<Exclude<BubbleMenuPluginProps['pluginKey'], string>>],\n type: null,\n default: 'bubbleMenu',\n },\n\n editor: {\n type: Object as PropType<BubbleMenuPluginProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<BubbleMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<BubbleMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n pluginKey,\n editor,\n tippyOptions,\n shouldShow,\n } = props\n\n editor.registerPlugin(BubbleMenuPlugin({\n pluginKey,\n editor,\n element: root.value as HTMLElement,\n tippyOptions,\n shouldShow,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h('div', { ref: root }, slots.default?.())\n },\n})\n","import { EditorState, Plugin, PluginKey } from 'prosemirror-state'\nimport { Editor as CoreEditor, EditorOptions } from '@tiptap/core'\nimport {\n markRaw,\n Ref,\n customRef,\n ComponentInternalInstance,\n ComponentPublicInstance,\n reactive,\n} from 'vue'\nimport { VueRenderer } from './VueRenderer'\n\nfunction useDebouncedRef<T>(value: T) {\n return customRef<T>((track, trigger) => {\n return {\n get() {\n track()\n return value\n },\n set(newValue) {\n // update state\n value = newValue\n\n // update view as soon as possible\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n trigger()\n })\n })\n },\n }\n })\n}\n\nexport type ContentComponent = ComponentInternalInstance & {\n ctx: ComponentPublicInstance,\n}\n\nexport class Editor extends CoreEditor {\n private reactiveState: Ref<EditorState>\n\n private reactiveExtensionStorage: Ref<Record<string, any>>\n\n public vueRenderers = reactive<Map<string, VueRenderer>>(new Map())\n\n public contentComponent: ContentComponent | null = null\n\n constructor(options: Partial<EditorOptions> = {}) {\n super(options)\n\n this.reactiveState = useDebouncedRef(this.view.state)\n this.reactiveExtensionStorage = useDebouncedRef(this.extensionStorage)\n\n this.on('transaction', () => {\n this.reactiveState.value = this.view.state\n this.reactiveExtensionStorage.value = this.extensionStorage\n })\n\n return markRaw(this)\n }\n\n get state() {\n return this.reactiveState\n ? this.reactiveState.value\n : this.view.state\n }\n\n get storage() {\n return this.reactiveExtensionStorage\n ? this.reactiveExtensionStorage.value\n : super.storage\n }\n\n /**\n * Register a ProseMirror plugin.\n */\n public registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]): void {\n super.registerPlugin(plugin, handlePlugins)\n this.reactiveState.value = this.view.state\n }\n\n /**\n * Unregister a ProseMirror plugin.\n */\n public unregisterPlugin(nameOrPluginKey: string | PluginKey): void {\n super.unregisterPlugin(nameOrPluginKey)\n this.reactiveState.value = this.view.state\n }\n}\n","import {\n h,\n ref,\n Ref,\n unref,\n Teleport,\n PropType,\n defineComponent,\n DefineComponent,\n watchEffect,\n nextTick,\n onBeforeUnmount,\n getCurrentInstance,\n} from 'vue'\nimport { Editor } from './Editor'\n\nexport const EditorContent = defineComponent({\n name: 'EditorContent',\n\n props: {\n editor: {\n default: null,\n type: Object as PropType<Editor>,\n },\n },\n\n setup(props) {\n const rootEl: Ref<Element | undefined> = ref()\n const instance = getCurrentInstance()\n\n watchEffect(() => {\n const editor = props.editor\n\n if (editor && editor.options.element && rootEl.value) {\n nextTick(() => {\n if (!rootEl.value || !editor.options.element.firstChild) {\n return\n }\n\n const element = unref(rootEl.value)\n\n rootEl.value.append(...editor.options.element.childNodes)\n\n // @ts-ignore\n editor.contentComponent = instance.ctx._\n\n editor.setOptions({\n element,\n })\n\n editor.createNodeViews()\n })\n }\n })\n\n onBeforeUnmount(() => {\n const editor = props.editor\n\n if (!editor) {\n return\n }\n\n // destroy nodeviews before vue removes dom element\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 return { rootEl }\n },\n\n render() {\n const vueRenderers: any[] = []\n\n if (this.editor) {\n this.editor.vueRenderers.forEach(vueRenderer => {\n const node = h(\n Teleport,\n {\n to: vueRenderer.teleportElement,\n key: vueRenderer.id,\n },\n h(\n vueRenderer.component as DefineComponent,\n {\n ref: vueRenderer.id,\n ...vueRenderer.props,\n },\n ),\n )\n\n vueRenderers.push(node)\n })\n }\n\n return h(\n 'div',\n {\n ref: (el: any) => { this.rootEl = el },\n },\n ...vueRenderers,\n )\n },\n})\n","import {\n h,\n ref,\n PropType,\n onMounted,\n onBeforeUnmount,\n defineComponent,\n} from 'vue'\nimport { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\n\nexport const FloatingMenu = defineComponent({\n name: 'FloatingMenu',\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],\n type: null,\n default: 'floatingMenu',\n },\n\n editor: {\n type: Object as PropType<FloatingMenuPluginProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<FloatingMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<FloatingMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n pluginKey,\n editor,\n tippyOptions,\n shouldShow,\n } = props\n\n editor.registerPlugin(FloatingMenuPlugin({\n pluginKey,\n editor,\n element: root.value as HTMLElement,\n tippyOptions,\n shouldShow,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h('div', { ref: root }, slots.default?.())\n },\n})\n","import { onMounted, onBeforeUnmount, shallowRef } from 'vue'\nimport { EditorOptions } from '@tiptap/core'\nimport { Editor } from './Editor'\n\nexport const useEditor = (options: Partial<EditorOptions> = {}) => {\n const editor = shallowRef<Editor>()\n\n onMounted(() => {\n editor.value = new Editor(options)\n })\n\n onBeforeUnmount(() => {\n editor.value?.destroy()\n })\n\n return editor\n}\n","import { reactive, markRaw, Component } from 'vue'\nimport { Editor } from '@tiptap/core'\nimport { Editor as ExtendedEditor } from './Editor'\n\nexport interface VueRendererOptions {\n editor: Editor,\n props?: Record<string, any>,\n}\n\nexport class VueRenderer {\n id: string\n\n editor: ExtendedEditor\n\n component: Component\n\n teleportElement: Element\n\n element: Element\n\n props: Record<string, any>\n\n constructor(component: Component, { props = {}, editor }: VueRendererOptions) {\n this.id = Math.floor(Math.random() * 0xFFFFFFFF).toString()\n this.editor = editor as ExtendedEditor\n this.component = markRaw(component)\n this.teleportElement = document.createElement('div')\n this.element = this.teleportElement\n this.props = reactive(props)\n this.editor.vueRenderers.set(this.id, this)\n\n if (this.editor.contentComponent) {\n this.editor.contentComponent.update()\n\n if (this.teleportElement.children.length !== 1) {\n throw Error('VueRenderer doesn’t support multiple child elements.')\n }\n\n this.element = this.teleportElement.firstElementChild as Element\n }\n }\n\n get ref(): any {\n return this.editor.contentComponent?.refs[this.id]\n }\n\n updateProps(props: Record<string, any> = {}): void {\n Object\n .entries(props)\n .forEach(([key, value]) => {\n this.props[key] = value\n })\n }\n\n destroy(): void {\n this.editor.vueRenderers.delete(this.id)\n }\n}\n","import {\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererProps,\n NodeViewRendererOptions,\n} from '@tiptap/core'\nimport {\n ref,\n Ref,\n provide,\n PropType,\n Component,\n defineComponent,\n} from 'vue'\nimport { Decoration, NodeView as ProseMirrorNodeView } from 'prosemirror-view'\nimport { Node as ProseMirrorNode } from 'prosemirror-model'\nimport { Editor } from './Editor'\nimport { VueRenderer } from './VueRenderer'\n\nexport const nodeViewProps = {\n editor: {\n type: Object as PropType<NodeViewProps['editor']>,\n required: true as const,\n },\n node: {\n type: Object as PropType<NodeViewProps['node']>,\n required: true as const,\n },\n decorations: {\n type: Object as PropType<NodeViewProps['decorations']>,\n required: true as const,\n },\n selected: {\n type: Boolean as PropType<NodeViewProps['selected']>,\n required: true as const,\n },\n extension: {\n type: Object as PropType<NodeViewProps['extension']>,\n required: true as const,\n },\n getPos: {\n type: Function as PropType<NodeViewProps['getPos']>,\n required: true as const,\n },\n updateAttributes: {\n type: Function as PropType<NodeViewProps['updateAttributes']>,\n required: true as const,\n },\n deleteNode: {\n type: Function as PropType<NodeViewProps['deleteNode']>,\n required: true as const,\n },\n}\n\nexport interface VueNodeViewRendererOptions extends NodeViewRendererOptions {\n update: ((props: {\n oldNode: ProseMirrorNode,\n oldDecorations: Decoration[],\n newNode: ProseMirrorNode,\n newDecorations: Decoration[],\n updateProps: () => void,\n }) => boolean) | null,\n}\n\nclass VueNodeView extends NodeView<Component, Editor, VueNodeViewRendererOptions> {\n\n renderer!: VueRenderer\n\n decorationClasses!: Ref<string>\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 = ref(this.getDecorationClasses())\n\n const extendedComponent = defineComponent({\n extends: { ...this.component },\n props: Object.keys(props),\n template: (this.component as any).template,\n setup: reactiveProps => {\n provide('onDragStart', onDragStart)\n provide('decorationClasses', this.decorationClasses)\n\n return (this.component as any).setup?.(reactiveProps, {\n expose: () => undefined,\n })\n },\n // add support for scoped styles\n // @ts-ignore\n // eslint-disable-next-line\n __scopeId: this.component.__scopeId,\n // add support for CSS Modules\n // @ts-ignore\n // eslint-disable-next-line\n __cssModules: this.component.__cssModules,\n })\n\n this.renderer = new VueRenderer(extendedComponent, {\n editor: this.editor,\n 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\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\n }\n\n update(node: ProseMirrorNode, decorations: Decoration[]) {\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 }\n\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n }\n\n getDecorationClasses() {\n return this.decorations\n // @ts-ignore\n .map(item => item.type.attrs.class)\n .flat()\n .join(' ')\n }\n\n destroy() {\n this.renderer.destroy()\n }\n\n}\n\nexport function VueNodeViewRenderer(component: Component, options?: Partial<VueNodeViewRendererOptions>): 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 ProseMirrorNodeView\n }\n}\n","import { h, defineComponent } from 'vue'\n\nexport const NodeViewWrapper = defineComponent({\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n inject: ['onDragStart', 'decorationClasses'],\n\n render() {\n return h(\n this.as, {\n // @ts-ignore\n class: this.decorationClasses.value,\n style: {\n whiteSpace: 'normal',\n },\n 'data-node-view-wrapper': '',\n // @ts-ignore (https://github.com/vuejs/vue-next/issues/3031)\n onDragstart: this.onDragStart,\n },\n this.$slots.default?.(),\n )\n },\n})\n","import { h, defineComponent } from 'vue'\n\nexport const NodeViewContent = defineComponent({\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n render() {\n return h(\n this.as, {\n style: {\n whiteSpace: 'pre-wrap',\n },\n 'data-node-view-content': '',\n },\n )\n },\n})\n"],"names":["defineComponent","ref","onMounted","BubbleMenuPlugin","onBeforeUnmount","h","customRef","CoreEditor","reactive","markRaw","getCurrentInstance","watchEffect","nextTick","unref","Teleport","FloatingMenuPlugin","shallowRef","NodeView","provide"],"mappings":";;;;;;;;;MAUa,UAAU,GAAGA,mBAAe,CAAC;IACxC,IAAI,EAAE,YAAY;IAElB,KAAK,EAAE;QACL,SAAS,EAAE;;;YAGT,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,YAAY;SACtB;QAED,MAAM,EAAE;YACN,IAAI,EAAE,MAAmD;YACzD,QAAQ,EAAE,IAAI;SACf;QAED,YAAY,EAAE;YACZ,IAAI,EAAE,MAAyD;YAC/D,OAAO,EAAE,OAAO,EAAE,CAAC;SACpB;QAED,UAAU,EAAE;YACV,IAAI,EAAE,QAAkF;YACxF,OAAO,EAAE,IAAI;SACd;KACF;IAED,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE;QACpB,MAAM,IAAI,GAAGC,OAAG,CAAqB,IAAI,CAAC,CAAA;QAE1CC,aAAS,CAAC;YACR,MAAM,EACJ,SAAS,EACT,MAAM,EACN,YAAY,EACZ,UAAU,GACX,GAAG,KAAK,CAAA;YAET,MAAM,CAAC,cAAc,CAACC,oCAAgB,CAAC;gBACrC,SAAS;gBACT,MAAM;gBACN,OAAO,EAAE,IAAI,CAAC,KAAoB;gBAClC,YAAY;gBACZ,UAAU;aAC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CAAA;AACH;;MC9Ma,eAAe,GAAGlB,mBAAe,CAAC;IAC7C,KAAK,EAAE;QACL,EAAE,EAAE;YACF,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,KAAK;SACf;KACF;IAED,MAAM,EAAE,CAAC,aAAa,EAAE,mBAAmB,CAAC;IAE5C,MAAM;;QACJ,OAAOK,KAAC,CACN,IAAI,CAAC,EAAE,EAAE;;YAEP,KAAK,EAAE,IAAI,CAAC,iBAAiB,CAAC,KAAK;YACnC,KAAK,EAAE;gBACL,UAAU,EAAE,QAAQ;aACrB;YACD,wBAAwB,EAAE,EAAE;;YAE5B,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,EACD,MAAA,MAAA,IAAI,CAAC,MAAM,EAAC,OAAO,kDAAI,CACxB,CAAA;KACF;CACF;;MCzBY,eAAe,GAAGL,mBAAe,CAAC;IAC7C,KAAK,EAAE;QACL,EAAE,EAAE;YACF,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,KAAK;SACf;KACF;IAED,MAAM;QACJ,OAAOK,KAAC,CACN,IAAI,CAAC,EAAE,EAAE;YACP,KAAK,EAAE;gBACL,UAAU,EAAE,UAAU;aACvB;YACD,wBAAwB,EAAE,EAAE;SAC7B,CACF,CAAA;KACF;CACF;;;;;;;;;;;;;;;;;;;"}
@@ -328,6 +328,10 @@ class VueNodeView extends NodeView {
328
328
  // @ts-ignore
329
329
  // eslint-disable-next-line
330
330
  __scopeId: this.component.__scopeId,
331
+ // add support for CSS Modules
332
+ // @ts-ignore
333
+ // eslint-disable-next-line
334
+ __cssModules: this.component.__cssModules,
331
335
  });
332
336
  this.renderer = new VueRenderer(extendedComponent, {
333
337
  editor: this.editor,
@@ -1 +1 @@
1
- {"version":3,"file":"tiptap-vue-3.esm.js","sources":["../src/BubbleMenu.ts","../src/Editor.ts","../src/EditorContent.ts","../src/FloatingMenu.ts","../src/useEditor.ts","../src/VueRenderer.ts","../src/VueNodeViewRenderer.ts","../src/NodeViewWrapper.ts","../src/NodeViewContent.ts"],"sourcesContent":["import {\n h,\n ref,\n PropType,\n onMounted,\n onBeforeUnmount,\n defineComponent,\n} from 'vue'\nimport { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\n\nexport const BubbleMenu = defineComponent({\n name: 'BubbleMenu',\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType<Exclude<BubbleMenuPluginProps['pluginKey'], string>>],\n type: null,\n default: 'bubbleMenu',\n },\n\n editor: {\n type: Object as PropType<BubbleMenuPluginProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<BubbleMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<BubbleMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n pluginKey,\n editor,\n tippyOptions,\n shouldShow,\n } = props\n\n editor.registerPlugin(BubbleMenuPlugin({\n pluginKey,\n editor,\n element: root.value as HTMLElement,\n tippyOptions,\n shouldShow,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h('div', { ref: root }, slots.default?.())\n },\n})\n","import { EditorState, Plugin, PluginKey } from 'prosemirror-state'\nimport { Editor as CoreEditor, EditorOptions } from '@tiptap/core'\nimport {\n markRaw,\n Ref,\n customRef,\n ComponentInternalInstance,\n ComponentPublicInstance,\n reactive,\n} from 'vue'\nimport { VueRenderer } from './VueRenderer'\n\nfunction useDebouncedRef<T>(value: T) {\n return customRef<T>((track, trigger) => {\n return {\n get() {\n track()\n return value\n },\n set(newValue) {\n // update state\n value = newValue\n\n // update view as soon as possible\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n trigger()\n })\n })\n },\n }\n })\n}\n\nexport type ContentComponent = ComponentInternalInstance & {\n ctx: ComponentPublicInstance,\n}\n\nexport class Editor extends CoreEditor {\n private reactiveState: Ref<EditorState>\n\n private reactiveExtensionStorage: Ref<Record<string, any>>\n\n public vueRenderers = reactive<Map<string, VueRenderer>>(new Map())\n\n public contentComponent: ContentComponent | null = null\n\n constructor(options: Partial<EditorOptions> = {}) {\n super(options)\n\n this.reactiveState = useDebouncedRef(this.view.state)\n this.reactiveExtensionStorage = useDebouncedRef(this.extensionStorage)\n\n this.on('transaction', () => {\n this.reactiveState.value = this.view.state\n this.reactiveExtensionStorage.value = this.extensionStorage\n })\n\n return markRaw(this)\n }\n\n get state() {\n return this.reactiveState\n ? this.reactiveState.value\n : this.view.state\n }\n\n get storage() {\n return this.reactiveExtensionStorage\n ? this.reactiveExtensionStorage.value\n : super.storage\n }\n\n /**\n * Register a ProseMirror plugin.\n */\n public registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]): void {\n super.registerPlugin(plugin, handlePlugins)\n this.reactiveState.value = this.view.state\n }\n\n /**\n * Unregister a ProseMirror plugin.\n */\n public unregisterPlugin(nameOrPluginKey: string | PluginKey): void {\n super.unregisterPlugin(nameOrPluginKey)\n this.reactiveState.value = this.view.state\n }\n}\n","import {\n h,\n ref,\n Ref,\n unref,\n Teleport,\n PropType,\n defineComponent,\n DefineComponent,\n watchEffect,\n nextTick,\n onBeforeUnmount,\n getCurrentInstance,\n} from 'vue'\nimport { Editor } from './Editor'\n\nexport const EditorContent = defineComponent({\n name: 'EditorContent',\n\n props: {\n editor: {\n default: null,\n type: Object as PropType<Editor>,\n },\n },\n\n setup(props) {\n const rootEl: Ref<Element | undefined> = ref()\n const instance = getCurrentInstance()\n\n watchEffect(() => {\n const editor = props.editor\n\n if (editor && editor.options.element && rootEl.value) {\n nextTick(() => {\n if (!rootEl.value || !editor.options.element.firstChild) {\n return\n }\n\n const element = unref(rootEl.value)\n\n rootEl.value.append(...editor.options.element.childNodes)\n\n // @ts-ignore\n editor.contentComponent = instance.ctx._\n\n editor.setOptions({\n element,\n })\n\n editor.createNodeViews()\n })\n }\n })\n\n onBeforeUnmount(() => {\n const editor = props.editor\n\n if (!editor) {\n return\n }\n\n // destroy nodeviews before vue removes dom element\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 return { rootEl }\n },\n\n render() {\n const vueRenderers: any[] = []\n\n if (this.editor) {\n this.editor.vueRenderers.forEach(vueRenderer => {\n const node = h(\n Teleport,\n {\n to: vueRenderer.teleportElement,\n key: vueRenderer.id,\n },\n h(\n vueRenderer.component as DefineComponent,\n {\n ref: vueRenderer.id,\n ...vueRenderer.props,\n },\n ),\n )\n\n vueRenderers.push(node)\n })\n }\n\n return h(\n 'div',\n {\n ref: (el: any) => { this.rootEl = el },\n },\n ...vueRenderers,\n )\n },\n})\n","import {\n h,\n ref,\n PropType,\n onMounted,\n onBeforeUnmount,\n defineComponent,\n} from 'vue'\nimport { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\n\nexport const FloatingMenu = defineComponent({\n name: 'FloatingMenu',\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],\n type: null,\n default: 'floatingMenu',\n },\n\n editor: {\n type: Object as PropType<FloatingMenuPluginProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<FloatingMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<FloatingMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n pluginKey,\n editor,\n tippyOptions,\n shouldShow,\n } = props\n\n editor.registerPlugin(FloatingMenuPlugin({\n pluginKey,\n editor,\n element: root.value as HTMLElement,\n tippyOptions,\n shouldShow,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h('div', { ref: root }, slots.default?.())\n },\n})\n","import { onMounted, onBeforeUnmount, shallowRef } from 'vue'\nimport { EditorOptions } from '@tiptap/core'\nimport { Editor } from './Editor'\n\nexport const useEditor = (options: Partial<EditorOptions> = {}) => {\n const editor = shallowRef<Editor>()\n\n onMounted(() => {\n editor.value = new Editor(options)\n })\n\n onBeforeUnmount(() => {\n editor.value?.destroy()\n })\n\n return editor\n}\n","import { reactive, markRaw, Component } from 'vue'\nimport { Editor } from '@tiptap/core'\nimport { Editor as ExtendedEditor } from './Editor'\n\nexport interface VueRendererOptions {\n editor: Editor,\n props?: Record<string, any>,\n}\n\nexport class VueRenderer {\n id: string\n\n editor: ExtendedEditor\n\n component: Component\n\n teleportElement: Element\n\n element: Element\n\n props: Record<string, any>\n\n constructor(component: Component, { props = {}, editor }: VueRendererOptions) {\n this.id = Math.floor(Math.random() * 0xFFFFFFFF).toString()\n this.editor = editor as ExtendedEditor\n this.component = markRaw(component)\n this.teleportElement = document.createElement('div')\n this.element = this.teleportElement\n this.props = reactive(props)\n this.editor.vueRenderers.set(this.id, this)\n\n if (this.editor.contentComponent) {\n this.editor.contentComponent.update()\n\n if (this.teleportElement.children.length !== 1) {\n throw Error('VueRenderer doesn’t support multiple child elements.')\n }\n\n this.element = this.teleportElement.firstElementChild as Element\n }\n }\n\n get ref(): any {\n return this.editor.contentComponent?.refs[this.id]\n }\n\n updateProps(props: Record<string, any> = {}): void {\n Object\n .entries(props)\n .forEach(([key, value]) => {\n this.props[key] = value\n })\n }\n\n destroy(): void {\n this.editor.vueRenderers.delete(this.id)\n }\n}\n","import {\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererProps,\n NodeViewRendererOptions,\n} from '@tiptap/core'\nimport {\n ref,\n Ref,\n provide,\n PropType,\n Component,\n defineComponent,\n} from 'vue'\nimport { Decoration, NodeView as ProseMirrorNodeView } from 'prosemirror-view'\nimport { Node as ProseMirrorNode } from 'prosemirror-model'\nimport { Editor } from './Editor'\nimport { VueRenderer } from './VueRenderer'\n\nexport const nodeViewProps = {\n editor: {\n type: Object as PropType<NodeViewProps['editor']>,\n required: true,\n },\n node: {\n type: Object as PropType<NodeViewProps['node']>,\n required: true,\n },\n decorations: {\n type: Object as PropType<NodeViewProps['decorations']>,\n required: true,\n },\n selected: {\n type: Boolean as PropType<NodeViewProps['selected']>,\n required: true,\n },\n extension: {\n type: Object as PropType<NodeViewProps['extension']>,\n required: true,\n },\n getPos: {\n type: Function as PropType<NodeViewProps['getPos']>,\n required: true,\n },\n updateAttributes: {\n type: Function as PropType<NodeViewProps['updateAttributes']>,\n required: true,\n },\n deleteNode: {\n type: Function as PropType<NodeViewProps['deleteNode']>,\n required: true,\n },\n}\n\nexport interface VueNodeViewRendererOptions extends NodeViewRendererOptions {\n update: ((props: {\n oldNode: ProseMirrorNode,\n oldDecorations: Decoration[],\n newNode: ProseMirrorNode,\n newDecorations: Decoration[],\n updateProps: () => void,\n }) => boolean) | null,\n}\n\nclass VueNodeView extends NodeView<Component, Editor, VueNodeViewRendererOptions> {\n\n renderer!: VueRenderer\n\n decorationClasses!: Ref<string>\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 = ref(this.getDecorationClasses())\n\n const extendedComponent = defineComponent({\n extends: { ...this.component },\n props: Object.keys(props),\n template: (this.component as any).template,\n setup: reactiveProps => {\n provide('onDragStart', onDragStart)\n provide('decorationClasses', this.decorationClasses)\n\n return (this.component as any).setup?.(reactiveProps, {\n expose: () => undefined,\n })\n },\n // add support for scoped styles\n // @ts-ignore\n // eslint-disable-next-line\n __scopeId: this.component.__scopeId,\n })\n\n this.renderer = new VueRenderer(extendedComponent, {\n editor: this.editor,\n 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\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\n }\n\n update(node: ProseMirrorNode, decorations: Decoration[]) {\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 }\n\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n }\n\n getDecorationClasses() {\n return this.decorations\n // @ts-ignore\n .map(item => item.type.attrs.class)\n .flat()\n .join(' ')\n }\n\n destroy() {\n this.renderer.destroy()\n }\n\n}\n\nexport function VueNodeViewRenderer(component: Component, options?: Partial<VueNodeViewRendererOptions>): 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 ProseMirrorNodeView\n }\n}\n","import { h, defineComponent } from 'vue'\n\nexport const NodeViewWrapper = defineComponent({\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n inject: ['onDragStart', 'decorationClasses'],\n\n render() {\n return h(\n this.as, {\n // @ts-ignore\n class: this.decorationClasses.value,\n style: {\n whiteSpace: 'normal',\n },\n 'data-node-view-wrapper': '',\n // @ts-ignore (https://github.com/vuejs/vue-next/issues/3031)\n onDragstart: this.onDragStart,\n },\n this.$slots.default?.(),\n )\n },\n})\n","import { h, defineComponent } from 'vue'\n\nexport const NodeViewContent = defineComponent({\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n render() {\n return h(\n this.as, {\n style: {\n whiteSpace: 'pre-wrap',\n },\n 'data-node-view-content': '',\n },\n )\n },\n})\n"],"names":["CoreEditor"],"mappings":";;;;;;MAUa,UAAU,GAAG,eAAe,CAAC;IACxC,IAAI,EAAE,YAAY;IAElB,KAAK,EAAE;QACL,SAAS,EAAE;;;YAGT,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,YAAY;SACtB;QAED,MAAM,EAAE;YACN,IAAI,EAAE,MAAmD;YACzD,QAAQ,EAAE,IAAI;SACf;QAED,YAAY,EAAE;YACZ,IAAI,EAAE,MAAyD;YAC/D,OAAO,EAAE,OAAO,EAAE,CAAC;SACpB;QAED,UAAU,EAAE;YACV,IAAI,EAAE,QAAkF;YACxF,OAAO,EAAE,IAAI;SACd;KACF;IAED,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE;QACpB,MAAM,IAAI,GAAG,GAAG,CAAqB,IAAI,CAAC,CAAA;QAE1C,SAAS,CAAC;YACR,MAAM,EACJ,SAAS,EACT,MAAM,EACN,YAAY,EACZ,UAAU,GACX,GAAG,KAAK,CAAA;YAET,MAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC;gBACrC,SAAS;gBACT,MAAM;gBACN,OAAO,EAAE,IAAI,CAAC,KAAoB;gBAClC,YAAY;gBACZ,UAAU;aACX,CAAC,CAAC,CAAA;SACJ,CAAC,CAAA;QAEF,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,CAAC,aAAa,EAAE,mBAAmB,CAAC;IAE5C,MAAM;;QACJ,OAAO,CAAC,CACN,IAAI,CAAC,EAAE,EAAE;;YAEP,KAAK,EAAE,IAAI,CAAC,iBAAiB,CAAC,KAAK;YACnC,KAAK,EAAE;gBACL,UAAU,EAAE,QAAQ;aACrB;YACD,wBAAwB,EAAE,EAAE;;YAE5B,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,EACD,MAAA,MAAA,IAAI,CAAC,MAAM,EAAC,OAAO,kDAAI,CACxB,CAAA;KACF;CACF;;MCzBY,eAAe,GAAG,eAAe,CAAC;IAC7C,KAAK,EAAE;QACL,EAAE,EAAE;YACF,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,KAAK;SACf;KACF;IAED,MAAM;QACJ,OAAO,CAAC,CACN,IAAI,CAAC,EAAE,EAAE;YACP,KAAK,EAAE;gBACL,UAAU,EAAE,UAAU;aACvB;YACD,wBAAwB,EAAE,EAAE;SAC7B,CACF,CAAA;KACF;CACF;;;;"}
1
+ {"version":3,"file":"tiptap-vue-3.esm.js","sources":["../src/BubbleMenu.ts","../src/Editor.ts","../src/EditorContent.ts","../src/FloatingMenu.ts","../src/useEditor.ts","../src/VueRenderer.ts","../src/VueNodeViewRenderer.ts","../src/NodeViewWrapper.ts","../src/NodeViewContent.ts"],"sourcesContent":["import {\n h,\n ref,\n PropType,\n onMounted,\n onBeforeUnmount,\n defineComponent,\n} from 'vue'\nimport { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\n\nexport const BubbleMenu = defineComponent({\n name: 'BubbleMenu',\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType<Exclude<BubbleMenuPluginProps['pluginKey'], string>>],\n type: null,\n default: 'bubbleMenu',\n },\n\n editor: {\n type: Object as PropType<BubbleMenuPluginProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<BubbleMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<BubbleMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n pluginKey,\n editor,\n tippyOptions,\n shouldShow,\n } = props\n\n editor.registerPlugin(BubbleMenuPlugin({\n pluginKey,\n editor,\n element: root.value as HTMLElement,\n tippyOptions,\n shouldShow,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h('div', { ref: root }, slots.default?.())\n },\n})\n","import { EditorState, Plugin, PluginKey } from 'prosemirror-state'\nimport { Editor as CoreEditor, EditorOptions } from '@tiptap/core'\nimport {\n markRaw,\n Ref,\n customRef,\n ComponentInternalInstance,\n ComponentPublicInstance,\n reactive,\n} from 'vue'\nimport { VueRenderer } from './VueRenderer'\n\nfunction useDebouncedRef<T>(value: T) {\n return customRef<T>((track, trigger) => {\n return {\n get() {\n track()\n return value\n },\n set(newValue) {\n // update state\n value = newValue\n\n // update view as soon as possible\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n trigger()\n })\n })\n },\n }\n })\n}\n\nexport type ContentComponent = ComponentInternalInstance & {\n ctx: ComponentPublicInstance,\n}\n\nexport class Editor extends CoreEditor {\n private reactiveState: Ref<EditorState>\n\n private reactiveExtensionStorage: Ref<Record<string, any>>\n\n public vueRenderers = reactive<Map<string, VueRenderer>>(new Map())\n\n public contentComponent: ContentComponent | null = null\n\n constructor(options: Partial<EditorOptions> = {}) {\n super(options)\n\n this.reactiveState = useDebouncedRef(this.view.state)\n this.reactiveExtensionStorage = useDebouncedRef(this.extensionStorage)\n\n this.on('transaction', () => {\n this.reactiveState.value = this.view.state\n this.reactiveExtensionStorage.value = this.extensionStorage\n })\n\n return markRaw(this)\n }\n\n get state() {\n return this.reactiveState\n ? this.reactiveState.value\n : this.view.state\n }\n\n get storage() {\n return this.reactiveExtensionStorage\n ? this.reactiveExtensionStorage.value\n : super.storage\n }\n\n /**\n * Register a ProseMirror plugin.\n */\n public registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]): void {\n super.registerPlugin(plugin, handlePlugins)\n this.reactiveState.value = this.view.state\n }\n\n /**\n * Unregister a ProseMirror plugin.\n */\n public unregisterPlugin(nameOrPluginKey: string | PluginKey): void {\n super.unregisterPlugin(nameOrPluginKey)\n this.reactiveState.value = this.view.state\n }\n}\n","import {\n h,\n ref,\n Ref,\n unref,\n Teleport,\n PropType,\n defineComponent,\n DefineComponent,\n watchEffect,\n nextTick,\n onBeforeUnmount,\n getCurrentInstance,\n} from 'vue'\nimport { Editor } from './Editor'\n\nexport const EditorContent = defineComponent({\n name: 'EditorContent',\n\n props: {\n editor: {\n default: null,\n type: Object as PropType<Editor>,\n },\n },\n\n setup(props) {\n const rootEl: Ref<Element | undefined> = ref()\n const instance = getCurrentInstance()\n\n watchEffect(() => {\n const editor = props.editor\n\n if (editor && editor.options.element && rootEl.value) {\n nextTick(() => {\n if (!rootEl.value || !editor.options.element.firstChild) {\n return\n }\n\n const element = unref(rootEl.value)\n\n rootEl.value.append(...editor.options.element.childNodes)\n\n // @ts-ignore\n editor.contentComponent = instance.ctx._\n\n editor.setOptions({\n element,\n })\n\n editor.createNodeViews()\n })\n }\n })\n\n onBeforeUnmount(() => {\n const editor = props.editor\n\n if (!editor) {\n return\n }\n\n // destroy nodeviews before vue removes dom element\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 return { rootEl }\n },\n\n render() {\n const vueRenderers: any[] = []\n\n if (this.editor) {\n this.editor.vueRenderers.forEach(vueRenderer => {\n const node = h(\n Teleport,\n {\n to: vueRenderer.teleportElement,\n key: vueRenderer.id,\n },\n h(\n vueRenderer.component as DefineComponent,\n {\n ref: vueRenderer.id,\n ...vueRenderer.props,\n },\n ),\n )\n\n vueRenderers.push(node)\n })\n }\n\n return h(\n 'div',\n {\n ref: (el: any) => { this.rootEl = el },\n },\n ...vueRenderers,\n )\n },\n})\n","import {\n h,\n ref,\n PropType,\n onMounted,\n onBeforeUnmount,\n defineComponent,\n} from 'vue'\nimport { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\n\nexport const FloatingMenu = defineComponent({\n name: 'FloatingMenu',\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],\n type: null,\n default: 'floatingMenu',\n },\n\n editor: {\n type: Object as PropType<FloatingMenuPluginProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<FloatingMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<FloatingMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n pluginKey,\n editor,\n tippyOptions,\n shouldShow,\n } = props\n\n editor.registerPlugin(FloatingMenuPlugin({\n pluginKey,\n editor,\n element: root.value as HTMLElement,\n tippyOptions,\n shouldShow,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h('div', { ref: root }, slots.default?.())\n },\n})\n","import { onMounted, onBeforeUnmount, shallowRef } from 'vue'\nimport { EditorOptions } from '@tiptap/core'\nimport { Editor } from './Editor'\n\nexport const useEditor = (options: Partial<EditorOptions> = {}) => {\n const editor = shallowRef<Editor>()\n\n onMounted(() => {\n editor.value = new Editor(options)\n })\n\n onBeforeUnmount(() => {\n editor.value?.destroy()\n })\n\n return editor\n}\n","import { reactive, markRaw, Component } from 'vue'\nimport { Editor } from '@tiptap/core'\nimport { Editor as ExtendedEditor } from './Editor'\n\nexport interface VueRendererOptions {\n editor: Editor,\n props?: Record<string, any>,\n}\n\nexport class VueRenderer {\n id: string\n\n editor: ExtendedEditor\n\n component: Component\n\n teleportElement: Element\n\n element: Element\n\n props: Record<string, any>\n\n constructor(component: Component, { props = {}, editor }: VueRendererOptions) {\n this.id = Math.floor(Math.random() * 0xFFFFFFFF).toString()\n this.editor = editor as ExtendedEditor\n this.component = markRaw(component)\n this.teleportElement = document.createElement('div')\n this.element = this.teleportElement\n this.props = reactive(props)\n this.editor.vueRenderers.set(this.id, this)\n\n if (this.editor.contentComponent) {\n this.editor.contentComponent.update()\n\n if (this.teleportElement.children.length !== 1) {\n throw Error('VueRenderer doesn’t support multiple child elements.')\n }\n\n this.element = this.teleportElement.firstElementChild as Element\n }\n }\n\n get ref(): any {\n return this.editor.contentComponent?.refs[this.id]\n }\n\n updateProps(props: Record<string, any> = {}): void {\n Object\n .entries(props)\n .forEach(([key, value]) => {\n this.props[key] = value\n })\n }\n\n destroy(): void {\n this.editor.vueRenderers.delete(this.id)\n }\n}\n","import {\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererProps,\n NodeViewRendererOptions,\n} from '@tiptap/core'\nimport {\n ref,\n Ref,\n provide,\n PropType,\n Component,\n defineComponent,\n} from 'vue'\nimport { Decoration, NodeView as ProseMirrorNodeView } from 'prosemirror-view'\nimport { Node as ProseMirrorNode } from 'prosemirror-model'\nimport { Editor } from './Editor'\nimport { VueRenderer } from './VueRenderer'\n\nexport const nodeViewProps = {\n editor: {\n type: Object as PropType<NodeViewProps['editor']>,\n required: true as const,\n },\n node: {\n type: Object as PropType<NodeViewProps['node']>,\n required: true as const,\n },\n decorations: {\n type: Object as PropType<NodeViewProps['decorations']>,\n required: true as const,\n },\n selected: {\n type: Boolean as PropType<NodeViewProps['selected']>,\n required: true as const,\n },\n extension: {\n type: Object as PropType<NodeViewProps['extension']>,\n required: true as const,\n },\n getPos: {\n type: Function as PropType<NodeViewProps['getPos']>,\n required: true as const,\n },\n updateAttributes: {\n type: Function as PropType<NodeViewProps['updateAttributes']>,\n required: true as const,\n },\n deleteNode: {\n type: Function as PropType<NodeViewProps['deleteNode']>,\n required: true as const,\n },\n}\n\nexport interface VueNodeViewRendererOptions extends NodeViewRendererOptions {\n update: ((props: {\n oldNode: ProseMirrorNode,\n oldDecorations: Decoration[],\n newNode: ProseMirrorNode,\n newDecorations: Decoration[],\n updateProps: () => void,\n }) => boolean) | null,\n}\n\nclass VueNodeView extends NodeView<Component, Editor, VueNodeViewRendererOptions> {\n\n renderer!: VueRenderer\n\n decorationClasses!: Ref<string>\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 = ref(this.getDecorationClasses())\n\n const extendedComponent = defineComponent({\n extends: { ...this.component },\n props: Object.keys(props),\n template: (this.component as any).template,\n setup: reactiveProps => {\n provide('onDragStart', onDragStart)\n provide('decorationClasses', this.decorationClasses)\n\n return (this.component as any).setup?.(reactiveProps, {\n expose: () => undefined,\n })\n },\n // add support for scoped styles\n // @ts-ignore\n // eslint-disable-next-line\n __scopeId: this.component.__scopeId,\n // add support for CSS Modules\n // @ts-ignore\n // eslint-disable-next-line\n __cssModules: this.component.__cssModules,\n })\n\n this.renderer = new VueRenderer(extendedComponent, {\n editor: this.editor,\n 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\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\n }\n\n update(node: ProseMirrorNode, decorations: Decoration[]) {\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 }\n\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n }\n\n getDecorationClasses() {\n return this.decorations\n // @ts-ignore\n .map(item => item.type.attrs.class)\n .flat()\n .join(' ')\n }\n\n destroy() {\n this.renderer.destroy()\n }\n\n}\n\nexport function VueNodeViewRenderer(component: Component, options?: Partial<VueNodeViewRendererOptions>): 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 ProseMirrorNodeView\n }\n}\n","import { h, defineComponent } from 'vue'\n\nexport const NodeViewWrapper = defineComponent({\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n inject: ['onDragStart', 'decorationClasses'],\n\n render() {\n return h(\n this.as, {\n // @ts-ignore\n class: this.decorationClasses.value,\n style: {\n whiteSpace: 'normal',\n },\n 'data-node-view-wrapper': '',\n // @ts-ignore (https://github.com/vuejs/vue-next/issues/3031)\n onDragstart: this.onDragStart,\n },\n this.$slots.default?.(),\n )\n },\n})\n","import { h, defineComponent } from 'vue'\n\nexport const NodeViewContent = defineComponent({\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n render() {\n return h(\n this.as, {\n style: {\n whiteSpace: 'pre-wrap',\n },\n 'data-node-view-content': '',\n },\n )\n },\n})\n"],"names":["CoreEditor"],"mappings":";;;;;;MAUa,UAAU,GAAG,eAAe,CAAC;IACxC,IAAI,EAAE,YAAY;IAElB,KAAK,EAAE;QACL,SAAS,EAAE;;;YAGT,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,YAAY;SACtB;QAED,MAAM,EAAE;YACN,IAAI,EAAE,MAAmD;YACzD,QAAQ,EAAE,IAAI;SACf;QAED,YAAY,EAAE;YACZ,IAAI,EAAE,MAAyD;YAC/D,OAAO,EAAE,OAAO,EAAE,CAAC;SACpB;QAED,UAAU,EAAE;YACV,IAAI,EAAE,QAAkF;YACxF,OAAO,EAAE,IAAI;SACd;KACF;IAED,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE;QACpB,MAAM,IAAI,GAAG,GAAG,CAAqB,IAAI,CAAC,CAAA;QAE1C,SAAS,CAAC;YACR,MAAM,EACJ,SAAS,EACT,MAAM,EACN,YAAY,EACZ,UAAU,GACX,GAAG,KAAK,CAAA;YAET,MAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC;gBACrC,SAAS;gBACT,MAAM;gBACN,OAAO,EAAE,IAAI,CAAC,KAAoB;gBAClC,YAAY;gBACZ,UAAU;aACX,CAAC,CAAC,CAAA;SACJ,CAAC,CAAA;QAEF,eAAe,CAAC;YACd,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,KAAK,CAAA;YAEnC,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAA;SACnC,CAAC,CAAA;QAEF,OAAO,gBAAM,OAAA,CAAC,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,MAAA,KAAK,CAAC,OAAO,+CAAb,KAAK,CAAY,CAAC,CAAA,EAAA,CAAA;KACxD;CACF;;ACrDD,SAAS,eAAe,CAAI,KAAQ;IAClC,OAA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AAI,CAAC,MAAM,EAAC,OAAO,kDAAI,CACxB,CAAA;KACF;CACF;;MCzBY,eAAe,GAAG,eAAe,CAAC;IAC7C,KAAK,EAAE;QACL,EAAE,EAAE;YACF,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,KAAK;SACf;KACF;IAED,MAAM;QACJ,OAAO,CAAC,CACN,IAAI,CAAC,EAAE,EAAE;YACP,KAAK,EAAE;gBACL,UAAU,EAAE,UAAU;aACvB;YACD,wBAAwB,EAAE,EAAE;SAC7B,CACF,CAAA;KACF;CACF;;;;"}
@@ -328,6 +328,10 @@
328
328
  // @ts-ignore
329
329
  // eslint-disable-next-line
330
330
  __scopeId: this.component.__scopeId,
331
+ // add support for CSS Modules
332
+ // @ts-ignore
333
+ // eslint-disable-next-line
334
+ __cssModules: this.component.__cssModules,
331
335
  });
332
336
  this.renderer = new VueRenderer(extendedComponent, {
333
337
  editor: this.editor,
@@ -1 +1 @@
1
- {"version":3,"file":"tiptap-vue-3.umd.js","sources":["../src/BubbleMenu.ts","../src/Editor.ts","../src/EditorContent.ts","../src/FloatingMenu.ts","../src/useEditor.ts","../src/VueRenderer.ts","../src/VueNodeViewRenderer.ts","../src/NodeViewWrapper.ts","../src/NodeViewContent.ts"],"sourcesContent":["import {\n h,\n ref,\n PropType,\n onMounted,\n onBeforeUnmount,\n defineComponent,\n} from 'vue'\nimport { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\n\nexport const BubbleMenu = defineComponent({\n name: 'BubbleMenu',\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType<Exclude<BubbleMenuPluginProps['pluginKey'], string>>],\n type: null,\n default: 'bubbleMenu',\n },\n\n editor: {\n type: Object as PropType<BubbleMenuPluginProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<BubbleMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<BubbleMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n pluginKey,\n editor,\n tippyOptions,\n shouldShow,\n } = props\n\n editor.registerPlugin(BubbleMenuPlugin({\n pluginKey,\n editor,\n element: root.value as HTMLElement,\n tippyOptions,\n shouldShow,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h('div', { ref: root }, slots.default?.())\n },\n})\n","import { EditorState, Plugin, PluginKey } from 'prosemirror-state'\nimport { Editor as CoreEditor, EditorOptions } from '@tiptap/core'\nimport {\n markRaw,\n Ref,\n customRef,\n ComponentInternalInstance,\n ComponentPublicInstance,\n reactive,\n} from 'vue'\nimport { VueRenderer } from './VueRenderer'\n\nfunction useDebouncedRef<T>(value: T) {\n return customRef<T>((track, trigger) => {\n return {\n get() {\n track()\n return value\n },\n set(newValue) {\n // update state\n value = newValue\n\n // update view as soon as possible\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n trigger()\n })\n })\n },\n }\n })\n}\n\nexport type ContentComponent = ComponentInternalInstance & {\n ctx: ComponentPublicInstance,\n}\n\nexport class Editor extends CoreEditor {\n private reactiveState: Ref<EditorState>\n\n private reactiveExtensionStorage: Ref<Record<string, any>>\n\n public vueRenderers = reactive<Map<string, VueRenderer>>(new Map())\n\n public contentComponent: ContentComponent | null = null\n\n constructor(options: Partial<EditorOptions> = {}) {\n super(options)\n\n this.reactiveState = useDebouncedRef(this.view.state)\n this.reactiveExtensionStorage = useDebouncedRef(this.extensionStorage)\n\n this.on('transaction', () => {\n this.reactiveState.value = this.view.state\n this.reactiveExtensionStorage.value = this.extensionStorage\n })\n\n return markRaw(this)\n }\n\n get state() {\n return this.reactiveState\n ? this.reactiveState.value\n : this.view.state\n }\n\n get storage() {\n return this.reactiveExtensionStorage\n ? this.reactiveExtensionStorage.value\n : super.storage\n }\n\n /**\n * Register a ProseMirror plugin.\n */\n public registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]): void {\n super.registerPlugin(plugin, handlePlugins)\n this.reactiveState.value = this.view.state\n }\n\n /**\n * Unregister a ProseMirror plugin.\n */\n public unregisterPlugin(nameOrPluginKey: string | PluginKey): void {\n super.unregisterPlugin(nameOrPluginKey)\n this.reactiveState.value = this.view.state\n }\n}\n","import {\n h,\n ref,\n Ref,\n unref,\n Teleport,\n PropType,\n defineComponent,\n DefineComponent,\n watchEffect,\n nextTick,\n onBeforeUnmount,\n getCurrentInstance,\n} from 'vue'\nimport { Editor } from './Editor'\n\nexport const EditorContent = defineComponent({\n name: 'EditorContent',\n\n props: {\n editor: {\n default: null,\n type: Object as PropType<Editor>,\n },\n },\n\n setup(props) {\n const rootEl: Ref<Element | undefined> = ref()\n const instance = getCurrentInstance()\n\n watchEffect(() => {\n const editor = props.editor\n\n if (editor && editor.options.element && rootEl.value) {\n nextTick(() => {\n if (!rootEl.value || !editor.options.element.firstChild) {\n return\n }\n\n const element = unref(rootEl.value)\n\n rootEl.value.append(...editor.options.element.childNodes)\n\n // @ts-ignore\n editor.contentComponent = instance.ctx._\n\n editor.setOptions({\n element,\n })\n\n editor.createNodeViews()\n })\n }\n })\n\n onBeforeUnmount(() => {\n const editor = props.editor\n\n if (!editor) {\n return\n }\n\n // destroy nodeviews before vue removes dom element\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 return { rootEl }\n },\n\n render() {\n const vueRenderers: any[] = []\n\n if (this.editor) {\n this.editor.vueRenderers.forEach(vueRenderer => {\n const node = h(\n Teleport,\n {\n to: vueRenderer.teleportElement,\n key: vueRenderer.id,\n },\n h(\n vueRenderer.component as DefineComponent,\n {\n ref: vueRenderer.id,\n ...vueRenderer.props,\n },\n ),\n )\n\n vueRenderers.push(node)\n })\n }\n\n return h(\n 'div',\n {\n ref: (el: any) => { this.rootEl = el },\n },\n ...vueRenderers,\n )\n },\n})\n","import {\n h,\n ref,\n PropType,\n onMounted,\n onBeforeUnmount,\n defineComponent,\n} from 'vue'\nimport { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\n\nexport const FloatingMenu = defineComponent({\n name: 'FloatingMenu',\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],\n type: null,\n default: 'floatingMenu',\n },\n\n editor: {\n type: Object as PropType<FloatingMenuPluginProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<FloatingMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<FloatingMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n pluginKey,\n editor,\n tippyOptions,\n shouldShow,\n } = props\n\n editor.registerPlugin(FloatingMenuPlugin({\n pluginKey,\n editor,\n element: root.value as HTMLElement,\n tippyOptions,\n shouldShow,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h('div', { ref: root }, slots.default?.())\n },\n})\n","import { onMounted, onBeforeUnmount, shallowRef } from 'vue'\nimport { EditorOptions } from '@tiptap/core'\nimport { Editor } from './Editor'\n\nexport const useEditor = (options: Partial<EditorOptions> = {}) => {\n const editor = shallowRef<Editor>()\n\n onMounted(() => {\n editor.value = new Editor(options)\n })\n\n onBeforeUnmount(() => {\n editor.value?.destroy()\n })\n\n return editor\n}\n","import { reactive, markRaw, Component } from 'vue'\nimport { Editor } from '@tiptap/core'\nimport { Editor as ExtendedEditor } from './Editor'\n\nexport interface VueRendererOptions {\n editor: Editor,\n props?: Record<string, any>,\n}\n\nexport class VueRenderer {\n id: string\n\n editor: ExtendedEditor\n\n component: Component\n\n teleportElement: Element\n\n element: Element\n\n props: Record<string, any>\n\n constructor(component: Component, { props = {}, editor }: VueRendererOptions) {\n this.id = Math.floor(Math.random() * 0xFFFFFFFF).toString()\n this.editor = editor as ExtendedEditor\n this.component = markRaw(component)\n this.teleportElement = document.createElement('div')\n this.element = this.teleportElement\n this.props = reactive(props)\n this.editor.vueRenderers.set(this.id, this)\n\n if (this.editor.contentComponent) {\n this.editor.contentComponent.update()\n\n if (this.teleportElement.children.length !== 1) {\n throw Error('VueRenderer doesn’t support multiple child elements.')\n }\n\n this.element = this.teleportElement.firstElementChild as Element\n }\n }\n\n get ref(): any {\n return this.editor.contentComponent?.refs[this.id]\n }\n\n updateProps(props: Record<string, any> = {}): void {\n Object\n .entries(props)\n .forEach(([key, value]) => {\n this.props[key] = value\n })\n }\n\n destroy(): void {\n this.editor.vueRenderers.delete(this.id)\n }\n}\n","import {\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererProps,\n NodeViewRendererOptions,\n} from '@tiptap/core'\nimport {\n ref,\n Ref,\n provide,\n PropType,\n Component,\n defineComponent,\n} from 'vue'\nimport { Decoration, NodeView as ProseMirrorNodeView } from 'prosemirror-view'\nimport { Node as ProseMirrorNode } from 'prosemirror-model'\nimport { Editor } from './Editor'\nimport { VueRenderer } from './VueRenderer'\n\nexport const nodeViewProps = {\n editor: {\n type: Object as PropType<NodeViewProps['editor']>,\n required: true,\n },\n node: {\n type: Object as PropType<NodeViewProps['node']>,\n required: true,\n },\n decorations: {\n type: Object as PropType<NodeViewProps['decorations']>,\n required: true,\n },\n selected: {\n type: Boolean as PropType<NodeViewProps['selected']>,\n required: true,\n },\n extension: {\n type: Object as PropType<NodeViewProps['extension']>,\n required: true,\n },\n getPos: {\n type: Function as PropType<NodeViewProps['getPos']>,\n required: true,\n },\n updateAttributes: {\n type: Function as PropType<NodeViewProps['updateAttributes']>,\n required: true,\n },\n deleteNode: {\n type: Function as PropType<NodeViewProps['deleteNode']>,\n required: true,\n },\n}\n\nexport interface VueNodeViewRendererOptions extends NodeViewRendererOptions {\n update: ((props: {\n oldNode: ProseMirrorNode,\n oldDecorations: Decoration[],\n newNode: ProseMirrorNode,\n newDecorations: Decoration[],\n updateProps: () => void,\n }) => boolean) | null,\n}\n\nclass VueNodeView extends NodeView<Component, Editor, VueNodeViewRendererOptions> {\n\n renderer!: VueRenderer\n\n decorationClasses!: Ref<string>\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 = ref(this.getDecorationClasses())\n\n const extendedComponent = defineComponent({\n extends: { ...this.component },\n props: Object.keys(props),\n template: (this.component as any).template,\n setup: reactiveProps => {\n provide('onDragStart', onDragStart)\n provide('decorationClasses', this.decorationClasses)\n\n return (this.component as any).setup?.(reactiveProps, {\n expose: () => undefined,\n })\n },\n // add support for scoped styles\n // @ts-ignore\n // eslint-disable-next-line\n __scopeId: this.component.__scopeId,\n })\n\n this.renderer = new VueRenderer(extendedComponent, {\n editor: this.editor,\n 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\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\n }\n\n update(node: ProseMirrorNode, decorations: Decoration[]) {\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 }\n\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n }\n\n getDecorationClasses() {\n return this.decorations\n // @ts-ignore\n .map(item => item.type.attrs.class)\n .flat()\n .join(' ')\n }\n\n destroy() {\n this.renderer.destroy()\n }\n\n}\n\nexport function VueNodeViewRenderer(component: Component, options?: Partial<VueNodeViewRendererOptions>): 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 ProseMirrorNodeView\n }\n}\n","import { h, defineComponent } from 'vue'\n\nexport const NodeViewWrapper = defineComponent({\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n inject: ['onDragStart', 'decorationClasses'],\n\n render() {\n return h(\n this.as, {\n // @ts-ignore\n class: this.decorationClasses.value,\n style: {\n whiteSpace: 'normal',\n },\n 'data-node-view-wrapper': '',\n // @ts-ignore (https://github.com/vuejs/vue-next/issues/3031)\n onDragstart: this.onDragStart,\n },\n this.$slots.default?.(),\n )\n },\n})\n","import { h, defineComponent } from 'vue'\n\nexport const NodeViewContent = defineComponent({\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n render() {\n return h(\n this.as, {\n style: {\n whiteSpace: 'pre-wrap',\n },\n 'data-node-view-content': '',\n },\n )\n },\n})\n"],"names":["defineComponent","ref","onMounted","BubbleMenuPlugin","onBeforeUnmount","h","customRef","CoreEditor","reactive","markRaw","getCurrentInstance","watchEffect","nextTick","unref","Teleport","FloatingMenuPlugin","shallowRef","NodeView","provide"],"mappings":";;;;;;QAUa,UAAU,GAAGA,mBAAe,CAAC;MACxC,IAAI,EAAE,YAAY;MAElB,KAAK,EAAE;UACL,SAAS,EAAE;;;cAGT,IAAI,EAAE,IAAI;cACV,OAAO,EAAE,YAAY;WACtB;UAED,MAAM,EAAE;cACN,IAAI,EAAE,MAAmD;cACzD,QAAQ,EAAE,IAAI;WACf;UAED,YAAY,EAAE;cACZ,IAAI,EAAE,MAAyD;cAC/D,OAAO,EAAE,OAAO,EAAE,CAAC;WACpB;UAED,UAAU,EAAE;cACV,IAAI,EAAE,QAAkF;cACxF,OAAO,EAAE,IAAI;WACd;OACF;MAED,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE;UACpB,MAAM,IAAI,GAAGC,OAAG,CAAqB,IAAI,CAAC,CAAA;UAE1CC,aAAS,CAAC;cACR,MAAM,EACJ,SAAS,EACT,MAAM,EACN,YAAY,EACZ,UAAU,GACX,GAAG,KAAK,CAAA;cAET,MAAM,CAAC,cAAc,CAACC,oCAAgB,CAAC;kBACrC,SAAS;kBACT,MAAM;kBACN,OAAO,EAAE,IAAI,CAAC,KAAoB;kBAClC,YAAY;kBACZ,UAAU;eACX,CAAC,CAAC,CAAA;WACJ,CAAC,CAAA;UAEFC,mBAAe,CAAC;cACd,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,KAAK,CAAA;cAEnC,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAA;WACnC,CAAC,CAAA;UAEF,OAAO,gBAAM,OAAAC,KAAC,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,MAAA,KAAK,CAAC,OAAO,+CAAb,KAAK,CAAY,CAAC,CAAA,EAAA,CAAA;OACxD;GACF;;ECrDD,SAAS,eAAe,CAAI,KAAQ;MAClC,OAA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MAAM,EAAC,OAAO,kDAAI,CACxB,CAAA;OACF;GACF;;QCzBY,eAAe,GAAGL,mBAAe,CAAC;MAC7C,KAAK,EAAE;UACL,EAAE,EAAE;cACF,IAAI,EAAE,MAAM;cACZ,OAAO,EAAE,KAAK;WACf;OACF;MAED,MAAM;UACJ,OAAOK,KAAC,CACN,IAAI,CAAC,EAAE,EAAE;cACP,KAAK,EAAE;kBACL,UAAU,EAAE,UAAU;eACvB;cACD,wBAAwB,EAAE,EAAE;WAC7B,CACF,CAAA;OACF;GACF;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"tiptap-vue-3.umd.js","sources":["../src/BubbleMenu.ts","../src/Editor.ts","../src/EditorContent.ts","../src/FloatingMenu.ts","../src/useEditor.ts","../src/VueRenderer.ts","../src/VueNodeViewRenderer.ts","../src/NodeViewWrapper.ts","../src/NodeViewContent.ts"],"sourcesContent":["import {\n h,\n ref,\n PropType,\n onMounted,\n onBeforeUnmount,\n defineComponent,\n} from 'vue'\nimport { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\n\nexport const BubbleMenu = defineComponent({\n name: 'BubbleMenu',\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType<Exclude<BubbleMenuPluginProps['pluginKey'], string>>],\n type: null,\n default: 'bubbleMenu',\n },\n\n editor: {\n type: Object as PropType<BubbleMenuPluginProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<BubbleMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<BubbleMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n pluginKey,\n editor,\n tippyOptions,\n shouldShow,\n } = props\n\n editor.registerPlugin(BubbleMenuPlugin({\n pluginKey,\n editor,\n element: root.value as HTMLElement,\n tippyOptions,\n shouldShow,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h('div', { ref: root }, slots.default?.())\n },\n})\n","import { EditorState, Plugin, PluginKey } from 'prosemirror-state'\nimport { Editor as CoreEditor, EditorOptions } from '@tiptap/core'\nimport {\n markRaw,\n Ref,\n customRef,\n ComponentInternalInstance,\n ComponentPublicInstance,\n reactive,\n} from 'vue'\nimport { VueRenderer } from './VueRenderer'\n\nfunction useDebouncedRef<T>(value: T) {\n return customRef<T>((track, trigger) => {\n return {\n get() {\n track()\n return value\n },\n set(newValue) {\n // update state\n value = newValue\n\n // update view as soon as possible\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n trigger()\n })\n })\n },\n }\n })\n}\n\nexport type ContentComponent = ComponentInternalInstance & {\n ctx: ComponentPublicInstance,\n}\n\nexport class Editor extends CoreEditor {\n private reactiveState: Ref<EditorState>\n\n private reactiveExtensionStorage: Ref<Record<string, any>>\n\n public vueRenderers = reactive<Map<string, VueRenderer>>(new Map())\n\n public contentComponent: ContentComponent | null = null\n\n constructor(options: Partial<EditorOptions> = {}) {\n super(options)\n\n this.reactiveState = useDebouncedRef(this.view.state)\n this.reactiveExtensionStorage = useDebouncedRef(this.extensionStorage)\n\n this.on('transaction', () => {\n this.reactiveState.value = this.view.state\n this.reactiveExtensionStorage.value = this.extensionStorage\n })\n\n return markRaw(this)\n }\n\n get state() {\n return this.reactiveState\n ? this.reactiveState.value\n : this.view.state\n }\n\n get storage() {\n return this.reactiveExtensionStorage\n ? this.reactiveExtensionStorage.value\n : super.storage\n }\n\n /**\n * Register a ProseMirror plugin.\n */\n public registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]): void {\n super.registerPlugin(plugin, handlePlugins)\n this.reactiveState.value = this.view.state\n }\n\n /**\n * Unregister a ProseMirror plugin.\n */\n public unregisterPlugin(nameOrPluginKey: string | PluginKey): void {\n super.unregisterPlugin(nameOrPluginKey)\n this.reactiveState.value = this.view.state\n }\n}\n","import {\n h,\n ref,\n Ref,\n unref,\n Teleport,\n PropType,\n defineComponent,\n DefineComponent,\n watchEffect,\n nextTick,\n onBeforeUnmount,\n getCurrentInstance,\n} from 'vue'\nimport { Editor } from './Editor'\n\nexport const EditorContent = defineComponent({\n name: 'EditorContent',\n\n props: {\n editor: {\n default: null,\n type: Object as PropType<Editor>,\n },\n },\n\n setup(props) {\n const rootEl: Ref<Element | undefined> = ref()\n const instance = getCurrentInstance()\n\n watchEffect(() => {\n const editor = props.editor\n\n if (editor && editor.options.element && rootEl.value) {\n nextTick(() => {\n if (!rootEl.value || !editor.options.element.firstChild) {\n return\n }\n\n const element = unref(rootEl.value)\n\n rootEl.value.append(...editor.options.element.childNodes)\n\n // @ts-ignore\n editor.contentComponent = instance.ctx._\n\n editor.setOptions({\n element,\n })\n\n editor.createNodeViews()\n })\n }\n })\n\n onBeforeUnmount(() => {\n const editor = props.editor\n\n if (!editor) {\n return\n }\n\n // destroy nodeviews before vue removes dom element\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 return { rootEl }\n },\n\n render() {\n const vueRenderers: any[] = []\n\n if (this.editor) {\n this.editor.vueRenderers.forEach(vueRenderer => {\n const node = h(\n Teleport,\n {\n to: vueRenderer.teleportElement,\n key: vueRenderer.id,\n },\n h(\n vueRenderer.component as DefineComponent,\n {\n ref: vueRenderer.id,\n ...vueRenderer.props,\n },\n ),\n )\n\n vueRenderers.push(node)\n })\n }\n\n return h(\n 'div',\n {\n ref: (el: any) => { this.rootEl = el },\n },\n ...vueRenderers,\n )\n },\n})\n","import {\n h,\n ref,\n PropType,\n onMounted,\n onBeforeUnmount,\n defineComponent,\n} from 'vue'\nimport { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\n\nexport const FloatingMenu = defineComponent({\n name: 'FloatingMenu',\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],\n type: null,\n default: 'floatingMenu',\n },\n\n editor: {\n type: Object as PropType<FloatingMenuPluginProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<FloatingMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<FloatingMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n pluginKey,\n editor,\n tippyOptions,\n shouldShow,\n } = props\n\n editor.registerPlugin(FloatingMenuPlugin({\n pluginKey,\n editor,\n element: root.value as HTMLElement,\n tippyOptions,\n shouldShow,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h('div', { ref: root }, slots.default?.())\n },\n})\n","import { onMounted, onBeforeUnmount, shallowRef } from 'vue'\nimport { EditorOptions } from '@tiptap/core'\nimport { Editor } from './Editor'\n\nexport const useEditor = (options: Partial<EditorOptions> = {}) => {\n const editor = shallowRef<Editor>()\n\n onMounted(() => {\n editor.value = new Editor(options)\n })\n\n onBeforeUnmount(() => {\n editor.value?.destroy()\n })\n\n return editor\n}\n","import { reactive, markRaw, Component } from 'vue'\nimport { Editor } from '@tiptap/core'\nimport { Editor as ExtendedEditor } from './Editor'\n\nexport interface VueRendererOptions {\n editor: Editor,\n props?: Record<string, any>,\n}\n\nexport class VueRenderer {\n id: string\n\n editor: ExtendedEditor\n\n component: Component\n\n teleportElement: Element\n\n element: Element\n\n props: Record<string, any>\n\n constructor(component: Component, { props = {}, editor }: VueRendererOptions) {\n this.id = Math.floor(Math.random() * 0xFFFFFFFF).toString()\n this.editor = editor as ExtendedEditor\n this.component = markRaw(component)\n this.teleportElement = document.createElement('div')\n this.element = this.teleportElement\n this.props = reactive(props)\n this.editor.vueRenderers.set(this.id, this)\n\n if (this.editor.contentComponent) {\n this.editor.contentComponent.update()\n\n if (this.teleportElement.children.length !== 1) {\n throw Error('VueRenderer doesn’t support multiple child elements.')\n }\n\n this.element = this.teleportElement.firstElementChild as Element\n }\n }\n\n get ref(): any {\n return this.editor.contentComponent?.refs[this.id]\n }\n\n updateProps(props: Record<string, any> = {}): void {\n Object\n .entries(props)\n .forEach(([key, value]) => {\n this.props[key] = value\n })\n }\n\n destroy(): void {\n this.editor.vueRenderers.delete(this.id)\n }\n}\n","import {\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererProps,\n NodeViewRendererOptions,\n} from '@tiptap/core'\nimport {\n ref,\n Ref,\n provide,\n PropType,\n Component,\n defineComponent,\n} from 'vue'\nimport { Decoration, NodeView as ProseMirrorNodeView } from 'prosemirror-view'\nimport { Node as ProseMirrorNode } from 'prosemirror-model'\nimport { Editor } from './Editor'\nimport { VueRenderer } from './VueRenderer'\n\nexport const nodeViewProps = {\n editor: {\n type: Object as PropType<NodeViewProps['editor']>,\n required: true as const,\n },\n node: {\n type: Object as PropType<NodeViewProps['node']>,\n required: true as const,\n },\n decorations: {\n type: Object as PropType<NodeViewProps['decorations']>,\n required: true as const,\n },\n selected: {\n type: Boolean as PropType<NodeViewProps['selected']>,\n required: true as const,\n },\n extension: {\n type: Object as PropType<NodeViewProps['extension']>,\n required: true as const,\n },\n getPos: {\n type: Function as PropType<NodeViewProps['getPos']>,\n required: true as const,\n },\n updateAttributes: {\n type: Function as PropType<NodeViewProps['updateAttributes']>,\n required: true as const,\n },\n deleteNode: {\n type: Function as PropType<NodeViewProps['deleteNode']>,\n required: true as const,\n },\n}\n\nexport interface VueNodeViewRendererOptions extends NodeViewRendererOptions {\n update: ((props: {\n oldNode: ProseMirrorNode,\n oldDecorations: Decoration[],\n newNode: ProseMirrorNode,\n newDecorations: Decoration[],\n updateProps: () => void,\n }) => boolean) | null,\n}\n\nclass VueNodeView extends NodeView<Component, Editor, VueNodeViewRendererOptions> {\n\n renderer!: VueRenderer\n\n decorationClasses!: Ref<string>\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 = ref(this.getDecorationClasses())\n\n const extendedComponent = defineComponent({\n extends: { ...this.component },\n props: Object.keys(props),\n template: (this.component as any).template,\n setup: reactiveProps => {\n provide('onDragStart', onDragStart)\n provide('decorationClasses', this.decorationClasses)\n\n return (this.component as any).setup?.(reactiveProps, {\n expose: () => undefined,\n })\n },\n // add support for scoped styles\n // @ts-ignore\n // eslint-disable-next-line\n __scopeId: this.component.__scopeId,\n // add support for CSS Modules\n // @ts-ignore\n // eslint-disable-next-line\n __cssModules: this.component.__cssModules,\n })\n\n this.renderer = new VueRenderer(extendedComponent, {\n editor: this.editor,\n 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\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\n }\n\n update(node: ProseMirrorNode, decorations: Decoration[]) {\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 }\n\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n }\n\n getDecorationClasses() {\n return this.decorations\n // @ts-ignore\n .map(item => item.type.attrs.class)\n .flat()\n .join(' ')\n }\n\n destroy() {\n this.renderer.destroy()\n }\n\n}\n\nexport function VueNodeViewRenderer(component: Component, options?: Partial<VueNodeViewRendererOptions>): 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 ProseMirrorNodeView\n }\n}\n","import { h, defineComponent } from 'vue'\n\nexport const NodeViewWrapper = defineComponent({\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n inject: ['onDragStart', 'decorationClasses'],\n\n render() {\n return h(\n this.as, {\n // @ts-ignore\n class: this.decorationClasses.value,\n style: {\n whiteSpace: 'normal',\n },\n 'data-node-view-wrapper': '',\n // @ts-ignore (https://github.com/vuejs/vue-next/issues/3031)\n onDragstart: this.onDragStart,\n },\n this.$slots.default?.(),\n )\n },\n})\n","import { h, defineComponent } from 'vue'\n\nexport const NodeViewContent = defineComponent({\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n render() {\n return h(\n this.as, {\n style: {\n whiteSpace: 'pre-wrap',\n },\n 'data-node-view-content': '',\n },\n )\n },\n})\n"],"names":["defineComponent","ref","onMounted","BubbleMenuPlugin","onBeforeUnmount","h","customRef","CoreEditor","reactive","markRaw","getCurrentInstance","watchEffect","nextTick","unref","Teleport","FloatingMenuPlugin","shallowRef","NodeView","provide"],"mappings":";;;;;;QAUa,UAAU,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BAAe,CAAC;MAC7C,KAAK,EAAE;UACL,EAAE,EAAE;cACF,IAAI,EAAE,MAAM;cACZ,OAAO,EAAE,KAAK;WACf;OACF;MAED,MAAM;UACJ,OAAOK,KAAC,CACN,IAAI,CAAC,EAAE,EAAE;cACP,KAAK,EAAE;kBACL,UAAU,EAAE,UAAU;eACvB;cACD,wBAAwB,EAAE,EAAE;WAC7B,CACF,CAAA;OACF;GACF;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiptap/vue-3",
3
3
  "description": "Vue components for tiptap",
4
- "version": "2.0.0-beta.90",
4
+ "version": "2.0.0-beta.91",
5
5
  "homepage": "https://tiptap.dev",
6
6
  "keywords": [
7
7
  "tiptap",
@@ -28,8 +28,8 @@
28
28
  "vue": "^3.0.0"
29
29
  },
30
30
  "dependencies": {
31
- "@tiptap/extension-bubble-menu": "^2.0.0-beta.55",
32
- "@tiptap/extension-floating-menu": "^2.0.0-beta.50",
31
+ "@tiptap/extension-bubble-menu": "^2.0.0-beta.56",
32
+ "@tiptap/extension-floating-menu": "^2.0.0-beta.51",
33
33
  "prosemirror-state": "^1.3.4",
34
34
  "prosemirror-view": "^1.23.6"
35
35
  },
@@ -39,5 +39,5 @@
39
39
  "directory": "packages/vue-3"
40
40
  },
41
41
  "sideEffects": false,
42
- "gitHead": "82759a898a77aa0bf6a459178021e86b6713ef39"
42
+ "gitHead": "90e719c711dbccae6a7333956d543fb93789f3d3"
43
43
  }
@@ -21,35 +21,35 @@ import { VueRenderer } from './VueRenderer'
21
21
  export const nodeViewProps = {
22
22
  editor: {
23
23
  type: Object as PropType<NodeViewProps['editor']>,
24
- required: true,
24
+ required: true as const,
25
25
  },
26
26
  node: {
27
27
  type: Object as PropType<NodeViewProps['node']>,
28
- required: true,
28
+ required: true as const,
29
29
  },
30
30
  decorations: {
31
31
  type: Object as PropType<NodeViewProps['decorations']>,
32
- required: true,
32
+ required: true as const,
33
33
  },
34
34
  selected: {
35
35
  type: Boolean as PropType<NodeViewProps['selected']>,
36
- required: true,
36
+ required: true as const,
37
37
  },
38
38
  extension: {
39
39
  type: Object as PropType<NodeViewProps['extension']>,
40
- required: true,
40
+ required: true as const,
41
41
  },
42
42
  getPos: {
43
43
  type: Function as PropType<NodeViewProps['getPos']>,
44
- required: true,
44
+ required: true as const,
45
45
  },
46
46
  updateAttributes: {
47
47
  type: Function as PropType<NodeViewProps['updateAttributes']>,
48
- required: true,
48
+ required: true as const,
49
49
  },
50
50
  deleteNode: {
51
51
  type: Function as PropType<NodeViewProps['deleteNode']>,
52
- required: true,
52
+ required: true as const,
53
53
  },
54
54
  }
55
55
 
@@ -101,6 +101,10 @@ class VueNodeView extends NodeView<Component, Editor, VueNodeViewRendererOptions
101
101
  // @ts-ignore
102
102
  // eslint-disable-next-line
103
103
  __scopeId: this.component.__scopeId,
104
+ // add support for CSS Modules
105
+ // @ts-ignore
106
+ // eslint-disable-next-line
107
+ __cssModules: this.component.__cssModules,
104
108
  })
105
109
 
106
110
  this.renderer = new VueRenderer(extendedComponent, {