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

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

View File

@@ -0,0 +1,41 @@
import {
h,
ref,
PropType,
onMounted,
onBeforeUnmount,
defineComponent,
} from 'vue'
import {
FloatingMenuPlugin,
FloatingMenuPluginKey,
FloatingMenuPluginProps,
} from '@tiptap/extension-floating-menu'
export const FloatingMenu = defineComponent({
name: 'FloatingMenu',
props: {
editor: {
type: Object as PropType<FloatingMenuPluginProps['editor']>,
required: true,
},
},
setup({ editor }, { slots }) {
const root = ref<HTMLElement | null>(null)
onMounted(() => {
editor.registerPlugin(FloatingMenuPlugin({
editor,
element: root.value as HTMLElement,
}))
})
onBeforeUnmount(() => {
editor.unregisterPlugin(FloatingMenuPluginKey)
})
return () => h('div', { ref: root }, slots.default?.())
},
})

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 './useEditor'
export * from './VueRenderer'
export * from './VueNodeViewRenderer'