1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 09:46:22 +00:00

Fix incorrect tag completion in code block

This commit is contained in:
asmsuechan
2017-03-19 14:10:33 -07:00
parent 6a711d6a71
commit 04097ecfcd

View File

@@ -24,6 +24,21 @@ function decodeHTMLEntities (text) {
return text
}
function encodeHTMLEntities (text) {
var entities = [
['\'', 'apos'],
['&', 'amp'],
['<', 'lt'],
['>', 'gt']
]
for (var i = 0, max = entities.length; i < max; ++i) {
text = text.replace(entities[i][0], '&' + entities[i][1] + ';')
}
return text
}
const { remote } = require('electron')
const { app } = remote
const path = require('path')
@@ -241,7 +256,7 @@ export default class MarkdownPreview extends React.Component {
let { value, theme, indentSize, codeBlockTheme } = this.props
this.refs.root.contentWindow.document.body.setAttribute('data-theme', theme)
this.refs.root.contentWindow.document.body.innerHTML = markdown.render(value)
this.refs.root.contentWindow.document.body.innerHTML = markdown.render(encodeHTMLEntities(value))
_.forEach(this.refs.root.contentWindow.document.querySelectorAll('.taskListItem'), (el) => {
el.parentNode.parentNode.style.listStyleType = 'none'