mirror of
https://github.com/doocs/md.git
synced 2024-11-24 19:10:34 +08:00
parent
ff44d3d40f
commit
8d12093ada
@ -28,9 +28,9 @@ export function setColorWithCustomTemplate(theme, color) {
|
||||
export function setFontSizeWithTemplate(template) {
|
||||
return function (fontSize) {
|
||||
const customTheme = JSON.parse(JSON.stringify(template))
|
||||
customTheme.block.h1[`font-size`] = `${fontSize * 1.14}px`
|
||||
customTheme.block.h2[`font-size`] = `${fontSize * 1.1}px`
|
||||
customTheme.block.h3[`font-size`] = `${fontSize}px`
|
||||
customTheme.block.h1[`font-size`] = `${fontSize * 1.2}px`
|
||||
customTheme.block.h2[`font-size`] = `${fontSize * 1.2}px`
|
||||
customTheme.block.h3[`font-size`] = `${fontSize * 1.1}px`
|
||||
customTheme.block.h4[`font-size`] = `${fontSize}px`
|
||||
return customTheme
|
||||
}
|
||||
@ -284,9 +284,7 @@ export function exportHTML() {
|
||||
|
||||
// 判断是否是包裹代码块的 code 元素
|
||||
function isCode(element) {
|
||||
return (
|
||||
element.tagName === `CODE`
|
||||
)
|
||||
return element.tagName === `CODE`
|
||||
}
|
||||
|
||||
// 判断是否是包裹代码字符的 span 元素
|
||||
|
@ -6,7 +6,12 @@ import config from '../assets/scripts/config'
|
||||
import WxRenderer from '../assets/scripts/renderers/wx-renderer'
|
||||
import DEFAULT_CONTENT from '@/assets/example/markdown.md'
|
||||
import DEFAULT_CSS_CONTENT from '@/assets/example/theme-css.txt'
|
||||
import { setColor, formatDoc, formatCss } from '@/assets/scripts/util'
|
||||
import {
|
||||
formatDoc,
|
||||
formatCss,
|
||||
setFontSize,
|
||||
setColorWithCustomTemplate,
|
||||
} from '@/assets/scripts/util'
|
||||
|
||||
const defaultKeyMap = CodeMirror.keyMap[`default`]
|
||||
const modPrefix =
|
||||
@ -92,8 +97,10 @@ export const useStore = defineStore(`store`, {
|
||||
localStorage.getItem(`isMacCodeBlock`) === `false`
|
||||
)
|
||||
this.isEditOnLeft = !(localStorage.getItem(`isEditOnLeft`) === `false`)
|
||||
|
||||
const theme = setFontSize(this.currentSize.replace(`px`, ``))
|
||||
this.wxRenderer = new WxRenderer({
|
||||
theme: setColor(this.currentColor),
|
||||
theme: setColorWithCustomTemplate(theme, this.currentColor),
|
||||
fonts: this.currentFont,
|
||||
size: this.currentSize,
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user