import { emojiList } from '@/config/emoji' ; import Mint from 'mint-filter' ; import mintWords from '@/assets/mintWords' ; export const formatEmoji = ( value ) => { return value . replace ( /\[(.+?)\]/g , ( val , content ) => { const arr = content . split ( 'emoji=' ) ; const name = arr [ 1 ] ? arr [ 1 ] . trim ( ) : '' ; const current = emojiList . find ( ( item ) => item . name === name ) ; const text = `<img src="${ current ?. url }" class="comment-emoji"/>` ; return name ? text : val ; } ) ; } ; const mint = new Mint ( mintWords ) ; const emojiRe = /\[(.+?)\]/g ; export const checkMint = ( text ) => { return mint . filterSync ( text . replace ( emojiRe , '' ) ) ; } ; export const filterMint = ( text ) => { return text ; } ;