fix: copy and paste custom-emoji (#1873)
parent
fa3cfd6059
commit
3732a2cc16
|
@ -218,8 +218,10 @@ export function treeToText(input: Node): string {
|
||||||
body = (input.children as Node[]).map(n => treeToText(n)).join('')
|
body = (input.children as Node[]).map(n => treeToText(n)).join('')
|
||||||
|
|
||||||
if (input.name === 'img' || input.name === 'picture') {
|
if (input.name === 'img' || input.name === 'picture') {
|
||||||
if (input.attributes.class?.includes('custom-emoji'))
|
if (input.attributes.class?.includes('custom-emoji')) {
|
||||||
return `:${input.attributes['data-emoji-id'] || input.attributes.title}:`
|
const id = input.attributes['data-emoji-id'] ?? input.attributes.title ?? input.attributes.alt ?? 'unknown'
|
||||||
|
return id[0] !== ':' ? `:${id}:` : id
|
||||||
|
}
|
||||||
if (input.attributes.class?.includes('iconify-emoji'))
|
if (input.attributes.class?.includes('iconify-emoji'))
|
||||||
return input.attributes.alt
|
return input.attributes.alt
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue