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