Fix mentions in web
This commit is contained in:
parent
b4e5179c9c
commit
5bbb980250
1 changed files with 2 additions and 1 deletions
|
@ -66,6 +66,7 @@ export const TextInput = React.forwardRef(
|
||||||
injectCSS: true,
|
injectCSS: true,
|
||||||
onUpdate({editor: editorProp}) {
|
onUpdate({editor: editorProp}) {
|
||||||
const json = editorProp.getJSON()
|
const json = editorProp.getJSON()
|
||||||
|
|
||||||
const newText = editorJsonToText(json).trim()
|
const newText = editorJsonToText(json).trim()
|
||||||
onTextChanged(newText)
|
onTextChanged(newText)
|
||||||
|
|
||||||
|
@ -101,7 +102,7 @@ function editorJsonToText(json: JSONContent): string {
|
||||||
} else if (json.type === 'text') {
|
} else if (json.type === 'text') {
|
||||||
text += json.text || ''
|
text += json.text || ''
|
||||||
} else if (json.type === 'mention') {
|
} else if (json.type === 'mention') {
|
||||||
text += json.attrs?.id || ''
|
text += `@${json.attrs?.id || ''}`
|
||||||
}
|
}
|
||||||
return text
|
return text
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue