@procore/core-react
Version:
React library of Procore Design Guidelines
90 lines (89 loc) • 5.13 kB
JavaScript
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
export var scriptId = 'tiny-mce-core-source';
export var tinyMCESource = 'https://s3.amazonaws.com/procore-core/tinymce';
export var tinyMCEVersion = '5.8.1';
// TinyMCE Supported Languages: https://www.tiny.cloud/docs/configure/localization/#supportedlanguages
var textEditorLocales = {
en: 'en',
'en-CA': 'en',
'fr-CA': 'fr_FR',
'fr-FR': 'fr_FR',
es: 'es',
'es-ES': 'es',
'en-AE': 'en',
'en-AU': 'en',
'en-GB': 'en',
'en-SG': 'en',
'th-TH': 'th_TH',
'ja-JP': 'ja',
'pt-BR': 'pt_BR',
'is-IS': 'en',
'de-DE': 'de',
'zh-SG': 'zh_CN',
pseudo: 'en',
'pl-PL': 'pl',
'nb-NO': 'nb',
'zh-TW': 'zh_TW',
'it-IT': 'it',
'pt-PT': 'pt'
};
export var defaultPlugins = ['autolink', 'autoresize', 'lists', 'nonbreaking', 'paste', 'advlist'];
export var plugins = ['advlist', 'anchor', 'autolink', 'autoresize', 'autosave', 'bbcode', 'charmap', 'code', 'codesample', 'colorpicker', 'contextmenu', 'directionality', 'emoticons', 'fullpage', 'fullscreen', 'help', 'hr', 'image', 'imagetools', 'importcss', 'insertdatetime', 'legacyoutput', 'link', 'lists', 'media', 'nonbreaking', 'noneditable', 'pagebreak', 'paste', 'preview', 'print', 'save', 'searchreplace', 'spellchecker', 'tabfocus', 'table', 'template', 'textpattern', 'toc', 'visualblocks', 'visualchars', 'wordcount'];
/**
* Historically, `nonbreaking_force_tab` has been set to `true`
* and this takes the `Tab` keypress as input to add to the content.
* e.g indent the start of the text block like a paragraph.
* This is different from the TinyMCE tool and command 'Indent', which
* indents the entire block. e.g. indent this entire text block and the
* wrapped lines.
* This is the HTML it outputs when `nonbreaking_force_tab: true`
*/
export var tinyMCETabMarkup = "<span class=\"mce-nbsp-wrap\" contenteditable=\"false\"> </span>";
export var tinyMCEConfig = {
autoresize_overflow_padding: 12,
autoresize_bottom_margin: 0,
browser_spellcheck: true,
convert_url: false,
content_css: "".concat(tinyMCESource, "/").concat(tinyMCEVersion, "/skins/content/default/content.min.css"),
extended_valid_elements: 'table[class=mce-table|border:1px double #000|cellpadding: 3px|style=border-collapse: collapse; border-color: #000]',
min_height: 96,
invalid_elements: 'form,script',
menubar: false,
nonbreaking_force_tab: true,
paste_preprocess: function paste_preprocess(_, args) {
args.content = args.content.replace(/<pre>/gi, '<p>');
args.content = args.content.replace(/<\/pre>/gi, '</p>');
},
paste_remove_styles_if_webkit: true,
paste_retain_style_properties: 'font-size,text-decoration',
paste_word_valid_elements: '@[style],pre,-strong/b,-em/i,-span,-p,-ol,-ul,-li,-table,-tr,-td[colspan|rowspan],-th,-thead,-tfoot,-tbody,-a[href|name],sub,sup,strike,br,u',
relative_urls: false,
remove_script_host: false,
statusbar: false,
skin_url: "".concat(tinyMCESource, "/").concat(tinyMCEVersion, "/skins/ui/oxide"),
toolbar: 'bold italic underline strikethrough | alignleft aligncenter alignright | bullist numlist | outdent indent | cut paste pastetext | fontsizeselect | forecolor backcolor | link table image | undo redo',
toolbar_mode: 'floating'
};
export function getValidLookupLocale(locale) {
return textEditorLocales[locale] || textEditorLocales.en;
}
function usesBuiltInText(locale) {
return locale === textEditorLocales.en;
}
export function generateLanguageUrl(locale) {
var lookupLocale = getValidLookupLocale(locale);
return usesBuiltInText(lookupLocale) ? '' : "".concat(tinyMCESource, "/").concat(tinyMCEVersion, "/langs/").concat(lookupLocale, ".js");
}
function generatePluginUrl(plugin) {
return "".concat(tinyMCESource, "/").concat(tinyMCEVersion, "/plugins/").concat(plugin, "/plugin.min.js");
}
export function generateExternalPlugins(plugins) {
var basePlugins = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultPlugins;
return Array.from(new Set(plugins.concat(basePlugins))).reduce(function (acc, plugin) {
return plugins.includes(plugin) ? Object.assign(acc, _defineProperty({}, plugin, generatePluginUrl(plugin))) : acc;
}, {});
}
//# sourceMappingURL=TinyMCE.js.map