web_ppt / frontend /src /hooks /useTextFormatPainter.ts
CatPtain's picture
Upload 339 files
89ce340 verified
raw
history blame
873 Bytes
import { storeToRefs } from 'pinia'
import { useMainStore } from '@/store'
export default () => {
const mainStore = useMainStore()
const { richTextAttrs, textFormatPainter } = storeToRefs(mainStore)
const toggleTextFormatPainter = (keep = false) => {
if (textFormatPainter.value) mainStore.setTextFormatPainter(null)
else {
mainStore.setTextFormatPainter({
keep,
bold: richTextAttrs.value.bold,
em: richTextAttrs.value.em,
underline: richTextAttrs.value.underline,
strikethrough: richTextAttrs.value.strikethrough,
color: richTextAttrs.value.color,
backcolor: richTextAttrs.value.backcolor,
fontname: richTextAttrs.value.fontname,
fontsize: richTextAttrs.value.fontsize,
align: richTextAttrs.value.align,
})
}
}
return {
toggleTextFormatPainter,
}
}