refactoring

This commit is contained in:
Philipp Kühn
2021-01-18 15:34:54 +01:00
committed by Hans Pagel
parent 3cb4b0f71f
commit 1892b8f893
2 changed files with 13 additions and 17 deletions

View File

@@ -32,33 +32,32 @@ export default {
Text,
Mention.configure({
items: query => {
return ['foo', 'bar']
return ['foo', 'bar'].filter(item => item.startsWith(query))
},
renderer: () => {
let component
let popup
return {
onStart(props) {
component = new VueRenderer(MentionList, props)
onStart: props => {
component = new VueRenderer(MentionList, {
parent: this,
propsData: props,
})
popup = tippy('.app', {
popup = tippy('body', {
getReferenceClientRect: () => props.virtualNode.getBoundingClientRect(),
appendTo: () => document.body,
interactive: true,
sticky: true,
plugins: [sticky],
content: component.element,
trigger: 'mouseenter',
showOnCreate: true,
theme: 'dark',
interactive: true,
trigger: 'manual',
placement: 'top-start',
inertia: true,
duration: [400, 200],
})
},
onUpdate(props) {
component.update(props)
component.updateProps(props)
},
onExit() {
popup[0].destroy()