@@ -2,7 +2,7 @@ import { StringControl } from "comps/controls/codeControl";
22import { BoolControl } from "comps/controls/boolControl" ;
33import { stringExposingStateControl } from "comps/controls/codeStateControl" ;
44import { AutoHeightControl } from "comps/controls/autoHeightControl" ;
5- import { ChangeEventHandlerControl } from "comps/controls/eventHandlerControl" ;
5+ import { blurEvent , changeEvent , eventHandlerControl } from "comps/controls/eventHandlerControl" ;
66import { UICompBuilder , withDefault } from "comps/generators" ;
77import { NameConfig , NameConfigHidden , withExposingConfigs , depsConfig } from "comps/generators/withExposing" ;
88import { Section , sectionNames } from "barda-design" ;
@@ -208,7 +208,7 @@ const childrenMap = {
208208 autoHeight : AutoHeightControl ,
209209 autoTimestamp : BoolControl ,
210210 placeholder : withDefault ( StringControl , trans ( "richTextEditor.placeholder" ) ) ,
211- onEvent : ChangeEventHandlerControl ,
211+ onEvent : eventHandlerControl ( [ changeEvent , blurEvent ] as const ) ,
212212 style : styleControl ( RichTextEditorStyle ) ,
213213
214214 ...formDataChildren ,
@@ -232,6 +232,7 @@ interface IProps {
232232 autoTimestamp : boolean ;
233233 autoHeight : boolean ;
234234 onChange : ( value : string ) => void ;
235+ onBlur : ( ) => void ;
235236 $style : RichTextEditorStyleType ;
236237}
237238
@@ -530,6 +531,10 @@ function RichTextEditor(props: IProps) {
530531 onChangeRef . current ( value ) ;
531532 } ;
532533
534+ const handleBlur = ( ) => {
535+ props . onBlur ?.( ) ;
536+ } ;
537+
533538 useEffect ( ( ) => {
534539 let finalValue = props . value ;
535540 if ( ! / ^ < \w + > .+ < \/ \w + > $ / . test ( props . value ) ) {
@@ -596,6 +601,7 @@ function RichTextEditor(props: IProps) {
596601 placeholder = { props . placeholder }
597602 readOnly = { props . readOnly }
598603 onChange = { handleChange }
604+ onBlur = { handleBlur }
599605 />
600606 </ Suspense >
601607 </ Wrapper >
@@ -608,6 +614,10 @@ const RichTextEditorCompBase = new UICompBuilder(childrenMap, (props) => {
608614 props . onEvent ( "change" ) ;
609615 } ;
610616
617+ const handleBlur = ( ) => {
618+ props . onEvent ( "blur" ) ;
619+ } ;
620+
611621 return (
612622 < RichTextEditor
613623 autoHeight = { props . autoHeight }
@@ -617,6 +627,7 @@ const RichTextEditorCompBase = new UICompBuilder(childrenMap, (props) => {
617627 value = { props . value . value }
618628 placeholder = { props . placeholder }
619629 onChange = { handleChange }
630+ onBlur = { handleBlur }
620631 $style = { props . style }
621632 />
622633 ) ;
0 commit comments