mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2026-01-14 00:44:34 +00:00
Add mention '@all' in webapp
This commit is contained in:
parent
a5578e4ff4
commit
32758de23a
@ -21,6 +21,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import { Editor, EditorContent } from 'tiptap'
|
||||
import { History } from 'tiptap-extensions'
|
||||
import linkify from 'linkify-it'
|
||||
@ -68,6 +69,10 @@ export default {
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
currentUser: 'auth/user',
|
||||
isAdmin: 'auth/isAdmin',
|
||||
}),
|
||||
placeholder() {
|
||||
return this.$t('editor.placeholder')
|
||||
},
|
||||
@ -78,6 +83,15 @@ export default {
|
||||
extensions.push(
|
||||
new Mention({
|
||||
items: () => {
|
||||
if (this.isAdmin)
|
||||
return [
|
||||
...this.users,
|
||||
{
|
||||
id: this.currentUser.id,
|
||||
slug: this.$t('editor.mention.atAllLabel'),
|
||||
dataMentionId: 'all',
|
||||
},
|
||||
]
|
||||
return this.users
|
||||
},
|
||||
onEnter: (props) => this.openSuggestionList(props, MENTION),
|
||||
@ -227,6 +241,7 @@ export default {
|
||||
const typeAttrs = {
|
||||
mention: {
|
||||
id: item.id,
|
||||
dataMentionId: item.dataMentionId ?? item.id,
|
||||
label: item.slug,
|
||||
},
|
||||
hashtag: {
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
import { HASHTAG, MENTION } from '../../constants/editor'
|
||||
|
||||
export default {
|
||||
name: 'SuggestionList',
|
||||
props: {
|
||||
suggestionType: String,
|
||||
filteredItems: Array,
|
||||
|
||||
@ -14,7 +14,7 @@ export default class Mention extends TipTapMention {
|
||||
{
|
||||
class: this.options.mentionClass,
|
||||
href: `/profile/${node.attrs.id}`,
|
||||
'data-mention-id': node.attrs.id,
|
||||
'data-mention-id': node.attrs.dataMentionId,
|
||||
target: '_blank',
|
||||
},
|
||||
`${this.options.matcher.char}${node.attrs.label} `,
|
||||
|
||||
@ -393,6 +393,7 @@
|
||||
"unorderedList": "Ungeordnete Liste"
|
||||
},
|
||||
"mention": {
|
||||
"atAllLabel": "alle",
|
||||
"noUsersFound": "Keine Nutzer gefunden"
|
||||
},
|
||||
"placeholder": "Schreib etwas Inspirierendes …"
|
||||
|
||||
@ -393,6 +393,7 @@
|
||||
"unorderedList": "Unordered list"
|
||||
},
|
||||
"mention": {
|
||||
"atAllLabel": "all",
|
||||
"noUsersFound": "No users found"
|
||||
},
|
||||
"placeholder": "Leave your inspirational thoughts …"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user