fix tippy for suggestions

This commit is contained in:
Philipp Kühn 2019-04-11 20:13:52 +02:00
parent 03cb2a1cce
commit d8f62f010a

View File

@ -159,6 +159,7 @@ export default {
filteredUsers: [], filteredUsers: [],
navigatedUserIndex: 0, navigatedUserIndex: 0,
insertMention: () => {}, insertMention: () => {},
observer: null,
} }
}, },
@ -222,20 +223,35 @@ export default {
interactive: true, interactive: true,
theme: 'dark', theme: 'dark',
placement: 'top-start', placement: 'top-start',
performance: true,
inertia: true, inertia: true,
duration: [400, 200], duration: [400, 200],
showOnInit: true, showOnInit: true,
arrow: true, arrow: true,
arrowType: 'round', arrowType: 'round',
}) })
// we have to update tippy whenever the DOM is updated
if (MutationObserver) {
this.observer = new MutationObserver(() => {
this.popup.popperInstance.scheduleUpdate()
})
this.observer.observe(this.$refs.suggestions, {
childList: true,
subtree: true,
characterData: true,
})
}
}, },
destroyPopup() { destroyPopup() {
if (this.popup) { if (this.popup) {
this.popup.destroyAll() this.popup.destroy()
this.popup = null this.popup = null
} }
if (this.observer) {
this.observer.disconnect()
}
}, },
}, },
@ -244,7 +260,6 @@ export default {
<style lang="scss"> <style lang="scss">
@import "~variables"; @import "~variables";
@import '~modules/tippy.js/dist/tippy.css';
.mention { .mention {
background: rgba($color-black, 0.1); background: rgba($color-black, 0.1);