fix: 应用全局字体

This commit is contained in:
pipipi-pikachu 2021-05-31 17:59:52 +08:00
parent 5657d3af05
commit fcc23b0ad6
2 changed files with 7 additions and 3 deletions

View File

@ -45,7 +45,7 @@ module.exports = {
}],
'default-case': 'error',
'consistent-this': ['error', '_this'],
'max-depth': ['error', 5],
'max-depth': ['error', 6],
'max-lines': ['error', 800],
'no-multi-str': 'error',
'space-infix-ops': 'error',

View File

@ -294,7 +294,7 @@ export default defineComponent({
//
const applyThemeAllSlide = () => {
const newSlides: Slide[] = JSON.parse(JSON.stringify(slides.value))
const { themeColor, backgroundColor, fontColor } = theme.value
const { themeColor, backgroundColor, fontColor, fontName } = theme.value
for (const slide of newSlides) {
if (!slide.background || slide.background.type !== 'image') {
@ -311,13 +311,17 @@ export default defineComponent({
else if (el.type === 'line') el.color = themeColor
else if (el.type === 'text') {
el.defaultColor = fontColor
el.defaultFontName = fontName
if (el.fill) el.fill = themeColor
}
else if (el.type === 'table') {
if (el.theme) el.theme.color = themeColor
for (const rowCells of el.data) {
for (const cell of rowCells) {
cell.style?.color && (cell.style.color = fontColor)
if (cell.style) {
cell.style.color = fontColor
cell.style.fontname = fontName
}
}
}
}