@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
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/BubbleMenu.ts","../src/Editor.ts","../src/EditorContent.ts","../src/FloatingMenu.ts","../src/NodeViewContent.ts","../src/NodeViewWrapper.ts","../src/useEditor.ts","../src/VueRenderer.ts","../src/VueNodeViewRenderer.ts"],"sourcesContent":["import { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n PropType,\n ref,\n} from 'vue'\n\nexport const BubbleMenu = defineComponent({\n name: 'BubbleMenu',\n\n props: {\n pluginKey: {\n type: [String, Object] as PropType<BubbleMenuPluginProps['pluginKey']>,\n default: 'bubbleMenu',\n },\n\n editor: {\n type: Object as PropType<BubbleMenuPluginProps['editor']>,\n required: true,\n },\n\n updateDelay: {\n type: Number as PropType<BubbleMenuPluginProps['updateDelay']>,\n default: undefined,\n },\n\n tippyOptions: {\n type: Object as PropType<BubbleMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<BubbleMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n updateDelay,\n editor,\n pluginKey,\n shouldShow,\n tippyOptions,\n } = props\n\n editor.registerPlugin(BubbleMenuPlugin({\n updateDelay,\n editor,\n element: root.value as HTMLElement,\n pluginKey,\n shouldShow,\n tippyOptions,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h('div', { ref: root }, slots.default?.())\n },\n})\n","/* eslint-disable react-hooks/rules-of-hooks */\nimport { Editor as CoreEditor, EditorOptions } from '@tiptap/core'\nimport { EditorState, Plugin, PluginKey } from '@tiptap/pm/state'\nimport {\n AppContext,\n ComponentInternalInstance,\n ComponentPublicInstance,\n customRef,\n markRaw,\n Ref,\n} from 'vue'\n\nfunction useDebouncedRef<T>(value: T) {\n return customRef<T>((track, trigger) => {\n return {\n get() {\n track()\n return value\n },\n set(newValue) {\n // update state\n value = newValue\n\n // update view as soon as possible\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n trigger()\n })\n })\n },\n }\n })\n}\n\nexport type ContentComponent = ComponentInternalInstance & {\n ctx: ComponentPublicInstance\n}\n\nexport class Editor extends CoreEditor {\n private reactiveState: Ref<EditorState>\n\n private reactiveExtensionStorage: Ref<Record<string, any>>\n\n public contentComponent: ContentComponent | null = null\n\n public appContext: AppContext | null = null\n\n constructor(options: Partial<EditorOptions> = {}) {\n super(options)\n\n this.reactiveState = useDebouncedRef(this.view.state)\n this.reactiveExtensionStorage = useDebouncedRef(this.extensionStorage)\n\n this.on('beforeTransaction', ({ nextState }) => {\n this.reactiveState.value = nextState\n this.reactiveExtensionStorage.value = this.extensionStorage\n })\n\n return markRaw(this) // eslint-disable-line\n }\n\n get state() {\n return this.reactiveState ? this.reactiveState.value : this.view.state\n }\n\n get storage() {\n return this.reactiveExtensionStorage ? this.reactiveExtensionStorage.value : super.storage\n }\n\n /**\n * Register a ProseMirror plugin.\n */\n public registerPlugin(\n plugin: Plugin,\n handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[],\n ): void {\n super.registerPlugin(plugin, handlePlugins)\n this.reactiveState.value = this.view.state\n }\n\n /**\n * Unregister a ProseMirror plugin.\n */\n public unregisterPlugin(nameOrPluginKey: string | PluginKey): void {\n super.unregisterPlugin(nameOrPluginKey)\n this.reactiveState.value = this.view.state\n }\n}\n","import {\n defineComponent,\n getCurrentInstance,\n h,\n nextTick,\n onBeforeUnmount,\n PropType,\n Ref,\n ref,\n unref,\n watchEffect,\n} from 'vue'\n\nimport { Editor } from './Editor.js'\n\nexport const EditorContent = defineComponent({\n name: 'EditorContent',\n\n props: {\n editor: {\n default: null,\n type: Object as PropType<Editor>,\n },\n },\n\n setup(props) {\n const rootEl: Ref<Element | undefined> = ref()\n const instance = getCurrentInstance()\n\n watchEffect(() => {\n const editor = props.editor\n\n if (editor && editor.options.element && rootEl.value) {\n nextTick(() => {\n if (!rootEl.value || !editor.options.element.firstChild) {\n return\n }\n\n const element = unref(rootEl.value)\n\n rootEl.value.append(...editor.options.element.childNodes)\n\n // @ts-ignore\n editor.contentComponent = instance.ctx._\n\n if (instance) {\n editor.appContext = {\n ...instance.appContext,\n // Vue internally uses prototype chain to forward/shadow injects across the entire component chain\n // so don't use object spread operator or 'Object.assign' and just set `provides` as is on editor's appContext\n // @ts-expect-error forward instance's 'provides' into appContext\n provides: instance.provides,\n }\n }\n\n editor.setOptions({\n element,\n })\n\n editor.createNodeViews()\n })\n }\n })\n\n onBeforeUnmount(() => {\n const editor = props.editor\n\n if (!editor) {\n return\n }\n\n // destroy nodeviews before vue removes dom element\n if (!editor.isDestroyed) {\n editor.view.setProps({\n nodeViews: {},\n })\n }\n\n editor.contentComponent = null\n editor.appContext = null\n\n if (!editor.options.element.firstChild) {\n return\n }\n\n const newElement = document.createElement('div')\n\n newElement.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element: newElement,\n })\n })\n\n return { rootEl }\n },\n\n render() {\n return h(\n 'div',\n {\n ref: (el: any) => { this.rootEl = el },\n },\n )\n },\n})\n","import { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n PropType,\n ref,\n} from 'vue'\n\nexport const FloatingMenu = defineComponent({\n name: 'FloatingMenu',\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],\n type: null,\n default: 'floatingMenu',\n },\n\n editor: {\n type: Object as PropType<FloatingMenuPluginProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<FloatingMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<FloatingMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n pluginKey,\n editor,\n tippyOptions,\n shouldShow,\n } = props\n\n editor.registerPlugin(FloatingMenuPlugin({\n pluginKey,\n editor,\n element: root.value as HTMLElement,\n tippyOptions,\n shouldShow,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h('div', { ref: root }, slots.default?.())\n },\n})\n","import { defineComponent, h } from 'vue'\n\nexport const NodeViewContent = defineComponent({\n name: 'NodeViewContent',\n\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n render() {\n return h(this.as, {\n style: {\n whiteSpace: 'pre-wrap',\n },\n 'data-node-view-content': '',\n })\n },\n})\n","import { defineComponent, h } from 'vue'\n\nexport const NodeViewWrapper = defineComponent({\n name: 'NodeViewWrapper',\n\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n inject: ['onDragStart', 'decorationClasses'],\n\n render() {\n return h(\n this.as,\n {\n // @ts-ignore\n class: this.decorationClasses,\n style: {\n whiteSpace: 'normal',\n },\n 'data-node-view-wrapper': '',\n // @ts-ignore (https://github.com/vuejs/vue-next/issues/3031)\n onDragstart: this.onDragStart,\n },\n this.$slots.default?.(),\n )\n },\n})\n","import { EditorOptions } from '@tiptap/core'\nimport { onBeforeUnmount, onMounted, shallowRef } from 'vue'\n\nimport { Editor } from './Editor.js'\n\nexport const useEditor = (options: Partial<EditorOptions> = {}) => {\n const editor = shallowRef<Editor>()\n\n onMounted(() => {\n editor.value = new Editor(options)\n })\n\n onBeforeUnmount(() => {\n editor.value?.destroy()\n })\n\n return editor\n}\n","import { Editor } from '@tiptap/core'\nimport {\n Component, DefineComponent, h, markRaw, reactive, render,\n} from 'vue'\n\nimport { Editor as ExtendedEditor } from './Editor.js'\n\nexport interface VueRendererOptions {\n editor: Editor;\n props?: Record<string, any>;\n}\n\ntype ExtendedVNode = ReturnType<typeof h> | null;\n\ninterface RenderedComponent {\n vNode: ExtendedVNode;\n destroy: () => void;\n el: Element | null;\n}\n\n/**\n * This class is used to render Vue components inside the editor.\n */\nexport class VueRenderer {\n renderedComponent!: RenderedComponent\n\n editor: ExtendedEditor\n\n component: Component\n\n el: Element | null\n\n props: Record<string, any>\n\n constructor(component: Component, { props = {}, editor }: VueRendererOptions) {\n this.editor = editor as ExtendedEditor\n this.component = markRaw(component)\n this.el = document.createElement('div')\n this.props = reactive(props)\n this.renderedComponent = this.renderComponent()\n }\n\n get element(): Element | null {\n return this.renderedComponent.el\n }\n\n get ref(): any {\n // Composition API\n if (this.renderedComponent.vNode?.component?.exposed) {\n return this.renderedComponent.vNode.component.exposed\n }\n // Option API\n return this.renderedComponent.vNode?.component?.proxy\n }\n\n renderComponent() {\n let vNode: ExtendedVNode = h(this.component as DefineComponent, this.props)\n\n if (this.editor.appContext) {\n vNode.appContext = this.editor.appContext\n }\n if (typeof document !== 'undefined' && this.el) {\n render(vNode, this.el)\n }\n\n const destroy = () => {\n if (this.el) {\n render(null, this.el)\n }\n this.el = null\n vNode = null\n }\n\n return { vNode, destroy, el: this.el ? this.el.firstElementChild : null }\n }\n\n updateProps(props: Record<string, any> = {}): void {\n Object.entries(props).forEach(([key, value]) => {\n this.props[key] = value\n })\n this.renderComponent()\n }\n\n destroy(): void {\n this.renderedComponent.destroy()\n }\n}\n","import {\n DecorationWithType,\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererOptions,\n NodeViewRendererProps,\n} from '@tiptap/core'\nimport { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { Decoration, NodeView as ProseMirrorNodeView } from '@tiptap/pm/view'\nimport {\n Component,\n defineComponent,\n PropType,\n provide,\n Ref,\n ref,\n} from 'vue'\n\nimport { Editor } from './Editor.js'\nimport { VueRenderer } from './VueRenderer.js'\n\nexport const nodeViewProps = {\n editor: {\n type: Object as PropType<NodeViewProps['editor']>,\n required: true as const,\n },\n node: {\n type: Object as PropType<NodeViewProps['node']>,\n required: true as const,\n },\n decorations: {\n type: Object as PropType<NodeViewProps['decorations']>,\n required: true as const,\n },\n selected: {\n type: Boolean as PropType<NodeViewProps['selected']>,\n required: true as const,\n },\n extension: {\n type: Object as PropType<NodeViewProps['extension']>,\n required: true as const,\n },\n getPos: {\n type: Function as PropType<NodeViewProps['getPos']>,\n required: true as const,\n },\n updateAttributes: {\n type: Function as PropType<NodeViewProps['updateAttributes']>,\n required: true as const,\n },\n deleteNode: {\n type: Function as PropType<NodeViewProps['deleteNode']>,\n required: true as const,\n },\n}\n\nexport interface VueNodeViewRendererOptions extends NodeViewRendererOptions {\n update:\n | ((props: {\n oldNode: ProseMirrorNode\n oldDecorations: Decoration[]\n newNode: ProseMirrorNode\n newDecorations: Decoration[]\n updateProps: () => void\n }) => boolean)\n | null\n}\n\nclass VueNodeView extends NodeView<Component, Editor, VueNodeViewRendererOptions> {\n renderer!: VueRenderer\n\n decorationClasses!: Ref<string>\n\n mount() {\n const props: NodeViewProps = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations,\n selected: false,\n extension: this.extension,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n deleteNode: () => this.deleteNode(),\n }\n\n const onDragStart = this.onDragStart.bind(this)\n\n this.decorationClasses = ref(this.getDecorationClasses())\n\n const extendedComponent = defineComponent({\n extends: { ...this.component },\n props: Object.keys(props),\n template: (this.component as any).template,\n setup: reactiveProps => {\n provide('onDragStart', onDragStart)\n provide('decorationClasses', this.decorationClasses)\n\n return (this.component as any).setup?.(reactiveProps, {\n expose: () => undefined,\n })\n },\n // add support for scoped styles\n // @ts-ignore\n // eslint-disable-next-line\n __scopeId: this.component.__scopeId,\n // add support for CSS Modules\n // @ts-ignore\n // eslint-disable-next-line\n __cssModules: this.component.__cssModules,\n // add support for vue devtools\n // @ts-ignore\n // eslint-disable-next-line\n __name: this.component.__name,\n // @ts-ignore\n // eslint-disable-next-line\n __file: this.component.__file,\n })\n\n this.renderer = new VueRenderer(extendedComponent, {\n editor: this.editor,\n props,\n })\n }\n\n get dom() {\n if (!this.renderer.element || !this.renderer.element.hasAttribute('data-node-view-wrapper')) {\n throw Error('Please use the NodeViewWrapper component for your node view.')\n }\n\n return this.renderer.element as HTMLElement\n }\n\n get contentDOM() {\n if (this.node.isLeaf) {\n return null\n }\n\n return this.dom.querySelector('[data-node-view-content]') as HTMLElement | null\n }\n\n update(node: ProseMirrorNode, decorations: DecorationWithType[]) {\n const updateProps = (props?: Record<string, any>) => {\n this.decorationClasses.value = this.getDecorationClasses()\n this.renderer.updateProps(props)\n }\n\n if (typeof this.options.update === 'function') {\n const oldNode = this.node\n const oldDecorations = this.decorations\n\n this.node = node\n this.decorations = decorations\n\n return this.options.update({\n oldNode,\n oldDecorations,\n newNode: node,\n newDecorations: decorations,\n updateProps: () => updateProps({ node, decorations }),\n })\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (node === this.node && this.decorations === decorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n\n updateProps({ node, decorations })\n\n return true\n }\n\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n if (this.renderer.element) {\n this.renderer.element.classList.add('ProseMirror-selectednode')\n }\n }\n\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n if (this.renderer.element) {\n this.renderer.element.classList.remove('ProseMirror-selectednode')\n }\n }\n\n getDecorationClasses() {\n return (\n this.decorations\n // @ts-ignore\n .map(item => item.type.attrs.class)\n .flat()\n .join(' ')\n )\n }\n\n destroy() {\n this.renderer.destroy()\n }\n}\n\nexport function VueNodeViewRenderer(\n component: Component,\n options?: Partial<VueNodeViewRendererOptions>,\n): NodeViewRenderer {\n return (props: NodeViewRendererProps) => {\n // try to get the parent component\n // this is important for vue devtools to show the component hierarchy correctly\n // maybe it’s `undefined` because <editor-content> isn’t rendered yet\n if (!(props.editor as Editor).contentComponent) {\n return {}\n }\n // check for class-component and normalize if neccessary\n const normalizedComponent = typeof component === 'function' && '__vccOpts' in component\n // eslint-disable-next-line no-underscore-dangle\n ? component.__vccOpts as Component\n : component\n\n return new VueNodeView(normalizedComponent, props, options) as unknown as ProseMirrorNodeView\n }\n}\n"],"names":["defineComponent","ref","onMounted","BubbleMenuPlugin","onBeforeUnmount","h","customRef","CoreEditor","markRaw","getCurrentInstance","watchEffect","nextTick","unref","FloatingMenuPlugin","shallowRef","reactive","render","NodeView","provide"],"mappings":";;;;;;;AAUO,MAAM,UAAU,GAAGA,mBAAe,CAAC;AACxC,IAAA,IAAI,EAAE,YAAY;AAElB,IAAA,KAAK,EAAE;AACL,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAiD;AACtE,YAAA,OAAO,EAAE,YAAY;AACtB,SAAA;AAED,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAmD;AACzD,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AAED,QAAA,WAAW,EAAE;AACX,YAAA,IAAI,EAAE,MAAwD;AAC9D,YAAA,OAAO,EAAE,SAAS;AACnB,SAAA;AAED,QAAA,YAAY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SAChE;KACF;IAED,YAAY,GAAA;AACV,QAAA,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;AACxB,YAAA,QAAQ,EAAE,KAAK;AAChB,SAAA,CAAC,CAAA;AACF,QAAA,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE;YACzB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAA;SACnE;KACF;IAED,oBAAoB,GAAA;QAClB,QACE,IAAI,CAAC,WAAW;;AAEb,aAAA,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;AAClC,aAAA,IAAI,EAAE;AACN,aAAA,IAAI,CAAC,GAAG,CAAC,EACb;KACF;IAED,OAAO,GAAA;AACL,QAAA,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAA;KACxB;AACF,CAAA;AAEe,SAAA,mBAAmB,CACjC,SAAoB,EACpB,OAA6C,EAAA;IAE7C,OAAO,CAAC,KAA4B,KAAI;;;;AAItC,QAAA,IAAI,CAAE,KAAK,CAAC,MAAiB,CAAC,gBAAgB,EAAE;AAC9C,YAAA,OAAO,EAAE,CAAA;SACV;;QAED,MAAM,mBAAmB,GAAG,OAAO,SAAS,KAAK,UAAU,IAAI,WAAW,IAAI,SAAS;;cAEnF,SAAS,CAAC,SAAsB;cAChC,SAAS,CAAA;QAEb,OAAO,IAAI,WAAW,CAAC,mBAAmB,EAAE,KAAK,EAAE,OAAO,CAAmC,CAAA;AAC/F,KAAC,CAAA;AACH;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"sources":["../src/index.ts","../src/BubbleMenu.ts","../src/Editor.ts","../src/EditorContent.ts","../src/FloatingMenu.ts","../src/NodeViewContent.ts","../src/NodeViewWrapper.ts","../src/useEditor.ts","../src/VueNodeViewRenderer.ts","../src/VueRenderer.ts"],"sourcesContent":["export * from './BubbleMenu.js'\nexport { Editor } from './Editor.js'\nexport * from './EditorContent.js'\nexport * from './FloatingMenu.js'\nexport * from './NodeViewContent.js'\nexport * from './NodeViewWrapper.js'\nexport * from './useEditor.js'\nexport * from './VueNodeViewRenderer.js'\nexport * from './VueRenderer.js'\nexport * from '@tiptap/core'\n","import { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n PropType,\n ref,\n Teleport,\n} from 'vue'\n\nexport const BubbleMenu = defineComponent({\n name: 'BubbleMenu',\n\n props: {\n pluginKey: {\n type: [String, Object] as PropType<BubbleMenuPluginProps['pluginKey']>,\n default: 'bubbleMenu',\n },\n\n editor: {\n type: Object as PropType<BubbleMenuPluginProps['editor']>,\n required: true,\n },\n\n updateDelay: {\n type: Number as PropType<BubbleMenuPluginProps['updateDelay']>,\n default: undefined,\n },\n\n resizeDelay: {\n type: Number as PropType<BubbleMenuPluginProps['resizeDelay']>,\n default: undefined,\n },\n\n options: {\n type: Object as PropType<BubbleMenuPluginProps['options']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<BubbleMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n editor,\n options,\n pluginKey,\n resizeDelay,\n shouldShow,\n updateDelay,\n } = props\n\n if (!root.value) {\n return\n }\n\n root.value.style.visibility = 'hidden'\n root.value.style.position = 'absolute'\n\n // remove the element from the DOM\n root.value.remove()\n\n editor.registerPlugin(BubbleMenuPlugin({\n editor,\n element: root.value as HTMLElement,\n options,\n pluginKey,\n resizeDelay,\n shouldShow,\n updateDelay,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h(Teleport, { to: 'body' }, h('div', { ref: root }, slots.default?.()))\n },\n})\n","/* eslint-disable react-hooks/rules-of-hooks */\nimport { Editor as CoreEditor, EditorOptions } from '@tiptap/core'\nimport { EditorState, Plugin, PluginKey } from '@tiptap/pm/state'\nimport {\n AppContext,\n ComponentInternalInstance,\n ComponentPublicInstance,\n customRef,\n markRaw,\n Ref,\n} from 'vue'\n\nfunction useDebouncedRef<T>(value: T) {\n return customRef<T>((track, trigger) => {\n return {\n get() {\n track()\n return value\n },\n set(newValue) {\n // update state\n value = newValue\n\n // update view as soon as possible\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n trigger()\n })\n })\n },\n }\n })\n}\n\nexport type ContentComponent = ComponentInternalInstance & {\n ctx: ComponentPublicInstance\n}\n\nexport class Editor extends CoreEditor {\n private reactiveState: Ref<EditorState>\n\n private reactiveExtensionStorage: Ref<Record<string, any>>\n\n public contentComponent: ContentComponent | null = null\n\n public appContext: AppContext | null = null\n\n constructor(options: Partial<EditorOptions> = {}) {\n super(options)\n\n this.reactiveState = useDebouncedRef(this.view.state)\n this.reactiveExtensionStorage = useDebouncedRef(this.extensionStorage)\n\n this.on('beforeTransaction', ({ nextState }) => {\n this.reactiveState.value = nextState\n this.reactiveExtensionStorage.value = this.extensionStorage\n })\n\n return markRaw(this) // eslint-disable-line\n }\n\n get state() {\n return this.reactiveState ? this.reactiveState.value : this.view.state\n }\n\n get storage() {\n return this.reactiveExtensionStorage ? this.reactiveExtensionStorage.value : super.storage\n }\n\n /**\n * Register a ProseMirror plugin.\n */\n public registerPlugin(\n plugin: Plugin,\n handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[],\n ): void {\n super.registerPlugin(plugin, handlePlugins)\n this.reactiveState.value = this.view.state\n }\n\n /**\n * Unregister a ProseMirror plugin.\n */\n public unregisterPlugin(nameOrPluginKey: string | PluginKey): void {\n super.unregisterPlugin(nameOrPluginKey)\n this.reactiveState.value = this.view.state\n }\n}\n","import {\n defineComponent,\n getCurrentInstance,\n h,\n nextTick,\n onBeforeUnmount,\n PropType,\n Ref,\n ref,\n unref,\n watchEffect,\n} from 'vue'\n\nimport { Editor } from './Editor.js'\n\nexport const EditorContent = defineComponent({\n name: 'EditorContent',\n\n props: {\n editor: {\n default: null,\n type: Object as PropType<Editor>,\n },\n },\n\n setup(props) {\n const rootEl: Ref<Element | undefined> = ref()\n const instance = getCurrentInstance()\n\n watchEffect(() => {\n const editor = props.editor\n\n if (editor && editor.options.element && rootEl.value) {\n nextTick(() => {\n if (!rootEl.value || !editor.options.element.firstChild) {\n return\n }\n\n const element = unref(rootEl.value)\n\n rootEl.value.append(...editor.options.element.childNodes)\n\n // @ts-ignore\n editor.contentComponent = instance.ctx._\n\n if (instance) {\n editor.appContext = {\n ...instance.appContext,\n // Vue internally uses prototype chain to forward/shadow injects across the entire component chain\n // so don't use object spread operator or 'Object.assign' and just set `provides` as is on editor's appContext\n // @ts-expect-error forward instance's 'provides' into appContext\n provides: instance.provides,\n }\n }\n\n editor.setOptions({\n element,\n })\n\n editor.createNodeViews()\n })\n }\n })\n\n onBeforeUnmount(() => {\n const editor = props.editor\n\n if (!editor) {\n return\n }\n\n // destroy nodeviews before vue removes dom element\n if (!editor.isDestroyed) {\n editor.view.setProps({\n nodeViews: {},\n })\n }\n\n editor.contentComponent = null\n editor.appContext = null\n\n if (!editor.options.element.firstChild) {\n return\n }\n\n const newElement = document.createElement('div')\n\n newElement.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element: newElement,\n })\n })\n\n return { rootEl }\n },\n\n render() {\n return h(\n 'div',\n {\n ref: (el: any) => { this.rootEl = el },\n },\n )\n },\n})\n","import type { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n PropType,\n ref,\n Teleport,\n} from 'vue'\n\nexport const FloatingMenu = defineComponent({\n name: 'FloatingMenu',\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],\n type: null,\n default: 'floatingMenu',\n },\n\n editor: {\n type: Object as PropType<FloatingMenuPluginProps['editor']>,\n required: true,\n },\n\n options: {\n type: Object as PropType<BubbleMenuPluginProps['options']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<FloatingMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n pluginKey,\n editor,\n options,\n shouldShow,\n } = props\n\n if (!root.value) {\n return\n }\n\n root.value.style.visibility = 'hidden'\n root.value.style.position = 'absolute'\n\n // remove the element from the DOM\n root.value.remove()\n\n editor.registerPlugin(FloatingMenuPlugin({\n pluginKey,\n editor,\n element: root.value as HTMLElement,\n options,\n shouldShow,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h(Teleport, { to: 'body' }, h('div', { ref: root }, slots.default?.()))\n },\n})\n","import { defineComponent, h } from 'vue'\n\nexport const NodeViewContent = defineComponent({\n name: 'NodeViewContent',\n\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n render() {\n return h(this.as, {\n style: {\n whiteSpace: 'pre-wrap',\n },\n 'data-node-view-content': '',\n })\n },\n})\n","import { defineComponent, h } from 'vue'\n\nexport const NodeViewWrapper = defineComponent({\n name: 'NodeViewWrapper',\n\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n inject: ['onDragStart', 'decorationClasses'],\n\n render() {\n return h(\n this.as,\n {\n // @ts-ignore\n class: this.decorationClasses,\n style: {\n whiteSpace: 'normal',\n },\n 'data-node-view-wrapper': '',\n // @ts-ignore (https://github.com/vuejs/vue-next/issues/3031)\n onDragstart: this.onDragStart,\n },\n this.$slots.default?.(),\n )\n },\n})\n","import { EditorOptions } from '@tiptap/core'\nimport { onBeforeUnmount, onMounted, shallowRef } from 'vue'\n\nimport { Editor } from './Editor.js'\n\nexport const useEditor = (options: Partial<EditorOptions> = {}) => {\n const editor = shallowRef<Editor>()\n\n onMounted(() => {\n editor.value = new Editor(options)\n })\n\n onBeforeUnmount(() => {\n editor.value?.destroy()\n })\n\n return editor\n}\n","import {\n DecorationWithType,\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererOptions,\n NodeViewRendererProps,\n} from '@tiptap/core'\nimport { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { Decoration, NodeView as ProseMirrorNodeView } from '@tiptap/pm/view'\nimport {\n Component,\n defineComponent,\n PropType,\n provide,\n Ref,\n ref,\n} from 'vue'\n\nimport { Editor } from './Editor.js'\nimport { VueRenderer } from './VueRenderer.js'\n\nexport const nodeViewProps = {\n editor: {\n type: Object as PropType<NodeViewProps['editor']>,\n required: true as const,\n },\n node: {\n type: Object as PropType<NodeViewProps['node']>,\n required: true as const,\n },\n decorations: {\n type: Object as PropType<NodeViewProps['decorations']>,\n required: true as const,\n },\n selected: {\n type: Boolean as PropType<NodeViewProps['selected']>,\n required: true as const,\n },\n extension: {\n type: Object as PropType<NodeViewProps['extension']>,\n required: true as const,\n },\n getPos: {\n type: Function as PropType<NodeViewProps['getPos']>,\n required: true as const,\n },\n updateAttributes: {\n type: Function as PropType<NodeViewProps['updateAttributes']>,\n required: true as const,\n },\n deleteNode: {\n type: Function as PropType<NodeViewProps['deleteNode']>,\n required: true as const,\n },\n}\n\nexport interface VueNodeViewRendererOptions extends NodeViewRendererOptions {\n update:\n | ((props: {\n oldNode: ProseMirrorNode\n oldDecorations: Decoration[]\n newNode: ProseMirrorNode\n newDecorations: Decoration[]\n updateProps: () => void\n }) => boolean)\n | null\n}\n\nclass VueNodeView extends NodeView<Component, Editor, VueNodeViewRendererOptions> {\n renderer!: VueRenderer\n\n decorationClasses!: Ref<string>\n\n mount() {\n const props: NodeViewProps = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations,\n selected: false,\n extension: this.extension,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n deleteNode: () => this.deleteNode(),\n }\n\n const onDragStart = this.onDragStart.bind(this)\n\n this.decorationClasses = ref(this.getDecorationClasses())\n\n const extendedComponent = defineComponent({\n extends: { ...this.component },\n props: Object.keys(props),\n template: (this.component as any).template,\n setup: reactiveProps => {\n provide('onDragStart', onDragStart)\n provide('decorationClasses', this.decorationClasses)\n\n return (this.component as any).setup?.(reactiveProps, {\n expose: () => undefined,\n })\n },\n // add support for scoped styles\n // @ts-ignore\n // eslint-disable-next-line\n __scopeId: this.component.__scopeId,\n // add support for CSS Modules\n // @ts-ignore\n // eslint-disable-next-line\n __cssModules: this.component.__cssModules,\n // add support for vue devtools\n // @ts-ignore\n // eslint-disable-next-line\n __name: this.component.__name,\n // @ts-ignore\n // eslint-disable-next-line\n __file: this.component.__file,\n })\n\n this.renderer = new VueRenderer(extendedComponent, {\n editor: this.editor,\n props,\n })\n }\n\n get dom() {\n if (!this.renderer.element || !this.renderer.element.hasAttribute('data-node-view-wrapper')) {\n throw Error('Please use the NodeViewWrapper component for your node view.')\n }\n\n return this.renderer.element as HTMLElement\n }\n\n get contentDOM() {\n if (this.node.isLeaf) {\n return null\n }\n\n return this.dom.querySelector('[data-node-view-content]') as HTMLElement | null\n }\n\n update(node: ProseMirrorNode, decorations: DecorationWithType[]) {\n const updateProps = (props?: Record<string, any>) => {\n this.decorationClasses.value = this.getDecorationClasses()\n this.renderer.updateProps(props)\n }\n\n if (typeof this.options.update === 'function') {\n const oldNode = this.node\n const oldDecorations = this.decorations\n\n this.node = node\n this.decorations = decorations\n\n return this.options.update({\n oldNode,\n oldDecorations,\n newNode: node,\n newDecorations: decorations,\n updateProps: () => updateProps({ node, decorations }),\n })\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (node === this.node && this.decorations === decorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n\n updateProps({ node, decorations })\n\n return true\n }\n\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n if (this.renderer.element) {\n this.renderer.element.classList.add('ProseMirror-selectednode')\n }\n }\n\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n if (this.renderer.element) {\n this.renderer.element.classList.remove('ProseMirror-selectednode')\n }\n }\n\n getDecorationClasses() {\n return (\n this.decorations\n // @ts-ignore\n .map(item => item.type.attrs.class)\n .flat()\n .join(' ')\n )\n }\n\n destroy() {\n this.renderer.destroy()\n }\n}\n\nexport function VueNodeViewRenderer(\n component: Component,\n options?: Partial<VueNodeViewRendererOptions>,\n): NodeViewRenderer {\n return (props: NodeViewRendererProps) => {\n // try to get the parent component\n // this is important for vue devtools to show the component hierarchy correctly\n // maybe it’s `undefined` because <editor-content> isn’t rendered yet\n if (!(props.editor as Editor).contentComponent) {\n return {}\n }\n // check for class-component and normalize if neccessary\n const normalizedComponent = typeof component === 'function' && '__vccOpts' in component\n // eslint-disable-next-line no-underscore-dangle\n ? component.__vccOpts as Component\n : component\n\n return new VueNodeView(normalizedComponent, props, options) as unknown as ProseMirrorNodeView\n }\n}\n","import { Editor } from '@tiptap/core'\nimport {\n Component, DefineComponent, h, markRaw, reactive, render,\n} from 'vue'\n\nimport { Editor as ExtendedEditor } from './Editor.js'\n\nexport interface VueRendererOptions {\n editor: Editor;\n props?: Record<string, any>;\n}\n\ntype ExtendedVNode = ReturnType<typeof h> | null;\n\ninterface RenderedComponent {\n vNode: ExtendedVNode;\n destroy: () => void;\n el: Element | null;\n}\n\n/**\n * This class is used to render Vue components inside the editor.\n */\nexport class VueRenderer {\n renderedComponent!: RenderedComponent\n\n editor: ExtendedEditor\n\n component: Component\n\n el: Element | null\n\n props: Record<string, any>\n\n constructor(component: Component, { props = {}, editor }: VueRendererOptions) {\n this.editor = editor as ExtendedEditor\n this.component = markRaw(component)\n this.el = document.createElement('div')\n this.props = reactive(props)\n this.renderedComponent = this.renderComponent()\n }\n\n get element(): Element | null {\n return this.renderedComponent.el\n }\n\n get ref(): any {\n // Composition API\n if (this.renderedComponent.vNode?.component?.exposed) {\n return this.renderedComponent.vNode.component.exposed\n }\n // Option API\n return this.renderedComponent.vNode?.component?.proxy\n }\n\n renderComponent() {\n let vNode: ExtendedVNode = h(this.component as DefineComponent, this.props)\n\n if (this.editor.appContext) {\n vNode.appContext = this.editor.appContext\n }\n if (typeof document !== 'undefined' && this.el) {\n render(vNode, this.el)\n }\n\n const destroy = () => {\n if (this.el) {\n render(null, this.el)\n }\n this.el = null\n vNode = null\n }\n\n return { vNode, destroy, el: this.el ? this.el.firstElementChild : null }\n }\n\n updateProps(props: Record<string, any> = {}): void {\n Object.entries(props).forEach(([key, value]) => {\n this.props[key] = value\n })\n this.renderComponent()\n }\n\n destroy(): void {\n this.renderedComponent.destroy()\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mCAAwD;AACxD,iBAQO;AAEA,IAAM,iBAAa,4BAAgB;AAAA,EACxC,MAAM;AAAA,EAEN,OAAO;AAAA,IACL,WAAW;AAAA,MACT,MAAM,CAAC,QAAQ,MAAM;AAAA,MACrB,SAAS;AAAA,IACX;AAAA,IAEA,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,IACZ;AAAA,IAEA,aAAa;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,IAEA,aAAa;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,IAEA,SAAS;AAAA,MACP,MAAM;AAAA,MACN,SAAS,OAAO,CAAC;AAAA,IACnB;AAAA,IAEA,YAAY;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,EACF;AAAA,EAEA,MAAM,OAAO,EAAE,MAAM,GAAG;AACtB,UAAM,WAAO,gBAAwB,IAAI;AAEzC,8BAAU,MAAM;AACd,YAAM;AAAA,QACJ;AAAA,QACA;AAAA,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AAO,CAAC,UAAiC;AAIvC,QAAI,CAAE,MAAM,OAAkB,kBAAkB;AAC9C,aAAO,CAAC;AAAA,IACV;AAEA,UAAM,sBAAsB,OAAO,cAAc,cAAc,eAAe,YAE1E,UAAU,YACV;AAEJ,WAAO,IAAI,YAAY,qBAAqB,OAAO,OAAO;AAAA,EAC5D;AACF;;;AR9NA,wBAAc,yBATd;","names":["import_vue","CoreEditor","import_vue","import_vue","import_vue","import_vue","import_vue","import_core","import_vue","import_vue"]}
@@ -0,0 +1,300 @@
1
+ import * as prosemirror_view from 'prosemirror-view';
2
+ import * as _tiptap_core from '@tiptap/core';
3
+ import { Editor as Editor$1, EditorOptions, NodeViewProps, NodeViewRendererOptions, NodeViewRenderer } from '@tiptap/core';
4
+ export * from '@tiptap/core';
5
+ import * as _floating_ui_core from '@floating-ui/core';
6
+ import * as _floating_ui_dom from '@floating-ui/dom';
7
+ import * as _floating_ui_utils from '@floating-ui/utils';
8
+ import * as prosemirror_state from 'prosemirror-state';
9
+ import * as vue from 'vue';
10
+ import { PropType, AppContext, ComponentInternalInstance, ComponentPublicInstance, Ref, Component, h } from 'vue';
11
+ import { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu';
12
+ import { EditorState, Plugin, PluginKey } from '@tiptap/pm/state';
13
+ import { FloatingMenuPluginProps } from '@tiptap/extension-floating-menu';
14
+ import { Node } from '@tiptap/pm/model';
15
+ import { Decoration } from '@tiptap/pm/view';
16
+
17
+ declare const BubbleMenu: vue.DefineComponent<{
18
+ pluginKey: {
19
+ type: PropType<BubbleMenuPluginProps["pluginKey"]>;
20
+ default: string;
21
+ };
22
+ editor: {
23
+ type: PropType<BubbleMenuPluginProps["editor"]>;
24
+ required: true;
25
+ };
26
+ updateDelay: {
27
+ type: PropType<BubbleMenuPluginProps["updateDelay"]>;
28
+ default: undefined;
29
+ };
30
+ resizeDelay: {
31
+ type: PropType<BubbleMenuPluginProps["resizeDelay"]>;
32
+ default: undefined;
33
+ };
34
+ options: {
35
+ type: PropType<BubbleMenuPluginProps["options"]>;
36
+ default: () => {};
37
+ };
38
+ shouldShow: {
39
+ type: PropType<Exclude<Required<BubbleMenuPluginProps>["shouldShow"], null>>;
40
+ default: null;
41
+ };
42
+ }, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
43
+ [key: string]: any;
44
+ }>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
45
+ pluginKey: {
46
+ type: PropType<BubbleMenuPluginProps["pluginKey"]>;
47
+ default: string;
48
+ };
49
+ editor: {
50
+ type: PropType<BubbleMenuPluginProps["editor"]>;
51
+ required: true;
52
+ };
53
+ updateDelay: {
54
+ type: PropType<BubbleMenuPluginProps["updateDelay"]>;
55
+ default: undefined;
56
+ };
57
+ resizeDelay: {
58
+ type: PropType<BubbleMenuPluginProps["resizeDelay"]>;
59
+ default: undefined;
60
+ };
61
+ options: {
62
+ type: PropType<BubbleMenuPluginProps["options"]>;
63
+ default: () => {};
64
+ };
65
+ shouldShow: {
66
+ type: PropType<Exclude<Required<BubbleMenuPluginProps>["shouldShow"], null>>;
67
+ default: null;
68
+ };
69
+ }>>, {
70
+ pluginKey: string | prosemirror_state.PluginKey<any>;
71
+ updateDelay: number | undefined;
72
+ resizeDelay: number | undefined;
73
+ options: {
74
+ strategy?: _floating_ui_utils.Strategy;
75
+ placement?: _floating_ui_utils.Placement;
76
+ offset?: _floating_ui_dom.OffsetOptions | boolean;
77
+ flip?: _floating_ui_dom.FlipOptions | boolean;
78
+ shift?: _floating_ui_dom.ShiftOptions | boolean;
79
+ arrow?: _floating_ui_dom.ArrowOptions | false;
80
+ size?: _floating_ui_dom.SizeOptions | boolean;
81
+ autoPlacement?: _floating_ui_dom.AutoPlacementOptions | boolean;
82
+ hide?: _floating_ui_dom.HideOptions | boolean;
83
+ inline?: _floating_ui_core.InlineOptions | boolean;
84
+ } | undefined;
85
+ shouldShow: (props: {
86
+ editor: _tiptap_core.Editor;
87
+ view: prosemirror_view.EditorView;
88
+ state: prosemirror_state.EditorState;
89
+ oldState?: prosemirror_state.EditorState;
90
+ from: number;
91
+ to: number;
92
+ }) => boolean;
93
+ }, {}>;
94
+
95
+ type ContentComponent = ComponentInternalInstance & {
96
+ ctx: ComponentPublicInstance;
97
+ };
98
+ declare class Editor extends Editor$1 {
99
+ private reactiveState;
100
+ private reactiveExtensionStorage;
101
+ contentComponent: ContentComponent | null;
102
+ appContext: AppContext | null;
103
+ constructor(options?: Partial<EditorOptions>);
104
+ get state(): EditorState;
105
+ get storage(): Record<string, any>;
106
+ /**
107
+ * Register a ProseMirror plugin.
108
+ */
109
+ registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]): void;
110
+ /**
111
+ * Unregister a ProseMirror plugin.
112
+ */
113
+ unregisterPlugin(nameOrPluginKey: string | PluginKey): void;
114
+ }
115
+
116
+ declare const EditorContent: vue.DefineComponent<{
117
+ editor: {
118
+ default: null;
119
+ type: PropType<Editor>;
120
+ };
121
+ }, {
122
+ rootEl: Ref<Element | undefined>;
123
+ }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
124
+ editor: {
125
+ default: null;
126
+ type: PropType<Editor>;
127
+ };
128
+ }>>, {
129
+ editor: Editor;
130
+ }, {}>;
131
+
132
+ declare const FloatingMenu: vue.DefineComponent<{
133
+ pluginKey: {
134
+ type: null;
135
+ default: string;
136
+ };
137
+ editor: {
138
+ type: PropType<FloatingMenuPluginProps["editor"]>;
139
+ required: true;
140
+ };
141
+ options: {
142
+ type: PropType<BubbleMenuPluginProps["options"]>;
143
+ default: () => {};
144
+ };
145
+ shouldShow: {
146
+ type: PropType<Exclude<Required<FloatingMenuPluginProps>["shouldShow"], null>>;
147
+ default: null;
148
+ };
149
+ }, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
150
+ [key: string]: any;
151
+ }>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
152
+ pluginKey: {
153
+ type: null;
154
+ default: string;
155
+ };
156
+ editor: {
157
+ type: PropType<FloatingMenuPluginProps["editor"]>;
158
+ required: true;
159
+ };
160
+ options: {
161
+ type: PropType<BubbleMenuPluginProps["options"]>;
162
+ default: () => {};
163
+ };
164
+ shouldShow: {
165
+ type: PropType<Exclude<Required<FloatingMenuPluginProps>["shouldShow"], null>>;
166
+ default: null;
167
+ };
168
+ }>>, {
169
+ pluginKey: any;
170
+ options: {
171
+ strategy?: _floating_ui_utils.Strategy;
172
+ placement?: _floating_ui_utils.Placement;
173
+ offset?: _floating_ui_dom.OffsetOptions | boolean;
174
+ flip?: _floating_ui_dom.FlipOptions | boolean;
175
+ shift?: _floating_ui_dom.ShiftOptions | boolean;
176
+ arrow?: _floating_ui_dom.ArrowOptions | false;
177
+ size?: _floating_ui_dom.SizeOptions | boolean;
178
+ autoPlacement?: _floating_ui_dom.AutoPlacementOptions | boolean;
179
+ hide?: _floating_ui_dom.HideOptions | boolean;
180
+ inline?: _floating_ui_core.InlineOptions | boolean;
181
+ } | undefined;
182
+ shouldShow: (props: {
183
+ editor: _tiptap_core.Editor;
184
+ view: prosemirror_view.EditorView;
185
+ state: prosemirror_state.EditorState;
186
+ oldState?: prosemirror_state.EditorState;
187
+ from: number;
188
+ to: number;
189
+ }) => boolean;
190
+ }, {}>;
191
+
192
+ declare const NodeViewContent: vue.DefineComponent<{
193
+ as: {
194
+ type: StringConstructor;
195
+ default: string;
196
+ };
197
+ }, unknown, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
198
+ as: {
199
+ type: StringConstructor;
200
+ default: string;
201
+ };
202
+ }>>, {
203
+ as: string;
204
+ }, {}>;
205
+
206
+ declare const NodeViewWrapper: vue.DefineComponent<{
207
+ as: {
208
+ type: StringConstructor;
209
+ default: string;
210
+ };
211
+ }, unknown, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
212
+ as: {
213
+ type: StringConstructor;
214
+ default: string;
215
+ };
216
+ }>>, {
217
+ as: string;
218
+ }, {}>;
219
+
220
+ declare const useEditor: (options?: Partial<EditorOptions>) => vue.ShallowRef<Editor | undefined>;
221
+
222
+ declare const nodeViewProps: {
223
+ editor: {
224
+ type: PropType<NodeViewProps["editor"]>;
225
+ required: true;
226
+ };
227
+ node: {
228
+ type: PropType<NodeViewProps["node"]>;
229
+ required: true;
230
+ };
231
+ decorations: {
232
+ type: PropType<NodeViewProps["decorations"]>;
233
+ required: true;
234
+ };
235
+ selected: {
236
+ type: PropType<NodeViewProps["selected"]>;
237
+ required: true;
238
+ };
239
+ extension: {
240
+ type: PropType<NodeViewProps["extension"]>;
241
+ required: true;
242
+ };
243
+ getPos: {
244
+ type: PropType<NodeViewProps["getPos"]>;
245
+ required: true;
246
+ };
247
+ updateAttributes: {
248
+ type: PropType<NodeViewProps["updateAttributes"]>;
249
+ required: true;
250
+ };
251
+ deleteNode: {
252
+ type: PropType<NodeViewProps["deleteNode"]>;
253
+ required: true;
254
+ };
255
+ };
256
+ interface VueNodeViewRendererOptions extends NodeViewRendererOptions {
257
+ update: ((props: {
258
+ oldNode: Node;
259
+ oldDecorations: Decoration[];
260
+ newNode: Node;
261
+ newDecorations: Decoration[];
262
+ updateProps: () => void;
263
+ }) => boolean) | null;
264
+ }
265
+ declare function VueNodeViewRenderer(component: Component, options?: Partial<VueNodeViewRendererOptions>): NodeViewRenderer;
266
+
267
+ interface VueRendererOptions {
268
+ editor: Editor$1;
269
+ props?: Record<string, any>;
270
+ }
271
+ type ExtendedVNode = ReturnType<typeof h> | null;
272
+ interface RenderedComponent {
273
+ vNode: ExtendedVNode;
274
+ destroy: () => void;
275
+ el: Element | null;
276
+ }
277
+ /**
278
+ * This class is used to render Vue components inside the editor.
279
+ */
280
+ declare class VueRenderer {
281
+ renderedComponent: RenderedComponent;
282
+ editor: Editor;
283
+ component: Component;
284
+ el: Element | null;
285
+ props: Record<string, any>;
286
+ constructor(component: Component, { props, editor }: VueRendererOptions);
287
+ get element(): Element | null;
288
+ get ref(): any;
289
+ renderComponent(): {
290
+ vNode: vue.VNode<vue.RendererNode, vue.RendererElement, {
291
+ [key: string]: any;
292
+ }>;
293
+ destroy: () => void;
294
+ el: Element | null;
295
+ };
296
+ updateProps(props?: Record<string, any>): void;
297
+ destroy(): void;
298
+ }
299
+
300
+ export { BubbleMenu, Editor, EditorContent, FloatingMenu, NodeViewContent, NodeViewWrapper, VueNodeViewRenderer, type VueNodeViewRendererOptions, VueRenderer, type VueRendererOptions, nodeViewProps, useEditor };