diff --git a/functions/editorutils.js b/functions/editorutils.js new file mode 100644 index 000000000..c8e14a5f9 --- /dev/null +++ b/functions/editorutils.js @@ -0,0 +1,11 @@ +const mimeToMode = { + "text/plain": "plain_text", + "text/html": "html", + "application/xml": "xml", + "application/hal+json": "json", + "application/json": "json" +} + +export function getEditorLangForMimeType(mimeType) { + return mimeToMode[mimeType] || "plain_text"; +}