Skip to content

Commit

Permalink
ESC-406 Fix Mention Extendtion for Quill
Browse files Browse the repository at this point in the history
  • Loading branch information
chiragchhatrala committed Dec 16, 2024
1 parent b782631 commit 08d60f3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions client/lib/quill/quillMentionExtension.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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 || ''
Expand Down Expand Up @@ -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') || ''
Expand Down

0 comments on commit 08d60f3

Please sign in to comment.