Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Amy Chen authored and Amy Chen committed Mar 4, 2024
1 parent 26ce5ff commit 2c0e8e5
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions src/components/report/CopyPaste.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default class CopyPaste extends Component {
handleContentChange() {
this.setState({
contentHTML: this.contentAreaRef.current.innerHTML,
previousContent: ""
});
}

Expand All @@ -38,7 +39,15 @@ export default class CopyPaste extends Component {
this.importScoreSummaryContent();
return;
}
this.clear();
const tempNode = this.contentAreaRef.current.cloneNode(true);
console.log("temp node? ", tempNode);
const originalElement = tempNode.querySelector(".original");
console.log("original ", originalElement)
this.setState({
contentHTML: originalElement.innerHTML
}, () => {
this.contentAreaRef.current.innerHTML = this.state.contentHTML
})
}
);
}
Expand All @@ -47,6 +56,7 @@ export default class CopyPaste extends Component {
this.setState(
{
contentHTML: this.getDefaultContent(),
hasScoreSummary: false
},
() => {
this.contentAreaRef.current.innerHTML = this.state.contentHTML;
Expand Down Expand Up @@ -100,9 +110,13 @@ export default class CopyPaste extends Component {
{
contentHTML:
"<div style='font-family: ariel, sans-serif'>" +
this.contentAreaRef.current.innerHTML +
"<br/><br/>" +
scoreSummaryNode.outerHTML +
"<div class='original'>" +
this.state.contentHTML +
"</div>" +
"<div class='score-summary-content'>" +
"<br/><br/>" +
scoreSummaryNode.outerHTML +
"</div>" +
"</div>",
},
() => {
Expand Down Expand Up @@ -144,6 +158,9 @@ export default class CopyPaste extends Component {
type="checkbox"
onChange={this.handleGetScoreSummary}
checked={this.state.hasScoreSummary}
style={{
marginRight: "8px"
}}
></input>
Add scoring summary table content to box area
</label>
Expand Down

0 comments on commit 2c0e8e5

Please sign in to comment.