Skip to content

Commit

Permalink
fix: copy and paste custom-emoji (elk-zone#1873)
Browse files Browse the repository at this point in the history
  • Loading branch information
patak-dev authored and DataDrivenMD committed Mar 11, 2023
1 parent c7cc3f4 commit 70b3902
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions composables/content-parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,10 @@ export function treeToText(input: Node): string {
body = (input.children as Node[]).map(n => treeToText(n)).join('')

if (input.name === 'img' || input.name === 'picture') {
if (input.attributes.class?.includes('custom-emoji'))
return `:${input.attributes['data-emoji-id'] || input.attributes.title}:`
if (input.attributes.class?.includes('custom-emoji')) {
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'))
return input.attributes.alt
}
Expand Down

0 comments on commit 70b3902

Please sign in to comment.