mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +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)
|
||||
|
||||
const codeBlocks = value.match(/(```)(.|[\n])*?(```)/g)
|
||||
if (codeBlocks.length > 0) {
|
||||
if (codeBlocks !== null && codeBlocks.length > 0) {
|
||||
codeBlocks.forEach((codeBlock) => {
|
||||
const encodedCodeBlock = encodeHTMLEntities(codeBlock)
|
||||
value = value.replace(codeBlock, encodedCodeBlock)
|
||||
|
||||
Reference in New Issue
Block a user