Merge branch 'feature/extension-floating-menu'

# Conflicts:
#	packages/react/package.json
#	packages/vue-2/package.json
#	packages/vue-3/package.json
This commit is contained in:
Philipp Kühn
2021-04-01 15:57:23 +02:00
19 changed files with 496 additions and 0 deletions

View File

@@ -27,6 +27,7 @@
},
"dependencies": {
"@tiptap/extension-bubble-menu": "^2.0.0-beta.4",
"@tiptap/extension-floating-menu": "^2.0.0-beta.0",
"prosemirror-view": "^1.18.2"
}
}

View File

@@ -0,0 +1,39 @@
import Vue, { PropType } from 'vue'
import { FloatingMenuPlugin, FloatingMenuPluginKey, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'
export const FloatingMenu = Vue.extend({
name: 'FloatingMenu',
props: {
editor: {
type: Object as PropType<FloatingMenuPluginProps['editor']>,
required: true,
},
},
watch: {
editor: {
immediate: true,
handler(editor: FloatingMenuPluginProps['editor']) {
if (!editor) {
return
}
this.$nextTick(() => {
editor.registerPlugin(FloatingMenuPlugin({
editor,
element: this.$el as HTMLElement,
}))
})
},
},
},
render(createElement) {
return createElement('div', {}, this.$slots.default)
},
beforeDestroy() {
this.editor.unregisterPlugin(FloatingMenuPluginKey)
},
})

View File

@@ -2,6 +2,7 @@ export * from '@tiptap/core'
export * from './BubbleMenu'
export { Editor } from './Editor'
export * from './EditorContent'
export * from './FloatingMenu'
export * from './VueRenderer'
export * from './VueNodeViewRenderer'
export * from './NodeViewWrapper'