Added editorutils file with a utility function to convert mimetype to editor modes
This commit is contained in:
11
functions/editorutils.js
Normal file
11
functions/editorutils.js
Normal file
@@ -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";
|
||||
}
|
||||
Reference in New Issue
Block a user