From 07540681bcc125c3d15449e3e1bf5d061563c8ff Mon Sep 17 00:00:00 2001 From: terminaldweller Date: Thu, 31 Mar 2022 15:50:02 +0430 Subject: wip --- spring-front/src/components/Left.js | 43 ++++++++++++++++++++----------- spring-front/src/index.css | 50 ++++++++++++++++--------------------- 2 files changed, 49 insertions(+), 44 deletions(-) diff --git a/spring-front/src/components/Left.js b/spring-front/src/components/Left.js index 20b6258..af4def7 100644 --- a/spring-front/src/components/Left.js +++ b/spring-front/src/components/Left.js @@ -10,7 +10,16 @@ hljs.registerLanguage("markdown", markdown); class Code extends React.Component { constructor(props) { super(props); - this.updateCodeSyntaxHighlighting.bind(this); + this.updateCodeSyntaxHighlighting = + this.updateCodeSyntaxHighlighting.bind(this); + this.handleChange = this.handleChange.bind(this); + this.state = { value: "" }; + } + + handleChange(event) { + this.setState({ value: event.target.value }); + this.updateCodeSyntaxHighlighting(); + console.log(this.state.value); } componentDidMount() { @@ -24,15 +33,20 @@ class Code extends React.Component { updateCodeSyntaxHighlighting() { document.querySelectorAll("pre code").forEach((block) => { console.log("block:", block); - console.log("blockt text:", block.innerHTML); + console.log("blockt text:", block.textContent); hljs.highlightElement(block); }); } render() { return ( -