refactoring

This commit is contained in:
Philipp Kühn
2021-01-19 12:50:09 +01:00
committed by Hans Pagel
parent 19c3599605
commit 008fd9b519
2 changed files with 58 additions and 39 deletions

View File

@@ -31,45 +31,47 @@ export default {
Paragraph,
Text,
Mention.configure({
items: query => {
return ['Hans', 'Philipp', 'Kris'].filter(item => item.startsWith(query))
},
render: () => {
let component
let popup
suggestionOptions: {
items: query => {
return ['Hans', 'Philipp', 'Kris'].filter(item => item.startsWith(query))
},
render: () => {
let component
let popup
return {
onStart: props => {
component = new VueRenderer(MentionList, {
parent: this,
propsData: props,
})
return {
onStart: props => {
component = new VueRenderer(MentionList, {
parent: this,
propsData: props,
})
popup = tippy('body', {
getReferenceClientRect: () => props.clientRect,
appendTo: () => document.body,
content: component.element,
showOnCreate: true,
interactive: true,
trigger: 'manual',
placement: 'top-start',
})
},
onUpdate(props) {
component.updateProps(props)
popup = tippy('body', {
getReferenceClientRect: () => props.clientRect,
appendTo: () => document.body,
content: component.element,
showOnCreate: true,
interactive: true,
trigger: 'manual',
placement: 'top-start',
})
},
onUpdate(props) {
component.updateProps(props)
popup[0].setProps({
getReferenceClientRect: () => props.clientRect,
})
},
onKeyDown(props) {
return component.vm.onKeyDown(props)
},
onExit() {
popup[0].destroy()
component.destroy()
},
}
popup[0].setProps({
getReferenceClientRect: () => props.clientRect,
})
},
onKeyDown(props) {
return component.vm.onKeyDown(props)
},
onExit() {
popup[0].destroy()
component.destroy()
},
}
},
},
}),
],