aboutsummaryrefslogtreecommitdiffstats
path: root/spring-front/src/components/Editor.js
diff options
context:
space:
mode:
authorterminaldweller <thabogre@gmail.com>2022-06-03 18:18:34 +0000
committerterminaldweller <thabogre@gmail.com>2022-06-03 18:18:34 +0000
commit44593d546bd32f61eb5387f324485a20f9583c42 (patch)
tree39de1769a5745883dfb042a9bf299708d54dc8a5 /spring-front/src/components/Editor.js
parentwip. mostly working now. working out a few kinks. (diff)
downloadmdrtl-44593d546bd32f61eb5387f324485a20f9583c42.tar.gz
mdrtl-44593d546bd32f61eb5387f324485a20f9583c42.zip
load,delete and save are working now. we just need to add put.
Diffstat (limited to 'spring-front/src/components/Editor.js')
-rw-r--r--spring-front/src/components/Editor.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/spring-front/src/components/Editor.js b/spring-front/src/components/Editor.js
index d062e28..7b97a50 100644
--- a/spring-front/src/components/Editor.js
+++ b/spring-front/src/components/Editor.js
@@ -155,6 +155,14 @@ export default class Editor extends React.Component {
}
res = response.json().then((json) => {
this.setState({ value: json.body });
+ let result_element = document.getElementById("highlight-content");
+ result_element.textContent = this.state.value;
+ document.querySelectorAll("pre code").forEach((block) => {
+ hljs.highlightElement(block);
+ });
+ let element = document.getElementById("markdown-placeholder");
+ let htm = md.render(this.state.value);
+ element.innerHTML = htm;
});
}
);