From fbe4de347bf8a4f0ac6115096773113fb2e0daee Mon Sep 17 00:00:00 2001 From: Alina Beck Date: Fri, 23 Aug 2019 22:30:05 +0100 Subject: [PATCH] extract suggestions menu into separate component --- webapp/components/Editor/Editor.vue | 62 +++++--------------- webapp/components/Editor/SuggestionsMenu.vue | 59 +++++++++++++++++++ 2 files changed, 75 insertions(+), 46 deletions(-) create mode 100644 webapp/components/Editor/SuggestionsMenu.vue diff --git a/webapp/components/Editor/Editor.vue b/webapp/components/Editor/Editor.vue index 72b95771d..d660e9d15 100644 --- a/webapp/components/Editor/Editor.vue +++ b/webapp/components/Editor/Editor.vue @@ -1,48 +1,16 @@ @@ -96,6 +64,7 @@ import Hashtag from './nodes/Hashtag.js' import Mention from './nodes/Mention.js' import { mapGetters } from 'vuex' import MenuBar from './MenuBar' +import SuggestionsMenu from './SuggestionsMenu' let throttleInputEvent @@ -104,6 +73,7 @@ export default { EditorContent, EditorMenuBubble, MenuBar, + SuggestionsMenu, }, props: { users: { type: Array, default: () => null }, // If 'null', than the Mention extention is not assigned. @@ -400,7 +370,7 @@ export default { return } this.popup = tippy(node, { - content: this.$refs.suggestions, + content: this.$refs.suggestions.$el, trigger: 'mouseenter', interactive: true, theme: 'dark', @@ -416,7 +386,7 @@ export default { this.observer = new MutationObserver(() => { this.popup.popperInstance.scheduleUpdate() }) - this.observer.observe(this.$refs.suggestions, { + this.observer.observe(this.$refs.suggestions.$el, { childList: true, subtree: true, characterData: true, diff --git a/webapp/components/Editor/SuggestionsMenu.vue b/webapp/components/Editor/SuggestionsMenu.vue new file mode 100644 index 000000000..54877acc3 --- /dev/null +++ b/webapp/components/Editor/SuggestionsMenu.vue @@ -0,0 +1,59 @@ + + +