@tiptap/vue-3 3.0.0-next.1 → 3.0.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +73 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -31
- package/dist/index.d.ts +34 -31
- package/dist/index.js +73 -24
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/Editor.ts +16 -6
- package/src/EditorContent.ts +0 -19
- package/src/VueNodeViewRenderer.ts +87 -28
- package/src/useEditor.ts +6 -0
package/dist/index.cjs
CHANGED
|
@@ -147,15 +147,21 @@ var Editor = class extends import_core.Editor {
|
|
|
147
147
|
* Register a ProseMirror plugin.
|
|
148
148
|
*/
|
|
149
149
|
registerPlugin(plugin, handlePlugins) {
|
|
150
|
-
super.registerPlugin(plugin, handlePlugins);
|
|
151
|
-
this.reactiveState
|
|
150
|
+
const nextState = super.registerPlugin(plugin, handlePlugins);
|
|
151
|
+
if (this.reactiveState) {
|
|
152
|
+
this.reactiveState.value = nextState;
|
|
153
|
+
}
|
|
154
|
+
return nextState;
|
|
152
155
|
}
|
|
153
156
|
/**
|
|
154
157
|
* Unregister a ProseMirror plugin.
|
|
155
158
|
*/
|
|
156
159
|
unregisterPlugin(nameOrPluginKey) {
|
|
157
|
-
super.unregisterPlugin(nameOrPluginKey);
|
|
158
|
-
this.reactiveState
|
|
160
|
+
const nextState = super.unregisterPlugin(nameOrPluginKey);
|
|
161
|
+
if (this.reactiveState && nextState) {
|
|
162
|
+
this.reactiveState.value = nextState;
|
|
163
|
+
}
|
|
164
|
+
return nextState;
|
|
159
165
|
}
|
|
160
166
|
};
|
|
161
167
|
|
|
@@ -203,21 +209,8 @@ var EditorContent = (0, import_vue3.defineComponent)({
|
|
|
203
209
|
if (!editor) {
|
|
204
210
|
return;
|
|
205
211
|
}
|
|
206
|
-
if (!editor.isDestroyed) {
|
|
207
|
-
editor.view.setProps({
|
|
208
|
-
nodeViews: {}
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
212
|
editor.contentComponent = null;
|
|
212
213
|
editor.appContext = null;
|
|
213
|
-
if (!editor.options.element.firstChild) {
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
const newElement = document.createElement("div");
|
|
217
|
-
newElement.append(...editor.options.element.childNodes);
|
|
218
|
-
editor.setOptions({
|
|
219
|
-
element: newElement
|
|
220
|
-
});
|
|
221
214
|
});
|
|
222
215
|
return { rootEl };
|
|
223
216
|
},
|
|
@@ -350,8 +343,11 @@ var useEditor = (options = {}) => {
|
|
|
350
343
|
editor.value = new Editor(options);
|
|
351
344
|
});
|
|
352
345
|
(0, import_vue7.onBeforeUnmount)(() => {
|
|
353
|
-
var _a;
|
|
354
|
-
(_a = editor.value) == null ? void 0 : _a.
|
|
346
|
+
var _a, _b, _c;
|
|
347
|
+
const nodes = (_a = editor.value) == null ? void 0 : _a.options.element;
|
|
348
|
+
const newEl = nodes == null ? void 0 : nodes.cloneNode(true);
|
|
349
|
+
(_b = nodes == null ? void 0 : nodes.parentNode) == null ? void 0 : _b.replaceChild(newEl, nodes);
|
|
350
|
+
(_c = editor.value) == null ? void 0 : _c.destroy();
|
|
355
351
|
});
|
|
356
352
|
return editor;
|
|
357
353
|
};
|
|
@@ -449,8 +445,11 @@ var VueNodeView = class extends import_core2.NodeView {
|
|
|
449
445
|
editor: this.editor,
|
|
450
446
|
node: this.node,
|
|
451
447
|
decorations: this.decorations,
|
|
448
|
+
innerDecorations: this.innerDecorations,
|
|
449
|
+
view: this.view,
|
|
452
450
|
selected: false,
|
|
453
451
|
extension: this.extension,
|
|
452
|
+
HTMLAttributes: this.HTMLAttributes,
|
|
454
453
|
getPos: () => this.getPos(),
|
|
455
454
|
updateAttributes: (attributes = {}) => this.updateAttributes(attributes),
|
|
456
455
|
deleteNode: () => this.deleteNode()
|
|
@@ -485,52 +484,97 @@ var VueNodeView = class extends import_core2.NodeView {
|
|
|
485
484
|
// eslint-disable-next-line
|
|
486
485
|
__file: this.component.__file
|
|
487
486
|
});
|
|
487
|
+
this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this);
|
|
488
|
+
this.editor.on("selectionUpdate", this.handleSelectionUpdate);
|
|
488
489
|
this.renderer = new VueRenderer(extendedComponent, {
|
|
489
490
|
editor: this.editor,
|
|
490
491
|
props
|
|
491
492
|
});
|
|
492
493
|
}
|
|
494
|
+
/**
|
|
495
|
+
* Return the DOM element.
|
|
496
|
+
* This is the element that will be used to display the node view.
|
|
497
|
+
*/
|
|
493
498
|
get dom() {
|
|
494
499
|
if (!this.renderer.element || !this.renderer.element.hasAttribute("data-node-view-wrapper")) {
|
|
495
500
|
throw Error("Please use the NodeViewWrapper component for your node view.");
|
|
496
501
|
}
|
|
497
502
|
return this.renderer.element;
|
|
498
503
|
}
|
|
504
|
+
/**
|
|
505
|
+
* Return the content DOM element.
|
|
506
|
+
* This is the element that will be used to display the rich-text content of the node.
|
|
507
|
+
*/
|
|
499
508
|
get contentDOM() {
|
|
500
509
|
if (this.node.isLeaf) {
|
|
501
510
|
return null;
|
|
502
511
|
}
|
|
503
512
|
return this.dom.querySelector("[data-node-view-content]");
|
|
504
513
|
}
|
|
505
|
-
|
|
506
|
-
|
|
514
|
+
/**
|
|
515
|
+
* On editor selection update, check if the node is selected.
|
|
516
|
+
* If it is, call `selectNode`, otherwise call `deselectNode`.
|
|
517
|
+
*/
|
|
518
|
+
handleSelectionUpdate() {
|
|
519
|
+
const { from, to } = this.editor.state.selection;
|
|
520
|
+
const pos = this.getPos();
|
|
521
|
+
if (typeof pos !== "number") {
|
|
522
|
+
return;
|
|
523
|
+
}
|
|
524
|
+
if (from <= pos && to >= pos + this.node.nodeSize) {
|
|
525
|
+
if (this.renderer.props.selected) {
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
this.selectNode();
|
|
529
|
+
} else {
|
|
530
|
+
if (!this.renderer.props.selected) {
|
|
531
|
+
return;
|
|
532
|
+
}
|
|
533
|
+
this.deselectNode();
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* On update, update the React component.
|
|
538
|
+
* To prevent unnecessary updates, the `update` option can be used.
|
|
539
|
+
*/
|
|
540
|
+
update(node, decorations, innerDecorations) {
|
|
541
|
+
const rerenderComponent = (props) => {
|
|
507
542
|
this.decorationClasses.value = this.getDecorationClasses();
|
|
508
543
|
this.renderer.updateProps(props);
|
|
509
544
|
};
|
|
510
545
|
if (typeof this.options.update === "function") {
|
|
511
546
|
const oldNode = this.node;
|
|
512
547
|
const oldDecorations = this.decorations;
|
|
548
|
+
const oldInnerDecorations = this.innerDecorations;
|
|
513
549
|
this.node = node;
|
|
514
550
|
this.decorations = decorations;
|
|
551
|
+
this.innerDecorations = innerDecorations;
|
|
515
552
|
return this.options.update({
|
|
516
553
|
oldNode,
|
|
517
554
|
oldDecorations,
|
|
518
555
|
newNode: node,
|
|
519
556
|
newDecorations: decorations,
|
|
520
|
-
|
|
557
|
+
oldInnerDecorations,
|
|
558
|
+
innerDecorations,
|
|
559
|
+
updateProps: () => rerenderComponent({ node, decorations, innerDecorations })
|
|
521
560
|
});
|
|
522
561
|
}
|
|
523
562
|
if (node.type !== this.node.type) {
|
|
524
563
|
return false;
|
|
525
564
|
}
|
|
526
|
-
if (node === this.node && this.decorations === decorations) {
|
|
565
|
+
if (node === this.node && this.decorations === decorations && this.innerDecorations === innerDecorations) {
|
|
527
566
|
return true;
|
|
528
567
|
}
|
|
529
568
|
this.node = node;
|
|
530
569
|
this.decorations = decorations;
|
|
531
|
-
|
|
570
|
+
this.innerDecorations = innerDecorations;
|
|
571
|
+
rerenderComponent({ node, decorations, innerDecorations });
|
|
532
572
|
return true;
|
|
533
573
|
}
|
|
574
|
+
/**
|
|
575
|
+
* Select the node.
|
|
576
|
+
* Add the `selected` prop and the `ProseMirror-selectednode` class.
|
|
577
|
+
*/
|
|
534
578
|
selectNode() {
|
|
535
579
|
this.renderer.updateProps({
|
|
536
580
|
selected: true
|
|
@@ -539,6 +583,10 @@ var VueNodeView = class extends import_core2.NodeView {
|
|
|
539
583
|
this.renderer.element.classList.add("ProseMirror-selectednode");
|
|
540
584
|
}
|
|
541
585
|
}
|
|
586
|
+
/**
|
|
587
|
+
* Deselect the node.
|
|
588
|
+
* Remove the `selected` prop and the `ProseMirror-selectednode` class.
|
|
589
|
+
*/
|
|
542
590
|
deselectNode() {
|
|
543
591
|
this.renderer.updateProps({
|
|
544
592
|
selected: false
|
|
@@ -552,6 +600,7 @@ var VueNodeView = class extends import_core2.NodeView {
|
|
|
552
600
|
}
|
|
553
601
|
destroy() {
|
|
554
602
|
this.renderer.destroy();
|
|
603
|
+
this.editor.off("selectionUpdate", this.handleSelectionUpdate);
|
|
555
604
|
}
|
|
556
605
|
};
|
|
557
606
|
function VueNodeViewRenderer(component, options) {
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/BubbleMenu.ts","../src/Editor.ts","../src/EditorContent.ts","../src/FloatingMenu.ts","../src/NodeViewContent.ts","../src/NodeViewWrapper.ts","../src/useEditor.ts","../src/VueNodeViewRenderer.ts","../src/VueRenderer.ts"],"sourcesContent":["export * from './BubbleMenu.js'\nexport { Editor } from './Editor.js'\nexport * from './EditorContent.js'\nexport * from './FloatingMenu.js'\nexport * from './NodeViewContent.js'\nexport * from './NodeViewWrapper.js'\nexport * from './useEditor.js'\nexport * from './VueNodeViewRenderer.js'\nexport * from './VueRenderer.js'\nexport * from '@tiptap/core'\n","import { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n PropType,\n ref,\n Teleport,\n} from 'vue'\n\nexport const BubbleMenu = defineComponent({\n name: 'BubbleMenu',\n\n props: {\n pluginKey: {\n type: [String, Object] as PropType<BubbleMenuPluginProps['pluginKey']>,\n default: 'bubbleMenu',\n },\n\n editor: {\n type: Object as PropType<BubbleMenuPluginProps['editor']>,\n required: true,\n },\n\n updateDelay: {\n type: Number as PropType<BubbleMenuPluginProps['updateDelay']>,\n default: undefined,\n },\n\n resizeDelay: {\n type: Number as PropType<BubbleMenuPluginProps['resizeDelay']>,\n default: undefined,\n },\n\n options: {\n type: Object as PropType<BubbleMenuPluginProps['options']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<BubbleMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n editor,\n options,\n pluginKey,\n resizeDelay,\n shouldShow,\n updateDelay,\n } = props\n\n if (!root.value) {\n return\n }\n\n root.value.style.visibility = 'hidden'\n root.value.style.position = 'absolute'\n\n // remove the element from the DOM\n root.value.remove()\n\n editor.registerPlugin(BubbleMenuPlugin({\n editor,\n element: root.value as HTMLElement,\n options,\n pluginKey,\n resizeDelay,\n shouldShow,\n updateDelay,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h(Teleport, { to: 'body' }, h('div', { ref: root }, slots.default?.()))\n },\n})\n","/* eslint-disable react-hooks/rules-of-hooks */\nimport { Editor as CoreEditor, EditorOptions } from '@tiptap/core'\nimport { EditorState, Plugin, PluginKey } from '@tiptap/pm/state'\nimport {\n AppContext,\n ComponentInternalInstance,\n ComponentPublicInstance,\n customRef,\n markRaw,\n Ref,\n} from 'vue'\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 contentComponent: ContentComponent | null = null\n\n public appContext: AppContext | 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('beforeTransaction', ({ nextState }) => {\n this.reactiveState.value = nextState\n this.reactiveExtensionStorage.value = this.extensionStorage\n })\n\n return markRaw(this) // eslint-disable-line\n }\n\n get state() {\n return this.reactiveState ? this.reactiveState.value : this.view.state\n }\n\n get storage() {\n return this.reactiveExtensionStorage ? this.reactiveExtensionStorage.value : super.storage\n }\n\n /**\n * Register a ProseMirror plugin.\n */\n public registerPlugin(\n plugin: Plugin,\n handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[],\n ): 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 defineComponent,\n getCurrentInstance,\n h,\n nextTick,\n onBeforeUnmount,\n PropType,\n Ref,\n ref,\n unref,\n watchEffect,\n} from 'vue'\n\nimport { Editor } from './Editor.js'\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 if (instance) {\n editor.appContext = {\n ...instance.appContext,\n // Vue internally uses prototype chain to forward/shadow injects across the entire component chain\n // so don't use object spread operator or 'Object.assign' and just set `provides` as is on editor's appContext\n // @ts-expect-error forward instance's 'provides' into appContext\n provides: instance.provides,\n }\n }\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 editor.appContext = 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 return h(\n 'div',\n {\n ref: (el: any) => { this.rootEl = el },\n },\n )\n },\n})\n","import type { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n PropType,\n ref,\n Teleport,\n} from 'vue'\n\nexport const FloatingMenu = defineComponent({\n name: 'FloatingMenu',\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],\n type: null,\n default: 'floatingMenu',\n },\n\n editor: {\n type: Object as PropType<FloatingMenuPluginProps['editor']>,\n required: true,\n },\n\n options: {\n type: Object as PropType<BubbleMenuPluginProps['options']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<FloatingMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n pluginKey,\n editor,\n options,\n shouldShow,\n } = props\n\n if (!root.value) {\n return\n }\n\n root.value.style.visibility = 'hidden'\n root.value.style.position = 'absolute'\n\n // remove the element from the DOM\n root.value.remove()\n\n editor.registerPlugin(FloatingMenuPlugin({\n pluginKey,\n editor,\n element: root.value as HTMLElement,\n options,\n shouldShow,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h(Teleport, { to: 'body' }, h('div', { ref: root }, slots.default?.()))\n },\n})\n","import { defineComponent, h } from 'vue'\n\nexport const NodeViewContent = defineComponent({\n name: 'NodeViewContent',\n\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n render() {\n return h(this.as, {\n style: {\n whiteSpace: 'pre-wrap',\n },\n 'data-node-view-content': '',\n })\n },\n})\n","import { defineComponent, h } from 'vue'\n\nexport const NodeViewWrapper = defineComponent({\n name: 'NodeViewWrapper',\n\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 {\n // @ts-ignore\n class: this.decorationClasses,\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 { EditorOptions } from '@tiptap/core'\nimport { onBeforeUnmount, onMounted, shallowRef } from 'vue'\n\nimport { Editor } from './Editor.js'\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 {\n DecorationWithType,\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererOptions,\n NodeViewRendererProps,\n} from '@tiptap/core'\nimport { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { Decoration, NodeView as ProseMirrorNodeView } from '@tiptap/pm/view'\nimport {\n Component,\n defineComponent,\n PropType,\n provide,\n Ref,\n ref,\n} from 'vue'\n\nimport { Editor } from './Editor.js'\nimport { VueRenderer } from './VueRenderer.js'\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:\n | ((props: {\n oldNode: ProseMirrorNode\n oldDecorations: Decoration[]\n newNode: ProseMirrorNode\n newDecorations: Decoration[]\n updateProps: () => void\n }) => boolean)\n | null\n}\n\nclass VueNodeView extends NodeView<Component, Editor, VueNodeViewRendererOptions> {\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 // add support for vue devtools\n // @ts-ignore\n // eslint-disable-next-line\n __name: this.component.__name,\n // @ts-ignore\n // eslint-disable-next-line\n __file: this.component.__file,\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 || !this.renderer.element.hasAttribute('data-node-view-wrapper')) {\n throw Error('Please use the NodeViewWrapper component for your node view.')\n }\n\n return this.renderer.element as HTMLElement\n }\n\n get contentDOM() {\n if (this.node.isLeaf) {\n return null\n }\n\n return this.dom.querySelector('[data-node-view-content]') as HTMLElement | null\n }\n\n update(node: ProseMirrorNode, decorations: DecorationWithType[]) {\n const updateProps = (props?: Record<string, any>) => {\n this.decorationClasses.value = this.getDecorationClasses()\n this.renderer.updateProps(props)\n }\n\n if (typeof this.options.update === 'function') {\n const oldNode = this.node\n const oldDecorations = this.decorations\n\n this.node = node\n this.decorations = decorations\n\n return this.options.update({\n oldNode,\n oldDecorations,\n newNode: node,\n newDecorations: decorations,\n updateProps: () => updateProps({ node, decorations }),\n })\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (node === this.node && this.decorations === decorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n\n updateProps({ node, decorations })\n\n return true\n }\n\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n if (this.renderer.element) {\n this.renderer.element.classList.add('ProseMirror-selectednode')\n }\n }\n\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n if (this.renderer.element) {\n this.renderer.element.classList.remove('ProseMirror-selectednode')\n }\n }\n\n getDecorationClasses() {\n return (\n this.decorations\n // @ts-ignore\n .map(item => item.type.attrs.class)\n .flat()\n .join(' ')\n )\n }\n\n destroy() {\n this.renderer.destroy()\n }\n}\n\nexport function VueNodeViewRenderer(\n component: Component,\n options?: Partial<VueNodeViewRendererOptions>,\n): NodeViewRenderer {\n return (props: NodeViewRendererProps) => {\n // try to get the parent component\n // this is important for vue devtools to show the component hierarchy correctly\n // maybe it’s `undefined` because <editor-content> isn’t rendered yet\n if (!(props.editor as Editor).contentComponent) {\n return {}\n }\n // check for class-component and normalize if neccessary\n const normalizedComponent = typeof component === 'function' && '__vccOpts' in component\n // eslint-disable-next-line no-underscore-dangle\n ? component.__vccOpts as Component\n : component\n\n return new VueNodeView(normalizedComponent, props, options) as unknown as ProseMirrorNodeView\n }\n}\n","import { Editor } from '@tiptap/core'\nimport {\n Component, DefineComponent, h, markRaw, reactive, render,\n} from 'vue'\n\nimport { Editor as ExtendedEditor } from './Editor.js'\n\nexport interface VueRendererOptions {\n editor: Editor;\n props?: Record<string, any>;\n}\n\ntype ExtendedVNode = ReturnType<typeof h> | null;\n\ninterface RenderedComponent {\n vNode: ExtendedVNode;\n destroy: () => void;\n el: Element | null;\n}\n\n/**\n * This class is used to render Vue components inside the editor.\n */\nexport class VueRenderer {\n renderedComponent!: RenderedComponent\n\n editor: ExtendedEditor\n\n component: Component\n\n el: Element | null\n\n props: Record<string, any>\n\n constructor(component: Component, { props = {}, editor }: VueRendererOptions) {\n this.editor = editor as ExtendedEditor\n this.component = markRaw(component)\n this.el = document.createElement('div')\n this.props = reactive(props)\n this.renderedComponent = this.renderComponent()\n }\n\n get element(): Element | null {\n return this.renderedComponent.el\n }\n\n get ref(): any {\n // Composition API\n if (this.renderedComponent.vNode?.component?.exposed) {\n return this.renderedComponent.vNode.component.exposed\n }\n // Option API\n return this.renderedComponent.vNode?.component?.proxy\n }\n\n renderComponent() {\n let vNode: ExtendedVNode = h(this.component as DefineComponent, this.props)\n\n if (this.editor.appContext) {\n vNode.appContext = this.editor.appContext\n }\n if (typeof document !== 'undefined' && this.el) {\n render(vNode, this.el)\n }\n\n const destroy = () => {\n if (this.el) {\n render(null, this.el)\n }\n this.el = null\n vNode = null\n }\n\n return { vNode, destroy, el: this.el ? this.el.firstElementChild : null }\n }\n\n updateProps(props: Record<string, any> = {}): void {\n Object.entries(props).forEach(([key, value]) => {\n this.props[key] = value\n })\n this.renderComponent()\n }\n\n destroy(): void {\n this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AAK,SAAS,KAAK,KAAK,MAAM;AAChC,aAAO;AAAA,IACT;AAEA,QAAI,SAAS,KAAK,QAAQ,KAAK,gBAAgB,aAAa;AAC1D,aAAO;AAAA,IACT;AAEA,SAAK,OAAO;AACZ,SAAK,cAAc;AAEnB,gBAAY,EAAE,MAAM,YAAY,CAAC;AAEjC,WAAO;AAAA,EACT;AAAA,EAEA,aAAa;AACX,SAAK,SAAS,YAAY;AAAA,MACxB,UAAU;AAAA,IACZ,CAAC;AACD,QAAI,KAAK,SAAS,SAAS;AACzB,WAAK,SAAS,QAAQ,UAAU,IAAI,0BAA0B;AAAA,IAChE;AAAA,EACF;AAAA,EAEA,eAAe;AACb,SAAK,SAAS,YAAY;AAAA,MACxB,UAAU;AAAA,IACZ,CAAC;AACD,QAAI,KAAK,SAAS,SAAS;AACzB,WAAK,SAAS,QAAQ,UAAU,OAAO,0BAA0B;AAAA,IACnE;AAAA,EACF;AAAA,EAEA,uBAAuB;AACrB,WACE,KAAK,YAEF,IAAI,UAAQ,KAAK,KAAK,MAAM,KAAK,EACjC,KAAK,EACL,KAAK,GAAG;AAAA,EAEf;AAAA,EAEA,UAAU;AACR,SAAK,SAAS,QAAQ;AAAA,EACxB;AACF;AAEO,SAAS,oBACd,WACA,SACkB;AAClB,SAAO,CAAC,UAAiC;AAIvC,QAAI,CAAE,MAAM,OAAkB,kBAAkB;AAC9C,aAAO,CAAC;AAAA,IACV;AAEA,UAAM,sBAAsB,OAAO,cAAc,cAAc,eAAe,YAE1E,UAAU,YACV;AAEJ,WAAO,IAAI,YAAY,qBAAqB,OAAO,OAAO;AAAA,EAC5D;AACF;;;AR9NA,wBAAc,yBATd;","names":["import_vue","CoreEditor","import_vue","import_vue","import_vue","import_vue","import_vue","import_core","import_vue","import_vue"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/BubbleMenu.ts","../src/Editor.ts","../src/EditorContent.ts","../src/FloatingMenu.ts","../src/NodeViewContent.ts","../src/NodeViewWrapper.ts","../src/useEditor.ts","../src/VueNodeViewRenderer.ts","../src/VueRenderer.ts"],"sourcesContent":["export * from './BubbleMenu.js'\nexport { Editor } from './Editor.js'\nexport * from './EditorContent.js'\nexport * from './FloatingMenu.js'\nexport * from './NodeViewContent.js'\nexport * from './NodeViewWrapper.js'\nexport * from './useEditor.js'\nexport * from './VueNodeViewRenderer.js'\nexport * from './VueRenderer.js'\nexport * from '@tiptap/core'\n","import { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n PropType,\n ref,\n Teleport,\n} from 'vue'\n\nexport const BubbleMenu = defineComponent({\n name: 'BubbleMenu',\n\n props: {\n pluginKey: {\n type: [String, Object] as PropType<BubbleMenuPluginProps['pluginKey']>,\n default: 'bubbleMenu',\n },\n\n editor: {\n type: Object as PropType<BubbleMenuPluginProps['editor']>,\n required: true,\n },\n\n updateDelay: {\n type: Number as PropType<BubbleMenuPluginProps['updateDelay']>,\n default: undefined,\n },\n\n resizeDelay: {\n type: Number as PropType<BubbleMenuPluginProps['resizeDelay']>,\n default: undefined,\n },\n\n options: {\n type: Object as PropType<BubbleMenuPluginProps['options']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<BubbleMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n editor,\n options,\n pluginKey,\n resizeDelay,\n shouldShow,\n updateDelay,\n } = props\n\n if (!root.value) {\n return\n }\n\n root.value.style.visibility = 'hidden'\n root.value.style.position = 'absolute'\n\n // remove the element from the DOM\n root.value.remove()\n\n editor.registerPlugin(BubbleMenuPlugin({\n editor,\n element: root.value as HTMLElement,\n options,\n pluginKey,\n resizeDelay,\n shouldShow,\n updateDelay,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h(Teleport, { to: 'body' }, h('div', { ref: root }, slots.default?.()))\n },\n})\n","/* eslint-disable react-hooks/rules-of-hooks */\nimport { Editor as CoreEditor, EditorOptions } from '@tiptap/core'\nimport { EditorState, Plugin, PluginKey } from '@tiptap/pm/state'\nimport {\n AppContext,\n ComponentInternalInstance,\n ComponentPublicInstance,\n customRef,\n markRaw,\n Ref,\n} from 'vue'\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 contentComponent: ContentComponent | null = null\n\n public appContext: AppContext | 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('beforeTransaction', ({ nextState }) => {\n this.reactiveState.value = nextState\n this.reactiveExtensionStorage.value = this.extensionStorage\n })\n\n return markRaw(this) // eslint-disable-line\n }\n\n get state() {\n return this.reactiveState ? this.reactiveState.value : this.view.state\n }\n\n get storage() {\n return this.reactiveExtensionStorage ? this.reactiveExtensionStorage.value : super.storage\n }\n\n /**\n * Register a ProseMirror plugin.\n */\n public registerPlugin(\n plugin: Plugin,\n handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[],\n ): EditorState {\n const nextState = super.registerPlugin(plugin, handlePlugins)\n\n if (this.reactiveState) {\n this.reactiveState.value = nextState\n }\n\n return nextState\n }\n\n /**\n * Unregister a ProseMirror plugin.\n */\n public unregisterPlugin(nameOrPluginKey: string | PluginKey): EditorState | undefined {\n const nextState = super.unregisterPlugin(nameOrPluginKey)\n\n if (this.reactiveState && nextState) {\n this.reactiveState.value = nextState\n }\n\n return nextState\n }\n}\n","import {\n defineComponent,\n getCurrentInstance,\n h,\n nextTick,\n onBeforeUnmount,\n PropType,\n Ref,\n ref,\n unref,\n watchEffect,\n} from 'vue'\n\nimport { Editor } from './Editor.js'\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 if (instance) {\n editor.appContext = {\n ...instance.appContext,\n // Vue internally uses prototype chain to forward/shadow injects across the entire component chain\n // so don't use object spread operator or 'Object.assign' and just set `provides` as is on editor's appContext\n // @ts-expect-error forward instance's 'provides' into appContext\n provides: instance.provides,\n }\n }\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 editor.contentComponent = null\n editor.appContext = null\n })\n\n return { rootEl }\n },\n\n render() {\n return h(\n 'div',\n {\n ref: (el: any) => { this.rootEl = el },\n },\n )\n },\n})\n","import type { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n PropType,\n ref,\n Teleport,\n} from 'vue'\n\nexport const FloatingMenu = defineComponent({\n name: 'FloatingMenu',\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],\n type: null,\n default: 'floatingMenu',\n },\n\n editor: {\n type: Object as PropType<FloatingMenuPluginProps['editor']>,\n required: true,\n },\n\n options: {\n type: Object as PropType<BubbleMenuPluginProps['options']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<FloatingMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n pluginKey,\n editor,\n options,\n shouldShow,\n } = props\n\n if (!root.value) {\n return\n }\n\n root.value.style.visibility = 'hidden'\n root.value.style.position = 'absolute'\n\n // remove the element from the DOM\n root.value.remove()\n\n editor.registerPlugin(FloatingMenuPlugin({\n pluginKey,\n editor,\n element: root.value as HTMLElement,\n options,\n shouldShow,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h(Teleport, { to: 'body' }, h('div', { ref: root }, slots.default?.()))\n },\n})\n","import { defineComponent, h } from 'vue'\n\nexport const NodeViewContent = defineComponent({\n name: 'NodeViewContent',\n\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n render() {\n return h(this.as, {\n style: {\n whiteSpace: 'pre-wrap',\n },\n 'data-node-view-content': '',\n })\n },\n})\n","import { defineComponent, h } from 'vue'\n\nexport const NodeViewWrapper = defineComponent({\n name: 'NodeViewWrapper',\n\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 {\n // @ts-ignore\n class: this.decorationClasses,\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 { EditorOptions } from '@tiptap/core'\nimport { onBeforeUnmount, onMounted, shallowRef } from 'vue'\n\nimport { Editor } from './Editor.js'\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 // Cloning root node (and its children) to avoid content being lost by destroy\n const nodes = editor.value?.options.element\n const newEl = nodes?.cloneNode(true) as HTMLElement\n\n nodes?.parentNode?.replaceChild(newEl, nodes)\n\n editor.value?.destroy()\n })\n\n return editor\n}\n","/* eslint-disable no-underscore-dangle */\nimport {\n DecorationWithType,\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererOptions,\n} from '@tiptap/core'\nimport { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { Decoration, DecorationSource, NodeView as ProseMirrorNodeView } from '@tiptap/pm/view'\nimport {\n Component, defineComponent, PropType, provide, Ref, ref,\n} from 'vue'\n\nimport { Editor } from './Editor.js'\nimport { VueRenderer } from './VueRenderer.js'\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:\n | ((props: {\n oldNode: ProseMirrorNode;\n oldDecorations: readonly Decoration[];\n oldInnerDecorations: DecorationSource;\n newNode: ProseMirrorNode;\n newDecorations: readonly Decoration[];\n innerDecorations: DecorationSource;\n updateProps: () => void;\n }) => boolean)\n | null;\n}\n\nclass VueNodeView extends NodeView<Component, Editor, VueNodeViewRendererOptions> {\n renderer!: VueRenderer\n\n decorationClasses!: Ref<string>\n\n mount() {\n const props = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations as DecorationWithType[],\n innerDecorations: this.innerDecorations,\n view: this.view,\n selected: false,\n extension: this.extension,\n HTMLAttributes: this.HTMLAttributes,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n deleteNode: () => this.deleteNode(),\n } satisfies NodeViewProps\n\n const onDragStart = this.onDragStart.bind(this)\n\n this.decorationClasses = 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 // add support for vue devtools\n // @ts-ignore\n // eslint-disable-next-line\n __name: this.component.__name,\n // @ts-ignore\n // eslint-disable-next-line\n __file: this.component.__file,\n })\n\n this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this)\n this.editor.on('selectionUpdate', this.handleSelectionUpdate)\n\n this.renderer = new VueRenderer(extendedComponent, {\n editor: this.editor,\n props,\n })\n }\n\n /**\n * Return the DOM element.\n * This is the element that will be used to display the node view.\n */\n get dom() {\n if (!this.renderer.element || !this.renderer.element.hasAttribute('data-node-view-wrapper')) {\n throw Error('Please use the NodeViewWrapper component for your node view.')\n }\n\n return this.renderer.element as HTMLElement\n }\n\n /**\n * Return the content DOM element.\n * This is the element that will be used to display the rich-text content of the node.\n */\n get contentDOM() {\n if (this.node.isLeaf) {\n return null\n }\n\n return this.dom.querySelector('[data-node-view-content]') as HTMLElement | null\n }\n\n /**\n * On editor selection update, check if the node is selected.\n * If it is, call `selectNode`, otherwise call `deselectNode`.\n */\n handleSelectionUpdate() {\n const { from, to } = this.editor.state.selection\n const pos = this.getPos()\n\n if (typeof pos !== 'number') {\n return\n }\n\n if (from <= pos && to >= pos + this.node.nodeSize) {\n if (this.renderer.props.selected) {\n return\n }\n\n this.selectNode()\n } else {\n if (!this.renderer.props.selected) {\n return\n }\n\n this.deselectNode()\n }\n }\n\n /**\n * On update, update the React component.\n * To prevent unnecessary updates, the `update` option can be used.\n */\n update(\n node: ProseMirrorNode,\n decorations: readonly Decoration[],\n innerDecorations: DecorationSource,\n ): boolean {\n const rerenderComponent = (props?: Record<string, any>) => {\n this.decorationClasses.value = this.getDecorationClasses()\n this.renderer.updateProps(props)\n }\n\n if (typeof this.options.update === 'function') {\n const oldNode = this.node\n const oldDecorations = this.decorations\n const oldInnerDecorations = this.innerDecorations\n\n this.node = node\n this.decorations = decorations\n this.innerDecorations = innerDecorations\n\n return this.options.update({\n oldNode,\n oldDecorations,\n newNode: node,\n newDecorations: decorations,\n oldInnerDecorations,\n innerDecorations,\n updateProps: () => rerenderComponent({ node, decorations, innerDecorations }),\n })\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (node === this.node && this.decorations === decorations && this.innerDecorations === innerDecorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n this.innerDecorations = innerDecorations\n\n rerenderComponent({ node, decorations, innerDecorations })\n\n return true\n }\n\n /**\n * Select the node.\n * Add the `selected` prop and the `ProseMirror-selectednode` class.\n */\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n if (this.renderer.element) {\n this.renderer.element.classList.add('ProseMirror-selectednode')\n }\n }\n\n /**\n * Deselect the node.\n * Remove the `selected` prop and the `ProseMirror-selectednode` class.\n */\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n if (this.renderer.element) {\n this.renderer.element.classList.remove('ProseMirror-selectednode')\n }\n }\n\n getDecorationClasses() {\n return (\n this.decorations\n // @ts-ignore\n .map(item => item.type.attrs.class)\n .flat()\n .join(' ')\n )\n }\n\n destroy() {\n this.renderer.destroy()\n this.editor.off('selectionUpdate', this.handleSelectionUpdate)\n }\n}\n\nexport function VueNodeViewRenderer(\n component: Component<NodeViewProps>,\n options?: Partial<VueNodeViewRendererOptions>,\n): NodeViewRenderer {\n return props => {\n // try to get the parent component\n // this is important for vue devtools to show the component hierarchy correctly\n // maybe it’s `undefined` because <editor-content> isn’t rendered yet\n if (!(props.editor as Editor).contentComponent) {\n return {} as unknown as ProseMirrorNodeView\n }\n // check for class-component and normalize if neccessary\n const normalizedComponent = typeof component === 'function' && '__vccOpts' in component\n ? (component.__vccOpts as Component)\n : component\n\n return new VueNodeView(normalizedComponent, props, options)\n }\n}\n","import { Editor } from '@tiptap/core'\nimport {\n Component, DefineComponent, h, markRaw, reactive, render,\n} from 'vue'\n\nimport { Editor as ExtendedEditor } from './Editor.js'\n\nexport interface VueRendererOptions {\n editor: Editor;\n props?: Record<string, any>;\n}\n\ntype ExtendedVNode = ReturnType<typeof h> | null;\n\ninterface RenderedComponent {\n vNode: ExtendedVNode;\n destroy: () => void;\n el: Element | null;\n}\n\n/**\n * This class is used to render Vue components inside the editor.\n */\nexport class VueRenderer {\n renderedComponent!: RenderedComponent\n\n editor: ExtendedEditor\n\n component: Component\n\n el: Element | null\n\n props: Record<string, any>\n\n constructor(component: Component, { props = {}, editor }: VueRendererOptions) {\n this.editor = editor as ExtendedEditor\n this.component = markRaw(component)\n this.el = document.createElement('div')\n this.props = reactive(props)\n this.renderedComponent = this.renderComponent()\n }\n\n get element(): Element | null {\n return this.renderedComponent.el\n }\n\n get ref(): any {\n // Composition API\n if (this.renderedComponent.vNode?.component?.exposed) {\n return this.renderedComponent.vNode.component.exposed\n }\n // Option API\n return this.renderedComponent.vNode?.component?.proxy\n }\n\n renderComponent() {\n let vNode: ExtendedVNode = h(this.component as DefineComponent, this.props)\n\n if (this.editor.appContext) {\n vNode.appContext = this.editor.appContext\n }\n if (typeof document !== 'undefined' && this.el) {\n render(vNode, this.el)\n }\n\n const destroy = () => {\n if (this.el) {\n render(null, this.el)\n }\n this.el = null\n vNode = null\n }\n\n return { vNode, destroy, el: this.el ? this.el.firstElementChild : null }\n }\n\n updateProps(props: Record<string, any> = {}): void {\n Object.entries(props).forEach(([key, value]) => {\n this.props[key] = value\n })\n this.renderComponent()\n }\n\n destroy(): void {\n this.renderedComponent.destroy()\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mCAAwD;AACxD,iBAQO;AAEA,IAAM,iBAAa,4BAAgB;AAAA,EACxC,MAAM;AAAA,EAEN,OAAO;AAAA,IACL,WAAW;AAAA,MACT,MAAM,CAAC,QAAQ,MAAM;AAAA,MACrB,SAAS;AAAA,IACX;AAAA,IAEA,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,IACZ;AAAA,IAEA,aAAa;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,IAEA,aAAa;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,IAEA,SAAS;AAAA,MACP,MAAM;AAAA,MACN,SAAS,OAAO,CAAC;AAAA,IACnB;AAAA,IAEA,YAAY;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,EACF;AAAA,EAEA,MAAM,OAAO,EAAE,MAAM,GAAG;AACtB,UAAM,WAAO,gBAAwB,IAAI;AAEzC,8BAAU,MAAM;AACd,YAAM;AAAA,QACJ;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF,IAAI;AAEJ,UAAI,CAAC,KAAK,OAAO;AACf;AAAA,MACF;AAEA,WAAK,MAAM,MAAM,aAAa;AAC9B,WAAK,MAAM,MAAM,WAAW;AAG5B,WAAK,MAAM,OAAO;AAElB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AAK,SAAS,YAAY;AAAA,MACxB,UAAU;AAAA,IACZ,CAAC;AACD,QAAI,KAAK,SAAS,SAAS;AACzB,WAAK,SAAS,QAAQ,UAAU,IAAI,0BAA0B;AAAA,IAChE;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,eAAe;AACb,SAAK,SAAS,YAAY;AAAA,MACxB,UAAU;AAAA,IACZ,CAAC;AACD,QAAI,KAAK,SAAS,SAAS;AACzB,WAAK,SAAS,QAAQ,UAAU,OAAO,0BAA0B;AAAA,IACnE;AAAA,EACF;AAAA,EAEA,uBAAuB;AACrB,WACE,KAAK,YAEF,IAAI,UAAQ,KAAK,KAAK,MAAM,KAAK,EACjC,KAAK,EACL,KAAK,GAAG;AAAA,EAEf;AAAA,EAEA,UAAU;AACR,SAAK,SAAS,QAAQ;AACtB,SAAK,OAAO,IAAI,mBAAmB,KAAK,qBAAqB;AAAA,EAC/D;AACF;AAEO,SAAS,oBACd,WACA,SACkB;AAClB,SAAO,WAAS;AAId,QAAI,CAAE,MAAM,OAAkB,kBAAkB;AAC9C,aAAO,CAAC;AAAA,IACV;AAEA,UAAM,sBAAsB,OAAO,cAAc,cAAc,eAAe,YACzE,UAAU,YACX;AAEJ,WAAO,IAAI,YAAY,qBAAqB,OAAO,OAAO;AAAA,EAC5D;AACF;;;ARzRA,wBAAc,yBATd;","names":["import_vue","CoreEditor","import_vue","import_vue","import_vue","import_vue","import_vue","import_core","import_vue","import_vue"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -12,9 +12,9 @@ import { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu';
|
|
|
12
12
|
import { EditorState, Plugin, PluginKey } from '@tiptap/pm/state';
|
|
13
13
|
import { FloatingMenuPluginProps } from '@tiptap/extension-floating-menu';
|
|
14
14
|
import { Node } from '@tiptap/pm/model';
|
|
15
|
-
import { Decoration } from '@tiptap/pm/view';
|
|
15
|
+
import { Decoration, DecorationSource } from '@tiptap/pm/view';
|
|
16
16
|
|
|
17
|
-
declare const BubbleMenu: vue.DefineComponent<{
|
|
17
|
+
declare const BubbleMenu: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
18
18
|
pluginKey: {
|
|
19
19
|
type: PropType<BubbleMenuPluginProps["pluginKey"]>;
|
|
20
20
|
default: string;
|
|
@@ -39,9 +39,9 @@ declare const BubbleMenu: vue.DefineComponent<{
|
|
|
39
39
|
type: PropType<Exclude<Required<BubbleMenuPluginProps>["shouldShow"], null>>;
|
|
40
40
|
default: null;
|
|
41
41
|
};
|
|
42
|
-
}
|
|
42
|
+
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
43
43
|
[key: string]: any;
|
|
44
|
-
}>,
|
|
44
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
45
45
|
pluginKey: {
|
|
46
46
|
type: PropType<BubbleMenuPluginProps["pluginKey"]>;
|
|
47
47
|
default: string;
|
|
@@ -66,7 +66,7 @@ declare const BubbleMenu: vue.DefineComponent<{
|
|
|
66
66
|
type: PropType<Exclude<Required<BubbleMenuPluginProps>["shouldShow"], null>>;
|
|
67
67
|
default: null;
|
|
68
68
|
};
|
|
69
|
-
}
|
|
69
|
+
}>> & Readonly<{}>, {
|
|
70
70
|
pluginKey: string | prosemirror_state.PluginKey<any>;
|
|
71
71
|
updateDelay: number | undefined;
|
|
72
72
|
resizeDelay: number | undefined;
|
|
@@ -84,13 +84,14 @@ declare const BubbleMenu: vue.DefineComponent<{
|
|
|
84
84
|
} | undefined;
|
|
85
85
|
shouldShow: (props: {
|
|
86
86
|
editor: _tiptap_core.Editor;
|
|
87
|
+
element: HTMLElement;
|
|
87
88
|
view: prosemirror_view.EditorView;
|
|
88
89
|
state: prosemirror_state.EditorState;
|
|
89
90
|
oldState?: prosemirror_state.EditorState;
|
|
90
91
|
from: number;
|
|
91
92
|
to: number;
|
|
92
93
|
}) => boolean;
|
|
93
|
-
}, {}>;
|
|
94
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
94
95
|
|
|
95
96
|
type ContentComponent = ComponentInternalInstance & {
|
|
96
97
|
ctx: ComponentPublicInstance;
|
|
@@ -106,30 +107,30 @@ declare class Editor extends Editor$1 {
|
|
|
106
107
|
/**
|
|
107
108
|
* Register a ProseMirror plugin.
|
|
108
109
|
*/
|
|
109
|
-
registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]):
|
|
110
|
+
registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]): EditorState;
|
|
110
111
|
/**
|
|
111
112
|
* Unregister a ProseMirror plugin.
|
|
112
113
|
*/
|
|
113
|
-
unregisterPlugin(nameOrPluginKey: string | PluginKey):
|
|
114
|
+
unregisterPlugin(nameOrPluginKey: string | PluginKey): EditorState | undefined;
|
|
114
115
|
}
|
|
115
116
|
|
|
116
|
-
declare const EditorContent: vue.DefineComponent<{
|
|
117
|
+
declare const EditorContent: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
117
118
|
editor: {
|
|
118
119
|
default: null;
|
|
119
120
|
type: PropType<Editor>;
|
|
120
121
|
};
|
|
121
|
-
}
|
|
122
|
-
rootEl: Ref<Element | undefined>;
|
|
123
|
-
},
|
|
122
|
+
}>, {
|
|
123
|
+
rootEl: Ref<Element | undefined, Element | undefined>;
|
|
124
|
+
}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
124
125
|
editor: {
|
|
125
126
|
default: null;
|
|
126
127
|
type: PropType<Editor>;
|
|
127
128
|
};
|
|
128
|
-
}
|
|
129
|
+
}>> & Readonly<{}>, {
|
|
129
130
|
editor: Editor;
|
|
130
|
-
}, {}>;
|
|
131
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
131
132
|
|
|
132
|
-
declare const FloatingMenu: vue.DefineComponent<{
|
|
133
|
+
declare const FloatingMenu: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
133
134
|
pluginKey: {
|
|
134
135
|
type: null;
|
|
135
136
|
default: string;
|
|
@@ -146,9 +147,9 @@ declare const FloatingMenu: vue.DefineComponent<{
|
|
|
146
147
|
type: PropType<Exclude<Required<FloatingMenuPluginProps>["shouldShow"], null>>;
|
|
147
148
|
default: null;
|
|
148
149
|
};
|
|
149
|
-
}
|
|
150
|
+
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
150
151
|
[key: string]: any;
|
|
151
|
-
}>,
|
|
152
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
152
153
|
pluginKey: {
|
|
153
154
|
type: null;
|
|
154
155
|
default: string;
|
|
@@ -165,7 +166,7 @@ declare const FloatingMenu: vue.DefineComponent<{
|
|
|
165
166
|
type: PropType<Exclude<Required<FloatingMenuPluginProps>["shouldShow"], null>>;
|
|
166
167
|
default: null;
|
|
167
168
|
};
|
|
168
|
-
}
|
|
169
|
+
}>> & Readonly<{}>, {
|
|
169
170
|
pluginKey: any;
|
|
170
171
|
options: {
|
|
171
172
|
strategy?: _floating_ui_utils.Strategy;
|
|
@@ -187,37 +188,37 @@ declare const FloatingMenu: vue.DefineComponent<{
|
|
|
187
188
|
from: number;
|
|
188
189
|
to: number;
|
|
189
190
|
}) => boolean;
|
|
190
|
-
}, {}>;
|
|
191
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
191
192
|
|
|
192
|
-
declare const NodeViewContent: vue.DefineComponent<{
|
|
193
|
+
declare const NodeViewContent: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
193
194
|
as: {
|
|
194
195
|
type: StringConstructor;
|
|
195
196
|
default: string;
|
|
196
197
|
};
|
|
197
|
-
}
|
|
198
|
+
}>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
198
199
|
as: {
|
|
199
200
|
type: StringConstructor;
|
|
200
201
|
default: string;
|
|
201
202
|
};
|
|
202
|
-
}
|
|
203
|
+
}>> & Readonly<{}>, {
|
|
203
204
|
as: string;
|
|
204
|
-
}, {}>;
|
|
205
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
205
206
|
|
|
206
|
-
declare const NodeViewWrapper: vue.DefineComponent<{
|
|
207
|
+
declare const NodeViewWrapper: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
207
208
|
as: {
|
|
208
209
|
type: StringConstructor;
|
|
209
210
|
default: string;
|
|
210
211
|
};
|
|
211
|
-
}
|
|
212
|
+
}>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
212
213
|
as: {
|
|
213
214
|
type: StringConstructor;
|
|
214
215
|
default: string;
|
|
215
216
|
};
|
|
216
|
-
}
|
|
217
|
+
}>> & Readonly<{}>, {
|
|
217
218
|
as: string;
|
|
218
|
-
}, {}>;
|
|
219
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
219
220
|
|
|
220
|
-
declare const useEditor: (options?: Partial<EditorOptions>) => vue.ShallowRef<Editor | undefined>;
|
|
221
|
+
declare const useEditor: (options?: Partial<EditorOptions>) => vue.ShallowRef<Editor | undefined, Editor | undefined>;
|
|
221
222
|
|
|
222
223
|
declare const nodeViewProps: {
|
|
223
224
|
editor: {
|
|
@@ -256,13 +257,15 @@ declare const nodeViewProps: {
|
|
|
256
257
|
interface VueNodeViewRendererOptions extends NodeViewRendererOptions {
|
|
257
258
|
update: ((props: {
|
|
258
259
|
oldNode: Node;
|
|
259
|
-
oldDecorations: Decoration[];
|
|
260
|
+
oldDecorations: readonly Decoration[];
|
|
261
|
+
oldInnerDecorations: DecorationSource;
|
|
260
262
|
newNode: Node;
|
|
261
|
-
newDecorations: Decoration[];
|
|
263
|
+
newDecorations: readonly Decoration[];
|
|
264
|
+
innerDecorations: DecorationSource;
|
|
262
265
|
updateProps: () => void;
|
|
263
266
|
}) => boolean) | null;
|
|
264
267
|
}
|
|
265
|
-
declare function VueNodeViewRenderer(component: Component
|
|
268
|
+
declare function VueNodeViewRenderer(component: Component<NodeViewProps>, options?: Partial<VueNodeViewRendererOptions>): NodeViewRenderer;
|
|
266
269
|
|
|
267
270
|
interface VueRendererOptions {
|
|
268
271
|
editor: Editor$1;
|