@@ -8,10 +8,13 @@ import { motion } from "framer-motion";
88
99interface FloatingButtonProps {
1010 textArea : HTMLTextAreaElement | HTMLElement ;
11- getContentEditableText ?: ( el : HTMLElement ) => string ;
11+ getContentEditableText : boolean ;
1212}
1313
14- const FloatingButton : React . FC < FloatingButtonProps > = ( { textArea, getContentEditableText } ) => {
14+ const FloatingButton : React . FC < FloatingButtonProps > = ( {
15+ textArea,
16+ getContentEditableText,
17+ } ) => {
1518 const [ open , setOpen ] = useState ( false ) ;
1619 const [ text , setText ] = useState ( "" ) ;
1720 const [ isTyping , setIsTyping ] = useState ( false ) ;
@@ -41,10 +44,10 @@ const FloatingButton: React.FC<FloatingButtonProps> = ({ textArea, getContentEdi
4144 } , [ textArea ] ) ;
4245
4346 const handleOpen = ( ) => {
44- const extractedText = getContentEditableText
45- ? getContentEditableText ( textArea as HTMLElement )
46- : ( textArea as HTMLTextAreaElement ) . value ;
47-
47+ const extractedText =
48+ getContentEditableText === true
49+ ? ( textArea as HTMLElement ) . innerText
50+ : ( textArea as HTMLTextAreaElement ) . value ;
4851 setText ( extractedText ) ;
4952 setOpen ( true ) ;
5053 } ;
@@ -86,7 +89,10 @@ const FloatingButton: React.FC<FloatingButtonProps> = ({ textArea, getContentEdi
8689
8790 < motion . div
8891 animate = { isTyping ? { rotate : 360 } : { scale : [ 1 , 1.1 , 1 ] } }
89- transition = { { duration : isTyping ? 0.5 : 0.3 , repeat : isTyping ? Infinity : 1 } }
92+ transition = { {
93+ duration : isTyping ? 0.5 : 0.3 ,
94+ repeat : isTyping ? Infinity : 1 ,
95+ } }
9096 whileTap = { { scale : 0.9 } }
9197 whileHover = { { scale : 1.1 } }
9298 style = { {
@@ -101,7 +107,12 @@ const FloatingButton: React.FC<FloatingButtonProps> = ({ textArea, getContentEdi
101107 </ Fab >
102108 </ motion . div >
103109
104- < Sidebar open = { open } onClose = { ( ) => setOpen ( false ) } text = { text } textArea = { textArea } />
110+ < Sidebar
111+ open = { open }
112+ onClose = { ( ) => setOpen ( false ) }
113+ text = { text }
114+ textArea = { textArea }
115+ />
105116 </ >
106117 ) ;
107118} ;
0 commit comments