@@ -10,26 +10,23 @@ import {
1010 useLayoutEffect ,
1111 useRef
1212} from "react" ;
13- import { CustomFontsType , RichTextContainerProps } from "../../typings/RichTextProps" ;
13+ import { RichTextContainerProps } from "../../typings/RichTextProps" ;
1414import { EditorDispatchContext } from "../store/EditorProvider" ;
1515import { SET_FULLSCREEN_ACTION } from "../store/store" ;
1616import "../utils/customPluginRegisters" ;
17- import { FontStyleAttributor , formatCustomFonts } from "../utils/formats/fonts" ;
1817import "../utils/formats/quill-table-better/assets/css/quill-table-better.scss" ;
1918import { getResizeModuleConfig } from "../utils/formats/resizeModuleConfig" ;
2019import { ACTION_DISPATCHER } from "../utils/helpers" ;
2120import { getKeyboardBindings } from "../utils/modules/keyboard" ;
2221import { getIndentHandler } from "../utils/modules/toolbarHandlers" ;
2322import MxUploader from "../utils/modules/uploader" ;
24- import MxQuill from "../utils/MxQuill" ;
23+ import MxQuill , { MxQuillModulesOptions } from "../utils/MxQuill" ;
2524import { useEmbedModal } from "./CustomToolbars/useEmbedModal" ;
2625import Dialog from "./ModalDialog/Dialog" ;
2726
28- export interface EditorProps extends Pick <
29- RichTextContainerProps ,
30- "imageSource" | "imageSourceContent" | "enableDefaultUpload"
31- > {
32- customFonts : CustomFontsType [ ] ;
27+ export interface EditorProps
28+ extends Pick < RichTextContainerProps , "imageSource" | "imageSourceContent" | "enableDefaultUpload" > {
29+ options : MxQuillModulesOptions ;
3330 defaultValue ?: string ;
3431 onTextChange ?: ( ...args : [ delta : Delta , oldContent : Delta , source : EmitterSource ] ) => void ;
3532 onSelectionChange ?: ( ...args : [ range : Range , oldRange : Range , source : EmitterSource ] ) => void ;
@@ -43,10 +40,17 @@ export interface EditorProps extends Pick<
4340
4441// Editor is an uncontrolled React component
4542const Editor = forwardRef ( ( props : EditorProps , ref : MutableRefObject < Quill | null > ) => {
46- const fonts = formatCustomFonts ( props . customFonts ) ;
47- const FontStyle = new FontStyleAttributor ( fonts ) ;
48- Quill . register ( FontStyle , true ) ;
49- const { theme, defaultValue, style, className, toolbarId, onTextChange, onSelectionChange, readOnly } = props ;
43+ const {
44+ theme,
45+ defaultValue,
46+ style,
47+ className,
48+ toolbarId,
49+ onTextChange,
50+ onSelectionChange,
51+ readOnly,
52+ options : mxOptions
53+ } = props ;
5054 const containerRef = useRef < HTMLDivElement > ( null ) ;
5155 const modalRef = useRef < HTMLDivElement > ( null ) ;
5256 const onTextChangeRef = useRef ( onTextChange ) ;
@@ -127,6 +131,7 @@ const Editor = forwardRef((props: EditorProps, ref: MutableRefObject<Quill | nul
127131
128132 const quill = new MxQuill ( editorContainer , options ) ;
129133 ref . current = quill ;
134+ quill . registerCustomModules ( mxOptions ) ;
130135
131136 const delta = quill . clipboard . convert ( { html : defaultValue ?? "" } ) ;
132137 quill . updateContents ( delta , Quill . sources . SILENT ) ;
0 commit comments