import { IStore } from '@/store' ; import { notification , previewImg } from '@/components' ; import { copyTextByDom } from '@/utils/app' ; import hidden from './windowHidden' ; import resize from './windowrResize' ; import initStoreState from './initStoreState' ; const copyCode = ( ) => { copyTextByDom ( 'copy-code-btn' , { deep : true , success : ( ) => { notification . stack . show ( '代码复制成功~' ) ; } , error : ( ) => { notification . stack . show ( '代码复制失败~' ) ; } } ) ; } ; const previewImageByMd = ( ) => { document . body . addEventListener ( 'click' , ( e ) => { const target = e . target as HTMLImageElement ; if ( target . className === 'preview-image' ) { const src = target . src ; previewImg . show ( { src } ) ; } } ) ; } ; export const globalFn = ( ) => { copyCode ( ) ; previewImageByMd ( ) ; } ; export const globalFnByStore = ( store ) => { resize ( store ) ; initStoreState ( store ) ; } ;