@@ -15,7 +15,7 @@ import EditingPreview from '@ts/ui/chat/message_box/editing_preview';
1515import type { EnterKeyEvent , InputEvent } from '../../../../ui/text_area' ;
1616
1717export const CHAT_MESSAGEBOX_CLASS = 'dx-chat-messagebox' ;
18- export const CHAT_MESSAGEBOX_INPUT_CONTAINER_CLASS = 'dx-chat-messagebox-input -container' ;
18+ export const CHAT_MESSAGEBOX_TEXTAREA_CONTAINER_CLASS = 'dx-chat-messagebox-textarea -container' ;
1919export const CHAT_MESSAGEBOX_TEXTAREA_CLASS = 'dx-chat-messagebox-textarea' ;
2020export const CHAT_MESSAGEBOX_BUTTON_CLASS = 'dx-chat-messagebox-button' ;
2121
@@ -39,7 +39,9 @@ export interface Properties extends DOMComponentProperties<MessageBox> {
3939
4040 text ?: string ;
4141
42+ /** To remove */
4243 toolbarItems ?: ToolbarProperties [ 'items' ] ;
44+ /** End */
4345
4446 onMessageEntered ?: ( e : MessageEnteredEvent ) => void ;
4547
@@ -55,7 +57,9 @@ export interface Properties extends DOMComponentProperties<MessageBox> {
5557class MessageBox extends DOMComponent < MessageBox , Properties > {
5658 _textArea ! : TextAreaOnSteroids ;
5759
60+ /** Move to ChatTextArea */
5861 _sendButton ?: Button ;
62+ /** End */
5963
6064 _editingPreview ! : EditingPreview | null ;
6165
@@ -74,12 +78,15 @@ class MessageBox extends DOMComponent<MessageBox, Properties> {
7478 activeStateEnabled : true ,
7579 focusStateEnabled : true ,
7680 hoverStateEnabled : true ,
81+ text : '' ,
82+ /** To remove */
83+ toolbarItems : [ ] ,
84+ /** End */
7785 onMessageEntered : undefined ,
78- onTypingStart : undefined ,
79- onTypingEnd : undefined ,
8086 onMessageEditCanceled : undefined ,
8187 onMessageUpdating : undefined ,
82- text : '' ,
88+ onTypingStart : undefined ,
89+ onTypingEnd : undefined ,
8390 } ;
8491 }
8592
@@ -100,13 +107,12 @@ class MessageBox extends DOMComponent<MessageBox, Properties> {
100107 this . _renderEditingPreview ( ) ;
101108 }
102109
103- this . _renderInputContainer ( ) ;
110+ this . _renderTextAreaContainer ( ) ;
104111 }
105112
106- /** Why we need additional container? Why it is input container? */
107- _renderInputContainer ( ) : void {
113+ _renderTextAreaContainer ( ) : void {
108114 const $inputContainer = $ ( '<div>' )
109- . addClass ( CHAT_MESSAGEBOX_INPUT_CONTAINER_CLASS )
115+ . addClass ( CHAT_MESSAGEBOX_TEXTAREA_CONTAINER_CLASS )
110116 . appendTo ( this . element ( ) ) ;
111117
112118 this . _renderTextArea ( $inputContainer ) ;
@@ -150,13 +156,18 @@ class MessageBox extends DOMComponent<MessageBox, Properties> {
150156 textAreaOptions ,
151157 ) ;
152158
159+ /** Will conflict with Enter on other buttons? */
153160 this . _textArea . registerKeyHandler ( 'enter' , ( event : KeyboardEvent ) => {
161+ debugger ;
154162 if ( ! event . shiftKey && this . _isValuableTextEntered ( ) && ! isMobile ( ) ) {
155163 event . preventDefault ( ) ;
156164 }
157165 } ) ;
166+ /** End */
158167
168+ /** Will conflict with Esc on Toolbar DropDowns? */
159169 this . _textArea . registerKeyHandler ( ESCAPE_KEY , ( ) => {
170+ debugger ;
160171 if ( this . option ( 'text' ) ) {
161172 this . _cancelMessageEdit ( ) ;
162173 }
@@ -170,24 +181,31 @@ class MessageBox extends DOMComponent<MessageBox, Properties> {
170181 hoverStateEnabled,
171182 } = this . option ( ) ;
172183
184+ /** Move to ChatTextArea */
173185 const toolbarItems = this . _getToolbarItems ( ) ;
186+ /** End */
174187
175188 const options = {
176189 activeStateEnabled,
177190 focusStateEnabled,
178191 hoverStateEnabled,
192+ /** To remove */
179193 toolbarOptions : {
180194 items : toolbarItems ,
181195 } ,
196+ /** Move to ChatTextArea */
182197 stylingMode : 'outlined' ,
183198 placeholder : messageLocalization . format ( 'dxChat-textareaPlaceholder' ) ,
184199 autoResizeEnabled : true ,
185200 valueChangeEvent : 'input' ,
186201 maxHeight : '8em' ,
202+ /** End */
187203 onInput : ( e : InputEvent ) : void => {
204+ /** Move to ChatTextArea */
188205 const shouldButtonBeDisabled = ! this . _isValuableTextEntered ( ) ;
189206
190207 this . _toggleButtonDisableState ( shouldButtonBeDisabled ) ;
208+ /** End */
191209
192210 this . _triggerTypingStartAction ( e ) ;
193211 this . _updateTypingEndTimeout ( ) ;
@@ -206,6 +224,7 @@ class MessageBox extends DOMComponent<MessageBox, Properties> {
206224 return options as TextAreaOnSteroidsProperties ;
207225 }
208226
227+ /** Move to ChatTextArea */
209228 _getToolbarItems ( ) : ToolbarProperties [ 'items' ] {
210229 const { toolbarItems } = this . option ( ) ;
211230
@@ -218,7 +237,9 @@ class MessageBox extends DOMComponent<MessageBox, Properties> {
218237 // eslint-disable-next-line @typescript-eslint/no-unsafe-return
219238 return items ;
220239 }
240+ /** End */
221241
242+ /** Move to ChatTextArea */
222243 _getDefaultBeforeToolbarItems ( ) : ToolbarProperties [ 'items' ] {
223244 const {
224245 activeStateEnabled,
@@ -245,7 +266,9 @@ class MessageBox extends DOMComponent<MessageBox, Properties> {
245266
246267 return items ;
247268 }
269+ /** End */
248270
271+ /** Move to ChatTextArea */
249272 _getDefaultAfterToolbarItems ( ) : ToolbarProperties [ 'items' ] {
250273 const {
251274 activeStateEnabled,
@@ -294,6 +317,7 @@ class MessageBox extends DOMComponent<MessageBox, Properties> {
294317
295318 return items ;
296319 }
320+ /** End */
297321
298322 _createMessageEnteredAction ( ) : void {
299323 this . _messageEnteredAction = this . _createActionByOption (
@@ -348,7 +372,6 @@ class MessageBox extends DOMComponent<MessageBox, Properties> {
348372 this . _typingEndAction ?.( ) ;
349373
350374 const { text = '' } = this . _textArea . option ( ) ;
351-
352375 const { text : previewText } = this . option ( ) ;
353376
354377 if ( previewText ) {
@@ -359,21 +382,28 @@ class MessageBox extends DOMComponent<MessageBox, Properties> {
359382 return ;
360383 }
361384
385+ /** Move to ChatTextArea */
386+ /** Make onSend action */
362387 this . _textArea . reset ( ) ;
363388 this . _toggleButtonDisableState ( true ) ;
389+ /** end */
364390
365391 this . _messageEnteredAction ?.( { text, event : e . event } ) ;
366392 }
367393
394+ /** Move to ChatTextArea */
368395 _toggleButtonDisableState ( state : boolean ) : void {
369396 this . _sendButton ?. option ( 'disabled' , state ) ;
370397 }
398+ /** End */
371399
400+ /** Move to ChatTextArea */
372401 _isValuableTextEntered ( ) : boolean {
373402 const { text } = this . _textArea . option ( ) ;
374403
375404 return ! ! text ?. trim ( ) ;
376405 }
406+ /** End */
377407
378408 _optionChanged ( args : OptionChanged < Properties > ) : void {
379409 const { name, value } = args ;
@@ -435,13 +465,17 @@ class MessageBox extends DOMComponent<MessageBox, Properties> {
435465 }
436466 }
437467
468+ /** Move to ChatTextArea */
438469 _updateInputContainer ( value : string | undefined ) : void {
470+ /** Is it in law here in the updateInputContainer method? */
471+ /** There is no any related things to InputContainer */
439472 this . _textArea . option ( 'value' , value ) ;
440473
441474 const shouldButtonBeDisabled = ! this . _isValuableTextEntered ( ) ;
442475
443476 this . _toggleButtonDisableState ( shouldButtonBeDisabled ) ;
444477 }
478+ /** End */
445479}
446480
447481export default MessageBox ;
0 commit comments