Skip to content

Commit

Permalink
fix(readme): fixes to get correct html from render response
Browse files Browse the repository at this point in the history
  • Loading branch information
ramfox committed Nov 12, 2019
1 parent a0d53dd commit c28d49b
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 6 deletions.
9 changes: 4 additions & 5 deletions app/components/ReadMe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,12 @@ const Readme: React.FunctionComponent<ReadmeProps> = (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...'
}

Expand Down
28 changes: 28 additions & 0 deletions app/scss/_readme.scss
Original file line number Diff line number Diff line change
@@ -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;
}
2 changes: 2 additions & 0 deletions app/scss/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,7 @@
@import "toast";
@import "body";
@import "metadata";
@import "readme";

@import '~easymde/dist/easymde.min.css';
@import "dialog"
2 changes: 1 addition & 1 deletion version.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
exports.desktopVersion = '0.2.1-dev'
exports.backendVersion = '0.9.2-dev'
exports.backendVersion = '0.9.2-dev'

0 comments on commit c28d49b

Please sign in to comment.