Refactored avoiding Hashtags in Comments

This commit is contained in:
Wolfgang Huß 2019-07-15 09:03:09 +02:00
parent 2c9855e584
commit 5aec13caa1

View File

@ -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)