@tiptap/vue-3 2.0.0-beta.21 → 2.0.0-beta.211

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.
@@ -1,405 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var core = require('@tiptap/core');
6
- var vue = require('vue');
7
- var extensionBubbleMenu = require('@tiptap/extension-bubble-menu');
8
- var extensionFloatingMenu = require('@tiptap/extension-floating-menu');
9
-
10
- const BubbleMenu = vue.defineComponent({
11
- name: 'BubbleMenu',
12
- props: {
13
- editor: {
14
- type: Object,
15
- required: true,
16
- },
17
- keepInBounds: {
18
- type: Boolean,
19
- default: true,
20
- },
21
- },
22
- setup({ editor, keepInBounds }, { slots }) {
23
- const root = vue.ref(null);
24
- vue.onMounted(() => {
25
- editor.registerPlugin(extensionBubbleMenu.BubbleMenuPlugin({
26
- editor,
27
- element: root.value,
28
- keepInBounds,
29
- }));
30
- });
31
- vue.onBeforeUnmount(() => {
32
- editor.unregisterPlugin(extensionBubbleMenu.BubbleMenuPluginKey);
33
- });
34
- return () => { var _a; return vue.h('div', { ref: root }, (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)); };
35
- },
36
- });
37
-
38
- function useDebouncedRef(value) {
39
- return vue.customRef((track, trigger) => {
40
- return {
41
- get() {
42
- track();
43
- return value;
44
- },
45
- set(newValue) {
46
- // update state
47
- value = newValue;
48
- // update view as soon as possible
49
- requestAnimationFrame(() => {
50
- requestAnimationFrame(() => {
51
- trigger();
52
- });
53
- });
54
- },
55
- };
56
- });
57
- }
58
- class Editor extends core.Editor {
59
- constructor(options = {}) {
60
- super(options);
61
- this.vueRenderers = vue.reactive(new Map());
62
- this.contentComponent = null;
63
- this.reactiveState = useDebouncedRef(this.view.state);
64
- this.on('transaction', () => {
65
- this.reactiveState.value = this.view.state;
66
- });
67
- return vue.markRaw(this);
68
- }
69
- get state() {
70
- return this.reactiveState
71
- ? this.reactiveState.value
72
- : this.view.state;
73
- }
74
- /**
75
- * Register a ProseMirror plugin.
76
- */
77
- registerPlugin(plugin, handlePlugins) {
78
- super.registerPlugin(plugin, handlePlugins);
79
- this.reactiveState.value = this.view.state;
80
- }
81
- /**
82
- * Unregister a ProseMirror plugin.
83
- */
84
- unregisterPlugin(nameOrPluginKey) {
85
- super.unregisterPlugin(nameOrPluginKey);
86
- this.reactiveState.value = this.view.state;
87
- }
88
- }
89
-
90
- const EditorContent = vue.defineComponent({
91
- name: 'EditorContent',
92
- props: {
93
- editor: {
94
- default: null,
95
- type: Object,
96
- },
97
- },
98
- setup(props) {
99
- const rootEl = vue.ref();
100
- const instance = vue.getCurrentInstance();
101
- vue.watchEffect(() => {
102
- const editor = props.editor;
103
- if (editor && editor.options.element && rootEl.value) {
104
- vue.nextTick(() => {
105
- if (!rootEl.value || !editor.options.element.firstChild) {
106
- return;
107
- }
108
- const element = vue.unref(rootEl.value);
109
- rootEl.value.appendChild(editor.options.element.firstChild);
110
- // @ts-ignore
111
- editor.contentComponent = instance.ctx._;
112
- editor.setOptions({
113
- element,
114
- });
115
- editor.createNodeViews();
116
- });
117
- }
118
- });
119
- vue.onBeforeUnmount(() => {
120
- const editor = props.editor;
121
- // destroy nodeviews before vue removes dom element
122
- if (!editor.isDestroyed) {
123
- editor.view.setProps({
124
- nodeViews: {},
125
- });
126
- }
127
- editor.contentComponent = null;
128
- if (!editor.options.element.firstChild) {
129
- return;
130
- }
131
- const newElement = document.createElement('div');
132
- newElement.appendChild(editor.options.element.firstChild);
133
- editor.setOptions({
134
- element: newElement,
135
- });
136
- });
137
- return { rootEl };
138
- },
139
- render() {
140
- const vueRenderers = [];
141
- if (this.editor) {
142
- this.editor.vueRenderers.forEach(vueRenderer => {
143
- const node = vue.h(vue.Teleport, {
144
- to: vueRenderer.teleportElement,
145
- key: vueRenderer.id,
146
- }, vue.h(vueRenderer.component, {
147
- ref: vueRenderer.id,
148
- ...vueRenderer.props,
149
- }));
150
- vueRenderers.push(node);
151
- });
152
- }
153
- return vue.h('div', {
154
- ref: (el) => { this.rootEl = el; },
155
- }, ...vueRenderers);
156
- },
157
- });
158
-
159
- const FloatingMenu = vue.defineComponent({
160
- name: 'FloatingMenu',
161
- props: {
162
- editor: {
163
- type: Object,
164
- required: true,
165
- },
166
- },
167
- setup({ editor }, { slots }) {
168
- const root = vue.ref(null);
169
- vue.onMounted(() => {
170
- editor.registerPlugin(extensionFloatingMenu.FloatingMenuPlugin({
171
- editor,
172
- element: root.value,
173
- }));
174
- });
175
- vue.onBeforeUnmount(() => {
176
- editor.unregisterPlugin(extensionFloatingMenu.FloatingMenuPluginKey);
177
- });
178
- return () => { var _a; return vue.h('div', { ref: root }, (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)); };
179
- },
180
- });
181
-
182
- const useEditor = (options = {}) => {
183
- const editor = vue.ref();
184
- vue.onMounted(() => {
185
- editor.value = new Editor(options);
186
- });
187
- vue.onBeforeUnmount(() => {
188
- var _a;
189
- (_a = editor.value) === null || _a === void 0 ? void 0 : _a.destroy();
190
- });
191
- return editor;
192
- };
193
-
194
- class VueRenderer {
195
- constructor(component, { props = {}, editor }) {
196
- this.id = Math.floor(Math.random() * 0xFFFFFFFF).toString();
197
- this.editor = editor;
198
- this.component = vue.markRaw(component);
199
- this.teleportElement = document.createElement('div');
200
- this.element = this.teleportElement;
201
- this.props = vue.reactive(props);
202
- this.editor.vueRenderers.set(this.id, this);
203
- if (this.editor.contentComponent) {
204
- this.editor.contentComponent.update();
205
- if (this.teleportElement.children.length !== 1) {
206
- throw Error('VueRenderer doesn’t support multiple child elements.');
207
- }
208
- this.element = this.teleportElement.firstElementChild;
209
- }
210
- }
211
- get ref() {
212
- var _a;
213
- return (_a = this.editor.contentComponent) === null || _a === void 0 ? void 0 : _a.ctx.$refs[this.id];
214
- }
215
- updateProps(props = {}) {
216
- Object
217
- .entries(props)
218
- .forEach(([key, value]) => {
219
- this.props[key] = value;
220
- });
221
- }
222
- destroy() {
223
- this.editor.vueRenderers.delete(this.id);
224
- }
225
- }
226
-
227
- const nodeViewProps = {
228
- editor: {
229
- type: Object,
230
- required: true,
231
- },
232
- node: {
233
- type: Object,
234
- required: true,
235
- },
236
- decorations: {
237
- type: Object,
238
- required: true,
239
- },
240
- selected: {
241
- type: Boolean,
242
- required: true,
243
- },
244
- extension: {
245
- type: Object,
246
- required: true,
247
- },
248
- getPos: {
249
- type: Function,
250
- required: true,
251
- },
252
- updateAttributes: {
253
- type: Function,
254
- required: true,
255
- },
256
- };
257
- class VueNodeView extends core.NodeView {
258
- mount() {
259
- const props = {
260
- editor: this.editor,
261
- node: this.node,
262
- decorations: this.decorations,
263
- selected: false,
264
- extension: this.extension,
265
- getPos: () => this.getPos(),
266
- updateAttributes: (attributes = {}) => this.updateAttributes(attributes),
267
- };
268
- const onDragStart = this.onDragStart.bind(this);
269
- this.decorationClasses = vue.ref(this.getDecorationClasses());
270
- const extendedComponent = vue.defineComponent({
271
- extends: { ...this.component },
272
- props: Object.keys(props),
273
- setup: () => {
274
- var _a, _b;
275
- vue.provide('onDragStart', onDragStart);
276
- vue.provide('decorationClasses', this.decorationClasses);
277
- return (_b = (_a = this.component).setup) === null || _b === void 0 ? void 0 : _b.call(_a, props);
278
- },
279
- });
280
- this.renderer = new VueRenderer(extendedComponent, {
281
- editor: this.editor,
282
- props,
283
- });
284
- }
285
- get dom() {
286
- if (!this.renderer.element.hasAttribute('data-node-view-wrapper')) {
287
- throw Error('Please use the NodeViewWrapper component for your node view.');
288
- }
289
- return this.renderer.element;
290
- }
291
- get contentDOM() {
292
- if (this.node.isLeaf) {
293
- return null;
294
- }
295
- const contentElement = this.dom.querySelector('[data-node-view-content]');
296
- return contentElement || this.dom;
297
- }
298
- update(node, decorations) {
299
- if (typeof this.options.update === 'function') {
300
- return this.options.update(node, decorations);
301
- }
302
- if (node.type !== this.node.type) {
303
- return false;
304
- }
305
- if (node === this.node && this.decorations === decorations) {
306
- return true;
307
- }
308
- this.node = node;
309
- this.decorations = decorations;
310
- this.decorationClasses.value = this.getDecorationClasses();
311
- this.renderer.updateProps({ node, decorations });
312
- return true;
313
- }
314
- selectNode() {
315
- this.renderer.updateProps({
316
- selected: true,
317
- });
318
- }
319
- deselectNode() {
320
- this.renderer.updateProps({
321
- selected: false,
322
- });
323
- }
324
- getDecorationClasses() {
325
- return this.decorations
326
- // @ts-ignore
327
- .map(item => item.type.attrs.class)
328
- .flat()
329
- .join(' ');
330
- }
331
- destroy() {
332
- this.renderer.destroy();
333
- }
334
- }
335
- function VueNodeViewRenderer(component, options) {
336
- return (props) => {
337
- // try to get the parent component
338
- // this is important for vue devtools to show the component hierarchy correctly
339
- // maybe it’s `undefined` because <editor-content> isn’t rendered yet
340
- if (!props.editor.contentComponent) {
341
- return {};
342
- }
343
- return new VueNodeView(component, props, options);
344
- };
345
- }
346
-
347
- const NodeViewWrapper = vue.defineComponent({
348
- props: {
349
- as: {
350
- type: String,
351
- default: 'div',
352
- },
353
- },
354
- inject: ['onDragStart', 'decorationClasses'],
355
- render() {
356
- var _a, _b;
357
- return vue.h(this.as, {
358
- // @ts-ignore
359
- class: this.decorationClasses.value,
360
- style: {
361
- whiteSpace: 'normal',
362
- },
363
- 'data-node-view-wrapper': '',
364
- // @ts-ignore (https://github.com/vuejs/vue-next/issues/3031)
365
- onDragStart: this.onDragStart,
366
- }, (_b = (_a = this.$slots).default) === null || _b === void 0 ? void 0 : _b.call(_a));
367
- },
368
- });
369
-
370
- const NodeViewContent = vue.defineComponent({
371
- props: {
372
- as: {
373
- type: String,
374
- default: 'div',
375
- },
376
- },
377
- render() {
378
- return vue.h(this.as, {
379
- style: {
380
- whiteSpace: 'pre-wrap',
381
- },
382
- 'data-node-view-content': '',
383
- });
384
- },
385
- });
386
-
387
- exports.BubbleMenu = BubbleMenu;
388
- exports.Editor = Editor;
389
- exports.EditorContent = EditorContent;
390
- exports.FloatingMenu = FloatingMenu;
391
- exports.NodeViewContent = NodeViewContent;
392
- exports.NodeViewWrapper = NodeViewWrapper;
393
- exports.VueNodeViewRenderer = VueNodeViewRenderer;
394
- exports.VueRenderer = VueRenderer;
395
- exports.nodeViewProps = nodeViewProps;
396
- exports.useEditor = useEditor;
397
- Object.keys(core).forEach(function (k) {
398
- if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
399
- enumerable: true,
400
- get: function () {
401
- return core[k];
402
- }
403
- });
404
- });
405
- //# sourceMappingURL=tiptap-vue-3.cjs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tiptap-vue-3.cjs.js","sources":["../src/BubbleMenu.ts","../src/Editor.ts","../src/EditorContent.ts","../src/FloatingMenu.ts","../src/useEditor.ts","../src/VueRenderer.ts","../src/VueNodeViewRenderer.ts","../src/NodeViewWrapper.ts","../src/NodeViewContent.ts"],"sourcesContent":["import {\n h,\n ref,\n PropType,\n onMounted,\n onBeforeUnmount,\n defineComponent,\n} from 'vue'\nimport {\n BubbleMenuPlugin,\n BubbleMenuPluginKey,\n BubbleMenuPluginProps,\n} from '@tiptap/extension-bubble-menu'\n\nexport const BubbleMenu = defineComponent({\n name: 'BubbleMenu',\n\n props: {\n editor: {\n type: Object as PropType<BubbleMenuPluginProps['editor']>,\n required: true,\n },\n\n keepInBounds: {\n type: Boolean as PropType<BubbleMenuPluginProps['keepInBounds']>,\n default: true,\n },\n },\n\n setup({ editor, keepInBounds }, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n editor.registerPlugin(BubbleMenuPlugin({\n editor,\n element: root.value as HTMLElement,\n keepInBounds,\n }))\n })\n\n onBeforeUnmount(() => {\n editor.unregisterPlugin(BubbleMenuPluginKey)\n })\n\n return () => h('div', { ref: root }, slots.default?.())\n },\n})\n","import { EditorState, Plugin, PluginKey } from 'prosemirror-state'\nimport { Editor as CoreEditor, EditorOptions } from '@tiptap/core'\nimport {\n markRaw,\n Ref,\n customRef,\n ComponentInternalInstance,\n ComponentPublicInstance,\n reactive,\n} from 'vue'\nimport { VueRenderer } from './VueRenderer'\n\nfunction useDebouncedRef<T>(value: T) {\n return customRef<T>((track, trigger) => {\n return {\n get() {\n track()\n return value\n },\n set(newValue) {\n // update state\n value = newValue\n\n // update view as soon as possible\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n trigger()\n })\n })\n },\n }\n })\n}\n\nexport type ContentComponent = ComponentInternalInstance & {\n ctx: ComponentPublicInstance,\n}\n\nexport class Editor extends CoreEditor {\n private reactiveState: Ref<EditorState>\n\n public vueRenderers = reactive<Map<string, VueRenderer>>(new Map())\n\n public contentComponent: ContentComponent | null = null\n\n constructor(options: Partial<EditorOptions> = {}) {\n super(options)\n\n this.reactiveState = useDebouncedRef(this.view.state)\n\n this.on('transaction', () => {\n this.reactiveState.value = this.view.state\n })\n\n return markRaw(this)\n }\n\n get state() {\n return this.reactiveState\n ? this.reactiveState.value\n : this.view.state\n }\n\n /**\n * Register a ProseMirror plugin.\n */\n public registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]): void {\n super.registerPlugin(plugin, handlePlugins)\n this.reactiveState.value = this.view.state\n }\n\n /**\n * Unregister a ProseMirror plugin.\n */\n public unregisterPlugin(nameOrPluginKey: string | PluginKey): void {\n super.unregisterPlugin(nameOrPluginKey)\n this.reactiveState.value = this.view.state\n }\n}\n","import {\n h,\n ref,\n Ref,\n unref,\n Teleport,\n PropType,\n defineComponent,\n DefineComponent,\n watchEffect,\n nextTick,\n onBeforeUnmount,\n getCurrentInstance,\n} from 'vue'\nimport { Editor } from './Editor'\n\nexport const EditorContent = defineComponent({\n name: 'EditorContent',\n\n props: {\n editor: {\n default: null,\n type: Object as PropType<Editor>,\n },\n },\n\n setup(props) {\n const rootEl: Ref<Element | undefined> = ref()\n const instance = getCurrentInstance()\n\n watchEffect(() => {\n const editor = props.editor\n\n if (editor && editor.options.element && rootEl.value) {\n nextTick(() => {\n if (!rootEl.value || !editor.options.element.firstChild) {\n return\n }\n\n const element = unref(rootEl.value)\n\n rootEl.value.appendChild(editor.options.element.firstChild)\n\n // @ts-ignore\n editor.contentComponent = instance.ctx._\n\n editor.setOptions({\n element,\n })\n\n editor.createNodeViews()\n })\n }\n })\n\n onBeforeUnmount(() => {\n const editor = props.editor\n\n // destroy nodeviews before vue removes dom element\n if (!editor.isDestroyed) {\n editor.view.setProps({\n nodeViews: {},\n })\n }\n\n editor.contentComponent = null\n\n if (!editor.options.element.firstChild) {\n return\n }\n\n const newElement = document.createElement('div')\n\n newElement.appendChild(editor.options.element.firstChild)\n\n editor.setOptions({\n element: newElement,\n })\n })\n\n return { rootEl }\n },\n\n render() {\n const vueRenderers: any[] = []\n\n if (this.editor) {\n this.editor.vueRenderers.forEach(vueRenderer => {\n const node = h(\n Teleport,\n {\n to: vueRenderer.teleportElement,\n key: vueRenderer.id,\n },\n h(\n vueRenderer.component as DefineComponent,\n {\n ref: vueRenderer.id,\n ...vueRenderer.props,\n },\n ),\n )\n\n vueRenderers.push(node)\n })\n }\n\n return h(\n 'div',\n {\n ref: (el: any) => { this.rootEl = el },\n },\n ...vueRenderers,\n )\n },\n})\n","import {\n h,\n ref,\n PropType,\n onMounted,\n onBeforeUnmount,\n defineComponent,\n} from 'vue'\nimport {\n FloatingMenuPlugin,\n FloatingMenuPluginKey,\n FloatingMenuPluginProps,\n} from '@tiptap/extension-floating-menu'\n\nexport const FloatingMenu = defineComponent({\n name: 'FloatingMenu',\n\n props: {\n editor: {\n type: Object as PropType<FloatingMenuPluginProps['editor']>,\n required: true,\n },\n },\n\n setup({ editor }, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n editor.registerPlugin(FloatingMenuPlugin({\n editor,\n element: root.value as HTMLElement,\n }))\n })\n\n onBeforeUnmount(() => {\n editor.unregisterPlugin(FloatingMenuPluginKey)\n })\n\n return () => h('div', { ref: root }, slots.default?.())\n },\n})\n","import { onMounted, onBeforeUnmount, ref } from 'vue'\nimport { EditorOptions } from '@tiptap/core'\nimport { Editor } from './Editor'\n\nexport const useEditor = (options: Partial<EditorOptions> = {}) => {\n const editor = ref<Editor>()\n\n onMounted(() => {\n editor.value = new Editor(options)\n })\n\n onBeforeUnmount(() => {\n editor.value?.destroy()\n })\n\n return editor\n}\n","import { reactive, markRaw, Component } from 'vue'\nimport { AnyObject } from '@tiptap/core'\nimport { Editor } from './Editor'\n\nexport interface VueRendererOptions {\n editor: Editor,\n props?: AnyObject,\n}\n\nexport class VueRenderer {\n id: string\n\n editor: Editor\n\n component: Component\n\n teleportElement: Element\n\n element: Element\n\n props: AnyObject\n\n constructor(component: Component, { props = {}, editor }: VueRendererOptions) {\n this.id = Math.floor(Math.random() * 0xFFFFFFFF).toString()\n this.editor = editor\n this.component = markRaw(component)\n this.teleportElement = document.createElement('div')\n this.element = this.teleportElement\n this.props = reactive(props)\n this.editor.vueRenderers.set(this.id, this)\n\n if (this.editor.contentComponent) {\n this.editor.contentComponent.update()\n\n if (this.teleportElement.children.length !== 1) {\n throw Error('VueRenderer doesn’t support multiple child elements.')\n }\n\n this.element = this.teleportElement.firstElementChild as Element\n }\n }\n\n get ref(): any {\n return this.editor.contentComponent?.ctx.$refs[this.id]\n }\n\n updateProps(props: AnyObject = {}): void {\n Object\n .entries(props)\n .forEach(([key, value]) => {\n this.props[key] = value\n })\n }\n\n destroy(): void {\n this.editor.vueRenderers.delete(this.id)\n }\n}\n","import {\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererProps,\n} from '@tiptap/core'\nimport {\n ref,\n Ref,\n provide,\n PropType,\n Component,\n defineComponent,\n} from 'vue'\nimport { Decoration, NodeView as ProseMirrorNodeView } from 'prosemirror-view'\nimport { Node as ProseMirrorNode } from 'prosemirror-model'\nimport { Editor } from './Editor'\nimport { VueRenderer } from './VueRenderer'\n\nexport const nodeViewProps = {\n editor: {\n type: Object as PropType<NodeViewProps['editor']>,\n required: true,\n },\n node: {\n type: Object as PropType<NodeViewProps['node']>,\n required: true,\n },\n decorations: {\n type: Object as PropType<NodeViewProps['decorations']>,\n required: true,\n },\n selected: {\n type: Boolean as PropType<NodeViewProps['selected']>,\n required: true,\n },\n extension: {\n type: Object as PropType<NodeViewProps['extension']>,\n required: true,\n },\n getPos: {\n type: Function as PropType<NodeViewProps['getPos']>,\n required: true,\n },\n updateAttributes: {\n type: Function as PropType<NodeViewProps['updateAttributes']>,\n required: true,\n },\n}\n\ninterface VueNodeViewRendererOptions {\n stopEvent: ((event: Event) => boolean) | null,\n update: ((node: ProseMirrorNode, decorations: Decoration[]) => boolean) | null,\n}\n\nclass VueNodeView extends NodeView<Component, Editor> {\n\n renderer!: VueRenderer\n\n decorationClasses!: Ref<string>\n\n mount() {\n const props: NodeViewProps = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations,\n selected: false,\n extension: this.extension,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n }\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 setup: () => {\n provide('onDragStart', onDragStart)\n provide('decorationClasses', this.decorationClasses)\n\n return (this.component as any).setup?.(props)\n },\n })\n\n this.renderer = new VueRenderer(extendedComponent, {\n editor: this.editor,\n props,\n })\n }\n\n get dom() {\n if (!this.renderer.element.hasAttribute('data-node-view-wrapper')) {\n throw Error('Please use the NodeViewWrapper component for your node view.')\n }\n\n return this.renderer.element\n }\n\n get contentDOM() {\n if (this.node.isLeaf) {\n return null\n }\n\n const contentElement = this.dom.querySelector('[data-node-view-content]')\n\n return contentElement || this.dom\n }\n\n update(node: ProseMirrorNode, decorations: Decoration[]) {\n if (typeof this.options.update === 'function') {\n return this.options.update(node, decorations)\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (node === this.node && this.decorations === decorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n this.decorationClasses.value = this.getDecorationClasses()\n this.renderer.updateProps({ node, decorations })\n\n return true\n }\n\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n }\n\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n }\n\n getDecorationClasses() {\n return this.decorations\n // @ts-ignore\n .map(item => item.type.attrs.class)\n .flat()\n .join(' ')\n }\n\n destroy() {\n this.renderer.destroy()\n }\n\n}\n\nexport function VueNodeViewRenderer(component: Component, options?: Partial<VueNodeViewRendererOptions>): NodeViewRenderer {\n return (props: NodeViewRendererProps) => {\n // try to get the parent component\n // this is important for vue devtools to show the component hierarchy correctly\n // maybe it’s `undefined` because <editor-content> isn’t rendered yet\n if (!(props.editor as Editor).contentComponent) {\n return {}\n }\n\n return new VueNodeView(component, props, options) as ProseMirrorNodeView\n }\n}\n","import { h, defineComponent } from 'vue'\n\nexport const NodeViewWrapper = defineComponent({\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n inject: ['onDragStart', 'decorationClasses'],\n\n render() {\n return h(\n this.as, {\n // @ts-ignore\n class: this.decorationClasses.value,\n style: {\n whiteSpace: 'normal',\n },\n 'data-node-view-wrapper': '',\n // @ts-ignore (https://github.com/vuejs/vue-next/issues/3031)\n onDragStart: this.onDragStart,\n },\n this.$slots.default?.(),\n )\n },\n})\n","import { h, defineComponent } from 'vue'\n\nexport const NodeViewContent = defineComponent({\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n render() {\n return h(\n this.as, {\n style: {\n whiteSpace: 'pre-wrap',\n },\n 'data-node-view-content': '',\n },\n )\n },\n})\n"],"names":["defineComponent","ref","onMounted","BubbleMenuPlugin","onBeforeUnmount","BubbleMenuPluginKey","h","customRef","CoreEditor","reactive","markRaw","getCurrentInstance","watchEffect","nextTick","unref","Teleport","FloatingMenuPlugin","FloatingMenuPluginKey","NodeView","provide"],"mappings":";;;;;;;;;MAca,UAAU,GAAGA,mBAAe,CAAC;IACxC,IAAI,EAAE,YAAY;IAElB,KAAK,EAAE;QACL,MAAM,EAAE;YACN,IAAI,EAAE,MA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