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
20941
package-lock.json
generated
20941
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -30,7 +30,6 @@
|
|||||||
"minio": "7.0.33",
|
"minio": "7.0.33",
|
||||||
"node-fetch": "^3.2.10",
|
"node-fetch": "^3.2.10",
|
||||||
"pinia": "^2.1.6",
|
"pinia": "^2.1.6",
|
||||||
"prettify": "^0.1.7",
|
|
||||||
"qiniu-js": "^3.4.1",
|
"qiniu-js": "^3.4.1",
|
||||||
"uuid": "^8.3.2",
|
"uuid": "^8.3.2",
|
||||||
"vue": "^2.7.14"
|
"vue": "^2.7.14"
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
<!-- KaTeX CSS -->
|
<!-- 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">
|
<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>
|
<style>
|
||||||
/**
|
/**
|
||||||
解决公众号复制字体问题
|
解决公众号复制字体问题
|
||||||
|
@ -145,7 +145,7 @@ class WxRenderer {
|
|||||||
|
|
||||||
return `<pre class="hljs code__pre" ${getStyles(
|
return `<pre class="hljs code__pre" ${getStyles(
|
||||||
"code_pre"
|
"code_pre"
|
||||||
)}><code class="prettyprint language-${lang}" ${getStyles(
|
)}><code class="language-${lang}" ${getStyles(
|
||||||
"code"
|
"code"
|
||||||
)}>${text}</code></pre>`;
|
)}>${text}</code></pre>`;
|
||||||
};
|
};
|
||||||
|
@ -285,8 +285,7 @@ export function exportHTML() {
|
|||||||
// 判断是否是包裹代码块的 code 元素
|
// 判断是否是包裹代码块的 code 元素
|
||||||
function isCode(element) {
|
function isCode(element) {
|
||||||
return (
|
return (
|
||||||
element.tagName === `CODE` &&
|
element.tagName === `CODE`
|
||||||
Array.from(element.classList).includes(`prettyprint`)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -397,13 +397,6 @@ export default {
|
|||||||
)
|
)
|
||||||
// 公众号不支持 position, 转换为等价的 translateY
|
// 公众号不支持 position, 转换为等价的 translateY
|
||||||
.replace(/top:(.*?)em/g, `transform: translateY($1em)`)
|
.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()
|
clipboardDiv.focus()
|
||||||
window.getSelection().removeAllRanges()
|
window.getSelection().removeAllRanges()
|
||||||
let range = document.createRange()
|
let range = document.createRange()
|
||||||
|
@ -440,7 +440,6 @@ export default {
|
|||||||
onEditorRefresh() {
|
onEditorRefresh() {
|
||||||
this.codeThemeChanged(this.codeTheme)
|
this.codeThemeChanged(this.codeTheme)
|
||||||
this.editorRefresh()
|
this.editorRefresh()
|
||||||
setTimeout(() => window.PR.prettyPrint(), 0)
|
|
||||||
},
|
},
|
||||||
// 复制结束
|
// 复制结束
|
||||||
endCopy() {
|
endCopy() {
|
||||||
@ -607,7 +606,6 @@ export default {
|
|||||||
mounted() {
|
mounted() {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.leftAndRightScroll()
|
this.leftAndRightScroll()
|
||||||
window.PR.prettyPrint()
|
|
||||||
}, 300)
|
}, 300)
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
|
Loading…
Reference in New Issue
Block a user