@@ -53,7 +53,6 @@ const TextEditor = forwardRef<TextEditorRef, TextEditorProps>(
5353
5454 // Define button styling constants at component level for consistent use
5555 const buttonSize = 'sm'
56- const largeButtonSize = 'lg' // New constant for modal buttons
5756 const buttonClassName = 'w-4 h-4'
5857 const modalSize = 'full'
5958
@@ -228,47 +227,6 @@ const TextEditor = forwardRef<TextEditorRef, TextEditorProps>(
228227 }
229228 } , [ modalIsOpen , modalEditor , editor ] )
230229
231- useEffect ( ( ) => {
232- if ( modalIsOpen ) {
233- const handleKeyDown = ( event : KeyboardEvent ) => {
234- if ( event . key === 'Enter' && ( event . ctrlKey || event . metaKey ) ) {
235- if ( modalEditor && editor ) {
236- const content = modalEditor . storage . markdown ?. getMarkdown ( ) ?? ''
237- editor . commands . setContent ( content )
238- setLocalContent ( content )
239- setContent ( content )
240- modalOnOpenChange ( false )
241- }
242- } else if ( event . key === 'Escape' ) {
243- // The modal will be closed by the framework itself when ESC is pressed
244- // We just need to handle content restoration
245- if ( modalEditor && editor ) {
246- const content = editor . storage . markdown ?. getMarkdown ( ) ?? ''
247- modalEditor . commands . setContent ( content )
248- }
249- }
250- }
251-
252- window . addEventListener ( 'keydown' , handleKeyDown )
253- return ( ) => window . removeEventListener ( 'keydown' , handleKeyDown )
254- }
255- } , [ modalIsOpen , modalEditor , editor , setContent , modalOnOpenChange ] )
256-
257- useEffect ( ( ) => {
258- if ( isOpen ) {
259- const handleKeyDown = ( event : KeyboardEvent ) => {
260- if ( event . key === 'Enter' && ( event . ctrlKey || event . metaKey ) && ! isGenerating ) {
261- handleGenerateMessage ( )
262- } else if ( event . key === 'Escape' && ! isGenerating ) {
263- resetModalState ( )
264- }
265- }
266-
267- window . addEventListener ( 'keydown' , handleKeyDown )
268- return ( ) => window . removeEventListener ( 'keydown' , handleKeyDown )
269- }
270- } , [ isOpen , isGenerating , description , localContent , selectedVariables , generationType ] )
271-
272230 const renderVariableButtons = ( editorInstance : Editor | null ) => {
273231 // Only show variable buttons if this is a template editor
274232 if ( ! isTemplateEditor ) return null ;
@@ -504,16 +462,14 @@ const TextEditor = forwardRef<TextEditorRef, TextEditorProps>(
504462 color = "danger"
505463 variant = "light"
506464 onPress = { ( ) => handleCancel ( onClose ) }
507- size = { largeButtonSize }
508- endContent = { < span className = "text-xs opacity-70" > ESC</ span > }
465+ size = "lg"
509466 >
510467 Cancel
511468 </ Button >
512469 < Button
513470 color = "primary"
514471 onPress = { ( ) => handleSave ( onClose ) }
515- size = { largeButtonSize }
516- endContent = { < span className = "text-xs opacity-70" > ⌘+↵</ span > }
472+ size = "lg"
517473 >
518474 Save
519475 </ Button >
@@ -641,21 +597,19 @@ const TextEditor = forwardRef<TextEditorRef, TextEditorProps>(
641597 </ ModalBody >
642598 < ModalFooter >
643599 < Button
644- size = { largeButtonSize }
600+ size = "lg"
645601 variant = "light"
646602 onClick = { resetModalState }
647603 isDisabled = { isGenerating }
648- endContent = { < span className = "text-xs opacity-70" > ESC</ span > }
649604 >
650605 Cancel
651606 </ Button >
652607 < Button
653- size = { largeButtonSize }
608+ size = "lg"
654609 color = "primary"
655610 onClick = { handleGenerateMessage }
656611 isLoading = { isGenerating }
657612 isDisabled = { isGenerating }
658- endContent = { < span className = "text-xs opacity-70" > ⌘+↵</ span > }
659613 >
660614 Generate
661615 </ Button >
0 commit comments