@tiptap/vue-2 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 (187) hide show
  1. package/dist/index.cjs +395 -346
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +97 -0
  4. package/dist/index.d.ts +97 -0
  5. package/dist/index.js +353 -330
  6. package/dist/index.js.map +1 -1
  7. package/package.json +10 -12
  8. package/src/BubbleMenu.ts +16 -5
  9. package/src/FloatingMenu.ts +9 -4
  10. package/dist/index.umd.js +0 -379
  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-2/src/BubbleMenu.d.ts +0 -10
  180. package/dist/packages/vue-2/src/Editor.d.ts +0 -5
  181. package/dist/packages/vue-2/src/EditorContent.d.ts +0 -6
  182. package/dist/packages/vue-2/src/FloatingMenu.d.ts +0 -9
  183. package/dist/packages/vue-2/src/NodeViewContent.d.ts +0 -5
  184. package/dist/packages/vue-2/src/NodeViewWrapper.d.ts +0 -9
  185. package/dist/packages/vue-2/src/VueNodeViewRenderer.d.ts +0 -37
  186. package/dist/packages/vue-2/src/VueRenderer.d.ts +0 -12
  187. package/dist/packages/vue-2/src/index.d.ts +0 -9
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/BubbleMenu.ts","../src/Editor.ts","../src/EditorContent.ts","../src/FloatingMenu.ts","../src/NodeViewContent.ts","../src/NodeViewWrapper.ts","../src/VueRenderer.ts","../src/VueNodeViewRenderer.ts"],"sourcesContent":["import { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport Vue, { Component, CreateElement, PropType } from 'vue'\n\nexport interface BubbleMenuInterface extends Vue {\n pluginKey: BubbleMenuPluginProps['pluginKey'],\n editor: BubbleMenuPluginProps['editor'],\n tippyOptions: BubbleMenuPluginProps['tippyOptions'],\n updateDelay: BubbleMenuPluginProps['updateDelay'],\n shouldShow: BubbleMenuPluginProps['shouldShow'],\n}\n\nexport const BubbleMenu: Component = {\n name: 'BubbleMenu',\n\n props: {\n pluginKey: {\n type: [String, Object as PropType<Exclude<BubbleMenuPluginProps['pluginKey'], string>>],\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 },\n\n tippyOptions: {\n type: Object as PropType<BubbleMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<BubbleMenuPluginProps['shouldShow'], null>>,\n default: null,\n },\n },\n\n watch: {\n editor: {\n immediate: true,\n handler(this: BubbleMenuInterface, editor: BubbleMenuPluginProps['editor']) {\n if (!editor) {\n return\n }\n\n this.$nextTick(() => {\n editor.registerPlugin(BubbleMenuPlugin({\n updateDelay: this.updateDelay,\n editor,\n element: this.$el as HTMLElement,\n pluginKey: this.pluginKey,\n shouldShow: this.shouldShow,\n tippyOptions: this.tippyOptions,\n }))\n })\n },\n },\n },\n\n render(this: BubbleMenuInterface, createElement: CreateElement) {\n return createElement('div', { style: { visibility: 'hidden' } }, this.$slots.default)\n },\n\n beforeDestroy(this: BubbleMenuInterface) {\n this.editor.unregisterPlugin(this.pluginKey)\n },\n}\n","import { Editor as CoreEditor } from '@tiptap/core'\nimport Vue from 'vue'\n\nexport class Editor extends CoreEditor {\n public contentComponent: Vue | null = null\n}\n","import Vue, { Component, CreateElement, PropType } from 'vue'\n\nimport { Editor } from './Editor.js'\n\nexport interface EditorContentInterface extends Vue {\n editor: Editor,\n}\n\nexport const EditorContent: Component = {\n name: 'EditorContent',\n\n props: {\n editor: {\n default: null,\n type: Object as PropType<Editor>,\n },\n },\n\n watch: {\n editor: {\n immediate: true,\n handler(this: EditorContentInterface, editor: Editor) {\n if (editor && editor.options.element) {\n this.$nextTick(() => {\n const element = this.$el\n\n if (!element || !editor.options.element.firstChild) {\n return\n }\n\n element.append(...editor.options.element.childNodes)\n editor.contentComponent = this\n\n editor.setOptions({\n element,\n })\n\n editor.createNodeViews()\n })\n }\n },\n },\n },\n\n render(createElement: CreateElement) {\n return createElement('div')\n },\n\n beforeDestroy(this: EditorContentInterface) {\n const { editor } = this\n\n if (!editor) {\n return\n }\n\n if (!editor.isDestroyed) {\n editor.view.setProps({\n nodeViews: {},\n })\n }\n\n editor.contentComponent = null\n\n if (!editor.options.element.firstChild) {\n return\n }\n\n const newElement = document.createElement('div')\n\n newElement.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element: newElement,\n })\n },\n}\n","import { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport Vue, { Component, CreateElement, PropType } from 'vue'\n\nexport interface FloatingMenuInterface extends Vue {\n pluginKey: FloatingMenuPluginProps['pluginKey'],\n tippyOptions: FloatingMenuPluginProps['tippyOptions'],\n editor: FloatingMenuPluginProps['editor'],\n shouldShow: FloatingMenuPluginProps['shouldShow'],\n}\n\nexport const FloatingMenu: Component = {\n name: 'FloatingMenu',\n\n props: {\n pluginKey: {\n type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],\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<FloatingMenuPluginProps['shouldShow'], null>>,\n default: null,\n },\n },\n\n watch: {\n editor: {\n immediate: true,\n handler(this: FloatingMenuInterface, editor: FloatingMenuPluginProps['editor']) {\n if (!editor) {\n return\n }\n\n this.$nextTick(() => {\n editor.registerPlugin(FloatingMenuPlugin({\n pluginKey: this.pluginKey,\n editor,\n element: this.$el as HTMLElement,\n tippyOptions: this.tippyOptions,\n shouldShow: this.shouldShow,\n }))\n })\n },\n },\n },\n\n render(this: FloatingMenuInterface, createElement: CreateElement) {\n return createElement('div', { style: { visibility: 'hidden' } }, this.$slots.default)\n },\n\n beforeDestroy(this: FloatingMenuInterface) {\n this.editor.unregisterPlugin(this.pluginKey)\n },\n}\n","import Vue, { Component, CreateElement } from 'vue'\n\nexport interface NodeViewContentInterface extends Vue {\n as: string,\n}\n\nexport const NodeViewContent: Component = {\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n render(this: NodeViewContentInterface, createElement: CreateElement) {\n return createElement(this.as, {\n style: {\n whiteSpace: 'pre-wrap',\n },\n attrs: {\n 'data-node-view-content': '',\n },\n })\n },\n}\n","import Vue, { Component, CreateElement } from 'vue'\n\nexport interface NodeViewWrapperInterface extends Vue {\n as: string,\n decorationClasses: {\n value: string,\n },\n onDragStart: Function,\n}\n\nexport const NodeViewWrapper: Component = {\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n inject: ['onDragStart', 'decorationClasses'],\n\n render(this: NodeViewWrapperInterface, createElement: CreateElement) {\n return createElement(\n this.as,\n {\n class: this.decorationClasses.value,\n style: {\n whiteSpace: 'normal',\n },\n attrs: {\n 'data-node-view-wrapper': '',\n },\n on: {\n dragstart: this.onDragStart,\n },\n },\n this.$slots.default,\n )\n },\n}\n","import Vue from 'vue'\nimport { VueConstructor } from 'vue/types/umd'\n\n/**\n * The VueRenderer class is responsible for rendering a Vue component as a ProseMirror node view.\n */\nexport class VueRenderer {\n ref!: Vue\n\n constructor(component: Vue | VueConstructor, props: any) {\n const Component = (typeof component === 'function') ? component : Vue.extend(component)\n\n this.ref = new Component(props).$mount()\n }\n\n get element(): Element {\n return this.ref.$el\n }\n\n updateProps(props: Record<string, any> = {}): void {\n if (!this.ref.$props) {\n return\n }\n\n // prevents `Avoid mutating a prop directly` error message\n // Fix: `VueNodeViewRenderer` change vue Constructor `config.silent` not working\n const currentVueConstructor = this.ref.$props.editor?.contentComponent?.$options._base ?? Vue // eslint-disable-line\n const originalSilent = currentVueConstructor.config.silent\n\n currentVueConstructor.config.silent = true\n\n Object\n .entries(props)\n .forEach(([key, value]) => {\n this.ref.$props[key] = value\n })\n\n currentVueConstructor.config.silent = originalSilent\n }\n\n destroy(): void {\n this.ref.$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 Vue from 'vue'\nimport { VueConstructor } from 'vue/types/umd'\nimport { booleanProp, functionProp, objectProp } from 'vue-ts-types'\n\nimport { Editor } from './Editor.js'\nimport { VueRenderer } from './VueRenderer.js'\n\nexport const nodeViewProps = {\n editor: objectProp<NodeViewProps['editor']>().required,\n node: objectProp<NodeViewProps['node']>().required,\n decorations: objectProp<NodeViewProps['decorations']>().required,\n selected: booleanProp().required,\n extension: objectProp<NodeViewProps['extension']>().required,\n getPos: functionProp<NodeViewProps['getPos']>().required,\n updateAttributes: functionProp<NodeViewProps['updateAttributes']>().required,\n deleteNode: functionProp<NodeViewProps['deleteNode']>().required,\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<Vue | VueConstructor, Editor, VueNodeViewRendererOptions> {\n renderer!: VueRenderer\n\n decorationClasses!: {\n value: string\n }\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 = Vue.observable({\n value: this.getDecorationClasses(),\n })\n\n // @ts-ignore\n const vue = this.editor.contentComponent?.$options._base ?? Vue // eslint-disable-line\n\n const Component = vue.extend(this.component).extend({\n props: Object.keys(props),\n provide: () => {\n return {\n onDragStart,\n decorationClasses: this.decorationClasses,\n }\n },\n })\n\n this.renderer = new VueRenderer(Component, {\n parent: this.editor.contentComponent,\n propsData: props,\n })\n }\n\n get dom() {\n if (!this.renderer.element.hasAttribute('data-node-view-wrapper')) {\n throw Error('Please use the NodeViewWrapper component for your node view.')\n }\n\n return this.renderer.element as HTMLElement\n }\n\n get contentDOM() {\n if (this.node.isLeaf) {\n return null\n }\n\n const contentElement = this.dom.querySelector('[data-node-view-content]')\n\n return (contentElement || this.dom) 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 this.renderer.element.classList.add('ProseMirror-selectednode')\n }\n\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n this.renderer.element.classList.remove('ProseMirror-selectednode')\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: Vue | VueConstructor,\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\n return new VueNodeView(component, props, options) as unknown as ProseMirrorNodeView\n }\n}\n"],"names":["CoreEditor"],"mappings":";;;;;;;AAWa,MAAA,UAAU,GAAc;AACnC,IAAA,IAAI,EAAE,YAAY;AAElB,IAAA,KAAK,EAAE;AACL,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,CAAC,MAAM,EAAE,MAAuE,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EAAE,OAAO,CAAmC,CAAA;AACrF,KAAC,CAAA;AACH;;;;"}
1
+ {"version":3,"sources":["../src/BubbleMenu.ts","../src/Editor.ts","../src/EditorContent.ts","../src/FloatingMenu.ts","../src/NodeViewContent.ts","../src/NodeViewWrapper.ts","../src/VueNodeViewRenderer.ts","../src/VueRenderer.ts","../src/index.ts"],"sourcesContent":["import { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport Vue, { Component, CreateElement, PropType } from 'vue'\n\nexport interface BubbleMenuInterface extends Vue {\n pluginKey: BubbleMenuPluginProps['pluginKey'],\n editor: BubbleMenuPluginProps['editor'],\n updateDelay: BubbleMenuPluginProps['updateDelay'],\n resizeDelay: BubbleMenuPluginProps['resizeDelay'],\n shouldShow: BubbleMenuPluginProps['shouldShow'],\n options: BubbleMenuPluginProps['options'],\n}\n\nexport const BubbleMenu: Component = {\n name: 'BubbleMenu',\n\n props: {\n pluginKey: {\n type: [String, Object as PropType<Exclude<BubbleMenuPluginProps['pluginKey'], string>>],\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 },\n\n options: {\n type: Object as PropType<BubbleMenuPluginProps['options']>,\n default: {},\n },\n\n resizeDelay: {\n type: Number as PropType<BubbleMenuPluginProps['resizeDelay']>,\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<BubbleMenuPluginProps['shouldShow'], null>>,\n default: null,\n },\n },\n\n watch: {\n editor: {\n immediate: true,\n handler(this: BubbleMenuInterface, editor: BubbleMenuPluginProps['editor']) {\n if (!editor) {\n return\n }\n\n (this.$el as HTMLElement).style.visibility = 'hidden';\n (this.$el as HTMLElement).style.position = 'absolute'\n\n this.$el.remove()\n\n this.$nextTick(() => {\n editor.registerPlugin(BubbleMenuPlugin({\n updateDelay: this.updateDelay,\n resizeDelay: this.resizeDelay,\n options: this.options,\n editor,\n element: this.$el as HTMLElement,\n pluginKey: this.pluginKey,\n shouldShow: this.shouldShow,\n }))\n })\n },\n },\n },\n\n render(this: BubbleMenuInterface, createElement: CreateElement) {\n return createElement('div', { style: { visibility: 'hidden' } }, this.$slots.default)\n },\n\n beforeDestroy(this: BubbleMenuInterface) {\n this.editor.unregisterPlugin(this.pluginKey)\n },\n}\n","import { Editor as CoreEditor } from '@tiptap/core'\nimport Vue from 'vue'\n\nexport class Editor extends CoreEditor {\n public contentComponent: Vue | null = null\n}\n","import Vue, { Component, CreateElement, PropType } from 'vue'\n\nimport { Editor } from './Editor.js'\n\nexport interface EditorContentInterface extends Vue {\n editor: Editor,\n}\n\nexport const EditorContent: Component = {\n name: 'EditorContent',\n\n props: {\n editor: {\n default: null,\n type: Object as PropType<Editor>,\n },\n },\n\n watch: {\n editor: {\n immediate: true,\n handler(this: EditorContentInterface, editor: Editor) {\n if (editor && editor.options.element) {\n this.$nextTick(() => {\n const element = this.$el\n\n if (!element || !editor.options.element.firstChild) {\n return\n }\n\n element.append(...editor.options.element.childNodes)\n editor.contentComponent = this\n\n editor.setOptions({\n element,\n })\n\n editor.createNodeViews()\n })\n }\n },\n },\n },\n\n render(createElement: CreateElement) {\n return createElement('div')\n },\n\n beforeDestroy(this: EditorContentInterface) {\n const { editor } = this\n\n if (!editor) {\n return\n }\n\n if (!editor.isDestroyed) {\n editor.view.setProps({\n nodeViews: {},\n })\n }\n\n editor.contentComponent = null\n\n if (!editor.options.element.firstChild) {\n return\n }\n\n const newElement = document.createElement('div')\n\n newElement.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element: newElement,\n })\n },\n}\n","import { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport Vue, { Component, CreateElement, PropType } from 'vue'\n\nexport interface FloatingMenuInterface extends Vue {\n pluginKey: FloatingMenuPluginProps['pluginKey'],\n options: FloatingMenuPluginProps['options'],\n editor: FloatingMenuPluginProps['editor'],\n shouldShow: FloatingMenuPluginProps['shouldShow'],\n}\n\nexport const FloatingMenu: Component = {\n name: 'FloatingMenu',\n\n props: {\n pluginKey: {\n type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],\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<FloatingMenuPluginProps['options']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<FloatingMenuPluginProps['shouldShow'], null>>,\n default: null,\n },\n },\n\n watch: {\n editor: {\n immediate: true,\n handler(this: FloatingMenuInterface, editor: FloatingMenuPluginProps['editor']) {\n if (!editor) {\n return\n }\n\n (this.$el as HTMLElement).style.visibility = 'hidden';\n (this.$el as HTMLElement).style.position = 'absolute'\n\n this.$el.remove()\n\n this.$nextTick(() => {\n editor.registerPlugin(FloatingMenuPlugin({\n pluginKey: this.pluginKey,\n editor,\n element: this.$el as HTMLElement,\n options: this.options,\n shouldShow: this.shouldShow,\n }))\n })\n },\n },\n },\n\n render(this: FloatingMenuInterface, createElement: CreateElement) {\n return createElement('div', { style: { visibility: 'hidden' } }, this.$slots.default)\n },\n\n beforeDestroy(this: FloatingMenuInterface) {\n this.editor.unregisterPlugin(this.pluginKey)\n },\n}\n","import Vue, { Component, CreateElement } from 'vue'\n\nexport interface NodeViewContentInterface extends Vue {\n as: string,\n}\n\nexport const NodeViewContent: Component = {\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n render(this: NodeViewContentInterface, createElement: CreateElement) {\n return createElement(this.as, {\n style: {\n whiteSpace: 'pre-wrap',\n },\n attrs: {\n 'data-node-view-content': '',\n },\n })\n },\n}\n","import Vue, { Component, CreateElement } from 'vue'\n\nexport interface NodeViewWrapperInterface extends Vue {\n as: string,\n decorationClasses: {\n value: string,\n },\n onDragStart: Function,\n}\n\nexport const NodeViewWrapper: Component = {\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n inject: ['onDragStart', 'decorationClasses'],\n\n render(this: NodeViewWrapperInterface, createElement: CreateElement) {\n return createElement(\n this.as,\n {\n class: this.decorationClasses.value,\n style: {\n whiteSpace: 'normal',\n },\n attrs: {\n 'data-node-view-wrapper': '',\n },\n on: {\n dragstart: this.onDragStart,\n },\n },\n this.$slots.default,\n )\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 Vue from 'vue'\nimport { VueConstructor } from 'vue/types/umd'\nimport { booleanProp, functionProp, objectProp } from 'vue-ts-types'\n\nimport { Editor } from './Editor.js'\nimport { VueRenderer } from './VueRenderer.js'\n\nexport const nodeViewProps = {\n editor: objectProp<NodeViewProps['editor']>().required,\n node: objectProp<NodeViewProps['node']>().required,\n decorations: objectProp<NodeViewProps['decorations']>().required,\n selected: booleanProp().required,\n extension: objectProp<NodeViewProps['extension']>().required,\n getPos: functionProp<NodeViewProps['getPos']>().required,\n updateAttributes: functionProp<NodeViewProps['updateAttributes']>().required,\n deleteNode: functionProp<NodeViewProps['deleteNode']>().required,\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<Vue | VueConstructor, Editor, VueNodeViewRendererOptions> {\n renderer!: VueRenderer\n\n decorationClasses!: {\n value: string\n }\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 = Vue.observable({\n value: this.getDecorationClasses(),\n })\n\n // @ts-ignore\n const vue = this.editor.contentComponent?.$options._base ?? Vue // eslint-disable-line\n\n const Component = vue.extend(this.component).extend({\n props: Object.keys(props),\n provide: () => {\n return {\n onDragStart,\n decorationClasses: this.decorationClasses,\n }\n },\n })\n\n this.renderer = new VueRenderer(Component, {\n parent: this.editor.contentComponent,\n propsData: props,\n })\n }\n\n get dom() {\n if (!this.renderer.element.hasAttribute('data-node-view-wrapper')) {\n throw Error('Please use the NodeViewWrapper component for your node view.')\n }\n\n return this.renderer.element as HTMLElement\n }\n\n get contentDOM() {\n if (this.node.isLeaf) {\n return null\n }\n\n const contentElement = this.dom.querySelector('[data-node-view-content]')\n\n return (contentElement || this.dom) 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 this.renderer.element.classList.add('ProseMirror-selectednode')\n }\n\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n this.renderer.element.classList.remove('ProseMirror-selectednode')\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: Vue | VueConstructor,\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\n return new VueNodeView(component, props, options) as unknown as ProseMirrorNodeView\n }\n}\n","import Vue from 'vue'\nimport { VueConstructor } from 'vue/types/umd'\n\n/**\n * The VueRenderer class is responsible for rendering a Vue component as a ProseMirror node view.\n */\nexport class VueRenderer {\n ref!: Vue\n\n constructor(component: Vue | VueConstructor, props: any) {\n const Component = (typeof component === 'function') ? component : Vue.extend(component)\n\n this.ref = new Component(props).$mount()\n }\n\n get element(): Element {\n return this.ref.$el\n }\n\n updateProps(props: Record<string, any> = {}): void {\n if (!this.ref.$props) {\n return\n }\n\n // prevents `Avoid mutating a prop directly` error message\n // Fix: `VueNodeViewRenderer` change vue Constructor `config.silent` not working\n const currentVueConstructor = this.ref.$props.editor?.contentComponent?.$options._base ?? Vue // eslint-disable-line\n const originalSilent = currentVueConstructor.config.silent\n\n currentVueConstructor.config.silent = true\n\n Object\n .entries(props)\n .forEach(([key, value]) => {\n this.ref.$props[key] = value\n })\n\n currentVueConstructor.config.silent = originalSilent\n }\n\n destroy(): void {\n this.ref.$destroy()\n }\n}\n","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 './VueNodeViewRenderer.js'\nexport * from './VueRenderer.js'\nexport * from '@tiptap/core'\n"],"mappings":";AAAA,SAAS,wBAA+C;AAYjD,IAAM,aAAwB;AAAA,EACnC,MAAM;AAAA,EAEN,OAAO;AAAA,IACL,WAAW;AAAA,MACT,MAAM,CAAC,QAAQ,MAAuE;AAAA,MACtF,SAAS;AAAA,IACX;AAAA,IAEA,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,UAAU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ACkB;AAClB,SAAO,CAAC,UAAiC;AAIvC,QAAI,CAAE,MAAM,OAAkB,kBAAkB;AAC9C,aAAO,CAAC;AAAA,IACV;AAEA,WAAO,IAAI,YAAY,WAAW,OAAO,OAAO;AAAA,EAClD;AACF;;;AE/KA,cAAc;","names":["Vue","Vue"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiptap/vue-2",
3
3
  "description": "Vue components for tiptap",
4
- "version": "2.6.2",
4
+ "version": "3.0.0-next.1",
5
5
  "homepage": "https://tiptap.dev",
6
6
  "keywords": [
7
7
  "tiptap",
@@ -14,33 +14,32 @@
14
14
  },
15
15
  "exports": {
16
16
  ".": {
17
- "types": "./dist/packages/vue-2/src/index.d.ts",
17
+ "types": "./dist/index.d.ts",
18
18
  "import": "./dist/index.js",
19
19
  "require": "./dist/index.cjs"
20
20
  }
21
21
  },
22
22
  "main": "dist/index.cjs",
23
23
  "module": "dist/index.js",
24
- "umd": "dist/index.umd.js",
25
- "types": "dist/packages/vue-2/src/index.d.ts",
24
+ "types": "dist/index.d.ts",
26
25
  "type": "module",
27
26
  "files": [
28
27
  "src",
29
28
  "dist"
30
29
  ],
31
30
  "dependencies": {
32
- "@tiptap/extension-bubble-menu": "^2.6.2",
33
- "@tiptap/extension-floating-menu": "^2.6.2",
31
+ "@tiptap/extension-bubble-menu": "^3.0.0-next.1",
32
+ "@tiptap/extension-floating-menu": "^3.0.0-next.1",
34
33
  "vue-ts-types": "^1.6.0"
35
34
  },
36
35
  "devDependencies": {
37
- "@tiptap/core": "^2.6.2",
38
- "@tiptap/pm": "^2.6.2",
36
+ "@tiptap/core": "^3.0.0-next.1",
37
+ "@tiptap/pm": "^3.0.0-next.1",
39
38
  "vue": "^2.6.0"
40
39
  },
41
40
  "peerDependencies": {
42
- "@tiptap/core": "^2.6.2",
43
- "@tiptap/pm": "^2.6.2",
41
+ "@tiptap/core": "^3.0.0-next.1",
42
+ "@tiptap/pm": "^3.0.0-next.1",
44
43
  "vue": "^2.6.0"
45
44
  },
46
45
  "repository": {
@@ -50,7 +49,6 @@
50
49
  },
51
50
  "sideEffects": false,
52
51
  "scripts": {
53
- "clean": "rm -rf dist",
54
- "build": "npm run clean && rollup -c"
52
+ "build": "tsup"
55
53
  }
56
54
  }
package/src/BubbleMenu.ts CHANGED
@@ -4,9 +4,10 @@ import Vue, { Component, CreateElement, PropType } from 'vue'
4
4
  export interface BubbleMenuInterface extends Vue {
5
5
  pluginKey: BubbleMenuPluginProps['pluginKey'],
6
6
  editor: BubbleMenuPluginProps['editor'],
7
- tippyOptions: BubbleMenuPluginProps['tippyOptions'],
8
7
  updateDelay: BubbleMenuPluginProps['updateDelay'],
8
+ resizeDelay: BubbleMenuPluginProps['resizeDelay'],
9
9
  shouldShow: BubbleMenuPluginProps['shouldShow'],
10
+ options: BubbleMenuPluginProps['options'],
10
11
  }
11
12
 
12
13
  export const BubbleMenu: Component = {
@@ -27,9 +28,13 @@ export const BubbleMenu: Component = {
27
28
  type: Number as PropType<BubbleMenuPluginProps['updateDelay']>,
28
29
  },
29
30
 
30
- tippyOptions: {
31
- type: Object as PropType<BubbleMenuPluginProps['tippyOptions']>,
32
- default: () => ({}),
31
+ options: {
32
+ type: Object as PropType<BubbleMenuPluginProps['options']>,
33
+ default: {},
34
+ },
35
+
36
+ resizeDelay: {
37
+ type: Number as PropType<BubbleMenuPluginProps['resizeDelay']>,
33
38
  },
34
39
 
35
40
  shouldShow: {
@@ -46,14 +51,20 @@ export const BubbleMenu: Component = {
46
51
  return
47
52
  }
48
53
 
54
+ (this.$el as HTMLElement).style.visibility = 'hidden';
55
+ (this.$el as HTMLElement).style.position = 'absolute'
56
+
57
+ this.$el.remove()
58
+
49
59
  this.$nextTick(() => {
50
60
  editor.registerPlugin(BubbleMenuPlugin({
51
61
  updateDelay: this.updateDelay,
62
+ resizeDelay: this.resizeDelay,
63
+ options: this.options,
52
64
  editor,
53
65
  element: this.$el as HTMLElement,
54
66
  pluginKey: this.pluginKey,
55
67
  shouldShow: this.shouldShow,
56
- tippyOptions: this.tippyOptions,
57
68
  }))
58
69
  })
59
70
  },
@@ -3,7 +3,7 @@ import Vue, { Component, CreateElement, PropType } from 'vue'
3
3
 
4
4
  export interface FloatingMenuInterface extends Vue {
5
5
  pluginKey: FloatingMenuPluginProps['pluginKey'],
6
- tippyOptions: FloatingMenuPluginProps['tippyOptions'],
6
+ options: FloatingMenuPluginProps['options'],
7
7
  editor: FloatingMenuPluginProps['editor'],
8
8
  shouldShow: FloatingMenuPluginProps['shouldShow'],
9
9
  }
@@ -22,8 +22,8 @@ export const FloatingMenu: Component = {
22
22
  required: true,
23
23
  },
24
24
 
25
- tippyOptions: {
26
- type: Object as PropType<FloatingMenuPluginProps['tippyOptions']>,
25
+ options: {
26
+ type: Object as PropType<FloatingMenuPluginProps['options']>,
27
27
  default: () => ({}),
28
28
  },
29
29
 
@@ -41,12 +41,17 @@ export const FloatingMenu: Component = {
41
41
  return
42
42
  }
43
43
 
44
+ (this.$el as HTMLElement).style.visibility = 'hidden';
45
+ (this.$el as HTMLElement).style.position = 'absolute'
46
+
47
+ this.$el.remove()
48
+
44
49
  this.$nextTick(() => {
45
50
  editor.registerPlugin(FloatingMenuPlugin({
46
51
  pluginKey: this.pluginKey,
47
52
  editor,
48
53
  element: this.$el as HTMLElement,
49
- tippyOptions: this.tippyOptions,
54
+ options: this.options,
50
55
  shouldShow: this.shouldShow,
51
56
  }))
52
57
  })
package/dist/index.umd.js DELETED
@@ -1,379 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tiptap/extension-bubble-menu'), require('@tiptap/core'), require('@tiptap/extension-floating-menu'), require('vue'), require('vue-ts-types')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@tiptap/extension-bubble-menu', '@tiptap/core', '@tiptap/extension-floating-menu', 'vue', 'vue-ts-types'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@tiptap/vue-2"] = {}, global.extensionBubbleMenu, global.core, global.extensionFloatingMenu, global.Vue, global.vueTsTypes));
5
- })(this, (function (exports, extensionBubbleMenu, core, extensionFloatingMenu, Vue, vueTsTypes) { 'use strict';
6
-
7
- const BubbleMenu = {
8
- name: 'BubbleMenu',
9
- props: {
10
- pluginKey: {
11
- type: [String, Object],
12
- default: 'bubbleMenu',
13
- },
14
- editor: {
15
- type: Object,
16
- required: true,
17
- },
18
- updateDelay: {
19
- type: Number,
20
- },
21
- tippyOptions: {
22
- type: Object,
23
- default: () => ({}),
24
- },
25
- shouldShow: {
26
- type: Function,
27
- default: null,
28
- },
29
- },
30
- watch: {
31
- editor: {
32
- immediate: true,
33
- handler(editor) {
34
- if (!editor) {
35
- return;
36
- }
37
- this.$nextTick(() => {
38
- editor.registerPlugin(extensionBubbleMenu.BubbleMenuPlugin({
39
- updateDelay: this.updateDelay,
40
- editor,
41
- element: this.$el,
42
- pluginKey: this.pluginKey,
43
- shouldShow: this.shouldShow,
44
- tippyOptions: this.tippyOptions,
45
- }));
46
- });
47
- },
48
- },
49
- },
50
- render(createElement) {
51
- return createElement('div', { style: { visibility: 'hidden' } }, this.$slots.default);
52
- },
53
- beforeDestroy() {
54
- this.editor.unregisterPlugin(this.pluginKey);
55
- },
56
- };
57
-
58
- class Editor extends core.Editor {
59
- constructor() {
60
- super(...arguments);
61
- this.contentComponent = null;
62
- }
63
- }
64
-
65
- const EditorContent = {
66
- name: 'EditorContent',
67
- props: {
68
- editor: {
69
- default: null,
70
- type: Object,
71
- },
72
- },
73
- watch: {
74
- editor: {
75
- immediate: true,
76
- handler(editor) {
77
- if (editor && editor.options.element) {
78
- this.$nextTick(() => {
79
- const element = this.$el;
80
- if (!element || !editor.options.element.firstChild) {
81
- return;
82
- }
83
- element.append(...editor.options.element.childNodes);
84
- editor.contentComponent = this;
85
- editor.setOptions({
86
- element,
87
- });
88
- editor.createNodeViews();
89
- });
90
- }
91
- },
92
- },
93
- },
94
- render(createElement) {
95
- return createElement('div');
96
- },
97
- beforeDestroy() {
98
- const { editor } = this;
99
- if (!editor) {
100
- return;
101
- }
102
- if (!editor.isDestroyed) {
103
- editor.view.setProps({
104
- nodeViews: {},
105
- });
106
- }
107
- editor.contentComponent = null;
108
- if (!editor.options.element.firstChild) {
109
- return;
110
- }
111
- const newElement = document.createElement('div');
112
- newElement.append(...editor.options.element.childNodes);
113
- editor.setOptions({
114
- element: newElement,
115
- });
116
- },
117
- };
118
-
119
- const FloatingMenu = {
120
- name: 'FloatingMenu',
121
- props: {
122
- pluginKey: {
123
- type: [String, Object],
124
- default: 'floatingMenu',
125
- },
126
- editor: {
127
- type: Object,
128
- required: true,
129
- },
130
- tippyOptions: {
131
- type: Object,
132
- default: () => ({}),
133
- },
134
- shouldShow: {
135
- type: Function,
136
- default: null,
137
- },
138
- },
139
- watch: {
140
- editor: {
141
- immediate: true,
142
- handler(editor) {
143
- if (!editor) {
144
- return;
145
- }
146
- this.$nextTick(() => {
147
- editor.registerPlugin(extensionFloatingMenu.FloatingMenuPlugin({
148
- pluginKey: this.pluginKey,
149
- editor,
150
- element: this.$el,
151
- tippyOptions: this.tippyOptions,
152
- shouldShow: this.shouldShow,
153
- }));
154
- });
155
- },
156
- },
157
- },
158
- render(createElement) {
159
- return createElement('div', { style: { visibility: 'hidden' } }, this.$slots.default);
160
- },
161
- beforeDestroy() {
162
- this.editor.unregisterPlugin(this.pluginKey);
163
- },
164
- };
165
-
166
- const NodeViewContent = {
167
- props: {
168
- as: {
169
- type: String,
170
- default: 'div',
171
- },
172
- },
173
- render(createElement) {
174
- return createElement(this.as, {
175
- style: {
176
- whiteSpace: 'pre-wrap',
177
- },
178
- attrs: {
179
- 'data-node-view-content': '',
180
- },
181
- });
182
- },
183
- };
184
-
185
- const NodeViewWrapper = {
186
- props: {
187
- as: {
188
- type: String,
189
- default: 'div',
190
- },
191
- },
192
- inject: ['onDragStart', 'decorationClasses'],
193
- render(createElement) {
194
- return createElement(this.as, {
195
- class: this.decorationClasses.value,
196
- style: {
197
- whiteSpace: 'normal',
198
- },
199
- attrs: {
200
- 'data-node-view-wrapper': '',
201
- },
202
- on: {
203
- dragstart: this.onDragStart,
204
- },
205
- }, this.$slots.default);
206
- },
207
- };
208
-
209
- /**
210
- * The VueRenderer class is responsible for rendering a Vue component as a ProseMirror node view.
211
- */
212
- class VueRenderer {
213
- constructor(component, props) {
214
- const Component = (typeof component === 'function') ? component : Vue.extend(component);
215
- this.ref = new Component(props).$mount();
216
- }
217
- get element() {
218
- return this.ref.$el;
219
- }
220
- updateProps(props = {}) {
221
- var _a, _b, _c;
222
- if (!this.ref.$props) {
223
- return;
224
- }
225
- // prevents `Avoid mutating a prop directly` error message
226
- // Fix: `VueNodeViewRenderer` change vue Constructor `config.silent` not working
227
- const currentVueConstructor = (_c = (_b = (_a = this.ref.$props.editor) === null || _a === void 0 ? void 0 : _a.contentComponent) === null || _b === void 0 ? void 0 : _b.$options._base) !== null && _c !== void 0 ? _c : Vue; // eslint-disable-line
228
- const originalSilent = currentVueConstructor.config.silent;
229
- currentVueConstructor.config.silent = true;
230
- Object
231
- .entries(props)
232
- .forEach(([key, value]) => {
233
- this.ref.$props[key] = value;
234
- });
235
- currentVueConstructor.config.silent = originalSilent;
236
- }
237
- destroy() {
238
- this.ref.$destroy();
239
- }
240
- }
241
-
242
- const nodeViewProps = {
243
- editor: vueTsTypes.objectProp().required,
244
- node: vueTsTypes.objectProp().required,
245
- decorations: vueTsTypes.objectProp().required,
246
- selected: vueTsTypes.booleanProp().required,
247
- extension: vueTsTypes.objectProp().required,
248
- getPos: vueTsTypes.functionProp().required,
249
- updateAttributes: vueTsTypes.functionProp().required,
250
- deleteNode: vueTsTypes.functionProp().required,
251
- };
252
- class VueNodeView extends core.NodeView {
253
- mount() {
254
- var _a, _b;
255
- const props = {
256
- editor: this.editor,
257
- node: this.node,
258
- decorations: this.decorations,
259
- selected: false,
260
- extension: this.extension,
261
- getPos: () => this.getPos(),
262
- updateAttributes: (attributes = {}) => this.updateAttributes(attributes),
263
- deleteNode: () => this.deleteNode(),
264
- };
265
- const onDragStart = this.onDragStart.bind(this);
266
- this.decorationClasses = Vue.observable({
267
- value: this.getDecorationClasses(),
268
- });
269
- // @ts-ignore
270
- const vue = (_b = (_a = this.editor.contentComponent) === null || _a === void 0 ? void 0 : _a.$options._base) !== null && _b !== void 0 ? _b : Vue; // eslint-disable-line
271
- const Component = vue.extend(this.component).extend({
272
- props: Object.keys(props),
273
- provide: () => {
274
- return {
275
- onDragStart,
276
- decorationClasses: this.decorationClasses,
277
- };
278
- },
279
- });
280
- this.renderer = new VueRenderer(Component, {
281
- parent: this.editor.contentComponent,
282
- propsData: props,
283
- });
284
- }
285
- get dom() {
286
- if (!this.renderer.element.hasAttribute('data-node-view-wrapper')) {
287
- throw Error('Please use the NodeViewWrapper component for your node view.');
288
- }
289
- return this.renderer.element;
290
- }
291
- get contentDOM() {
292
- if (this.node.isLeaf) {
293
- return null;
294
- }
295
- const contentElement = this.dom.querySelector('[data-node-view-content]');
296
- return (contentElement || this.dom);
297
- }
298
- update(node, decorations) {
299
- const updateProps = (props) => {
300
- this.decorationClasses.value = this.getDecorationClasses();
301
- this.renderer.updateProps(props);
302
- };
303
- if (typeof this.options.update === 'function') {
304
- const oldNode = this.node;
305
- const oldDecorations = this.decorations;
306
- this.node = node;
307
- this.decorations = decorations;
308
- return this.options.update({
309
- oldNode,
310
- oldDecorations,
311
- newNode: node,
312
- newDecorations: decorations,
313
- updateProps: () => updateProps({ node, decorations }),
314
- });
315
- }
316
- if (node.type !== this.node.type) {
317
- return false;
318
- }
319
- if (node === this.node && this.decorations === decorations) {
320
- return true;
321
- }
322
- this.node = node;
323
- this.decorations = decorations;
324
- updateProps({ node, decorations });
325
- return true;
326
- }
327
- selectNode() {
328
- this.renderer.updateProps({
329
- selected: true,
330
- });
331
- this.renderer.element.classList.add('ProseMirror-selectednode');
332
- }
333
- deselectNode() {
334
- this.renderer.updateProps({
335
- selected: false,
336
- });
337
- this.renderer.element.classList.remove('ProseMirror-selectednode');
338
- }
339
- getDecorationClasses() {
340
- return (this.decorations
341
- // @ts-ignore
342
- .map(item => item.type.attrs.class)
343
- .flat()
344
- .join(' '));
345
- }
346
- destroy() {
347
- this.renderer.destroy();
348
- }
349
- }
350
- function VueNodeViewRenderer(component, options) {
351
- return (props) => {
352
- // try to get the parent component
353
- // this is important for vue devtools to show the component hierarchy correctly
354
- // maybe it’s `undefined` because <editor-content> isn’t rendered yet
355
- if (!props.editor.contentComponent) {
356
- return {};
357
- }
358
- return new VueNodeView(component, props, options);
359
- };
360
- }
361
-
362
- exports.BubbleMenu = BubbleMenu;
363
- exports.Editor = Editor;
364
- exports.EditorContent = EditorContent;
365
- exports.FloatingMenu = FloatingMenu;
366
- exports.NodeViewContent = NodeViewContent;
367
- exports.NodeViewWrapper = NodeViewWrapper;
368
- exports.VueNodeViewRenderer = VueNodeViewRenderer;
369
- exports.VueRenderer = VueRenderer;
370
- exports.nodeViewProps = nodeViewProps;
371
- Object.keys(core).forEach(function (k) {
372
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
373
- enumerable: true,
374
- get: function () { return core[k]; }
375
- });
376
- });
377
-
378
- }));
379
- //# sourceMappingURL=index.umd.js.map