@@ -168,8 +168,8 @@ function Placeholder(props) {
168
168
} ;
169
169
} , [ isShowDateFormat ] ) ;
170
170
171
- //onclick placeholder function to open signature pad
172
- const handlePlaceholderClick = ( ) => {
171
+ //`handleWidgetIdandPopup` is used to set current widget id and open relative popup
172
+ const handleWidgetIdandPopup = ( ) => {
173
173
if ( props . setSelectWidgetId ) {
174
174
props . setSelectWidgetId ( props . pos . key ) ;
175
175
}
@@ -238,9 +238,18 @@ function Placeholder(props) {
238
238
}
239
239
}
240
240
} ;
241
-
242
- //function to set state value of onclick on widget's setting icon
243
- const handleWidgetsOnclick = ( ) => {
241
+ const handleOnClickPlaceholder = ( ) => {
242
+ if ( ! props . isNeedSign ) {
243
+ props . setWidgetType ( props . pos . type ) ;
244
+ }
245
+ if ( props . isNeedSign && props . data ?. signerObjId === props . signerObjId ) {
246
+ handleWidgetIdandPopup ( ) ;
247
+ } else if ( props . isPlaceholder || props . isSignYourself ) {
248
+ handleWidgetIdandPopup ( ) ;
249
+ }
250
+ } ;
251
+ //`handleOnClickSettingIcon` is used set current widget details and open setting of it
252
+ const handleOnClickSettingIcon = ( ) => {
244
253
if ( props . pos . type === radioButtonWidget ) {
245
254
props . setIsRadio ( true ) ;
246
255
} else if ( props . pos . type === "dropdown" ) {
@@ -312,11 +321,11 @@ function Placeholder(props) {
312
321
< i
313
322
onClick = { ( e ) => {
314
323
e . stopPropagation ( ) ;
315
- handleWidgetsOnclick ( ) ;
324
+ handleOnClickSettingIcon ( ) ;
316
325
} }
317
326
onTouchEnd = { ( e ) => {
318
327
e . stopPropagation ( ) ;
319
- handleWidgetsOnclick ( ) ;
328
+ handleOnClickSettingIcon ( ) ;
320
329
} }
321
330
className = "fa-solid fa-gear settingIcon"
322
331
style = { {
@@ -335,11 +344,11 @@ function Placeholder(props) {
335
344
< i
336
345
onClick = { ( e ) => {
337
346
e . stopPropagation ( ) ;
338
- handleWidgetsOnclick ( ) ;
347
+ handleOnClickSettingIcon ( ) ;
339
348
} }
340
349
onTouchEnd = { ( e ) => {
341
350
e . stopPropagation ( ) ;
342
- handleWidgetsOnclick ( ) ;
351
+ handleOnClickSettingIcon ( ) ;
343
352
} }
344
353
className = "fa-solid fa-gear settingIcon"
345
354
style = { {
@@ -622,14 +631,7 @@ function Placeholder(props) {
622
631
false
623
632
) ;
624
633
} }
625
- onClick = { ( ) => {
626
- ! props . isNeedSign && props . setWidgetType ( props . pos . type ) ;
627
- props . isNeedSign && props . data ?. signerObjId === props . signerObjId
628
- ? handlePlaceholderClick ( )
629
- : props . isPlaceholder
630
- ? handlePlaceholderClick ( )
631
- : props . isSignYourself && handlePlaceholderClick ( ) ;
632
- } }
634
+ onClick = { ( ) => handleOnClickPlaceholder ( ) }
633
635
>
634
636
{ props . isShowBorder &&
635
637
props . pos . type !== radioButtonWidget &&
@@ -679,14 +681,7 @@ function Placeholder(props) {
679
681
// height: props.posHeight(props.pos, props.isSignYourself),
680
682
zIndex : "10"
681
683
} }
682
- onTouchEnd = { ( ) => {
683
- ! props . isNeedSign && props . setWidgetType ( props . pos . type ) ;
684
- props . isNeedSign && props . data ?. signerObjId === props . signerObjId
685
- ? handlePlaceholderClick ( )
686
- : props . isPlaceholder
687
- ? handlePlaceholderClick ( )
688
- : props . isSignYourself && handlePlaceholderClick ( ) ;
689
- } }
684
+ onTouchEnd = { ( ) => handleOnClickPlaceholder ( ) }
690
685
>
691
686
{ props . pos . key === props . selectWidgetId && < PlaceholderIcon /> }
692
687
0 commit comments