mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
Reduce the code
This commit is contained in:
@@ -261,8 +261,7 @@ export default class MarkdownPreview extends React.Component {
|
|||||||
const codeBlocks = value.match(/(```)(.|[\n])*?(```)/g)
|
const codeBlocks = value.match(/(```)(.|[\n])*?(```)/g)
|
||||||
if (codeBlocks !== null && codeBlocks.length > 0) {
|
if (codeBlocks !== null && codeBlocks.length > 0) {
|
||||||
codeBlocks.forEach((codeBlock) => {
|
codeBlocks.forEach((codeBlock) => {
|
||||||
const encodedCodeBlock = encodeHTMLEntities(codeBlock)
|
value = value.replace(codeBlock, encodeHTMLEntities(codeBlock))
|
||||||
value = value.replace(codeBlock, encodedCodeBlock)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.refs.root.contentWindow.document.body.innerHTML = markdown.render(value)
|
this.refs.root.contentWindow.document.body.innerHTML = markdown.render(value)
|
||||||
|
|||||||
Reference in New Issue
Block a user