From 5aec13caa130b6c8b4c4baddca554fbb579b865c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Mon, 15 Jul 2019 09:03:09 +0200 Subject: [PATCH] Refactored avoiding Hashtags in Comments --- webapp/components/Editor/Editor.vue | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/webapp/components/Editor/Editor.vue b/webapp/components/Editor/Editor.vue index bb86106cb..740578f50 100644 --- a/webapp/components/Editor/Editor.vue +++ b/webapp/components/Editor/Editor.vue @@ -224,11 +224,9 @@ export default { doc: { type: Object, default: () => {} }, }, data() { - let mentionExtension - if (!this.users) { - mentionExtension = [] - } else { - mentionExtension = [ + let optionalExtensions = [] + if (this.users) { + optionalExtensions.push( new Mention({ // a list of all suggested items items: () => { @@ -300,14 +298,10 @@ export default { return fuse.search(query) }, }), - ] + ) } - - let hashtagExtension - if (!this.hashtags) { - hashtagExtension = [] - } else { - hashtagExtension = [ + if (this.hashtags) { + optionalExtensions.push( new Hashtag({ // a list of all suggested items items: () => { @@ -385,7 +379,7 @@ export default { ) }, }), - ] + ) } return { @@ -413,8 +407,7 @@ export default { emptyNodeText: this.placeholder || this.$t('editor.placeholder'), }), new History(), - ...mentionExtension, - ...hashtagExtension, + ...optionalExtensions, ], onUpdate: e => { clearTimeout(throttleInputEvent)