UNPKG

react-native-cn-quill

Version:
36 lines (32 loc) 712 B
export const create_quill = ( id: string, toolbar: 'false' | string, placeholder: string, theme: 'snow' | 'bubble', customFonts: Array<string> = [], customJS: string ) => { let font = ''; if (customFonts.length > 0) { const fontList = "'" + customFonts.join("','") + "'"; font = ` // Add fonts to whitelist var Font = Quill.import('formats/font'); Font.whitelist = [${fontList}]; Quill.register(Font, true); `; } return ` <script> ${font} ${customJS} var quill = new Quill('#${id}', { modules: { toolbar: ${toolbar} }, placeholder: '${placeholder}', theme: '${theme}' }); </script> `; };