From 465d4754887f3f7c813ff770da6ee5f66ddb057b Mon Sep 17 00:00:00 2001 From: yutent Date: Fri, 28 Apr 2023 10:37:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dmarkd=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E5=99=A8=E5=AF=B9=E6=B7=B7=E5=90=88html=E7=9A=84=E5=A4=84?= =?UTF-8?q?=E7=90=86;=20=E4=BC=98=E5=8C=96markd=E5=BC=95=E7=94=A8=E5=9D=97?= =?UTF-8?q?=E7=9A=84=E6=A0=B7=E5=BC=8F;=E4=BC=98=E5=8C=96scoll=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=9C=A8=E8=BE=B9=E7=BC=98=E5=9C=BA=E6=99=AF=E4=B8=8B?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E7=9A=84=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/markd/core.js | 20 +++++++++++++++----- src/markd/index.js | 5 ++++- src/scroll/index.js | 2 +- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/markd/core.js b/src/markd/core.js index e7aead5..dd5aa28 100644 --- a/src/markd/core.js +++ b/src/markd/core.js @@ -521,13 +521,23 @@ class Tool { continue } - if (isParagraph) { + if (isHtmlBlock || isSingleLineHtml) { + if (isParagraph) { + isParagraph = false + html = trimBr(html) + html += '

' + } + html += `${it}\n` + } else if (isMultiLineHtml) { + if (isParagraph) { + isParagraph = false + html = trimBr(html) + html += '

' + } + isHtmlBlock = !isHtmlBlock html += `${it}\n` } else { - if (isHtmlBlock || isSingleLineHtml) { - html += `${it}\n` - } else if (isMultiLineHtml) { - isHtmlBlock = !isHtmlBlock + if (isParagraph) { html += `${it}\n` } else { html += `\n

${it}` diff --git a/src/markd/index.js b/src/markd/index.js index e16c7e3..1d366a6 100644 --- a/src/markd/index.js +++ b/src/markd/index.js @@ -68,6 +68,10 @@ class Markd extends Component { p { margin: 0; } + > blockquote { + margin: 5px 0; + padding: 0 10px; + } } fieldset.md-hr { @@ -193,7 +197,6 @@ class Markd extends Component { ` render() { - // console.log(md2html(this.code)) return html`

${raw(md2html(this.code))}
` } } diff --git a/src/scroll/index.js b/src/scroll/index.js index 02759a0..962bda2 100644 --- a/src/scroll/index.js +++ b/src/scroll/index.js @@ -392,7 +392,7 @@ class Scroll extends Component { this.__observer.observe(this.$refs.cont) } unmounted() { - this.__observer.disconnect() + this.__observer?.disconnect() } render() {