Skip to content

Commit 10a0c60

Browse files
Merge pull request #540 from OpenSignLabs/opensign_drive_move
fix: document list sorting issue on scroll down in opensign-drive issue, disable recipient's list and field after send request
2 parents 6014088 + 036c9b8 commit 10a0c60

14 files changed

+199
-149
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ function Placeholder(props) {
275275
}
276276
};
277277
const handleOnClickPlaceholder = () => {
278+
props.setCurrWidgetsDetails && props.setCurrWidgetsDetails(props.pos);
278279
if (!props.isNeedSign) {
279280
props.setWidgetType(props.pos.type);
280281
}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ function PlaceholderType(props) {
307307
return props.pos.SignUrl ? (
308308
<img
309309
alt="signimg"
310+
draggable="false"
310311
src={props.pos.SignUrl}
311312
style={{
312313
width: "99%",
@@ -328,6 +329,7 @@ function PlaceholderType(props) {
328329
return props.pos.SignUrl ? (
329330
<img
330331
alt="signimg"
332+
draggable="false"
331333
src={props.pos.SignUrl}
332334
style={{
333335
width: "99%",
@@ -483,6 +485,7 @@ function PlaceholderType(props) {
483485
return props.pos.SignUrl ? (
484486
<img
485487
alt="signimg"
488+
draggable="false"
486489
src={props.pos.SignUrl}
487490
style={{
488491
width: "99%",
@@ -668,6 +671,7 @@ function PlaceholderType(props) {
668671
return props.pos.SignUrl ? (
669672
<img
670673
alt="signimg"
674+
draggable="false"
671675
src={props.pos.SignUrl}
672676
style={{
673677
width: "99%",
@@ -787,6 +791,7 @@ function PlaceholderType(props) {
787791
<div style={{ pointerEvents: "none" }}>
788792
<img
789793
alt="signimg"
794+
draggable="false"
790795
src={props.pos.SignUrl}
791796
style={{
792797
width: "99%",

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,13 @@ const RecipientList = (props) => {
116116
data-tut="reactourFirst"
117117
onMouseEnter={() => setIsHover(ind)}
118118
onMouseLeave={() => setIsHover(null)}
119-
className={props.sendInOrder && "dragCursor"}
119+
className={
120+
props.sendInOrder
121+
? props.isMailSend
122+
? "disabled"
123+
: "dragCursor"
124+
: props.isMailSend && "disabled"
125+
}
120126
style={
121127
(!isMobile && isHover === ind) || props.isSelectListId === ind
122128
? onHoverStyle(ind, obj?.blockColor)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ function RenderPdf({
272272
unSignedWidgetId={unSignedWidgetId}
273273
setSelectWidgetId={setSelectWidgetId}
274274
selectWidgetId={selectWidgetId}
275+
setCurrWidgetsDetails={setCurrWidgetsDetails}
275276
/>
276277
</React.Fragment>
277278
)

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

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ function SignPad({
2020
isInitial,
2121
setIsInitial,
2222
setIsStamp,
23-
widgetType
23+
widgetType,
24+
currWidgetsDetails,
25+
setCurrWidgetsDetails
2426
}) {
2527
const [penColor, setPenColor] = useState("blue");
2628
const allColor = ["blue", "red", "black"];
@@ -31,6 +33,7 @@ function SignPad({
3133
const [signValue, setSignValue] = useState("");
3234
const [textWidth, setTextWidth] = useState(null);
3335
const [textHeight, setTextHeight] = useState(null);
36+
const [signatureType, setSignatureType] = useState("draw");
3437
const fontOptions = [
3538
{ value: "Fasthand" },
3639
{ value: "Dancing Script" },
@@ -48,19 +51,11 @@ function SignPad({
4851
`Parse/${localStorage.getItem("parseAppId")}/currentUser`
4952
);
5053
const jsonSender = JSON.parse(senderUser);
51-
5254
const currentUserName = jsonSender && jsonSender.name;
5355

54-
useEffect(() => {
55-
const trimmedName = currentUserName.trim();
56-
const firstCharacter = trimmedName.charAt(0);
57-
const userName = isInitial ? firstCharacter : currentUserName;
58-
setSignValue(userName);
59-
setFontSelect("Fasthand");
60-
// eslint-disable-next-line react-hooks/exhaustive-deps
61-
}, []);
6256
//function for clear signature image
6357
const handleClear = () => {
58+
setCurrWidgetsDetails({});
6459
if (isTab === "draw") {
6560
if (canvasRef.current) {
6661
canvasRef.current.clear();
@@ -72,7 +67,7 @@ function SignPad({
7267
} else if (isTab === "uploadImage") {
7368
setImage("");
7469
}
75-
setIsInitial(false);
70+
// setIsInitial(false);
7671
};
7772
//function for set signature url
7873
const handleSignatureChange = () => {
@@ -100,27 +95,28 @@ function SignPad({
10095

10196
<button
10297
onClick={() => {
98+
setCurrWidgetsDetails({});
10399
if (!image) {
104100
if (isTab === "mysignature") {
105101
setIsSignImg("");
106102
if (isInitial) {
107-
onSaveSign("initials");
103+
onSaveSign(signatureType, "initials");
108104
} else {
109-
onSaveSign("default");
105+
onSaveSign(null, "default");
110106
}
111107
} else {
112108
if (isTab === "type") {
113109
setIsSignImg("");
114-
onSaveSign(false, textWidth, textHeight);
110+
onSaveSign(null, false, textWidth, textHeight);
115111
} else {
116-
onSaveSign();
112+
onSaveSign(signatureType);
117113
}
118114
}
119115

120116
setPenColor("blue");
121117
} else {
122118
setIsSignImg("");
123-
onSaveImage();
119+
onSaveImage(signatureType);
124120
}
125121
setIsSignPad(false);
126122
setIsInitial(false);
@@ -150,11 +146,27 @@ function SignPad({
150146
</div>
151147
);
152148
};
153-
149+
//useEffect for set already draw or save signature url/text url of signature text type and draw type for initial type and signature type widgets
154150
useEffect(() => {
155-
if (canvasRef.current && isSignImg) {
156-
canvasRef.current.fromDataURL(isSignImg);
151+
if (currWidgetsDetails && canvasRef.current) {
152+
const isWidgetType = currWidgetsDetails?.type;
153+
const signatureType = currWidgetsDetails?.signatureType;
154+
const url = currWidgetsDetails?.SignUrl;
155+
156+
//checking widget type and draw type signature url
157+
if (isInitial) {
158+
if (isWidgetType === "initials" && signatureType === "draw" && url) {
159+
canvasRef.current.fromDataURL(url);
160+
}
161+
} else if (
162+
isWidgetType === "signature" &&
163+
signatureType === "draw" &&
164+
url
165+
) {
166+
canvasRef.current.fromDataURL(url);
167+
}
157168
}
169+
158170
const trimmedName = currentUserName.trim();
159171
const firstCharacter = trimmedName.charAt(0);
160172
const userName = isInitial ? firstCharacter : currentUserName;
@@ -349,6 +361,7 @@ function SignPad({
349361
setIsDefaultSign(false);
350362
setIsImageSelect(true);
351363
setIsTab("uploadImage");
364+
setSignatureType("");
352365
}}
353366
style={{
354367
color:
@@ -373,6 +386,7 @@ function SignPad({
373386
setIsDefaultSign(false);
374387
setIsImageSelect(false);
375388
setIsTab("type");
389+
setSignatureType("");
376390
setImage();
377391
}}
378392
style={{
@@ -400,6 +414,7 @@ function SignPad({
400414
setIsDefaultSign(true);
401415
setIsImageSelect(true);
402416
setIsTab("mysignature");
417+
setSignatureType("");
403418
setImage();
404419
}}
405420
style={{
@@ -430,6 +445,7 @@ function SignPad({
430445
setIsDefaultSign(true);
431446
setIsImageSelect(true);
432447
setIsTab("mysignature");
448+
setSignatureType("");
433449
setImage();
434450
}}
435451
style={{
@@ -469,6 +485,7 @@ function SignPad({
469485
setIsDefaultSign(false);
470486
setImage();
471487
setIsTab("draw");
488+
setSignatureType("draw");
472489
setSignValue("");
473490
setIsStamp(false);
474491
}}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ function SignerListPlace(props) {
2323
data-tut="reactourAddbtn"
2424
className="p-[10px] my-[2px] flex flex-row items-center justify-center border-[1px] border-[#47a3ad] hover:bg-[#47a3ad] text-[#47a3ad] hover:text-white cursor-pointer"
2525
onClick={() => props.handleAddSigner()}
26+
style={{
27+
opacity: props.isMailSend && "0.5",
28+
pointerEvents: props.isMailSend && "none"
29+
}}
2630
>
2731
<i className="fa-solid fa-plus"></i>
2832
<span style={{ marginLeft: 2 }}>Add role</span>

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,12 @@ function WidgetComponent({
364364
</div>
365365
)
366366
) : (
367-
<div data-tut={dataTut} className="signerComponent">
367+
<div
368+
data-tut={dataTut}
369+
className={
370+
isMailSend ? "disabled signerComponent " : "signerComponent"
371+
}
372+
>
368373
<div
369374
style={{
370375
background: themeColor,

apps/OpenSign/src/constant/Utils.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -935,6 +935,7 @@ export const embedDocId = async (pdfDoc, documentId, allPages) => {
935935

936936
//function for save button to save signature or image url
937937
export function onSaveSign(
938+
type,
938939
xyPostion,
939940
index,
940941
signKey,
@@ -975,6 +976,7 @@ export function onSaveSign(
975976
Width: posWidth,
976977
Height: posHeight,
977978
SignUrl: signatureImg,
979+
signatureType: type && type,
978980
options: {
979981
...position.options,
980982
response: signatureImg

0 commit comments

Comments
 (0)