From f8ba0d357bfb0c9958b4d397e965782b8a8e29e3 Mon Sep 17 00:00:00 2001 From: RaktimaNXG Date: Wed, 27 Mar 2024 17:31:11 +0530 Subject: [PATCH] fix: mismatch between signature URL in the signature widget and the initial widget on the signature pad. --- .../src/components/pdf/Placeholder.js | 1 + apps/OpenSign/src/components/pdf/RenderPdf.js | 1 + apps/OpenSign/src/components/pdf/SignPad.js | 51 ++++++++++++------- apps/OpenSign/src/constant/Utils.js | 2 + apps/OpenSign/src/pages/PdfRequestFiles.js | 7 ++- apps/OpenSign/src/pages/PlaceHolderSign.js | 2 +- apps/OpenSign/src/pages/SignyourselfPdf.js | 7 ++- 7 files changed, 49 insertions(+), 22 deletions(-) diff --git a/apps/OpenSign/src/components/pdf/Placeholder.js b/apps/OpenSign/src/components/pdf/Placeholder.js index 0b292b58f..29ee1eca4 100644 --- a/apps/OpenSign/src/components/pdf/Placeholder.js +++ b/apps/OpenSign/src/components/pdf/Placeholder.js @@ -275,6 +275,7 @@ function Placeholder(props) { } }; const handleOnClickPlaceholder = () => { + props.setCurrWidgetsDetails && props.setCurrWidgetsDetails(props.pos); if (!props.isNeedSign) { props.setWidgetType(props.pos.type); } diff --git a/apps/OpenSign/src/components/pdf/RenderPdf.js b/apps/OpenSign/src/components/pdf/RenderPdf.js index 7e7cadef6..8d656d383 100644 --- a/apps/OpenSign/src/components/pdf/RenderPdf.js +++ b/apps/OpenSign/src/components/pdf/RenderPdf.js @@ -272,6 +272,7 @@ function RenderPdf({ unSignedWidgetId={unSignedWidgetId} setSelectWidgetId={setSelectWidgetId} selectWidgetId={selectWidgetId} + setCurrWidgetsDetails={setCurrWidgetsDetails} /> ) diff --git a/apps/OpenSign/src/components/pdf/SignPad.js b/apps/OpenSign/src/components/pdf/SignPad.js index 32f29bdfe..0e59b965f 100644 --- a/apps/OpenSign/src/components/pdf/SignPad.js +++ b/apps/OpenSign/src/components/pdf/SignPad.js @@ -20,7 +20,9 @@ function SignPad({ isInitial, setIsInitial, setIsStamp, - widgetType + widgetType, + currWidgetsDetails, + setCurrWidgetsDetails }) { const [penColor, setPenColor] = useState("blue"); const allColor = ["blue", "red", "black"]; @@ -31,6 +33,7 @@ function SignPad({ const [signValue, setSignValue] = useState(""); const [textWidth, setTextWidth] = useState(null); const [textHeight, setTextHeight] = useState(null); + const [signatureType, setSignatureType] = useState("draw"); const fontOptions = [ { value: "Fasthand" }, { value: "Dancing Script" }, @@ -48,19 +51,11 @@ function SignPad({ `Parse/${localStorage.getItem("parseAppId")}/currentUser` ); const jsonSender = JSON.parse(senderUser); - const currentUserName = jsonSender && jsonSender.name; - useEffect(() => { - const trimmedName = currentUserName.trim(); - const firstCharacter = trimmedName.charAt(0); - const userName = isInitial ? firstCharacter : currentUserName; - setSignValue(userName); - setFontSelect("Fasthand"); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); //function for clear signature image const handleClear = () => { + setCurrWidgetsDetails({}); if (isTab === "draw") { if (canvasRef.current) { canvasRef.current.clear(); @@ -100,27 +95,28 @@ function SignPad({