editorutils.js 372 B

123456789101112
  1. const mimeToMode = {
  2. "text/plain": "text/x-yaml",
  3. "text/html": "htmlmixed",
  4. "application/xml": "application/xml",
  5. "application/hal+json": "application/ld+json",
  6. "application/vnd.api+json": "application/ld+json",
  7. "application/json": "application/ld+json",
  8. }
  9. export function getEditorLangForMimeType(mimeType) {
  10. return mimeToMode[mimeType] || "text/x-yaml"
  11. }