From 5936a06ad18e31862af6991845233b557f11b5ae Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Sun, 23 Feb 2020 23:23:18 -0500 Subject: [PATCH 1/2] Added editorutils file with a utility function to convert mimetype to editor modes --- functions/editorutils.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 functions/editorutils.js 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"; +} From fa339a51837211d4d98a7e4875682db0071d4882 Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Sun, 23 Feb 2020 23:24:23 -0500 Subject: [PATCH 2/2] Updated POST request body to react to the Content Type --- pages/index.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pages/index.vue b/pages/index.vue index 4b53a3057..5a1996734 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -375,7 +375,7 @@