@tiptap/vue-3 2.6.2 → 3.0.0-next.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.
Files changed (188) hide show
  1. package/dist/index.cjs +541 -465
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +300 -0
  4. package/dist/index.d.ts +300 -0
  5. package/dist/index.js +543 -452
  6. package/dist/index.js.map +1 -1
  7. package/package.json +10 -12
  8. package/src/BubbleMenu.ts +25 -7
  9. package/src/FloatingMenu.ts +17 -5
  10. package/dist/index.umd.js +0 -508
  11. package/dist/index.umd.js.map +0 -1
  12. package/dist/packages/core/src/CommandManager.d.ts +0 -20
  13. package/dist/packages/core/src/Editor.d.ts +0 -163
  14. package/dist/packages/core/src/EventEmitter.d.ts +0 -11
  15. package/dist/packages/core/src/Extension.d.ts +0 -344
  16. package/dist/packages/core/src/ExtensionManager.d.ts +0 -55
  17. package/dist/packages/core/src/InputRule.d.ts +0 -42
  18. package/dist/packages/core/src/Mark.d.ts +0 -452
  19. package/dist/packages/core/src/Node.d.ts +0 -612
  20. package/dist/packages/core/src/NodePos.d.ts +0 -44
  21. package/dist/packages/core/src/NodeView.d.ts +0 -31
  22. package/dist/packages/core/src/PasteRule.d.ts +0 -50
  23. package/dist/packages/core/src/Tracker.d.ts +0 -11
  24. package/dist/packages/core/src/commands/blur.d.ts +0 -13
  25. package/dist/packages/core/src/commands/clearContent.d.ts +0 -14
  26. package/dist/packages/core/src/commands/clearNodes.d.ts +0 -13
  27. package/dist/packages/core/src/commands/command.d.ts +0 -18
  28. package/dist/packages/core/src/commands/createParagraphNear.d.ts +0 -13
  29. package/dist/packages/core/src/commands/cut.d.ts +0 -20
  30. package/dist/packages/core/src/commands/deleteCurrentNode.d.ts +0 -13
  31. package/dist/packages/core/src/commands/deleteNode.d.ts +0 -15
  32. package/dist/packages/core/src/commands/deleteRange.d.ts +0 -14
  33. package/dist/packages/core/src/commands/deleteSelection.d.ts +0 -13
  34. package/dist/packages/core/src/commands/enter.d.ts +0 -13
  35. package/dist/packages/core/src/commands/exitCode.d.ts +0 -13
  36. package/dist/packages/core/src/commands/extendMarkRange.d.ts +0 -25
  37. package/dist/packages/core/src/commands/first.d.ts +0 -14
  38. package/dist/packages/core/src/commands/focus.d.ts +0 -27
  39. package/dist/packages/core/src/commands/forEach.d.ts +0 -14
  40. package/dist/packages/core/src/commands/index.d.ts +0 -55
  41. package/dist/packages/core/src/commands/insertContent.d.ts +0 -34
  42. package/dist/packages/core/src/commands/insertContentAt.d.ts +0 -47
  43. package/dist/packages/core/src/commands/join.d.ts +0 -41
  44. package/dist/packages/core/src/commands/joinItemBackward.d.ts +0 -13
  45. package/dist/packages/core/src/commands/joinItemForward.d.ts +0 -13
  46. package/dist/packages/core/src/commands/joinTextblockBackward.d.ts +0 -12
  47. package/dist/packages/core/src/commands/joinTextblockForward.d.ts +0 -12
  48. package/dist/packages/core/src/commands/keyboardShortcut.d.ts +0 -14
  49. package/dist/packages/core/src/commands/lift.d.ts +0 -17
  50. package/dist/packages/core/src/commands/liftEmptyBlock.d.ts +0 -13
  51. package/dist/packages/core/src/commands/liftListItem.d.ts +0 -15
  52. package/dist/packages/core/src/commands/newlineInCode.d.ts +0 -13
  53. package/dist/packages/core/src/commands/resetAttributes.d.ts +0 -16
  54. package/dist/packages/core/src/commands/scrollIntoView.d.ts +0 -13
  55. package/dist/packages/core/src/commands/selectAll.d.ts +0 -13
  56. package/dist/packages/core/src/commands/selectNodeBackward.d.ts +0 -13
  57. package/dist/packages/core/src/commands/selectNodeForward.d.ts +0 -13
  58. package/dist/packages/core/src/commands/selectParentNode.d.ts +0 -13
  59. package/dist/packages/core/src/commands/selectTextblockEnd.d.ts +0 -13
  60. package/dist/packages/core/src/commands/selectTextblockStart.d.ts +0 -13
  61. package/dist/packages/core/src/commands/setContent.d.ts +0 -40
  62. package/dist/packages/core/src/commands/setMark.d.ts +0 -15
  63. package/dist/packages/core/src/commands/setMeta.d.ts +0 -16
  64. package/dist/packages/core/src/commands/setNode.d.ts +0 -16
  65. package/dist/packages/core/src/commands/setNodeSelection.d.ts +0 -14
  66. package/dist/packages/core/src/commands/setTextSelection.d.ts +0 -14
  67. package/dist/packages/core/src/commands/sinkListItem.d.ts +0 -15
  68. package/dist/packages/core/src/commands/splitBlock.d.ts +0 -17
  69. package/dist/packages/core/src/commands/splitListItem.d.ts +0 -16
  70. package/dist/packages/core/src/commands/toggleList.d.ts +0 -18
  71. package/dist/packages/core/src/commands/toggleMark.d.ts +0 -30
  72. package/dist/packages/core/src/commands/toggleNode.d.ts +0 -17
  73. package/dist/packages/core/src/commands/toggleWrap.d.ts +0 -16
  74. package/dist/packages/core/src/commands/undoInputRule.d.ts +0 -13
  75. package/dist/packages/core/src/commands/unsetAllMarks.d.ts +0 -13
  76. package/dist/packages/core/src/commands/unsetMark.d.ts +0 -25
  77. package/dist/packages/core/src/commands/updateAttributes.d.ts +0 -24
  78. package/dist/packages/core/src/commands/wrapIn.d.ts +0 -16
  79. package/dist/packages/core/src/commands/wrapInList.d.ts +0 -16
  80. package/dist/packages/core/src/extensions/clipboardTextSerializer.d.ts +0 -5
  81. package/dist/packages/core/src/extensions/commands.d.ts +0 -3
  82. package/dist/packages/core/src/extensions/editable.d.ts +0 -2
  83. package/dist/packages/core/src/extensions/focusEvents.d.ts +0 -2
  84. package/dist/packages/core/src/extensions/index.d.ts +0 -6
  85. package/dist/packages/core/src/extensions/keymap.d.ts +0 -2
  86. package/dist/packages/core/src/extensions/tabindex.d.ts +0 -2
  87. package/dist/packages/core/src/helpers/combineTransactionSteps.d.ts +0 -10
  88. package/dist/packages/core/src/helpers/createChainableState.d.ts +0 -10
  89. package/dist/packages/core/src/helpers/createDocument.d.ts +0 -12
  90. package/dist/packages/core/src/helpers/createNodeFromContent.d.ts +0 -15
  91. package/dist/packages/core/src/helpers/defaultBlockAt.d.ts +0 -7
  92. package/dist/packages/core/src/helpers/findChildren.d.ts +0 -9
  93. package/dist/packages/core/src/helpers/findChildrenInRange.d.ts +0 -10
  94. package/dist/packages/core/src/helpers/findParentNode.d.ts +0 -16
  95. package/dist/packages/core/src/helpers/findParentNodeClosestToPos.d.ts +0 -17
  96. package/dist/packages/core/src/helpers/generateHTML.d.ts +0 -8
  97. package/dist/packages/core/src/helpers/generateJSON.d.ts +0 -8
  98. package/dist/packages/core/src/helpers/generateText.d.ts +0 -12
  99. package/dist/packages/core/src/helpers/getAttributes.d.ts +0 -9
  100. package/dist/packages/core/src/helpers/getAttributesFromExtensions.d.ts +0 -6
  101. package/dist/packages/core/src/helpers/getChangedRanges.d.ts +0 -11
  102. package/dist/packages/core/src/helpers/getDebugJSON.d.ts +0 -8
  103. package/dist/packages/core/src/helpers/getExtensionField.d.ts +0 -9
  104. package/dist/packages/core/src/helpers/getHTMLFromFragment.d.ts +0 -2
  105. package/dist/packages/core/src/helpers/getMarkAttributes.d.ts +0 -3
  106. package/dist/packages/core/src/helpers/getMarkRange.d.ts +0 -3
  107. package/dist/packages/core/src/helpers/getMarkType.d.ts +0 -2
  108. package/dist/packages/core/src/helpers/getMarksBetween.d.ts +0 -3
  109. package/dist/packages/core/src/helpers/getNodeAtPosition.d.ts +0 -11
  110. package/dist/packages/core/src/helpers/getNodeAttributes.d.ts +0 -3
  111. package/dist/packages/core/src/helpers/getNodeType.d.ts +0 -2
  112. package/dist/packages/core/src/helpers/getRenderedAttributes.d.ts +0 -3
  113. package/dist/packages/core/src/helpers/getSchema.d.ts +0 -4
  114. package/dist/packages/core/src/helpers/getSchemaByResolvedExtensions.d.ts +0 -10
  115. package/dist/packages/core/src/helpers/getSchemaTypeByName.d.ts +0 -8
  116. package/dist/packages/core/src/helpers/getSchemaTypeNameByName.d.ts +0 -8
  117. package/dist/packages/core/src/helpers/getSplittedAttributes.d.ts +0 -9
  118. package/dist/packages/core/src/helpers/getText.d.ts +0 -15
  119. package/dist/packages/core/src/helpers/getTextBetween.d.ts +0 -14
  120. package/dist/packages/core/src/helpers/getTextContentFromNodes.d.ts +0 -8
  121. package/dist/packages/core/src/helpers/getTextSerializersFromSchema.d.ts +0 -8
  122. package/dist/packages/core/src/helpers/index.d.ts +0 -50
  123. package/dist/packages/core/src/helpers/injectExtensionAttributesToParseRule.d.ts +0 -9
  124. package/dist/packages/core/src/helpers/isActive.d.ts +0 -2
  125. package/dist/packages/core/src/helpers/isAtEndOfNode.d.ts +0 -2
  126. package/dist/packages/core/src/helpers/isAtStartOfNode.d.ts +0 -2
  127. package/dist/packages/core/src/helpers/isExtensionRulesEnabled.d.ts +0 -2
  128. package/dist/packages/core/src/helpers/isList.d.ts +0 -2
  129. package/dist/packages/core/src/helpers/isMarkActive.d.ts +0 -3
  130. package/dist/packages/core/src/helpers/isNodeActive.d.ts +0 -3
  131. package/dist/packages/core/src/helpers/isNodeEmpty.d.ts +0 -14
  132. package/dist/packages/core/src/helpers/isNodeSelection.d.ts +0 -2
  133. package/dist/packages/core/src/helpers/isTextSelection.d.ts +0 -2
  134. package/dist/packages/core/src/helpers/posToDOMRect.d.ts +0 -2
  135. package/dist/packages/core/src/helpers/resolveFocusPosition.d.ts +0 -4
  136. package/dist/packages/core/src/helpers/selectionToInsertionEnd.d.ts +0 -2
  137. package/dist/packages/core/src/helpers/splitExtensions.d.ts +0 -9
  138. package/dist/packages/core/src/index.d.ts +0 -24
  139. package/dist/packages/core/src/inputRules/index.d.ts +0 -5
  140. package/dist/packages/core/src/inputRules/markInputRule.d.ts +0 -13
  141. package/dist/packages/core/src/inputRules/nodeInputRule.d.ts +0 -23
  142. package/dist/packages/core/src/inputRules/textInputRule.d.ts +0 -10
  143. package/dist/packages/core/src/inputRules/textblockTypeInputRule.d.ts +0 -15
  144. package/dist/packages/core/src/inputRules/wrappingInputRule.d.ts +0 -28
  145. package/dist/packages/core/src/pasteRules/index.d.ts +0 -3
  146. package/dist/packages/core/src/pasteRules/markPasteRule.d.ts +0 -13
  147. package/dist/packages/core/src/pasteRules/nodePasteRule.d.ts +0 -14
  148. package/dist/packages/core/src/pasteRules/textPasteRule.d.ts +0 -10
  149. package/dist/packages/core/src/style.d.ts +0 -1
  150. package/dist/packages/core/src/types.d.ts +0 -253
  151. package/dist/packages/core/src/utilities/callOrReturn.d.ts +0 -9
  152. package/dist/packages/core/src/utilities/createStyleTag.d.ts +0 -1
  153. package/dist/packages/core/src/utilities/deleteProps.d.ts +0 -6
  154. package/dist/packages/core/src/utilities/elementFromString.d.ts +0 -1
  155. package/dist/packages/core/src/utilities/escapeForRegEx.d.ts +0 -1
  156. package/dist/packages/core/src/utilities/findDuplicates.d.ts +0 -1
  157. package/dist/packages/core/src/utilities/fromString.d.ts +0 -1
  158. package/dist/packages/core/src/utilities/index.d.ts +0 -20
  159. package/dist/packages/core/src/utilities/isAndroid.d.ts +0 -1
  160. package/dist/packages/core/src/utilities/isEmptyObject.d.ts +0 -1
  161. package/dist/packages/core/src/utilities/isFunction.d.ts +0 -1
  162. package/dist/packages/core/src/utilities/isMacOS.d.ts +0 -1
  163. package/dist/packages/core/src/utilities/isNumber.d.ts +0 -1
  164. package/dist/packages/core/src/utilities/isPlainObject.d.ts +0 -1
  165. package/dist/packages/core/src/utilities/isRegExp.d.ts +0 -1
  166. package/dist/packages/core/src/utilities/isString.d.ts +0 -1
  167. package/dist/packages/core/src/utilities/isiOS.d.ts +0 -1
  168. package/dist/packages/core/src/utilities/mergeAttributes.d.ts +0 -1
  169. package/dist/packages/core/src/utilities/mergeDeep.d.ts +0 -1
  170. package/dist/packages/core/src/utilities/minMax.d.ts +0 -1
  171. package/dist/packages/core/src/utilities/objectIncludes.d.ts +0 -8
  172. package/dist/packages/core/src/utilities/removeDuplicates.d.ts +0 -8
  173. package/dist/packages/extension-bubble-menu/src/bubble-menu-plugin.d.ts +0 -76
  174. package/dist/packages/extension-bubble-menu/src/bubble-menu.d.ts +0 -15
  175. package/dist/packages/extension-bubble-menu/src/index.d.ts +0 -4
  176. package/dist/packages/extension-floating-menu/src/floating-menu-plugin.d.ts +0 -66
  177. package/dist/packages/extension-floating-menu/src/floating-menu.d.ts +0 -15
  178. package/dist/packages/extension-floating-menu/src/index.d.ts +0 -4
  179. package/dist/packages/vue-3/src/BubbleMenu.d.ts +0 -59
  180. package/dist/packages/vue-3/src/Editor.d.ts +0 -23
  181. package/dist/packages/vue-3/src/EditorContent.d.ts +0 -17
  182. package/dist/packages/vue-3/src/FloatingMenu.d.ts +0 -48
  183. package/dist/packages/vue-3/src/NodeViewContent.d.ts +0 -13
  184. package/dist/packages/vue-3/src/NodeViewWrapper.d.ts +0 -13
  185. package/dist/packages/vue-3/src/VueNodeViewRenderer.d.ts +0 -48
  186. package/dist/packages/vue-3/src/VueRenderer.d.ts +0 -36
  187. package/dist/packages/vue-3/src/index.d.ts +0 -10
  188. package/dist/packages/vue-3/src/useEditor.d.ts +0 -3
package/dist/index.cjs CHANGED
@@ -1,507 +1,583 @@
1
- 'use strict';
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
2
20
 
3
- var extensionBubbleMenu = require('@tiptap/extension-bubble-menu');
4
- var vue = require('vue');
5
- var core = require('@tiptap/core');
6
- var extensionFloatingMenu = require('@tiptap/extension-floating-menu');
21
+ // src/index.ts
22
+ var src_exports = {};
23
+ __export(src_exports, {
24
+ BubbleMenu: () => BubbleMenu,
25
+ Editor: () => Editor,
26
+ EditorContent: () => EditorContent,
27
+ FloatingMenu: () => FloatingMenu,
28
+ NodeViewContent: () => NodeViewContent,
29
+ NodeViewWrapper: () => NodeViewWrapper,
30
+ VueNodeViewRenderer: () => VueNodeViewRenderer,
31
+ VueRenderer: () => VueRenderer,
32
+ nodeViewProps: () => nodeViewProps,
33
+ useEditor: () => useEditor
34
+ });
35
+ module.exports = __toCommonJS(src_exports);
7
36
 
8
- const BubbleMenu = vue.defineComponent({
9
- name: 'BubbleMenu',
10
- props: {
11
- pluginKey: {
12
- type: [String, Object],
13
- default: 'bubbleMenu',
14
- },
15
- editor: {
16
- type: Object,
17
- required: true,
18
- },
19
- updateDelay: {
20
- type: Number,
21
- default: undefined,
22
- },
23
- tippyOptions: {
24
- type: Object,
25
- default: () => ({}),
26
- },
27
- shouldShow: {
28
- type: Function,
29
- default: null,
30
- },
37
+ // src/BubbleMenu.ts
38
+ var import_extension_bubble_menu = require("@tiptap/extension-bubble-menu");
39
+ var import_vue = require("vue");
40
+ var BubbleMenu = (0, import_vue.defineComponent)({
41
+ name: "BubbleMenu",
42
+ props: {
43
+ pluginKey: {
44
+ type: [String, Object],
45
+ default: "bubbleMenu"
31
46
  },
32
- setup(props, { slots }) {
33
- const root = vue.ref(null);
34
- vue.onMounted(() => {
35
- const { updateDelay, editor, pluginKey, shouldShow, tippyOptions, } = props;
36
- editor.registerPlugin(extensionBubbleMenu.BubbleMenuPlugin({
37
- updateDelay,
38
- editor,
39
- element: root.value,
40
- pluginKey,
41
- shouldShow,
42
- tippyOptions,
43
- }));
44
- });
45
- vue.onBeforeUnmount(() => {
46
- const { pluginKey, editor } = props;
47
- editor.unregisterPlugin(pluginKey);
48
- });
49
- return () => { var _a; return vue.h('div', { ref: root }, (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)); };
47
+ editor: {
48
+ type: Object,
49
+ required: true
50
+ },
51
+ updateDelay: {
52
+ type: Number,
53
+ default: void 0
54
+ },
55
+ resizeDelay: {
56
+ type: Number,
57
+ default: void 0
58
+ },
59
+ options: {
60
+ type: Object,
61
+ default: () => ({})
50
62
  },
63
+ shouldShow: {
64
+ type: Function,
65
+ default: null
66
+ }
67
+ },
68
+ setup(props, { slots }) {
69
+ const root = (0, import_vue.ref)(null);
70
+ (0, import_vue.onMounted)(() => {
71
+ const {
72
+ editor,
73
+ options,
74
+ pluginKey,
75
+ resizeDelay,
76
+ shouldShow,
77
+ updateDelay
78
+ } = props;
79
+ if (!root.value) {
80
+ return;
81
+ }
82
+ root.value.style.visibility = "hidden";
83
+ root.value.style.position = "absolute";
84
+ root.value.remove();
85
+ editor.registerPlugin((0, import_extension_bubble_menu.BubbleMenuPlugin)({
86
+ editor,
87
+ element: root.value,
88
+ options,
89
+ pluginKey,
90
+ resizeDelay,
91
+ shouldShow,
92
+ updateDelay
93
+ }));
94
+ });
95
+ (0, import_vue.onBeforeUnmount)(() => {
96
+ const { pluginKey, editor } = props;
97
+ editor.unregisterPlugin(pluginKey);
98
+ });
99
+ return () => {
100
+ var _a;
101
+ return (0, import_vue.h)(import_vue.Teleport, { to: "body" }, (0, import_vue.h)("div", { ref: root }, (_a = slots.default) == null ? void 0 : _a.call(slots)));
102
+ };
103
+ }
51
104
  });
52
105
 
53
- /* eslint-disable react-hooks/rules-of-hooks */
106
+ // src/Editor.ts
107
+ var import_core = require("@tiptap/core");
108
+ var import_vue2 = require("vue");
54
109
  function useDebouncedRef(value) {
55
- return vue.customRef((track, trigger) => {
56
- return {
57
- get() {
58
- track();
59
- return value;
60
- },
61
- set(newValue) {
62
- // update state
63
- value = newValue;
64
- // update view as soon as possible
65
- requestAnimationFrame(() => {
66
- requestAnimationFrame(() => {
67
- trigger();
68
- });
69
- });
70
- },
71
- };
72
- });
73
- }
74
- class Editor extends core.Editor {
75
- constructor(options = {}) {
76
- super(options);
77
- this.contentComponent = null;
78
- this.appContext = null;
79
- this.reactiveState = useDebouncedRef(this.view.state);
80
- this.reactiveExtensionStorage = useDebouncedRef(this.extensionStorage);
81
- this.on('beforeTransaction', ({ nextState }) => {
82
- this.reactiveState.value = nextState;
83
- this.reactiveExtensionStorage.value = this.extensionStorage;
110
+ return (0, import_vue2.customRef)((track, trigger) => {
111
+ return {
112
+ get() {
113
+ track();
114
+ return value;
115
+ },
116
+ set(newValue) {
117
+ value = newValue;
118
+ requestAnimationFrame(() => {
119
+ requestAnimationFrame(() => {
120
+ trigger();
121
+ });
84
122
  });
85
- return vue.markRaw(this); // eslint-disable-line
86
- }
87
- get state() {
88
- return this.reactiveState ? this.reactiveState.value : this.view.state;
89
- }
90
- get storage() {
91
- return this.reactiveExtensionStorage ? this.reactiveExtensionStorage.value : super.storage;
92
- }
93
- /**
94
- * Register a ProseMirror plugin.
95
- */
96
- registerPlugin(plugin, handlePlugins) {
97
- super.registerPlugin(plugin, handlePlugins);
98
- this.reactiveState.value = this.view.state;
99
- }
100
- /**
101
- * Unregister a ProseMirror plugin.
102
- */
103
- unregisterPlugin(nameOrPluginKey) {
104
- super.unregisterPlugin(nameOrPluginKey);
105
- this.reactiveState.value = this.view.state;
106
- }
123
+ }
124
+ };
125
+ });
107
126
  }
127
+ var Editor = class extends import_core.Editor {
128
+ constructor(options = {}) {
129
+ super(options);
130
+ this.contentComponent = null;
131
+ this.appContext = null;
132
+ this.reactiveState = useDebouncedRef(this.view.state);
133
+ this.reactiveExtensionStorage = useDebouncedRef(this.extensionStorage);
134
+ this.on("beforeTransaction", ({ nextState }) => {
135
+ this.reactiveState.value = nextState;
136
+ this.reactiveExtensionStorage.value = this.extensionStorage;
137
+ });
138
+ return (0, import_vue2.markRaw)(this);
139
+ }
140
+ get state() {
141
+ return this.reactiveState ? this.reactiveState.value : this.view.state;
142
+ }
143
+ get storage() {
144
+ return this.reactiveExtensionStorage ? this.reactiveExtensionStorage.value : super.storage;
145
+ }
146
+ /**
147
+ * Register a ProseMirror plugin.
148
+ */
149
+ registerPlugin(plugin, handlePlugins) {
150
+ super.registerPlugin(plugin, handlePlugins);
151
+ this.reactiveState.value = this.view.state;
152
+ }
153
+ /**
154
+ * Unregister a ProseMirror plugin.
155
+ */
156
+ unregisterPlugin(nameOrPluginKey) {
157
+ super.unregisterPlugin(nameOrPluginKey);
158
+ this.reactiveState.value = this.view.state;
159
+ }
160
+ };
108
161
 
109
- const EditorContent = vue.defineComponent({
110
- name: 'EditorContent',
111
- props: {
112
- editor: {
113
- default: null,
114
- type: Object,
115
- },
116
- },
117
- setup(props) {
118
- const rootEl = vue.ref();
119
- const instance = vue.getCurrentInstance();
120
- vue.watchEffect(() => {
121
- const editor = props.editor;
122
- if (editor && editor.options.element && rootEl.value) {
123
- vue.nextTick(() => {
124
- if (!rootEl.value || !editor.options.element.firstChild) {
125
- return;
126
- }
127
- const element = vue.unref(rootEl.value);
128
- rootEl.value.append(...editor.options.element.childNodes);
129
- // @ts-ignore
130
- editor.contentComponent = instance.ctx._;
131
- if (instance) {
132
- editor.appContext = {
133
- ...instance.appContext,
134
- // Vue internally uses prototype chain to forward/shadow injects across the entire component chain
135
- // so don't use object spread operator or 'Object.assign' and just set `provides` as is on editor's appContext
136
- // @ts-expect-error forward instance's 'provides' into appContext
137
- provides: instance.provides,
138
- };
139
- }
140
- editor.setOptions({
141
- element,
142
- });
143
- editor.createNodeViews();
144
- });
145
- }
146
- });
147
- vue.onBeforeUnmount(() => {
148
- const editor = props.editor;
149
- if (!editor) {
150
- return;
151
- }
152
- // destroy nodeviews before vue removes dom element
153
- if (!editor.isDestroyed) {
154
- editor.view.setProps({
155
- nodeViews: {},
156
- });
157
- }
158
- editor.contentComponent = null;
159
- editor.appContext = null;
160
- if (!editor.options.element.firstChild) {
161
- return;
162
- }
163
- const newElement = document.createElement('div');
164
- newElement.append(...editor.options.element.childNodes);
165
- editor.setOptions({
166
- element: newElement,
167
- });
162
+ // src/EditorContent.ts
163
+ var import_vue3 = require("vue");
164
+ var EditorContent = (0, import_vue3.defineComponent)({
165
+ name: "EditorContent",
166
+ props: {
167
+ editor: {
168
+ default: null,
169
+ type: Object
170
+ }
171
+ },
172
+ setup(props) {
173
+ const rootEl = (0, import_vue3.ref)();
174
+ const instance = (0, import_vue3.getCurrentInstance)();
175
+ (0, import_vue3.watchEffect)(() => {
176
+ const editor = props.editor;
177
+ if (editor && editor.options.element && rootEl.value) {
178
+ (0, import_vue3.nextTick)(() => {
179
+ if (!rootEl.value || !editor.options.element.firstChild) {
180
+ return;
181
+ }
182
+ const element = (0, import_vue3.unref)(rootEl.value);
183
+ rootEl.value.append(...editor.options.element.childNodes);
184
+ editor.contentComponent = instance.ctx._;
185
+ if (instance) {
186
+ editor.appContext = {
187
+ ...instance.appContext,
188
+ // Vue internally uses prototype chain to forward/shadow injects across the entire component chain
189
+ // so don't use object spread operator or 'Object.assign' and just set `provides` as is on editor's appContext
190
+ // @ts-expect-error forward instance's 'provides' into appContext
191
+ provides: instance.provides
192
+ };
193
+ }
194
+ editor.setOptions({
195
+ element
196
+ });
197
+ editor.createNodeViews();
168
198
  });
169
- return { rootEl };
170
- },
171
- render() {
172
- return vue.h('div', {
173
- ref: (el) => { this.rootEl = el; },
199
+ }
200
+ });
201
+ (0, import_vue3.onBeforeUnmount)(() => {
202
+ const editor = props.editor;
203
+ if (!editor) {
204
+ return;
205
+ }
206
+ if (!editor.isDestroyed) {
207
+ editor.view.setProps({
208
+ nodeViews: {}
174
209
  });
175
- },
210
+ }
211
+ editor.contentComponent = null;
212
+ editor.appContext = null;
213
+ if (!editor.options.element.firstChild) {
214
+ return;
215
+ }
216
+ const newElement = document.createElement("div");
217
+ newElement.append(...editor.options.element.childNodes);
218
+ editor.setOptions({
219
+ element: newElement
220
+ });
221
+ });
222
+ return { rootEl };
223
+ },
224
+ render() {
225
+ return (0, import_vue3.h)(
226
+ "div",
227
+ {
228
+ ref: (el) => {
229
+ this.rootEl = el;
230
+ }
231
+ }
232
+ );
233
+ }
176
234
  });
177
235
 
178
- const FloatingMenu = vue.defineComponent({
179
- name: 'FloatingMenu',
180
- props: {
181
- pluginKey: {
182
- // TODO: TypeScript breaks :(
183
- // type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],
184
- type: null,
185
- default: 'floatingMenu',
186
- },
187
- editor: {
188
- type: Object,
189
- required: true,
190
- },
191
- tippyOptions: {
192
- type: Object,
193
- default: () => ({}),
194
- },
195
- shouldShow: {
196
- type: Function,
197
- default: null,
198
- },
236
+ // src/FloatingMenu.ts
237
+ var import_extension_floating_menu = require("@tiptap/extension-floating-menu");
238
+ var import_vue4 = require("vue");
239
+ var FloatingMenu = (0, import_vue4.defineComponent)({
240
+ name: "FloatingMenu",
241
+ props: {
242
+ pluginKey: {
243
+ // TODO: TypeScript breaks :(
244
+ // type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],
245
+ type: null,
246
+ default: "floatingMenu"
199
247
  },
200
- setup(props, { slots }) {
201
- const root = vue.ref(null);
202
- vue.onMounted(() => {
203
- const { pluginKey, editor, tippyOptions, shouldShow, } = props;
204
- editor.registerPlugin(extensionFloatingMenu.FloatingMenuPlugin({
205
- pluginKey,
206
- editor,
207
- element: root.value,
208
- tippyOptions,
209
- shouldShow,
210
- }));
211
- });
212
- vue.onBeforeUnmount(() => {
213
- const { pluginKey, editor } = props;
214
- editor.unregisterPlugin(pluginKey);
215
- });
216
- return () => { var _a; return vue.h('div', { ref: root }, (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)); };
248
+ editor: {
249
+ type: Object,
250
+ required: true
217
251
  },
252
+ options: {
253
+ type: Object,
254
+ default: () => ({})
255
+ },
256
+ shouldShow: {
257
+ type: Function,
258
+ default: null
259
+ }
260
+ },
261
+ setup(props, { slots }) {
262
+ const root = (0, import_vue4.ref)(null);
263
+ (0, import_vue4.onMounted)(() => {
264
+ const {
265
+ pluginKey,
266
+ editor,
267
+ options,
268
+ shouldShow
269
+ } = props;
270
+ if (!root.value) {
271
+ return;
272
+ }
273
+ root.value.style.visibility = "hidden";
274
+ root.value.style.position = "absolute";
275
+ root.value.remove();
276
+ editor.registerPlugin((0, import_extension_floating_menu.FloatingMenuPlugin)({
277
+ pluginKey,
278
+ editor,
279
+ element: root.value,
280
+ options,
281
+ shouldShow
282
+ }));
283
+ });
284
+ (0, import_vue4.onBeforeUnmount)(() => {
285
+ const { pluginKey, editor } = props;
286
+ editor.unregisterPlugin(pluginKey);
287
+ });
288
+ return () => {
289
+ var _a;
290
+ return (0, import_vue4.h)(import_vue4.Teleport, { to: "body" }, (0, import_vue4.h)("div", { ref: root }, (_a = slots.default) == null ? void 0 : _a.call(slots)));
291
+ };
292
+ }
218
293
  });
219
294
 
220
- const NodeViewContent = vue.defineComponent({
221
- name: 'NodeViewContent',
222
- props: {
223
- as: {
224
- type: String,
225
- default: 'div',
226
- },
227
- },
228
- render() {
229
- return vue.h(this.as, {
230
- style: {
231
- whiteSpace: 'pre-wrap',
232
- },
233
- 'data-node-view-content': '',
234
- });
235
- },
295
+ // src/NodeViewContent.ts
296
+ var import_vue5 = require("vue");
297
+ var NodeViewContent = (0, import_vue5.defineComponent)({
298
+ name: "NodeViewContent",
299
+ props: {
300
+ as: {
301
+ type: String,
302
+ default: "div"
303
+ }
304
+ },
305
+ render() {
306
+ return (0, import_vue5.h)(this.as, {
307
+ style: {
308
+ whiteSpace: "pre-wrap"
309
+ },
310
+ "data-node-view-content": ""
311
+ });
312
+ }
236
313
  });
237
314
 
238
- const NodeViewWrapper = vue.defineComponent({
239
- name: 'NodeViewWrapper',
240
- props: {
241
- as: {
242
- type: String,
243
- default: 'div',
315
+ // src/NodeViewWrapper.ts
316
+ var import_vue6 = require("vue");
317
+ var NodeViewWrapper = (0, import_vue6.defineComponent)({
318
+ name: "NodeViewWrapper",
319
+ props: {
320
+ as: {
321
+ type: String,
322
+ default: "div"
323
+ }
324
+ },
325
+ inject: ["onDragStart", "decorationClasses"],
326
+ render() {
327
+ var _a, _b;
328
+ return (0, import_vue6.h)(
329
+ this.as,
330
+ {
331
+ // @ts-ignore
332
+ class: this.decorationClasses,
333
+ style: {
334
+ whiteSpace: "normal"
244
335
  },
245
- },
246
- inject: ['onDragStart', 'decorationClasses'],
247
- render() {
248
- var _a, _b;
249
- return vue.h(this.as, {
250
- // @ts-ignore
251
- class: this.decorationClasses,
252
- style: {
253
- whiteSpace: 'normal',
254
- },
255
- 'data-node-view-wrapper': '',
256
- // @ts-ignore (https://github.com/vuejs/vue-next/issues/3031)
257
- onDragstart: this.onDragStart,
258
- }, (_b = (_a = this.$slots).default) === null || _b === void 0 ? void 0 : _b.call(_a));
259
- },
336
+ "data-node-view-wrapper": "",
337
+ // @ts-ignore (https://github.com/vuejs/vue-next/issues/3031)
338
+ onDragstart: this.onDragStart
339
+ },
340
+ (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)
341
+ );
342
+ }
260
343
  });
261
344
 
262
- const useEditor = (options = {}) => {
263
- const editor = vue.shallowRef();
264
- vue.onMounted(() => {
265
- editor.value = new Editor(options);
266
- });
267
- vue.onBeforeUnmount(() => {
268
- var _a;
269
- (_a = editor.value) === null || _a === void 0 ? void 0 : _a.destroy();
270
- });
271
- return editor;
345
+ // src/useEditor.ts
346
+ var import_vue7 = require("vue");
347
+ var useEditor = (options = {}) => {
348
+ const editor = (0, import_vue7.shallowRef)();
349
+ (0, import_vue7.onMounted)(() => {
350
+ editor.value = new Editor(options);
351
+ });
352
+ (0, import_vue7.onBeforeUnmount)(() => {
353
+ var _a;
354
+ (_a = editor.value) == null ? void 0 : _a.destroy();
355
+ });
356
+ return editor;
272
357
  };
273
358
 
274
- /**
275
- * This class is used to render Vue components inside the editor.
276
- */
277
- class VueRenderer {
278
- constructor(component, { props = {}, editor }) {
279
- this.editor = editor;
280
- this.component = vue.markRaw(component);
281
- this.el = document.createElement('div');
282
- this.props = vue.reactive(props);
283
- this.renderedComponent = this.renderComponent();
284
- }
285
- get element() {
286
- return this.renderedComponent.el;
287
- }
288
- get ref() {
289
- var _a, _b, _c, _d;
290
- // Composition API
291
- if ((_b = (_a = this.renderedComponent.vNode) === null || _a === void 0 ? void 0 : _a.component) === null || _b === void 0 ? void 0 : _b.exposed) {
292
- return this.renderedComponent.vNode.component.exposed;
293
- }
294
- // Option API
295
- return (_d = (_c = this.renderedComponent.vNode) === null || _c === void 0 ? void 0 : _c.component) === null || _d === void 0 ? void 0 : _d.proxy;
296
- }
297
- renderComponent() {
298
- let vNode = vue.h(this.component, this.props);
299
- if (this.editor.appContext) {
300
- vNode.appContext = this.editor.appContext;
301
- }
302
- if (typeof document !== 'undefined' && this.el) {
303
- vue.render(vNode, this.el);
304
- }
305
- const destroy = () => {
306
- if (this.el) {
307
- vue.render(null, this.el);
308
- }
309
- this.el = null;
310
- vNode = null;
311
- };
312
- return { vNode, destroy, el: this.el ? this.el.firstElementChild : null };
359
+ // src/VueNodeViewRenderer.ts
360
+ var import_core2 = require("@tiptap/core");
361
+ var import_vue9 = require("vue");
362
+
363
+ // src/VueRenderer.ts
364
+ var import_vue8 = require("vue");
365
+ var VueRenderer = class {
366
+ constructor(component, { props = {}, editor }) {
367
+ this.editor = editor;
368
+ this.component = (0, import_vue8.markRaw)(component);
369
+ this.el = document.createElement("div");
370
+ this.props = (0, import_vue8.reactive)(props);
371
+ this.renderedComponent = this.renderComponent();
372
+ }
373
+ get element() {
374
+ return this.renderedComponent.el;
375
+ }
376
+ get ref() {
377
+ var _a, _b, _c, _d;
378
+ if ((_b = (_a = this.renderedComponent.vNode) == null ? void 0 : _a.component) == null ? void 0 : _b.exposed) {
379
+ return this.renderedComponent.vNode.component.exposed;
313
380
  }
314
- updateProps(props = {}) {
315
- Object.entries(props).forEach(([key, value]) => {
316
- this.props[key] = value;
317
- });
318
- this.renderComponent();
381
+ return (_d = (_c = this.renderedComponent.vNode) == null ? void 0 : _c.component) == null ? void 0 : _d.proxy;
382
+ }
383
+ renderComponent() {
384
+ let vNode = (0, import_vue8.h)(this.component, this.props);
385
+ if (this.editor.appContext) {
386
+ vNode.appContext = this.editor.appContext;
319
387
  }
320
- destroy() {
321
- this.renderedComponent.destroy();
388
+ if (typeof document !== "undefined" && this.el) {
389
+ (0, import_vue8.render)(vNode, this.el);
322
390
  }
323
- }
391
+ const destroy = () => {
392
+ if (this.el) {
393
+ (0, import_vue8.render)(null, this.el);
394
+ }
395
+ this.el = null;
396
+ vNode = null;
397
+ };
398
+ return { vNode, destroy, el: this.el ? this.el.firstElementChild : null };
399
+ }
400
+ updateProps(props = {}) {
401
+ Object.entries(props).forEach(([key, value]) => {
402
+ this.props[key] = value;
403
+ });
404
+ this.renderComponent();
405
+ }
406
+ destroy() {
407
+ this.renderedComponent.destroy();
408
+ }
409
+ };
324
410
 
325
- const nodeViewProps = {
326
- editor: {
327
- type: Object,
328
- required: true,
329
- },
330
- node: {
331
- type: Object,
332
- required: true,
333
- },
334
- decorations: {
335
- type: Object,
336
- required: true,
337
- },
338
- selected: {
339
- type: Boolean,
340
- required: true,
341
- },
342
- extension: {
343
- type: Object,
344
- required: true,
345
- },
346
- getPos: {
347
- type: Function,
348
- required: true,
349
- },
350
- updateAttributes: {
351
- type: Function,
352
- required: true,
353
- },
354
- deleteNode: {
355
- type: Function,
356
- required: true,
357
- },
411
+ // src/VueNodeViewRenderer.ts
412
+ var nodeViewProps = {
413
+ editor: {
414
+ type: Object,
415
+ required: true
416
+ },
417
+ node: {
418
+ type: Object,
419
+ required: true
420
+ },
421
+ decorations: {
422
+ type: Object,
423
+ required: true
424
+ },
425
+ selected: {
426
+ type: Boolean,
427
+ required: true
428
+ },
429
+ extension: {
430
+ type: Object,
431
+ required: true
432
+ },
433
+ getPos: {
434
+ type: Function,
435
+ required: true
436
+ },
437
+ updateAttributes: {
438
+ type: Function,
439
+ required: true
440
+ },
441
+ deleteNode: {
442
+ type: Function,
443
+ required: true
444
+ }
358
445
  };
359
- class VueNodeView extends core.NodeView {
360
- mount() {
361
- const props = {
362
- editor: this.editor,
363
- node: this.node,
364
- decorations: this.decorations,
365
- selected: false,
366
- extension: this.extension,
367
- getPos: () => this.getPos(),
368
- updateAttributes: (attributes = {}) => this.updateAttributes(attributes),
369
- deleteNode: () => this.deleteNode(),
370
- };
371
- const onDragStart = this.onDragStart.bind(this);
372
- this.decorationClasses = vue.ref(this.getDecorationClasses());
373
- const extendedComponent = vue.defineComponent({
374
- extends: { ...this.component },
375
- props: Object.keys(props),
376
- template: this.component.template,
377
- setup: reactiveProps => {
378
- var _a, _b;
379
- vue.provide('onDragStart', onDragStart);
380
- vue.provide('decorationClasses', this.decorationClasses);
381
- return (_b = (_a = this.component).setup) === null || _b === void 0 ? void 0 : _b.call(_a, reactiveProps, {
382
- expose: () => undefined,
383
- });
384
- },
385
- // add support for scoped styles
386
- // @ts-ignore
387
- // eslint-disable-next-line
388
- __scopeId: this.component.__scopeId,
389
- // add support for CSS Modules
390
- // @ts-ignore
391
- // eslint-disable-next-line
392
- __cssModules: this.component.__cssModules,
393
- // add support for vue devtools
394
- // @ts-ignore
395
- // eslint-disable-next-line
396
- __name: this.component.__name,
397
- // @ts-ignore
398
- // eslint-disable-next-line
399
- __file: this.component.__file,
400
- });
401
- this.renderer = new VueRenderer(extendedComponent, {
402
- editor: this.editor,
403
- props,
446
+ var VueNodeView = class extends import_core2.NodeView {
447
+ mount() {
448
+ const props = {
449
+ editor: this.editor,
450
+ node: this.node,
451
+ decorations: this.decorations,
452
+ selected: false,
453
+ extension: this.extension,
454
+ getPos: () => this.getPos(),
455
+ updateAttributes: (attributes = {}) => this.updateAttributes(attributes),
456
+ deleteNode: () => this.deleteNode()
457
+ };
458
+ const onDragStart = this.onDragStart.bind(this);
459
+ this.decorationClasses = (0, import_vue9.ref)(this.getDecorationClasses());
460
+ const extendedComponent = (0, import_vue9.defineComponent)({
461
+ extends: { ...this.component },
462
+ props: Object.keys(props),
463
+ template: this.component.template,
464
+ setup: (reactiveProps) => {
465
+ var _a, _b;
466
+ (0, import_vue9.provide)("onDragStart", onDragStart);
467
+ (0, import_vue9.provide)("decorationClasses", this.decorationClasses);
468
+ return (_b = (_a = this.component).setup) == null ? void 0 : _b.call(_a, reactiveProps, {
469
+ expose: () => void 0
404
470
  });
471
+ },
472
+ // add support for scoped styles
473
+ // @ts-ignore
474
+ // eslint-disable-next-line
475
+ __scopeId: this.component.__scopeId,
476
+ // add support for CSS Modules
477
+ // @ts-ignore
478
+ // eslint-disable-next-line
479
+ __cssModules: this.component.__cssModules,
480
+ // add support for vue devtools
481
+ // @ts-ignore
482
+ // eslint-disable-next-line
483
+ __name: this.component.__name,
484
+ // @ts-ignore
485
+ // eslint-disable-next-line
486
+ __file: this.component.__file
487
+ });
488
+ this.renderer = new VueRenderer(extendedComponent, {
489
+ editor: this.editor,
490
+ props
491
+ });
492
+ }
493
+ get dom() {
494
+ if (!this.renderer.element || !this.renderer.element.hasAttribute("data-node-view-wrapper")) {
495
+ throw Error("Please use the NodeViewWrapper component for your node view.");
405
496
  }
406
- get dom() {
407
- if (!this.renderer.element || !this.renderer.element.hasAttribute('data-node-view-wrapper')) {
408
- throw Error('Please use the NodeViewWrapper component for your node view.');
409
- }
410
- return this.renderer.element;
411
- }
412
- get contentDOM() {
413
- if (this.node.isLeaf) {
414
- return null;
415
- }
416
- return this.dom.querySelector('[data-node-view-content]');
497
+ return this.renderer.element;
498
+ }
499
+ get contentDOM() {
500
+ if (this.node.isLeaf) {
501
+ return null;
417
502
  }
418
- update(node, decorations) {
419
- const updateProps = (props) => {
420
- this.decorationClasses.value = this.getDecorationClasses();
421
- this.renderer.updateProps(props);
422
- };
423
- if (typeof this.options.update === 'function') {
424
- const oldNode = this.node;
425
- const oldDecorations = this.decorations;
426
- this.node = node;
427
- this.decorations = decorations;
428
- return this.options.update({
429
- oldNode,
430
- oldDecorations,
431
- newNode: node,
432
- newDecorations: decorations,
433
- updateProps: () => updateProps({ node, decorations }),
434
- });
435
- }
436
- if (node.type !== this.node.type) {
437
- return false;
438
- }
439
- if (node === this.node && this.decorations === decorations) {
440
- return true;
441
- }
442
- this.node = node;
443
- this.decorations = decorations;
444
- updateProps({ node, decorations });
445
- return true;
503
+ return this.dom.querySelector("[data-node-view-content]");
504
+ }
505
+ update(node, decorations) {
506
+ const updateProps = (props) => {
507
+ this.decorationClasses.value = this.getDecorationClasses();
508
+ this.renderer.updateProps(props);
509
+ };
510
+ if (typeof this.options.update === "function") {
511
+ const oldNode = this.node;
512
+ const oldDecorations = this.decorations;
513
+ this.node = node;
514
+ this.decorations = decorations;
515
+ return this.options.update({
516
+ oldNode,
517
+ oldDecorations,
518
+ newNode: node,
519
+ newDecorations: decorations,
520
+ updateProps: () => updateProps({ node, decorations })
521
+ });
446
522
  }
447
- selectNode() {
448
- this.renderer.updateProps({
449
- selected: true,
450
- });
451
- if (this.renderer.element) {
452
- this.renderer.element.classList.add('ProseMirror-selectednode');
453
- }
523
+ if (node.type !== this.node.type) {
524
+ return false;
454
525
  }
455
- deselectNode() {
456
- this.renderer.updateProps({
457
- selected: false,
458
- });
459
- if (this.renderer.element) {
460
- this.renderer.element.classList.remove('ProseMirror-selectednode');
461
- }
526
+ if (node === this.node && this.decorations === decorations) {
527
+ return true;
462
528
  }
463
- getDecorationClasses() {
464
- return (this.decorations
465
- // @ts-ignore
466
- .map(item => item.type.attrs.class)
467
- .flat()
468
- .join(' '));
529
+ this.node = node;
530
+ this.decorations = decorations;
531
+ updateProps({ node, decorations });
532
+ return true;
533
+ }
534
+ selectNode() {
535
+ this.renderer.updateProps({
536
+ selected: true
537
+ });
538
+ if (this.renderer.element) {
539
+ this.renderer.element.classList.add("ProseMirror-selectednode");
469
540
  }
470
- destroy() {
471
- this.renderer.destroy();
541
+ }
542
+ deselectNode() {
543
+ this.renderer.updateProps({
544
+ selected: false
545
+ });
546
+ if (this.renderer.element) {
547
+ this.renderer.element.classList.remove("ProseMirror-selectednode");
472
548
  }
473
- }
549
+ }
550
+ getDecorationClasses() {
551
+ return this.decorations.map((item) => item.type.attrs.class).flat().join(" ");
552
+ }
553
+ destroy() {
554
+ this.renderer.destroy();
555
+ }
556
+ };
474
557
  function VueNodeViewRenderer(component, options) {
475
- return (props) => {
476
- // try to get the parent component
477
- // this is important for vue devtools to show the component hierarchy correctly
478
- // maybe it’s `undefined` because <editor-content> isn’t rendered yet
479
- if (!props.editor.contentComponent) {
480
- return {};
481
- }
482
- // check for class-component and normalize if neccessary
483
- const normalizedComponent = typeof component === 'function' && '__vccOpts' in component
484
- // eslint-disable-next-line no-underscore-dangle
485
- ? component.__vccOpts
486
- : component;
487
- return new VueNodeView(normalizedComponent, props, options);
488
- };
558
+ return (props) => {
559
+ if (!props.editor.contentComponent) {
560
+ return {};
561
+ }
562
+ const normalizedComponent = typeof component === "function" && "__vccOpts" in component ? component.__vccOpts : component;
563
+ return new VueNodeView(normalizedComponent, props, options);
564
+ };
489
565
  }
490
566
 
491
- exports.BubbleMenu = BubbleMenu;
492
- exports.Editor = Editor;
493
- exports.EditorContent = EditorContent;
494
- exports.FloatingMenu = FloatingMenu;
495
- exports.NodeViewContent = NodeViewContent;
496
- exports.NodeViewWrapper = NodeViewWrapper;
497
- exports.VueNodeViewRenderer = VueNodeViewRenderer;
498
- exports.VueRenderer = VueRenderer;
499
- exports.nodeViewProps = nodeViewProps;
500
- exports.useEditor = useEditor;
501
- Object.keys(core).forEach(function (k) {
502
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
503
- enumerable: true,
504
- get: function () { return core[k]; }
505
- });
567
+ // src/index.ts
568
+ __reExport(src_exports, require("@tiptap/core"), module.exports);
569
+ // Annotate the CommonJS export names for ESM import in node:
570
+ 0 && (module.exports = {
571
+ BubbleMenu,
572
+ Editor,
573
+ EditorContent,
574
+ FloatingMenu,
575
+ NodeViewContent,
576
+ NodeViewWrapper,
577
+ VueNodeViewRenderer,
578
+ VueRenderer,
579
+ nodeViewProps,
580
+ useEditor,
581
+ ...require("@tiptap/core")
506
582
  });
507
- //# sourceMappingURL=index.cjs.map
583
+ //# sourceMappingURL=index.cjs.map