ESC-406 Fix Mention Extendtion for Quill (#648)

This commit is contained in:
Chirag Chhatrala 2024-12-16 14:38:13 +05:30 committed by GitHub
parent b782631709
commit 25a1d032a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 4 deletions

View File

@ -30,7 +30,7 @@ export default function registerMentionExtension(Quill) {
static create(data) {
// Only create mention if we have valid data
if (!data || !data.field || !data.field.nf_id) {
if (!data || !data.field || !data.field.id) {
return null
}
let node = super.create()
@ -40,13 +40,13 @@ export default function registerMentionExtension(Quill) {
static setAttributes(node, data) {
// Only set attributes if we have valid data
if (!data || !data.field || !data.field.nf_id) {
if (!data || !data.field || !data.field.id) {
return
}
node.setAttribute('contenteditable', 'false')
node.setAttribute('mention', 'true')
node.setAttribute('mention-field-id', data.field.nf_id || '')
node.setAttribute('mention-field-id', data.field.id || '')
node.setAttribute('mention-field-name', data.field.name || '')
node.setAttribute('mention-fallback', data.fallback || '')
node.textContent = data.field.name || ''
@ -77,7 +77,7 @@ export default function registerMentionExtension(Quill) {
static value(domNode) {
return {
field: {
nf_id: domNode.getAttribute('mention-field-id') || '',
id: domNode.getAttribute('mention-field-id') || '',
name: domNode.getAttribute('mention-field-name') || ''
},
fallback: domNode.getAttribute('mention-fallback') || ''