From 806894b24b34dd1d06a8509ae079b7c2673caa88 Mon Sep 17 00:00:00 2001 From: RaktimaNXG Date: Wed, 4 Sep 2024 14:48:49 +0530 Subject: [PATCH 1/3] fix : issue while rename the document/folder in opensign-drive --- .../src/components/opensigndrive/DriveBody.js | 52 +++++++++++-------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/apps/OpenSign/src/components/opensigndrive/DriveBody.js b/apps/OpenSign/src/components/opensigndrive/DriveBody.js index 37f11c55c..4a7fde6b0 100644 --- a/apps/OpenSign/src/components/opensigndrive/DriveBody.js +++ b/apps/OpenSign/src/components/opensigndrive/DriveBody.js @@ -357,7 +357,7 @@ function DriveBody(props) { e.stopPropagation(); handleMenuItemClick("Download", data); }} - className="fa-light fa-download mr-[8px] op-text-primary" + className="fa-light fa-download mr-[8px] op-text-primary cursor-pointer" aria-hidden="true" > @@ -370,7 +370,16 @@ function DriveBody(props) { {/* folder */}
handleOnclikFolder(data)} + onClick={() => { + if (rename) { + inputRef.current.setSelectionRange( + inputRef.current.value.length, + inputRef.current.value.length + ); + } else { + handleOnclikFolder(data); + } + }} className="cursor-pointer" > {rename === data.objectId ? ( {data.Name} @@ -423,7 +425,11 @@ function DriveBody(props) {
) : ( - +
@@ -432,7 +438,16 @@ function DriveBody(props) { {/* pdf */}
checkPdfStatus(data)} + onClick={() => { + if (rename) { + inputRef.current.setSelectionRange( + inputRef.current.value.length, + inputRef.current.value.length + ); + } else { + checkPdfStatus(data); + } + }} className="cursor-pointer" > { - inputRef.current.setSelectionRange(0, 0); - const input = inputRef.current; - if (input) { - input.select(); - } - }} + onFocus={() => inputRef.current.select()} onBlur={() => handledRenameDoc(data)} onKeyDown={(e) => handleEnterPress(e, data)} ref={inputRef} defaultValue={renameValue} - // value={renameValue} onChange={(e) => setRenameValue(e.target.value)} - className="w-[100px] border-[1.5px] border-black rounded-sm text-[10px]" + className="op-input op-input-bordered op-input-xs w-[100px] focus:outline-none hover:border-base-content text-[10px]" /> ) : ( {data.Name} From 4f2b0313dec77c96ccf70bf408b511fcd59f4246 Mon Sep 17 00:00:00 2001 From: RaktimaNXG Date: Wed, 4 Sep 2024 15:09:38 +0530 Subject: [PATCH 2/3] refactor code --- .../src/components/opensigndrive/DriveBody.js | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/apps/OpenSign/src/components/opensigndrive/DriveBody.js b/apps/OpenSign/src/components/opensigndrive/DriveBody.js index 4a7fde6b0..b0df1a745 100644 --- a/apps/OpenSign/src/components/opensigndrive/DriveBody.js +++ b/apps/OpenSign/src/components/opensigndrive/DriveBody.js @@ -371,12 +371,7 @@ function DriveBody(props) {
{ - if (rename) { - inputRef.current.setSelectionRange( - inputRef.current.value.length, - inputRef.current.value.length - ); - } else { + if (!rename) { handleOnclikFolder(data); } }} @@ -439,12 +434,7 @@ function DriveBody(props) {
{ - if (rename) { - inputRef.current.setSelectionRange( - inputRef.current.value.length, - inputRef.current.value.length - ); - } else { + if (!rename) { checkPdfStatus(data); } }} From 9cc9a93c3d29b45187baca249acd3fa61e30cc96 Mon Sep 17 00:00:00 2001 From: RaktimaNXG Date: Wed, 4 Sep 2024 15:13:10 +0530 Subject: [PATCH 3/3] fix: handle error --- .../src/components/opensigndrive/DriveBody.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/apps/OpenSign/src/components/opensigndrive/DriveBody.js b/apps/OpenSign/src/components/opensigndrive/DriveBody.js index b0df1a745..1b4e69a2e 100644 --- a/apps/OpenSign/src/components/opensigndrive/DriveBody.js +++ b/apps/OpenSign/src/components/opensigndrive/DriveBody.js @@ -386,7 +386,12 @@ function DriveBody(props) { {rename === data.objectId ? ( inputRef.current.select()} + onFocus={() => { + const input = inputRef.current; + if (input) { + input.select(); + } + }} autoFocus={true} type="text" onBlur={() => handledRenameDoc(data)} @@ -451,7 +456,12 @@ function DriveBody(props) { inputRef.current.select()} + onFocus={() => { + const input = inputRef.current; + if (input) { + input.select(); + } + }} onBlur={() => handledRenameDoc(data)} onKeyDown={(e) => handleEnterPress(e, data)} ref={inputRef}