🔥 The free & Open Source DocuSign alternative
JavaScript digital-signaturedocument-signingdocusign-alternativedocusign-freee-signatureelectronic-signatureelectronic-signaturesesignesignaturehacktoberfestjavascriptlegaltechmongodbnodejsopen-sourcepdf-signpdf-signaturereactjsself-hostedsign-pdf-files
fix: blank page appear when try to add typed signature
prafull-opensignlabsec4d87554753
diff --git a/apps/OpenSign/src/components/pdf/SignPad.js b/apps/OpenSign/src/components/pdf/SignPad.jsindex 33c61eb67..37772445c 100644--- a/apps/OpenSign/src/components/pdf/SignPad.js+++ b/apps/OpenSign/src/components/pdf/SignPad.js@@ -31,8 +31,8 @@ function SignPad({const [isTab, setIsTab] = useState("draw");const [isSignImg, setIsSignImg] = useState("");const [signValue, setSignValue] = useState("");- const [textWidth, setTextWidth] = useState(null);- const [textHeight, setTextHeight] = useState(null);+ const [textWidth, setTextWidth] = useState(0);+ const [textHeight, setTextHeight] = useState(0);const [signatureType, setSignatureType] = useState("draw");const fontOptions = [{ value: "Fasthand" },@@ -51,7 +51,7 @@ function SignPad({`Parse/${localStorage.getItem("parseAppId")}/currentUser`);const jsonSender = JSON.parse(senderUser);- const currentUserName = jsonSender && jsonSender.name;+ const currentUserName = jsonSender && jsonSender?.name;//function for clear signature imageconst handleClear = () => {@@ -137,7 +137,7 @@ function SignPad({(isTab === "draw" && isSignImg) ||(isTab === "image" && image) ||(isTab === "mysignature" && isDefaultSign) ||- (isTab === "type" && textWidth)+ (isTab === "type" && signValue)? false: image? false@@ -169,10 +169,10 @@ function SignPad({}}- const trimmedName = currentUserName && currentUserName.trim();+ const trimmedName = currentUserName && currentUserName?.trim();const firstCharacter = trimmedName?.charAt(0);const userName = isInitial ? firstCharacter : currentUserName;- setSignValue(userName);+ setSignValue(userName || "");setFontSelect("Fasthand");// eslint-disable-next-line react-hooks/exhaustive-deps@@ -200,8 +200,10 @@ function SignPad({canvasRef.current.fromDataURL(isSignImg);}if (isTab === "type") {- const trimmedName = signValue ? signValue.trim() : currentUserName.trim();- const firstCharacter = trimmedName.charAt(0);+ const trimmedName = signValue+ ? signValue?.trim()+ : currentUserName?.trim();+ const firstCharacter = trimmedName?.charAt(0);const userName = isInitial ? firstCharacter : signValue;setSignValue(userName);convertToImg(fontSelect, userName);diff --git a/apps/OpenSign/src/pages/TemplatePlaceholder.js b/apps/OpenSign/src/pages/TemplatePlaceholder.jsindex 96cacac81..d602ba4ac 100644--- a/apps/OpenSign/src/pages/TemplatePlaceholder.js+++ b/apps/OpenSign/src/pages/TemplatePlaceholder.js@@ -779,6 +779,7 @@ const TemplatePlaceholder = () => {AutomaticReminders: pdfDetails[0]?.AutomaticReminders,RemindOnceInEvery: parseInt(pdfDetails[0]?.RemindOnceInEvery),NextReminderDate: pdfDetails[0]?.NextReminderDate,+ IsEnableOTP: pdfDetails[0]?.IsEnableOTP === "true" ? true : false,URL: pdfUrl};const updateTemplate = new Parse.Object("contracts_Template");diff --git a/apps/OpenSignServer/cloud/parsefunction/PublicUserLinkContactToDoc.js b/apps/OpenSignServer/cloud/parsefunction/PublicUserLinkContactToDoc.jsindex 5c2e16532..863769996 100644--- a/apps/OpenSignServer/cloud/parsefunction/PublicUserLinkContactToDoc.js+++ b/apps/OpenSignServer/cloud/parsefunction/PublicUserLinkContactToDoc.js@@ -62,6 +62,7 @@ const createDocumentFromTemplate = async (template, existContact, index) => {object.set('CreatedBy', template?.CreatedBy);object.set('ExtUserPtr', template?.ExtUserPtr);object.set('OriginIp', template?.OriginIp || '');+ object.set('IsEnableOTP', template?.IsEnableOTP || false);let signers = template?.Signers || [];const signerobj = {__type: 'Pointer',