@atlaskit/editor-wikimarkup-transformer
Version:
Wiki markup transformer for JIRA and Confluence
30 lines • 938 B
JavaScript
import { buildInlineCard, getIssue } from '../issue-key';
export function issueLinkResolver(link, schema, context) {
var originalLinkText = link.originalLinkText,
linkTitle = link.linkTitle,
notLinkBody = link.notLinkBody;
if (linkTitle === 'smart-card' ||
// Ignored via go/ees007
// eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
// TODO: Depricated should be removed in the next major release
linkTitle === 'block-link') {
return [schema.nodes.blockCard.createChecked({
url: notLinkBody
})];
}
if (linkTitle === 'smart-link') {
return [schema.nodes.inlineCard.createChecked({
url: notLinkBody
})];
}
if (linkTitle === 'smart-embed') {
return [schema.nodes.embedCard.createChecked({
url: notLinkBody
})];
}
var issue = getIssue(context, originalLinkText);
if (issue) {
return buildInlineCard(schema, issue);
}
return undefined;
}