@@ -31,6 +31,8 @@ import { TextColorClass } from "../extensions/TextColorClass";
3131import { TextDirection } from "../extensions/TextDirection" ;
3232import { TextHighlightClass } from "../extensions/TextHighlightClass" ;
3333import { ConfirmDialog } from "./toolbars/components/ConfirmDialog" ;
34+ import { ToolbarGroupsConfig } from "./toolbars/ToolbarConfig" ;
35+ import { PresetEnum , ToolbarConfigEnum , AdvancedConfigType } from "../../typings/RichTextProps" ;
3436
3537export interface EditorProps {
3638 defaultValue ?: string ;
@@ -40,6 +42,10 @@ export interface EditorProps {
4042 showToolbar ?: boolean ;
4143 styleDataFormat ?: "inline" | "class" ;
4244 imageSourceContent ?: ReactNode ;
45+ preset ?: PresetEnum ;
46+ toolbarConfig ?: ToolbarConfigEnum ;
47+ toolbarGroups ?: ToolbarGroupsConfig ;
48+ advancedConfig ?: AdvancedConfigType [ ] ;
4349}
4450
4551export interface EditorHandle {
@@ -55,9 +61,22 @@ interface EditorInnerProps {
5561 readOnly : boolean ;
5662 className ?: string ;
5763 imageSourceContent ?: ReactNode ;
64+ preset ?: PresetEnum ;
65+ toolbarConfig ?: ToolbarConfigEnum ;
66+ toolbarGroups ?: ToolbarGroupsConfig ;
67+ advancedConfig ?: AdvancedConfigType [ ] ;
5868}
5969
60- function EditorInner ( { showToolbar, readOnly, className, imageSourceContent } : EditorInnerProps ) : ReactElement {
70+ function EditorInner ( {
71+ showToolbar,
72+ readOnly,
73+ className,
74+ imageSourceContent,
75+ preset,
76+ toolbarConfig,
77+ toolbarGroups,
78+ advancedConfig
79+ } : EditorInnerProps ) : ReactElement {
6180 const { editor, codeViewState, codeViewDispatch } = useCurrentEditor ( ) ;
6281 const textareaRef = useRef < HTMLTextAreaElement > ( null ) ;
6382
@@ -80,7 +99,15 @@ function EditorInner({ showToolbar, readOnly, className, imageSourceContent }: E
8099 return (
81100 < >
82101 < div className = "tiptap-wrapper" >
83- { showToolbar && ! readOnly && < Toolbar imageSourceContent = { imageSourceContent } /> }
102+ { showToolbar && ! readOnly && (
103+ < Toolbar
104+ imageSourceContent = { imageSourceContent }
105+ preset = { preset }
106+ toolbarConfig = { toolbarConfig }
107+ toolbarGroups = { toolbarGroups }
108+ advancedConfig = { advancedConfig }
109+ />
110+ ) }
84111 { codeViewState . isCodeView ? (
85112 < textarea
86113 ref = { textareaRef }
@@ -117,7 +144,11 @@ const Editor = forwardRef<EditorHandle, EditorProps>((props, ref) => {
117144 className,
118145 showToolbar = true ,
119146 styleDataFormat = "inline" ,
120- imageSourceContent
147+ imageSourceContent,
148+ preset,
149+ toolbarConfig,
150+ toolbarGroups,
151+ advancedConfig
121152 } = props ;
122153
123154 const extensions = [
@@ -212,6 +243,10 @@ const Editor = forwardRef<EditorHandle, EditorProps>((props, ref) => {
212243 readOnly = { ! ! readOnly }
213244 className = { className }
214245 imageSourceContent = { imageSourceContent }
246+ preset = { preset }
247+ toolbarConfig = { toolbarConfig }
248+ toolbarGroups = { toolbarGroups }
249+ advancedConfig = { advancedConfig }
215250 />
216251 </ EditorContextProvider >
217252 ) ;
0 commit comments