From c28d49bcf4e44685d2fbe305d026a0e1141688a3 Mon Sep 17 00:00:00 2001 From: ramfox Date: Tue, 12 Nov 2019 15:12:56 -0500 Subject: [PATCH] fix(readme): fixes to get correct html from render response --- app/components/ReadMe.tsx | 9 ++++----- app/scss/_readme.scss | 28 ++++++++++++++++++++++++++++ app/scss/style.scss | 2 ++ version.js | 2 +- 4 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 app/scss/_readme.scss diff --git a/app/components/ReadMe.tsx b/app/components/ReadMe.tsx index 3791e753..8400a165 100644 --- a/app/components/ReadMe.tsx +++ b/app/components/ReadMe.tsx @@ -38,13 +38,12 @@ const Readme: React.FunctionComponent = (props) => { setInternalValue(value) } - const getPreview = (plainText: string, preview: any) => { + const getPreview = (plainText: string, preview: HTMLElement) => { fetch(`http://localhost:2503/render/${peername}/${name}?fsi=true`) - .then(async (d) => d.json()) - .then(({ data: html }) => { - preview.innerHTML = html + .then(async (res) => res.text()) + .then((render) => { + preview.innerHTML = render }) - return 'Loading...' } diff --git a/app/scss/_readme.scss b/app/scss/_readme.scss new file mode 100644 index 00000000..450e46c4 --- /dev/null +++ b/app/scss/_readme.scss @@ -0,0 +1,28 @@ +.CodeMirror { + padding: 1rem; +} + +.editor-preview { + padding: 1rem; +} + +.editor-preview > blockquote { + margin: 1rem; + padding-left: .5rem; + border-left: solid #eaeaea; +} + +.editor-preview > ol { + margin-top: 1rem; + margin-bottom: 1rem; +} + +.editor-preview > ul { + margin-top: 1rem; + margin-bottom: 1rem; +} + +.editor-preview > table { + margin-top: 1rem; + margin-bottom: 1rem; +} \ No newline at end of file diff --git a/app/scss/style.scss b/app/scss/style.scss index 29d1bb4a..f65c80a5 100755 --- a/app/scss/style.scss +++ b/app/scss/style.scss @@ -32,5 +32,7 @@ @import "toast"; @import "body"; @import "metadata"; +@import "readme"; +@import '~easymde/dist/easymde.min.css'; @import "dialog" diff --git a/version.js b/version.js index d2ac7530..9a310ee6 100644 --- a/version.js +++ b/version.js @@ -1,2 +1,2 @@ exports.desktopVersion = '0.2.1-dev' -exports.backendVersion = '0.9.2-dev' \ No newline at end of file +exports.backendVersion = '0.9.2-dev'