修复markd解析器对混合html的处理; 优化markd引用块的样式;优化scoll组件在边缘场景下报错的的问题

master
yutent 2023-04-28 10:37:09 +08:00
parent f65db2e830
commit 465d475488
3 changed files with 20 additions and 7 deletions

View File

@ -521,13 +521,23 @@ class Tool {
continue continue
} }
if (isParagraph) { if (isHtmlBlock || isSingleLineHtml) {
if (isParagraph) {
isParagraph = false
html = trimBr(html)
html += '</p>'
}
html += `${it}\n`
} else if (isMultiLineHtml) {
if (isParagraph) {
isParagraph = false
html = trimBr(html)
html += '</p>'
}
isHtmlBlock = !isHtmlBlock
html += `${it}\n` html += `${it}\n`
} else { } else {
if (isHtmlBlock || isSingleLineHtml) { if (isParagraph) {
html += `${it}\n`
} else if (isMultiLineHtml) {
isHtmlBlock = !isHtmlBlock
html += `${it}\n` html += `${it}\n`
} else { } else {
html += `\n<p>${it}` html += `\n<p>${it}`

View File

@ -68,6 +68,10 @@ class Markd extends Component {
p { p {
margin: 0; margin: 0;
} }
> blockquote {
margin: 5px 0;
padding: 0 10px;
}
} }
fieldset.md-hr { fieldset.md-hr {
@ -193,7 +197,6 @@ class Markd extends Component {
` `
render() { render() {
// console.log(md2html(this.code))
return html`<div class="container">${raw(md2html(this.code))}</div>` return html`<div class="container">${raw(md2html(this.code))}</div>`
} }
} }

View File

@ -392,7 +392,7 @@ class Scroll extends Component {
this.__observer.observe(this.$refs.cont) this.__observer.observe(this.$refs.cont)
} }
unmounted() { unmounted() {
this.__observer.disconnect() this.__observer?.disconnect()
} }
render() { render() {