mirror of
https://github.com/doocs/md.git
synced 2024-11-24 19:10:34 +08:00
fix: font-size of theme (#429)
All checks were successful
Build and Deploy / build-and-deploy (push) Has been skipped
All checks were successful
Build and Deploy / build-and-deploy (push) Has been skipped
This commit is contained in:
parent
c7b0e027ac
commit
e7f01b640a
@ -43,7 +43,7 @@ export const useStore = defineStore(`store`, () => {
|
|||||||
// 图注格式
|
// 图注格式
|
||||||
const legend = useStorage(`legend`, legendOptions[3].value)
|
const legend = useStorage(`legend`, legendOptions[3].value)
|
||||||
|
|
||||||
const fontSizeNumber = computed(() => fontSize.value.replace(`px`, ``))
|
const fontSizeNumber = computed(() => Number(fontSize.value.replace(`px`, ``)))
|
||||||
|
|
||||||
// 内容编辑器编辑器
|
// 内容编辑器编辑器
|
||||||
const editor = ref<CodeMirror.EditorFromTextArea | null>(null)
|
const editor = ref<CodeMirror.EditorFromTextArea | null>(null)
|
||||||
@ -132,7 +132,7 @@ export const useStore = defineStore(`store`, () => {
|
|||||||
const renderer = initRenderer({
|
const renderer = initRenderer({
|
||||||
theme: customCssWithTemplate(css2json(getCurrentTab().content), primaryColor.value, customizeTheme(themeMap[theme.value], { fontSize: fontSizeNumber.value, color: primaryColor.value })),
|
theme: customCssWithTemplate(css2json(getCurrentTab().content), primaryColor.value, customizeTheme(themeMap[theme.value], { fontSize: fontSizeNumber.value, color: primaryColor.value })),
|
||||||
fonts: fontFamily.value,
|
fonts: fontFamily.value,
|
||||||
size: fontSizeNumber.value,
|
size: fontSize.value,
|
||||||
})
|
})
|
||||||
|
|
||||||
// 更新编辑器
|
// 更新编辑器
|
||||||
@ -264,7 +264,7 @@ export const useStore = defineStore(`store`, () => {
|
|||||||
|
|
||||||
const getTheme = (size: string, color: string) => {
|
const getTheme = (size: string, color: string) => {
|
||||||
const newTheme = themeMap[theme.value]
|
const newTheme = themeMap[theme.value]
|
||||||
const fontSize = size.replace(`px`, ``)
|
const fontSize = Number(size.replace(`px`, ``))
|
||||||
return customCssWithTemplate(css2json(getCurrentTab().content), color, customizeTheme(newTheme, { fontSize, color }))
|
return customCssWithTemplate(css2json(getCurrentTab().content), color, customizeTheme(newTheme, { fontSize, color }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ export function addPrefix(str: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function customizeTheme(theme: Theme, options: {
|
export function customizeTheme(theme: Theme, options: {
|
||||||
fontSize?: string
|
fontSize?: number
|
||||||
color?: string
|
color?: string
|
||||||
}) {
|
}) {
|
||||||
const newTheme = JSON.parse(JSON.stringify(theme))
|
const newTheme = JSON.parse(JSON.stringify(theme))
|
||||||
@ -22,7 +22,7 @@ export function customizeTheme(theme: Theme, options: {
|
|||||||
if (fontSize) {
|
if (fontSize) {
|
||||||
for (let i = 1; i <= 4; i++) {
|
for (let i = 1; i <= 4; i++) {
|
||||||
const v = newTheme.block[`h${i}`][`font-size`]
|
const v = newTheme.block[`h${i}`][`font-size`]
|
||||||
newTheme.block[`h${i}`][`font-size`] = `${Number(fontSize) * Number.parseFloat(v)}px`
|
newTheme.block[`h${i}`][`font-size`] = `${fontSize * Number.parseFloat(v)}px`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (color) {
|
if (color) {
|
||||||
|
Loading…
Reference in New Issue
Block a user