UNPKG

@atlaskit/editor-wikimarkup-transformer

Version:

Wiki markup transformer for JIRA and Confluence

15 lines 723 B
export function mentionLinkResolver(link, schema, context) { // [CS-1896] Empty mention nodes should fallback to plaintext if (link.notLinkBody.toLowerCase() === '~accountid:' || link.notLinkBody === '~') { return [schema.nodes.paragraph.createChecked({}, [schema.nodes.text.create({})])]; } if (link.notLinkBody.startsWith('~')) { const mentionText = link.notLinkBody.substring(1); const mentionKey = mentionText.toLowerCase(); const id = context.conversion && context.conversion.mentionConversion && context.conversion.mentionConversion[mentionKey] ? context.conversion.mentionConversion[mentionKey] : mentionText; return [schema.nodes.mention.createChecked({ id })]; } return; }