diff --git a/src/configs/font.ts b/src/configs/font.ts new file mode 100644 index 00000000..b57be519 --- /dev/null +++ b/src/configs/font.ts @@ -0,0 +1,45 @@ +export const SYS_FONTS = [ + { zh: '微软雅黑', en: 'Microsoft Yahei' }, + { zh: '宋体', en: 'SimSun' }, + { zh: '黑体', en: 'SimHei' }, + { zh: '楷体', en: 'KaiTi' }, + { zh: '新宋体', en: 'NSimSun' }, + { zh: '仿宋', en: 'FangSong' }, + { zh: '苹方', en: 'PingFang SC' }, + { zh: '华文黑体', en: 'STHeiti' }, + { zh: '华文楷体', en: 'STKaiti' }, + { zh: '华文宋体', en: 'STSong' }, + { zh: '华文仿宋', en: 'STFangSong' }, + { zh: '华文中宋', en: 'STZhongSong' }, + { zh: '华文琥珀', en: 'STHupo' }, + { zh: '华文新魏', en: 'STXinwei' }, + { zh: '华文隶书', en: 'STLiti' }, + { zh: '华文行楷', en: 'STXingkai' }, + { zh: '冬青黑体简', en: 'Hiragino Sans GB' }, + { zh: '兰亭黑-简', en: 'Lantinghei SC' }, + { zh: '偏偏体-简', en: 'Hanzipen SC' }, + { zh: '手札体-简', en: 'Hannotate SC' }, + { zh: '宋体-简', en: 'Songti SC' }, + { zh: '娃娃体-简', en: 'Wawati SC' }, + { zh: '行楷-简', en: 'Xingkai SC' }, + { zh: '圆体-简', en: 'Yuanti SC' }, + { zh: '华文细黑', en: 'STXihei' }, + { zh: '幼圆', en: 'YouYuan' }, + { zh: '隶书', en: 'LiSu' }, + { zh: 'Arial', en: 'Arial' }, +] + +export const WEB_FONTS = [ + { name: '仓耳小丸子' }, + { name: '优设标题黑' }, + { name: '峰广明锐体' }, + { name: '摄图摩登小方体' }, + { name: '站酷快乐体' }, + { name: '站酷酷黑体' }, + { name: '素材集市康康体' }, + { name: '联盟起艺卢帅正锐黑体' }, + { name: '谦度手写楷体' }, + { name: '途牛类圆体' }, + { name: '锐字真言体' }, + { name: '问藏书房' }, +] \ No newline at end of file diff --git a/src/configs/fontName.ts b/src/configs/fontName.ts deleted file mode 100644 index 0bb722aa..00000000 --- a/src/configs/fontName.ts +++ /dev/null @@ -1,38 +0,0 @@ -export interface FontName { - source: string; - zh: string; - en: string; -} - -export const FONT_NAMES: FontName[] = [ - { source: 'windows', zh: '微软雅黑', en: 'Microsoft Yahei' }, - { source: 'windows', zh: '宋体', en: 'SimSun' }, - { source: 'windows', zh: '黑体', en: 'SimHei' }, - { source: 'windows', zh: '楷体', en: 'KaiTi' }, - { source: 'windows', zh: '新宋体', en: 'NSimSun' }, - { source: 'windows', zh: '仿宋', en: 'FangSong' }, - - { source: 'osx', zh: '苹方', en: 'PingFang SC' }, - { source: 'osx', zh: '华文黑体', en: 'STHeiti' }, - { source: 'osx', zh: '华文楷体', en: 'STKaiti' }, - { source: 'osx', zh: '华文宋体', en: 'STSong' }, - { source: 'osx', zh: '华文仿宋', en: 'STFangSong' }, - { source: 'osx', zh: '华文中宋', en: 'STZhongSong' }, - { source: 'osx', zh: '华文琥珀', en: 'STHupo' }, - { source: 'osx', zh: '华文新魏', en: 'STXinwei' }, - { source: 'osx', zh: '华文隶书', en: 'STLiti' }, - { source: 'osx', zh: '华文行楷', en: 'STXingkai' }, - { source: 'osx', zh: '冬青黑体简', en: 'Hiragino Sans GB' }, - { source: 'osx', zh: '兰亭黑-简', en: 'Lantinghei SC' }, - { source: 'osx', zh: '偏偏体-简', en: 'Hanzipen SC' }, - { source: 'osx', zh: '手札体-简', en: 'Hannotate SC' }, - { source: 'osx', zh: '宋体-简', en: 'Songti SC' }, - { source: 'osx', zh: '娃娃体-简', en: 'Wawati SC' }, - { source: 'osx', zh: '行楷-简', en: 'Xingkai SC' }, - { source: 'osx', zh: '圆体-简', en: 'Yuanti SC' }, - - { source: 'office', zh: '华文细黑', en: 'STXihei' }, - { source: 'office', zh: '幼圆', en: 'YouYuan' }, - { source: 'office', zh: '隶书', en: 'LiSu' }, - { source: '', zh: 'Arial', en: 'Arial' }, -] \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index b9ce1c81..74b10a35 100644 --- a/src/main.ts +++ b/src/main.ts @@ -48,6 +48,7 @@ app.component('Popover', Popover) app.component('Slider', Slider) app.component('Select', Select) app.component('SelectOption', Select.Option) +app.component('SelectOptGroup', Select.OptGroup) app.component('Switch', Switch) app.component('Radio', Radio) app.component('RadioGroup', Radio.Group) diff --git a/src/store/index.ts b/src/store/index.ts index 913d7d2f..be2b46b2 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -8,7 +8,7 @@ import { Slide, SlideTheme } from '@/types/slides' import { CreatingElement } from '@/types/edit' import { ToolbarState } from '@/types/toolbar' import { slides } from '@/mocks/index' -import { FontName } from '@/configs/fontName' +import { SYS_FONTS } from '@/configs/font' export { MutationTypes, ActionTypes } @@ -22,7 +22,7 @@ export interface State { disableHotkeys: boolean; showGridLines: boolean; creatingElement: CreatingElement | null; - availableFonts: FontName[]; + availableFonts: typeof SYS_FONTS; toolbarState: ToolbarState; theme: SlideTheme; slides: Slide[]; diff --git a/src/store/mutations.ts b/src/store/mutations.ts index 26d42190..0209d9c6 100644 --- a/src/store/mutations.ts +++ b/src/store/mutations.ts @@ -4,7 +4,7 @@ import { MutationTypes } from './constants' import { State } from './index' import { Slide, PPTElement, SlideTheme } from '@/types/slides' import { CreatingElement } from '@/types/edit' -import { FONT_NAMES } from '@/configs/fontName' +import { SYS_FONTS } from '@/configs/font' import { isSupportFontFamily } from '@/utils/fontFamily' interface RemoveElementPropData { @@ -61,7 +61,7 @@ export const mutations: MutationTree = { }, [MutationTypes.SET_AVAILABLE_FONTS](state) { - state.availableFonts = FONT_NAMES.filter(font => isSupportFontFamily(font.en)) + state.availableFonts = SYS_FONTS.filter(font => isSupportFontFamily(font.en)) }, [MutationTypes.SET_TOOLBAR_STATE](state, type) { diff --git a/src/views/Editor/Toolbar/ElementStylePanel/TextStylePanel.vue b/src/views/Editor/Toolbar/ElementStylePanel/TextStylePanel.vue index c1d825b3..9c4dd2e3 100644 --- a/src/views/Editor/Toolbar/ElementStylePanel/TextStylePanel.vue +++ b/src/views/Editor/Toolbar/ElementStylePanel/TextStylePanel.vue @@ -19,9 +19,16 @@ @change="value => emitRichTextCommand('fontname', value)" > - - {{font.zh}} - + + + {{font.zh}} + + + + + {{font.name}} + +