mirror of
https://github.com/doocs/md.git
synced 2024-11-24 19:10:34 +08:00
fix: code block (#310)
This commit is contained in:
parent
74eba4e5fa
commit
9d8757bd39
20943
package-lock.json
generated
20943
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -30,7 +30,6 @@
|
||||
"minio": "7.0.33",
|
||||
"node-fetch": "^3.2.10",
|
||||
"pinia": "^2.1.6",
|
||||
"prettify": "^0.1.7",
|
||||
"qiniu-js": "^3.4.1",
|
||||
"uuid": "^8.3.2",
|
||||
"vue": "^2.7.14"
|
||||
|
@ -31,7 +31,6 @@
|
||||
<!-- KaTeX CSS -->
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.css" integrity="sha384-n8MVd4RsNIU0tAv4ct0nTaAbDJwPJzDEaqSD1odI+WdtXRGWt2kTvGFasHpSy3SV" crossorigin="anonymous">
|
||||
|
||||
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/prettify/r298/prettify.min.js"></script>
|
||||
<style>
|
||||
/**
|
||||
解决公众号复制字体问题
|
||||
|
@ -145,7 +145,7 @@ class WxRenderer {
|
||||
|
||||
return `<pre class="hljs code__pre" ${getStyles(
|
||||
"code_pre"
|
||||
)}><code class="prettyprint language-${lang}" ${getStyles(
|
||||
)}><code class="language-${lang}" ${getStyles(
|
||||
"code"
|
||||
)}>${text}</code></pre>`;
|
||||
};
|
||||
|
@ -285,8 +285,7 @@ export function exportHTML() {
|
||||
// 判断是否是包裹代码块的 code 元素
|
||||
function isCode(element) {
|
||||
return (
|
||||
element.tagName === `CODE` &&
|
||||
Array.from(element.classList).includes(`prettyprint`)
|
||||
element.tagName === `CODE`
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -397,13 +397,6 @@ export default {
|
||||
)
|
||||
// 公众号不支持 position, 转换为等价的 translateY
|
||||
.replace(/top:(.*?)em/g, `transform: translateY($1em)`)
|
||||
|
||||
if (this.isMacCodeBlock) {
|
||||
clipboardDiv.innerHTML = clipboardDiv.innerHTML.replaceAll(
|
||||
/(<code class="prettyprint[^>]*)(style=")/g,
|
||||
`$1style="font-family: Menlo, 'Operator Mono', Consolas, Monaco, monospace;`
|
||||
)
|
||||
}
|
||||
clipboardDiv.focus()
|
||||
window.getSelection().removeAllRanges()
|
||||
let range = document.createRange()
|
||||
|
@ -440,7 +440,6 @@ export default {
|
||||
onEditorRefresh() {
|
||||
this.codeThemeChanged(this.codeTheme)
|
||||
this.editorRefresh()
|
||||
setTimeout(() => window.PR.prettyPrint(), 0)
|
||||
},
|
||||
// 复制结束
|
||||
endCopy() {
|
||||
@ -607,7 +606,6 @@ export default {
|
||||
mounted() {
|
||||
setTimeout(() => {
|
||||
this.leftAndRightScroll()
|
||||
window.PR.prettyPrint()
|
||||
}, 300)
|
||||
},
|
||||
setup() {
|
||||
|
Loading…
Reference in New Issue
Block a user