|
@@ -149,6 +149,11 @@
|
|
|
|
|
|
const { isHeaderDisabled } = defineProps(['isHeaderDisabled'])
|
|
|
const useViewer = useViewerStore()
|
|
|
+ const isOpen = computed(() => useViewer.isElementOpen('contentEditorPanel'))
|
|
|
+ const type = computed(() => useViewer.getContentEditorType)
|
|
|
+ const rightPanelButtonDisabled = computed(() => useViewer.getRightPanelButtonDisabled)
|
|
|
+ const customFonts = computed(() => useViewer.getCustomFonts)
|
|
|
+
|
|
|
const instance = getCurrentInstance().appContext.app.config.globalProperties
|
|
|
const $t = instance.$t
|
|
|
|
|
@@ -172,25 +177,28 @@
|
|
|
})
|
|
|
const loadFont = (data) => {
|
|
|
const fontFamily = data.fontFamily
|
|
|
- if (!fontFamilyArr.includes(fontFamily)) {
|
|
|
- fontFamilyArr.push(fontFamily)
|
|
|
- fontFamilyOptions.value.push({
|
|
|
- label: fontFamily,
|
|
|
- value: fontFamily,
|
|
|
- class: 'edit-select'
|
|
|
+ useViewer.setCustomFonts(fontFamily)
|
|
|
+ }
|
|
|
+
|
|
|
+ core.addEvent('LoadFont', loadFont)
|
|
|
+ watch(() => customFonts.value, (newValue, oldValue) => {
|
|
|
+ fontFamilyOptions.value = setFontMap(newValue)
|
|
|
+ }, { deep: true })
|
|
|
+
|
|
|
+ const setFontMap = (fonts) => {
|
|
|
+ if (fonts.length) {
|
|
|
+ return fonts.map(font => {
|
|
|
+ return {
|
|
|
+ label: font,
|
|
|
+ value: font,
|
|
|
+ class: 'edit-select'
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
- core.addEvent('LoadFont', loadFont)
|
|
|
- const fontFamilyArr = ['Helvetica', 'Courier', 'Times-Roman', 'NotoSansSC-Regular', 'NotoSansSC-Bold', 'NotoSerifSC-Regular']
|
|
|
+
|
|
|
const fontFamilyOptions = ref([])
|
|
|
- fontFamilyOptions.value = fontFamilyArr.map(fontFamily => {
|
|
|
- return {
|
|
|
- label: fontFamily,
|
|
|
- value: fontFamily,
|
|
|
- class: 'edit-select'
|
|
|
- }
|
|
|
- })
|
|
|
+ fontFamilyOptions.value = setFontMap(customFonts.value)
|
|
|
const fontStyleOptions = computed(() => {
|
|
|
return [{
|
|
|
label: $t('regular'),
|
|
@@ -219,10 +227,6 @@
|
|
|
}
|
|
|
})
|
|
|
|
|
|
- const isOpen = computed(() => useViewer.isElementOpen('contentEditorPanel'))
|
|
|
- const type = computed(() => useViewer.getContentEditorType)
|
|
|
- const rightPanelButtonDisabled = computed(() => useViewer.getRightPanelButtonDisabled)
|
|
|
-
|
|
|
const imageUrl = ref('')
|
|
|
const colorPickerValue = ref('rgb(0, 0, 0)')
|
|
|
|