fix: allow mentions in comment
This commit is contained in:
parent
58aa8e5a13
commit
a4613c5699
@ -7,6 +7,7 @@
|
|||||||
:starterkit-options="{ heading: { levels: [2, 3, 4, 5, 6] } }"
|
:starterkit-options="{ heading: { levels: [2, 3, 4, 5, 6] } }"
|
||||||
:placeholder="placeholder"
|
:placeholder="placeholder"
|
||||||
:editable="editable"
|
:editable="editable"
|
||||||
|
:mentions="users"
|
||||||
>
|
>
|
||||||
<template v-slot:editor="{ editor }">
|
<template v-slot:editor="{ editor }">
|
||||||
<EditorContent
|
<EditorContent
|
||||||
@ -78,6 +79,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import AttachmentIcon from '@/components/Icons/AttachmentIcon.vue'
|
import AttachmentIcon from '@/components/Icons/AttachmentIcon.vue'
|
||||||
import AttachmentItem from '@/components/AttachmentItem.vue'
|
import AttachmentItem from '@/components/AttachmentItem.vue'
|
||||||
|
import { usersStore } from '@/stores/users'
|
||||||
import { TextEditorFixedMenu, TextEditor, FileUploader } from 'frappe-ui'
|
import { TextEditorFixedMenu, TextEditor, FileUploader } from 'frappe-ui'
|
||||||
import { EditorContent } from '@tiptap/vue-3'
|
import { EditorContent } from '@tiptap/vue-3'
|
||||||
import { ref, computed, defineModel } from 'vue'
|
import { ref, computed, defineModel } from 'vue'
|
||||||
@ -117,6 +119,8 @@ const emit = defineEmits(['change'])
|
|||||||
const modelValue = defineModel()
|
const modelValue = defineModel()
|
||||||
const attachments = defineModel('attachments')
|
const attachments = defineModel('attachments')
|
||||||
|
|
||||||
|
const { users: usersList } = usersStore()
|
||||||
|
|
||||||
const textEditor = ref(null)
|
const textEditor = ref(null)
|
||||||
|
|
||||||
const editor = computed(() => {
|
const editor = computed(() => {
|
||||||
@ -127,6 +131,17 @@ function removeAttachment(attachment) {
|
|||||||
attachments.value = attachments.value.filter((a) => a !== 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 })
|
defineExpose({ editor })
|
||||||
|
|
||||||
const textEditorMenuButtons = [
|
const textEditorMenuButtons = [
|
||||||
|
|||||||
@ -30,7 +30,6 @@ export const usersStore = defineStore('crm-users', () => {
|
|||||||
email = session.user
|
email = session.user
|
||||||
}
|
}
|
||||||
if (!usersByName[email]) {
|
if (!usersByName[email]) {
|
||||||
users.reload()
|
|
||||||
usersByName[email] = {
|
usersByName[email] = {
|
||||||
name: email,
|
name: email,
|
||||||
email: email,
|
email: email,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user