UNPKG

@atlaskit/editor-common

Version:

A package that contains common classes and components for editor and renderer

25 lines 967 B
// Ignored via go/ees005 // eslint-disable-next-line @typescript-eslint/max-params export function getUnsupportedContent( // Ignored via go/ees005 // eslint-disable-next-line @typescript-eslint/no-explicit-any message, prefix, node, intl) { var defaultLocale = 'en'; var canTranslateToLocale = true; var locale = intl ? intl.locale : defaultLocale; var finalMessage = message.defaultMessage; if (node && locale.startsWith(defaultLocale)) { var originalValue = node.attrs.originalValue; if (originalValue.text || originalValue.attrs && originalValue.attrs.text) { finalMessage = originalValue.text ? originalValue.text : originalValue.attrs.text; canTranslateToLocale = false; } else if (originalValue.type) { finalMessage = "".concat(prefix, " ").concat(originalValue.type); canTranslateToLocale = false; } } if (intl && canTranslateToLocale) { return intl.formatMessage(message); } return finalMessage; }