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