@@ -13,8 +13,8 @@ import {
1313 triggerPropsCheck ,
1414} from './utils' ;
1515
16- import { CommandItem } from '../CommandItem/CommandItem ' ;
17- import { UserItem } from '../UserItem/UserItem ' ;
16+ import { CommandItem } from '../CommandItem' ;
17+ import { UserItem } from '../UserItem' ;
1818
1919export class ReactTextareaAutocomplete extends React . Component {
2020 static defaultProps = {
@@ -687,6 +687,16 @@ export class ReactTextareaAutocomplete extends React.Component {
687687
688688 render ( ) {
689689 const { className, containerClassName, containerStyle, style } = this . props ;
690+ const {
691+ onBlur,
692+ onChange,
693+ onClick,
694+ onFocus,
695+ onKeyDown,
696+ onScroll,
697+ onSelect,
698+ ...restAdditionalTextareaProps
699+ } = this . props . additionalTextareaProps || { } ;
690700
691701 let { maxRows } = this . props ;
692702
@@ -711,20 +721,41 @@ export class ReactTextareaAutocomplete extends React.Component {
711721 { ...this . _cleanUpProps ( ) }
712722 className = { clsx ( 'rta__textarea' , className ) }
713723 maxRows = { maxRows }
714- onBlur = { this . _onClickAndBlurHandler }
715- onChange = { this . _changeHandler }
716- onClick = { this . _onClickAndBlurHandler }
717- onFocus = { this . props . onFocus }
718- onKeyDown = { this . _handleKeyDown }
719- onScroll = { this . _onScrollHandler }
720- onSelect = { this . _selectHandler }
724+ onBlur = { ( e ) => {
725+ this . _onClickAndBlurHandler ( e ) ;
726+ onBlur ?. ( e ) ;
727+ } }
728+ onChange = { ( e ) => {
729+ this . _changeHandler ( e ) ;
730+ onChange ?. ( e ) ;
731+ } }
732+ onClick = { ( e ) => {
733+ this . _onClickAndBlurHandler ( e ) ;
734+ onClick ?. ( e ) ;
735+ } }
736+ onFocus = { ( e ) => {
737+ this . props . onFocus ?. ( e ) ;
738+ onFocus ?. ( e ) ;
739+ } }
740+ onKeyDown = { ( e ) => {
741+ this . _handleKeyDown ( e ) ;
742+ onKeyDown ?. ( e ) ;
743+ } }
744+ onScroll = { ( e ) => {
745+ this . _onScrollHandler ( e ) ;
746+ onScroll ?. ( e ) ;
747+ } }
748+ onSelect = { ( e ) => {
749+ this . _selectHandler ( e ) ;
750+ onSelect ?. ( e ) ;
751+ } }
721752 ref = { ( ref ) => {
722753 this . props ?. innerRef ( ref ) ;
723754 this . textareaRef = ref ;
724755 } }
725756 style = { style }
726757 value = { value }
727- { ...this . props . additionalTextareaProps }
758+ { ...restAdditionalTextareaProps }
728759 defaultValue = { undefined }
729760 />
730761 </ div >
0 commit comments