From 0fba96465a2364d031d0f48477541afd40144e0f Mon Sep 17 00:00:00 2001 From: YangQi Date: Tue, 7 Nov 2023 18:49:41 -0600 Subject: [PATCH] fix: render katex (#253) --- src/components/CodemirrorEditor/EditorHeader/index.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/CodemirrorEditor/EditorHeader/index.vue b/src/components/CodemirrorEditor/EditorHeader/index.vue index a6e0e5c..4dfd95d 100644 --- a/src/components/CodemirrorEditor/EditorHeader/index.vue +++ b/src/components/CodemirrorEditor/EditorHeader/index.vue @@ -343,7 +343,13 @@ export default { clipboardDiv.innerHTML = mergeCss(clipboardDiv.innerHTML) // 调整 katex 公式元素为行内标签,目的是兼容微信公众号渲染 - clipboardDiv.innerHTML = clipboardDiv.innerHTML.replace(/class="base"( style="display: inline")*/g, `class="base" style="display: inline"`) + clipboardDiv.innerHTML = clipboardDiv.innerHTML + .replace( + /class="base"( style="display: inline")*/g, + `class="base" style="display: inline"` + ) + // 公众号不支持 position, 转换为等价的 translateY + .replace(/top:(.*?)em/g, `transform: translateY($1em)`) if (this.isMacCodeBlock) { clipboardDiv.innerHTML = clipboardDiv.innerHTML.replaceAll(