Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a549974

Browse files
committed
修复 textarea 的渲染问题
1 parent e25a3c1 commit a549974

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎routes/article.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,15 @@ async function updateArticle(req, res, next) {
111111
if (linesLength) {
112112
html += '<b class="name">' + lang + '</b>'
113113
}
114-
return `<pre ><code>${html}</code>${linesNum}</pre><textarea style="position: absolute;top: -9999px;left: -9999px;z-index: -9999;" id="copy${codeIndex}">${str}</textarea>`
114+
return `<pre class="hljs"><code>${html}</code>${linesNum}</pre><textarea style="position: absolute;top: -9999px;left: -9999px;z-index: -9999;" id="copy${codeIndex}">${str.replace(/<\/textarea>/g,'&lt;textarea>')}</textarea>`
115115
} catch (error) {
116116
console.log(error)
117117
}
118118
}
119119

120120
const preCode = md.utils.escapeHtml(str)
121121
html = html + preCode
122-
return `<pre class="hljs"><code>${html}</code>${linesNum}</pre><textarea style="position: absolute;top: -9999px;left: -9999px;z-index: -9999;" id="copy${codeIndex}">${str}</textarea>`
122+
return `<pre class="hljs"><code>${html}</code>${linesNum}</pre><textarea style="position: absolute;top: -9999px;left: -9999px;z-index: -9999;" id="copy${codeIndex}">${str.replace(/<\/textarea>/g,'&lt;textarea>')}</textarea>`
123123
}
124124
})
125125
let articleContentHtml = md.use(markdownItTocAndAnchor, {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /