@atlaskit/editor-wikimarkup-transformer
Version:
Wiki markup transformer for JIRA and Confluence
21 lines (20 loc) • 845 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.mentionLinkResolver = mentionLinkResolver;
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('~')) {
var mentionText = link.notLinkBody.substring(1);
var mentionKey = mentionText.toLowerCase();
var id = context.conversion && context.conversion.mentionConversion && context.conversion.mentionConversion[mentionKey] ? context.conversion.mentionConversion[mentionKey] : mentionText;
return [schema.nodes.mention.createChecked({
id: id
})];
}
return;
}