Added editorutils file with a utility function to convert mimetype to editor modes
This commit is contained in:
parent
6e03c8d236
commit
5936a06ad1
1 changed files with 11 additions and 0 deletions
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";
|
||||
}
|
||||
Loading…
Reference in a new issue