Skip to content

Commit ec4d875

Browse files
fix: blank page appear when try to add typed signature
1 parent 4caf9f5 commit ec4d875

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

apps/OpenSign/src/components/pdf/SignPad.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ function SignPad({
3131
const [isTab, setIsTab] = useState("draw");
3232
const [isSignImg, setIsSignImg] = useState("");
3333
const [signValue, setSignValue] = useState("");
34-
const [textWidth, setTextWidth] = useState(null);
35-
const [textHeight, setTextHeight] = useState(null);
34+
const [textWidth, setTextWidth] = useState(0);
35+
const [textHeight, setTextHeight] = useState(0);
3636
const [signatureType, setSignatureType] = useState("draw");
3737
const fontOptions = [
3838
{ value: "Fasthand" },
@@ -51,7 +51,7 @@ function SignPad({
5151
`Parse/${localStorage.getItem("parseAppId")}/currentUser`
5252
);
5353
const jsonSender = JSON.parse(senderUser);
54-
const currentUserName = jsonSender && jsonSender.name;
54+
const currentUserName = jsonSender && jsonSender?.name;
5555

5656
//function for clear signature image
5757
const handleClear = () => {
@@ -137,7 +137,7 @@ function SignPad({
137137
(isTab === "draw" && isSignImg) ||
138138
(isTab === "image" && image) ||
139139
(isTab === "mysignature" && isDefaultSign) ||
140-
(isTab === "type" && textWidth)
140+
(isTab === "type" && signValue)
141141
? false
142142
: image
143143
? false
@@ -169,10 +169,10 @@ function SignPad({
169169
}
170170
}
171171

172-
const trimmedName = currentUserName && currentUserName.trim();
172+
const trimmedName = currentUserName && currentUserName?.trim();
173173
const firstCharacter = trimmedName?.charAt(0);
174174
const userName = isInitial ? firstCharacter : currentUserName;
175-
setSignValue(userName);
175+
setSignValue(userName || "");
176176
setFontSelect("Fasthand");
177177

178178
// eslint-disable-next-line react-hooks/exhaustive-deps
@@ -200,8 +200,10 @@ function SignPad({
200200
canvasRef.current.fromDataURL(isSignImg);
201201
}
202202
if (isTab === "type") {
203-
const trimmedName = signValue ? signValue.trim() : currentUserName.trim();
204-
const firstCharacter = trimmedName.charAt(0);
203+
const trimmedName = signValue
204+
? signValue?.trim()
205+
: currentUserName?.trim();
206+
const firstCharacter = trimmedName?.charAt(0);
205207
const userName = isInitial ? firstCharacter : signValue;
206208
setSignValue(userName);
207209
convertToImg(fontSelect, userName);

apps/OpenSign/src/pages/TemplatePlaceholder.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,7 @@ const TemplatePlaceholder = () => {
779779
AutomaticReminders: pdfDetails[0]?.AutomaticReminders,
780780
RemindOnceInEvery: parseInt(pdfDetails[0]?.RemindOnceInEvery),
781781
NextReminderDate: pdfDetails[0]?.NextReminderDate,
782+
IsEnableOTP: pdfDetails[0]?.IsEnableOTP === "true" ? true : false,
782783
URL: pdfUrl
783784
};
784785
const updateTemplate = new Parse.Object("contracts_Template");

apps/OpenSignServer/cloud/parsefunction/PublicUserLinkContactToDoc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ const createDocumentFromTemplate = async (template, existContact, index) => {
6262
object.set('CreatedBy', template?.CreatedBy);
6363
object.set('ExtUserPtr', template?.ExtUserPtr);
6464
object.set('OriginIp', template?.OriginIp || '');
65+
object.set('IsEnableOTP', template?.IsEnableOTP || false);
6566
let signers = template?.Signers || [];
6667
const signerobj = {
6768
__type: 'Pointer',

0 commit comments

Comments
 (0)