@tiptap/vue-3 2.9.1 → 2.10.1
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/BubbleMenu.d.ts +6 -5
- package/dist/BubbleMenu.d.ts.map +1 -1
- package/dist/EditorContent.d.ts +6 -6
- package/dist/EditorContent.d.ts.map +1 -1
- package/dist/FloatingMenu.d.ts +5 -5
- package/dist/FloatingMenu.d.ts.map +1 -1
- package/dist/NodeViewContent.d.ts +4 -4
- package/dist/NodeViewContent.d.ts.map +1 -1
- package/dist/NodeViewWrapper.d.ts +4 -4
- package/dist/NodeViewWrapper.d.ts.map +1 -1
- package/dist/index.cjs +6 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +6 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/useEditor.d.ts +1 -1
- package/dist/useEditor.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/EditorContent.ts +0 -1
- package/src/useEditor.ts +6 -0
package/dist/BubbleMenu.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu';
|
|
2
2
|
import { PropType } from 'vue';
|
|
3
|
-
export declare const BubbleMenu: import("vue").DefineComponent<{
|
|
3
|
+
export declare const BubbleMenu: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
4
|
pluginKey: {
|
|
5
5
|
type: PropType<BubbleMenuPluginProps["pluginKey"]>;
|
|
6
6
|
default: string;
|
|
@@ -21,9 +21,9 @@ export declare const BubbleMenu: import("vue").DefineComponent<{
|
|
|
21
21
|
type: PropType<Exclude<Required<BubbleMenuPluginProps>["shouldShow"], null>>;
|
|
22
22
|
default: null;
|
|
23
23
|
};
|
|
24
|
-
}
|
|
24
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
25
25
|
[key: string]: any;
|
|
26
|
-
}>,
|
|
26
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
27
27
|
pluginKey: {
|
|
28
28
|
type: PropType<BubbleMenuPluginProps["pluginKey"]>;
|
|
29
29
|
default: string;
|
|
@@ -44,17 +44,18 @@ export declare const BubbleMenu: import("vue").DefineComponent<{
|
|
|
44
44
|
type: PropType<Exclude<Required<BubbleMenuPluginProps>["shouldShow"], null>>;
|
|
45
45
|
default: null;
|
|
46
46
|
};
|
|
47
|
-
}
|
|
47
|
+
}>> & Readonly<{}>, {
|
|
48
48
|
pluginKey: string | import("prosemirror-state").PluginKey<any>;
|
|
49
49
|
updateDelay: number | undefined;
|
|
50
50
|
tippyOptions: Partial<import("tippy.js").Props> | undefined;
|
|
51
51
|
shouldShow: (props: {
|
|
52
52
|
editor: import("@tiptap/core").Editor;
|
|
53
|
+
element: HTMLElement;
|
|
53
54
|
view: import("prosemirror-view").EditorView;
|
|
54
55
|
state: import("prosemirror-state").EditorState;
|
|
55
56
|
oldState?: import("prosemirror-state").EditorState;
|
|
56
57
|
from: number;
|
|
57
58
|
to: number;
|
|
58
59
|
}) => boolean;
|
|
59
|
-
}, {}>;
|
|
60
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
60
61
|
//# sourceMappingURL=BubbleMenu.d.ts.map
|
package/dist/BubbleMenu.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BubbleMenu.d.ts","sourceRoot":"","sources":["../src/BubbleMenu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,qBAAqB,EAAE,MAAM,+BAA+B,CAAA;AACvF,OAAO,EAKL,QAAQ,EAET,MAAM,KAAK,CAAA;AAEZ,eAAO,MAAM,UAAU;;cAKS,QAAQ,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC;;;;cAKtD,QAAQ,CAAC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,QAAQ,CAAC,CAAC;;;;cAKzC,QAAQ,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC;;;;cAK9C,QAAQ,CAAC,qBAAqB,CAAC,cAAc,CAAC,CAAC;;;;cAK7C,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC,CAAC;;;;;;;;;;;;gBAsBtF,CAAJ;;;;4EAaF,CAAA"}
|
package/dist/EditorContent.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { PropType, Ref } from 'vue';
|
|
2
2
|
import { Editor } from './Editor.js';
|
|
3
|
-
export declare const EditorContent: import("vue").DefineComponent<{
|
|
3
|
+
export declare const EditorContent: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
4
|
editor: {
|
|
5
5
|
default: null;
|
|
6
6
|
type: PropType<Editor>;
|
|
7
7
|
};
|
|
8
|
-
}
|
|
9
|
-
rootEl: Ref<Element | undefined>;
|
|
10
|
-
},
|
|
8
|
+
}>, {
|
|
9
|
+
rootEl: Ref<Element | undefined, Element | undefined>;
|
|
10
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
11
11
|
editor: {
|
|
12
12
|
default: null;
|
|
13
13
|
type: PropType<Editor>;
|
|
14
14
|
};
|
|
15
|
-
}
|
|
15
|
+
}>> & Readonly<{}>, {
|
|
16
16
|
editor: Editor;
|
|
17
|
-
}, {}>;
|
|
17
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
18
18
|
//# sourceMappingURL=EditorContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorContent.d.ts","sourceRoot":"","sources":["../src/EditorContent.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,QAAQ,EACR,GAAG,EAIJ,MAAM,KAAK,CAAA;AAEZ,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,eAAO,MAAM,aAAa;;;cAMJ,QAAQ,CAAC,MAAM,CAAC;;;;;;;cAAhB,QAAQ,CAAC,MAAM,CAAC;;;;
|
|
1
|
+
{"version":3,"file":"EditorContent.d.ts","sourceRoot":"","sources":["../src/EditorContent.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,QAAQ,EACR,GAAG,EAIJ,MAAM,KAAK,CAAA;AAEZ,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,eAAO,MAAM,aAAa;;;cAMJ,QAAQ,CAAC,MAAM,CAAC;;;;;;;cAAhB,QAAQ,CAAC,MAAM,CAAC;;;;4EAiEpC,CAAA"}
|
package/dist/FloatingMenu.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FloatingMenuPluginProps } from '@tiptap/extension-floating-menu';
|
|
2
2
|
import { PropType } from 'vue';
|
|
3
|
-
export declare const FloatingMenu: import("vue").DefineComponent<{
|
|
3
|
+
export declare const FloatingMenu: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
4
|
pluginKey: {
|
|
5
5
|
type: null;
|
|
6
6
|
default: string;
|
|
@@ -17,9 +17,9 @@ export declare const FloatingMenu: import("vue").DefineComponent<{
|
|
|
17
17
|
type: PropType<Exclude<Required<FloatingMenuPluginProps>["shouldShow"], null>>;
|
|
18
18
|
default: null;
|
|
19
19
|
};
|
|
20
|
-
}
|
|
20
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
21
21
|
[key: string]: any;
|
|
22
|
-
}>,
|
|
22
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
23
23
|
pluginKey: {
|
|
24
24
|
type: null;
|
|
25
25
|
default: string;
|
|
@@ -36,7 +36,7 @@ export declare const FloatingMenu: import("vue").DefineComponent<{
|
|
|
36
36
|
type: PropType<Exclude<Required<FloatingMenuPluginProps>["shouldShow"], null>>;
|
|
37
37
|
default: null;
|
|
38
38
|
};
|
|
39
|
-
}
|
|
39
|
+
}>> & Readonly<{}>, {
|
|
40
40
|
tippyOptions: Partial<import("tippy.js").Props> | undefined;
|
|
41
41
|
shouldShow: (props: {
|
|
42
42
|
editor: import("@tiptap/core").Editor;
|
|
@@ -45,5 +45,5 @@ export declare const FloatingMenu: import("vue").DefineComponent<{
|
|
|
45
45
|
oldState?: import("prosemirror-state").EditorState;
|
|
46
46
|
}) => boolean;
|
|
47
47
|
pluginKey: any;
|
|
48
|
-
}, {}>;
|
|
48
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
49
49
|
//# sourceMappingURL=FloatingMenu.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FloatingMenu.d.ts","sourceRoot":"","sources":["../src/FloatingMenu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,uBAAuB,EAAE,MAAM,iCAAiC,CAAA;AAC7F,OAAO,EAKL,QAAQ,EAET,MAAM,KAAK,CAAA;AAEZ,eAAO,MAAM,YAAY;;;;;;cAYH,QAAQ,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAC;;;;cAK3C,QAAQ,CAAC,uBAAuB,CAAC,cAAc,CAAC,CAAC;;;;cAK/C,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC,CAAC;;;;;;;;;;;cAV1E,QAAQ,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAC;;;;cAK3C,QAAQ,CAAC,uBAAuB,CAAC,cAAc,CAAC,CAAC;;;;cAK/C,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC,CAAC;;;;;;;;;gBAc1F,CAAJ;;;
|
|
1
|
+
{"version":3,"file":"FloatingMenu.d.ts","sourceRoot":"","sources":["../src/FloatingMenu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,uBAAuB,EAAE,MAAM,iCAAiC,CAAA;AAC7F,OAAO,EAKL,QAAQ,EAET,MAAM,KAAK,CAAA;AAEZ,eAAO,MAAM,YAAY;;;;;;cAYH,QAAQ,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAC;;;;cAK3C,QAAQ,CAAC,uBAAuB,CAAC,cAAc,CAAC,CAAC;;;;cAK/C,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC,CAAC;;;;;;;;;;;cAV1E,QAAQ,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAC;;;;cAK3C,QAAQ,CAAC,uBAAuB,CAAC,cAAc,CAAC,CAAC;;;;cAK/C,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC,CAAC;;;;;;;;;gBAc1F,CAAJ;;;4EAmBA,CAAA"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export declare const NodeViewContent: import("vue").DefineComponent<{
|
|
1
|
+
export declare const NodeViewContent: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
2
|
as: {
|
|
3
3
|
type: StringConstructor;
|
|
4
4
|
default: string;
|
|
5
5
|
};
|
|
6
|
-
}
|
|
6
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
7
7
|
as: {
|
|
8
8
|
type: StringConstructor;
|
|
9
9
|
default: string;
|
|
10
10
|
};
|
|
11
|
-
}
|
|
11
|
+
}>> & Readonly<{}>, {
|
|
12
12
|
as: string;
|
|
13
|
-
}, {}>;
|
|
13
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
14
14
|
//# sourceMappingURL=NodeViewContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeViewContent.d.ts","sourceRoot":"","sources":["../src/NodeViewContent.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"NodeViewContent.d.ts","sourceRoot":"","sources":["../src/NodeViewContent.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe;;;;;;;;;;;;4EAkB1B,CAAA"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export declare const NodeViewWrapper: import("vue").DefineComponent<{
|
|
1
|
+
export declare const NodeViewWrapper: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
2
|
as: {
|
|
3
3
|
type: StringConstructor;
|
|
4
4
|
default: string;
|
|
5
5
|
};
|
|
6
|
-
}
|
|
6
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
7
7
|
as: {
|
|
8
8
|
type: StringConstructor;
|
|
9
9
|
default: string;
|
|
10
10
|
};
|
|
11
|
-
}
|
|
11
|
+
}>> & Readonly<{}>, {
|
|
12
12
|
as: string;
|
|
13
|
-
}, {}>;
|
|
13
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
14
14
|
//# sourceMappingURL=NodeViewWrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeViewWrapper.d.ts","sourceRoot":"","sources":["../src/NodeViewWrapper.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"NodeViewWrapper.d.ts","sourceRoot":"","sources":["../src/NodeViewWrapper.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe;;;;;;;;;;;;4EA4B1B,CAAA"}
|
package/dist/index.cjs
CHANGED
|
@@ -257,8 +257,12 @@ const useEditor = (options = {}) => {
|
|
|
257
257
|
editor.value = new Editor(options);
|
|
258
258
|
});
|
|
259
259
|
vue.onBeforeUnmount(() => {
|
|
260
|
-
var _a;
|
|
261
|
-
|
|
260
|
+
var _a, _b, _c;
|
|
261
|
+
// Cloning root node (and its children) to avoid content being lost by destroy
|
|
262
|
+
const nodes = (_a = editor.value) === null || _a === void 0 ? void 0 : _a.options.element;
|
|
263
|
+
const newEl = nodes === null || nodes === void 0 ? void 0 : nodes.cloneNode(true);
|
|
264
|
+
(_b = nodes === null || nodes === void 0 ? void 0 : nodes.parentNode) === null || _b === void 0 ? void 0 : _b.replaceChild(newEl, nodes);
|
|
265
|
+
(_c = editor.value) === null || _c === void 0 ? void 0 : _c.destroy();
|
|
262
266
|
});
|
|
263
267
|
return editor;
|
|
264
268
|
};
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/BubbleMenu.ts","../src/Editor.ts","../src/EditorContent.ts","../src/FloatingMenu.ts","../src/NodeViewContent.ts","../src/NodeViewWrapper.ts","../src/useEditor.ts","../src/VueRenderer.ts","../src/VueNodeViewRenderer.ts"],"sourcesContent":["import { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n PropType,\n ref,\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 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 updateDelay,\n editor,\n pluginKey,\n shouldShow,\n tippyOptions,\n } = props\n\n editor.registerPlugin(BubbleMenuPlugin({\n updateDelay,\n editor,\n element: root.value as HTMLElement,\n pluginKey,\n shouldShow,\n tippyOptions,\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","/* 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\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 { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n PropType,\n ref,\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 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 { 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 { 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","/* 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"],"names":["defineComponent","ref","onMounted","BubbleMenuPlugin","onBeforeUnmount","h","customRef","CoreEditor","markRaw","getCurrentInstance","watchEffect","nextTick","unref","FloatingMenuPlugin","shallowRef","reactive","render","NodeView","provide"],"mappings":";;;;;;;AAUO,MAAM,UAAU,GAAGA,mBAAe,CAAC;AACxC,IAAA,IAAI,EAAE,YAAY;AAElB,IAAA,KAAK,EAAE;AACL,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAiD;AACtE,YAAA,OAAO,EAAE,YAAY;AACtB,SAAA;AAED,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAmD;AACzD,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AAED,QAAA,WAAW,EAAE;AACX,YAAA,IAAI,EAAE,MAAwD;AAC9D,YAAA,OAAO,EAAE,SAAS;AACnB,SAAA;AAED,QAAA,YAAY,EAAE;AACZ,YAAA,IAAI,EAAE,MAAyD;AAC/D,YAAA,OAAO,EAAE,OAAO,EAAE,CAAC;AACpB,SAAA;AAED,QAAA,UAAU,EAAE;AACV,YAAA,IAAI,EAAE,QAAkF;AACxF,YAAA,OAAO,EAAE,IAAI;AACd,SAAA;AACF,KAAA;AAED,IAAA,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAA;AACpB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,CAAA;QACvB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,iBAAiB,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAA;KAC/D;AACF,CAAA;AAEe,SAAA,mBAAmB,CACjC,SAAmC,EACnC,OAA6C,EAAA;IAE7C,OAAO,KAAK,IAAG;;;;AAIb,QAAA,IAAI,CAAE,KAAK,CAAC,MAAiB,CAAC,gBAAgB,EAAE;AAC9C,YAAA,OAAO,EAAoC,CAAA;SAC5C;;QAED,MAAM,mBAAmB,GAAG,OAAO,SAAS,KAAK,UAAU,IAAI,WAAW,IAAI,SAAS;cAClF,SAAS,CAAC,SAAuB;cAClC,SAAS,CAAA;QAEb,OAAO,IAAI,WAAW,CAAC,mBAAmB,EAAE,KAAK,EAAE,OAAO,CAAC,CAAA;AAC7D,KAAC,CAAA;AACH;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/BubbleMenu.ts","../src/Editor.ts","../src/EditorContent.ts","../src/FloatingMenu.ts","../src/NodeViewContent.ts","../src/NodeViewWrapper.ts","../src/useEditor.ts","../src/VueRenderer.ts","../src/VueNodeViewRenderer.ts"],"sourcesContent":["import { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n PropType,\n ref,\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 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 updateDelay,\n editor,\n pluginKey,\n shouldShow,\n tippyOptions,\n } = props\n\n editor.registerPlugin(BubbleMenuPlugin({\n updateDelay,\n editor,\n element: root.value as HTMLElement,\n pluginKey,\n shouldShow,\n tippyOptions,\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","/* 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 { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n PropType,\n ref,\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 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 { 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","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","/* 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"],"names":["defineComponent","ref","onMounted","BubbleMenuPlugin","onBeforeUnmount","h","customRef","CoreEditor","markRaw","getCurrentInstance","watchEffect","nextTick","unref","FloatingMenuPlugin","shallowRef","reactive","render","NodeView","provide"],"mappings":";;;;;;;AAUO,MAAM,UAAU,GAAGA,mBAAe,CAAC;AACxC,IAAA,IAAI,EAAE,YAAY;AAElB,IAAA,KAAK,EAAE;AACL,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAiD;AACtE,YAAA,OAAO,EAAE,YAAY;AACtB,SAAA;AAED,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAmD;AACzD,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AAED,QAAA,WAAW,EAAE;AACX,YAAA,IAAI,EAAE,MAAwD;AAC9D,YAAA,OAAO,EAAE,SAAS;AACnB,SAAA;AAED,QAAA,YAAY,EAAE;AACZ,YAAA,IAAI,EAAE,MAAyD;AAC/D,YAAA,OAAO,EAAE,OAAO,EAAE,CAAC;AACpB,SAAA;AAED,QAAA,UAAU,EAAE;AACV,YAAA,IAAI,EAAE,QAAkF;AACxF,YAAA,OAAO,EAAE,IAAI;AACd,SAAA;AACF,KAAA;AAED,IAAA,KAAK,CAAC,KAAK,EAAE,EAAE,KAA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Eb,OAAO,IAAI,WAAW,CAAC,mBAAmB,EAAE,KAAK,EAAE,OAAO,CAAC;AAC7D,KAAC;AACH;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -256,8 +256,12 @@ const useEditor = (options = {}) => {
|
|
|
256
256
|
editor.value = new Editor(options);
|
|
257
257
|
});
|
|
258
258
|
onBeforeUnmount(() => {
|
|
259
|
-
var _a;
|
|
260
|
-
|
|
259
|
+
var _a, _b, _c;
|
|
260
|
+
// Cloning root node (and its children) to avoid content being lost by destroy
|
|
261
|
+
const nodes = (_a = editor.value) === null || _a === void 0 ? void 0 : _a.options.element;
|
|
262
|
+
const newEl = nodes === null || nodes === void 0 ? void 0 : nodes.cloneNode(true);
|
|
263
|
+
(_b = nodes === null || nodes === void 0 ? void 0 : nodes.parentNode) === null || _b === void 0 ? void 0 : _b.replaceChild(newEl, nodes);
|
|
264
|
+
(_c = editor.value) === null || _c === void 0 ? void 0 : _c.destroy();
|
|
261
265
|
});
|
|
262
266
|
return editor;
|
|
263
267
|
};
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/BubbleMenu.ts","../src/Editor.ts","../src/EditorContent.ts","../src/FloatingMenu.ts","../src/NodeViewContent.ts","../src/NodeViewWrapper.ts","../src/useEditor.ts","../src/VueRenderer.ts","../src/VueNodeViewRenderer.ts"],"sourcesContent":["import { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n PropType,\n ref,\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 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 updateDelay,\n editor,\n pluginKey,\n shouldShow,\n tippyOptions,\n } = props\n\n editor.registerPlugin(BubbleMenuPlugin({\n updateDelay,\n editor,\n element: root.value as HTMLElement,\n pluginKey,\n shouldShow,\n tippyOptions,\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","/* 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\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 { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n PropType,\n ref,\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 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 { 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 { 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","/* 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"],"names":["CoreEditor"],"mappings":";;;;;;AAUO,MAAM,UAAU,GAAG,eAAe,CAAC;AACxC,IAAA,IAAI,EAAE,YAAY;AAElB,IAAA,KAAK,EAAE;AACL,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAiD;AACtE,YAAA,OAAO,EAAE,YAAY;AACtB,SAAA;AAED,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAmD;AACzD,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AAED,QAAA,WAAW,EAAE;AACX,YAAA,IAAI,EAAE,MAAwD;AAC9D,YAAA,OAAO,EAAE,SAAS;AACnB,SAAA;AAED,QAAA,YAAY,EAAE;AACZ,YAAA,IAAI,EAAE,MAAyD;AAC/D,YAAA,OAAO,EAAE,OAAO,EAAE,CAAC;AACpB,SAAA;AAED,QAAA,UAAU,EAAE;AACV,YAAA,IAAI,EAAE,QAAkF;AACxF,YAAA,OAAO,EAAE,IAAI;AACd,SAAA;AACF,KAAA;AAED,IAAA,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAA;AACpB,QAAA,MAAM,IAAI,GAAG,GAAG,CAAqB,IAAI,CAAC,CAAA;QAE1C,SAAS,CAA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mB,CACjC,SAAmC,EACnC,OAA6C,EAAA;IAE7C,OAAO,KAAK,IAAG;;;;AAIb,QAAA,IAAI,CAAE,KAAK,CAAC,MAAiB,CAAC,gBAAgB,EAAE;AAC9C,YAAA,OAAO,EAAoC,CAAA;SAC5C;;QAED,MAAM,mBAAmB,GAAG,OAAO,SAAS,KAAK,UAAU,IAAI,WAAW,IAAI,SAAS;cAClF,SAAS,CAAC,SAAuB;cAClC,SAAS,CAAA;QAEb,OAAO,IAAI,WAAW,CAAC,mBAAmB,EAAE,KAAK,EAAE,OAAO,CAAC,CAAA;AAC7D,KAAC,CAAA;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/BubbleMenu.ts","../src/Editor.ts","../src/EditorContent.ts","../src/FloatingMenu.ts","../src/NodeViewContent.ts","../src/NodeViewWrapper.ts","../src/useEditor.ts","../src/VueRenderer.ts","../src/VueNodeViewRenderer.ts"],"sourcesContent":["import { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n PropType,\n ref,\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 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 updateDelay,\n editor,\n pluginKey,\n shouldShow,\n tippyOptions,\n } = props\n\n editor.registerPlugin(BubbleMenuPlugin({\n updateDelay,\n editor,\n element: root.value as HTMLElement,\n pluginKey,\n shouldShow,\n tippyOptions,\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","/* 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 { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n PropType,\n ref,\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 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 { 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","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","/* 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"],"names":["CoreEditor"],"mappings":";;;;;;AAUO,MAAM,UAAU,GAAG,eAAe,CAAC;AACxC,IAAA,IAAI,EAAE,YAAY;AAElB,IAAA,KAAK,EAAE;AACL,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAiD;AACtE,YAAA,OAAO,EAAE,YAAY;AACtB,SAAA;AAED,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAmD;AACzD,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AAED,QAAA,WAAW,EAAE;AACX,YAAA,IAAI,EAAE,MAAwD;AAC9D,YAAA,OAAO,EAAE,SAAS;AACnB,SAAA;AAED,QAAA,YAAY,EAAE;AACZ,YAAA,IAAI,EAAE,MAAyD;AAC/D,YAAA,OAAO,EAAE,OAAO,EAAE,CAAC;AACpB,SAAA;AAED,QAAA,UAAU,EAAE;AACV,YAAA,IAAI,EAAE,QAAkF;AACxF,YAAA,OAAO,EAAE,IAAI;AACd,SAAA;AACF,KAAA;AAED,IAAA,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAA;AACpB,QAAA,MAAM,IAAI,GAAG,GAAG,CAAqB,IAAI,CAAC;QAE1C,SAAS,CAAC,MAAK;AACb,YAAA,MAAM,EACJ,WAAW,EACX,MAAM,EACN,SAAS,EACT,UAAU,EACV,YAAY,GACb,GAAG,KAAK;AAET,YAAA,MAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC;gBACrC,WAAW;gBACX,MAAM;gBACN,OAAO,EAAE,I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0BAA0B,CAAC;;;AAInE;;;AAGG;IACH,YAAY,GAAA;AACV,QAAA,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;AACxB,YAAA,QAAQ,EAAE,KAAK;AAChB,SAAA,CAAC;AACF,QAAA,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE;YACzB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,0BAA0B,CAAC;;;IAItE,oBAAoB,GAAA;QAClB,QACE,IAAI,CAAC;;AAEF,aAAA,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK;AACjC,aAAA,IAAI;AACJ,aAAA,IAAI,CAAC,GAAG,CAAC;;IAIhB,OAAO,GAAA;AACL,QAAA,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE;QACvB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,iBAAiB,EAAE,IAAI,CAAC,qBAAqB,CAAC;;AAEjE;AAEe,SAAA,mBAAmB,CACjC,SAAmC,EACnC,OAA6C,EAAA;IAE7C,OAAO,KAAK,IAAG;;;;AAIb,QAAA,IAAI,CAAE,KAAK,CAAC,MAAiB,CAAC,gBAAgB,EAAE;AAC9C,YAAA,OAAO,EAAoC;;;QAG7C,MAAM,mBAAmB,GAAG,OAAO,SAAS,KAAK,UAAU,IAAI,WAAW,IAAI;cACzE,SAAS,CAAC;cACX,SAAS;QAEb,OAAO,IAAI,WAAW,CAAC,mBAAmB,EAAE,KAAK,EAAE,OAAO,CAAC;AAC7D,KAAC;AACH;;;;"}
|
package/dist/index.umd.js
CHANGED
|
@@ -256,8 +256,12 @@
|
|
|
256
256
|
editor.value = new Editor(options);
|
|
257
257
|
});
|
|
258
258
|
vue.onBeforeUnmount(() => {
|
|
259
|
-
var _a;
|
|
260
|
-
|
|
259
|
+
var _a, _b, _c;
|
|
260
|
+
// Cloning root node (and its children) to avoid content being lost by destroy
|
|
261
|
+
const nodes = (_a = editor.value) === null || _a === void 0 ? void 0 : _a.options.element;
|
|
262
|
+
const newEl = nodes === null || nodes === void 0 ? void 0 : nodes.cloneNode(true);
|
|
263
|
+
(_b = nodes === null || nodes === void 0 ? void 0 : nodes.parentNode) === null || _b === void 0 ? void 0 : _b.replaceChild(newEl, nodes);
|
|
264
|
+
(_c = editor.value) === null || _c === void 0 ? void 0 : _c.destroy();
|
|
261
265
|
});
|
|
262
266
|
return editor;
|
|
263
267
|
};
|
package/dist/index.umd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","sources":["../src/BubbleMenu.ts","../src/Editor.ts","../src/EditorContent.ts","../src/FloatingMenu.ts","../src/NodeViewContent.ts","../src/NodeViewWrapper.ts","../src/useEditor.ts","../src/VueRenderer.ts","../src/VueNodeViewRenderer.ts"],"sourcesContent":["import { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n PropType,\n ref,\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 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 updateDelay,\n editor,\n pluginKey,\n shouldShow,\n tippyOptions,\n } = props\n\n editor.registerPlugin(BubbleMenuPlugin({\n updateDelay,\n editor,\n element: root.value as HTMLElement,\n pluginKey,\n shouldShow,\n tippyOptions,\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","/* 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\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 { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n PropType,\n ref,\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 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 { 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 { 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","/* 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"],"names":["defineComponent","ref","onMounted","BubbleMenuPlugin","onBeforeUnmount","h","customRef","CoreEditor","markRaw","getCurrentInstance","watchEffect","nextTick","unref","FloatingMenuPlugin","shallowRef","reactive","render","NodeView","provide"],"mappings":";;;;;;AAUO,QAAM,UAAU,GAAGA,mBAAe,CAAC;EACxC,IAAA,IAAI,EAAE,YAAY;EAElB,IAAA,KAAK,EAAE;EACL,QAAA,SAAS,EAAE;EACT,YAAA,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAiD;EACtE,YAAA,OAAO,EAAE,YAAY;EACtB,SAAA;EAED,QAAA,MAAM,EAAE;EACN,YAAA,IAAI,EAAE,MAAmD;EACzD,YAAA,QAAQ,EAAE,IAAI;EACf,SAAA;EAED,QAAA,WAAW,EAAE;EACX,YAAA,IAAI,EAAE,MAAwD;EAC9D,YAAA,OAAO,EAAE,SAAS;EACnB,SAAA;EAED,QAAA,YAAY,EAAE;EACZ,YAAA,IAAI,EAAE,MAAyD;EAC/D,YAAA,OAAO,EAAE,OAAO,EAAE,CAAC;EACpB,SAAA;EAED,QAAA,UAAU,EAAE;EACV,YAAA,IAAI,EAAE,QAAkF;EACxF,YAAA,OAAO,EAAE,IAAI;EACd,SAAA;EACF,KAAA;EAED,IAAA,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAA;EACpB,QAAA,MAAM,IAAI,GAAGC,OAAG,CAAqB,IAAI,CAAC,CAAA;UAE1CC,aAAS,CAAC,MAAK;EACb,YAAA,MAAM,EACJ,WAAW,EACX,MAAM,EACN,SAAS,EACT,UAAU,EACV,YAAY,GACb,GAAG,KAAK,CAAA;EAET,YAAA,MAAM,CAAC,cAAc,CAACC,oCAAgB,CAAC;kBACrC,WAAW;kBACX,MAAM;kBACN,OAAO,EAAE,IAAI,CAAC,KAAoB;kBAClC,SAAS;k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MAAM,mBAAmB,GAAG,OAAO,SAAS,KAAK,UAAU,IAAI,WAAW,IAAI,SAAS;gBAClF,SAAS,CAAC,SAAuB;gBAClC,SAAS,CAAA;UAEb,OAAO,IAAI,WAAW,CAAC,mBAAmB,EAAE,KAAK,EAAE,OAAO,CAAC,CAAA;EAC7D,KAAC,CAAA;EACH;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.umd.js","sources":["../src/BubbleMenu.ts","../src/Editor.ts","../src/EditorContent.ts","../src/FloatingMenu.ts","../src/NodeViewContent.ts","../src/NodeViewWrapper.ts","../src/useEditor.ts","../src/VueRenderer.ts","../src/VueNodeViewRenderer.ts"],"sourcesContent":["import { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n PropType,\n ref,\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 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 updateDelay,\n editor,\n pluginKey,\n shouldShow,\n tippyOptions,\n } = props\n\n editor.registerPlugin(BubbleMenuPlugin({\n updateDelay,\n editor,\n element: root.value as HTMLElement,\n pluginKey,\n shouldShow,\n tippyOptions,\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","/* 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 { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n PropType,\n ref,\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 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 { 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","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","/* 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"],"names":["defineComponent","ref","onMounted","BubbleMenuPlugin","onBeforeUnmount","h","customRef","CoreEditor","markRaw","getCurrentInstance","watchEffect","nextTick","unref","FloatingMenuPlugin","shallowRef","reactive","render","NodeView","provide"],"mappings":";;;;;;AAUO,QAAM,UAAU,GAAGA,mBAAe,CAAC;EACxC,IAAA,IAAI,EAAE,YAAY;EAElB,IAAA,KAAK,EAAE;EACL,QAAA,SAAS,EAAE;EACT,YAAA,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAiD;EACtE,YAAA,OAAO,EAAE,YAAY;EACtB,SAAA;EAED,QAAA,MAAM,EAAE;EACN,YAAA,IAAI,EAAE,MAAmD;EACzD,YAAA,QAAQ,EAAE,IAAI;EACf,SAAA;EAED,QAAA,WAAW,EAAE;EACX,YAAA,IAAI,EAAE,MAAwD;EAC9D,YAAA,OAAO,EAAE,SAAS;EACnB,SAAA;EAED,QAAA,YAAY,EAAE;EACZ,YAAA,IAAI,EAAE,MAAyD;EAC/D,YAAA,OAAO,EAAE,OAAO,EAAE,CAAC;EACpB,SAAA;EAED,QAAA,UAAU,EAAE;EACV,YAAA,IAAI,EAAE,QAAkF;EACxF,YAAA,OAAO,EAAE,IAAI;EACd,SAAA;EACF,KAAA;EAED,IAAA,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAA;EACpB,QAAA,MAAM,IAAI,GAAGC,OAAG,CAAqB,IAAI,CAAC;UAE1CC,aAAS,CAAC,MAAK;EACb,YAAA,MAAM,EACJ,WAAW,EACX,MAAM,EACN,SAAS,EACT,UAAU,EACV,YAAY,GACb,GAAG,KAAK;EAET,YAAA,MAAM,CAAC,cAAc,CAACC,oCAAgB,CAAC;kBACrC,WAAW;kBACX,MAAM;kBACN,OAAO,EAAE,IAAI,CAAC,KAAoB;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,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,0BAA0B,CAAC;;;EAInE;;;EAGG;MACH,YAAY,GAAA;EACV,QAAA,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;EACxB,YAAA,QAAQ,EAAE,KAAK;EAChB,SAAA,CAAC;EACF,QAAA,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE;cACzB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,0BAA0B,CAAC;;;MAItE,oBAAoB,GAAA;UAClB,QACE,IAAI,CAAC;;EAEF,aAAA,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK;EACjC,aAAA,IAAI;EACJ,aAAA,IAAI,CAAC,GAAG,CAAC;;MAIhB,OAAO,GAAA;EACL,QAAA,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE;UACvB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,iBAAiB,EAAE,IAAI,CAAC,qBAAqB,CAAC;;EAEjE;EAEe,SAAA,mBAAmB,CACjC,SAAmC,EACnC,OAA6C,EAAA;MAE7C,OAAO,KAAK,IAAG;;;;EAIb,QAAA,IAAI,CAAE,KAAK,CAAC,MAAiB,CAAC,gBAAgB,EAAE;EAC9C,YAAA,OAAO,EAAoC;;;UAG7C,MAAM,mBAAmB,GAAG,OAAO,SAAS,KAAK,UAAU,IAAI,WAAW,IAAI;gBACzE,SAAS,CAAC;gBACX,SAAS;UAEb,OAAO,IAAI,WAAW,CAAC,mBAAmB,EAAE,KAAK,EAAE,OAAO,CAAC;EAC7D,KAAC;EACH;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/useEditor.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { EditorOptions } from '@tiptap/core';
|
|
2
2
|
import { Editor } from './Editor.js';
|
|
3
|
-
export declare const useEditor: (options?: Partial<EditorOptions>) => import("vue").ShallowRef<Editor | undefined>;
|
|
3
|
+
export declare const useEditor: (options?: Partial<EditorOptions>) => import("vue").ShallowRef<Editor | undefined, Editor | undefined>;
|
|
4
4
|
//# sourceMappingURL=useEditor.d.ts.map
|
package/dist/useEditor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEditor.d.ts","sourceRoot":"","sources":["../src/useEditor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAG5C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,eAAO,MAAM,SAAS,aAAa,OAAO,CAAC,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"useEditor.d.ts","sourceRoot":"","sources":["../src/useEditor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAG5C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,eAAO,MAAM,SAAS,aAAa,OAAO,CAAC,aAAa,CAAC,qEAkBxD,CAAA"}
|
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.
|
|
4
|
+
"version": "2.10.1",
|
|
5
5
|
"homepage": "https://tiptap.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiptap",
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
"dist"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@tiptap/extension-bubble-menu": "^2.
|
|
33
|
-
"@tiptap/extension-floating-menu": "^2.
|
|
32
|
+
"@tiptap/extension-bubble-menu": "^2.10.1",
|
|
33
|
+
"@tiptap/extension-floating-menu": "^2.10.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@tiptap/core": "^2.
|
|
37
|
-
"@tiptap/pm": "^2.
|
|
36
|
+
"@tiptap/core": "^2.10.1",
|
|
37
|
+
"@tiptap/pm": "^2.10.1",
|
|
38
38
|
"vue": "^3.0.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
package/src/EditorContent.ts
CHANGED
package/src/useEditor.ts
CHANGED
|
@@ -11,6 +11,12 @@ export const useEditor = (options: Partial<EditorOptions> = {}) => {
|
|
|
11
11
|
})
|
|
12
12
|
|
|
13
13
|
onBeforeUnmount(() => {
|
|
14
|
+
// Cloning root node (and its children) to avoid content being lost by destroy
|
|
15
|
+
const nodes = editor.value?.options.element
|
|
16
|
+
const newEl = nodes?.cloneNode(true) as HTMLElement
|
|
17
|
+
|
|
18
|
+
nodes?.parentNode?.replaceChild(newEl, nodes)
|
|
19
|
+
|
|
14
20
|
editor.value?.destroy()
|
|
15
21
|
})
|
|
16
22
|
|