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