1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
<template>
<NodeViewWrapper as="span" class="mention" contenteditable="false">
<NcUserBubble :user="node.attrs.id"
:display-name="username"
:primary="isCurrentUser"
class="mention-user-bubble">
@{{ username }}
</NcUserBubble>
</NodeViewWrapper>
</template>
<script>
import NcUserBubble from '@nextcloud/vue/dist/Components/NcUserBubble.js'
import { NodeViewWrapper } from '@tiptap/vue-2'
import { getCurrentUser } from '@nextcloud/auth'
export default {
name: 'Mention',
components: {
NcUserBubble,
NodeViewWrapper,
},
props: {
updateAttributes: {
type: Function,
required: true,
},
node: {
type: Object,
required: true,
},
},
data() {
return {
username: this.node.attrs.label,
}
},
computed: {
isCurrentUser() {
return this.node.attrs.id === getCurrentUser()?.uid
},
},
}
</script>
<style scoped>
/* This is required to properly render the bubble text (which seems linke a browser bug) */
.text-editor__wrapper div.ProseMirror .mention[contenteditable=false] :deep(*) {
-webkit-user-modify: read-only !important;
}
</style>
|