fix: allow mentions in comment

This commit is contained in:
Shariq Ansari 2024-01-25 19:59:00 +05:30
parent 58aa8e5a13
commit a4613c5699
2 changed files with 15 additions and 1 deletions

View File

@ -7,6 +7,7 @@
:starterkit-options="{ heading: { levels: [2, 3, 4, 5, 6] } }"
:placeholder="placeholder"
:editable="editable"
:mentions="users"
>
<template v-slot:editor="{ editor }">
<EditorContent
@ -78,6 +79,7 @@
<script setup>
import AttachmentIcon from '@/components/Icons/AttachmentIcon.vue'
import AttachmentItem from '@/components/AttachmentItem.vue'
import { usersStore } from '@/stores/users'
import { TextEditorFixedMenu, TextEditor, FileUploader } from 'frappe-ui'
import { EditorContent } from '@tiptap/vue-3'
import { ref, computed, defineModel } from 'vue'
@ -117,6 +119,8 @@ const emit = defineEmits(['change'])
const modelValue = defineModel()
const attachments = defineModel('attachments')
const { users: usersList } = usersStore()
const textEditor = ref(null)
const editor = computed(() => {
@ -127,6 +131,17 @@ function removeAttachment(attachment) {
attachments.value = attachments.value.filter((a) => a !== attachment)
}
const users = computed(() => {
return (
usersList.data
?.filter((user) => user.enabled)
.map((user) => ({
label: user.full_name.trimEnd(),
value: user.name,
})) || []
)
})
defineExpose({ editor })
const textEditorMenuButtons = [

View File

@ -30,7 +30,6 @@ export const usersStore = defineStore('crm-users', () => {
email = session.user
}
if (!usersByName[email]) {
users.reload()
usersByName[email] = {
name: email,
email: email,