Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion apps/OpenSign/src/components/pdf/Placeholder.js
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,15 @@ function Placeholder(props) {
data-tut={props.pos.key === props.unSignedWidgetId ? "IsSigned" : ""}
key={props.pos.key}
lockAspectRatio={
props.pos.type !== textWidget &&
// props.pos.type !== textWidget
![
textWidget,
"email",
"name",
"company",
"job title",
textInputWidget
].includes(props.pos.type) &&
(props.pos.Width
? props.pos.Width / props.pos.Height
: defaultWidthHeight(props.pos.type).width /
Expand Down
88 changes: 54 additions & 34 deletions apps/OpenSign/src/components/pdf/PlaceholderType.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ function PlaceholderType(props) {
}
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [props.pos]);
}, [props.pos?.options?.defaultValue]);

const ExampleCustomInput = forwardRef(({ value, onClick }, ref) => (
<div
Expand Down Expand Up @@ -288,7 +288,7 @@ function PlaceholderType(props) {
};
//handle height on enter press in text area
const handleEnterPress = (e) => {
const height = 15;
const height = 18;
if (e.key === "Enter") {
//function to save height of text area
onChangeHeightOfTextArea(
Expand Down Expand Up @@ -403,19 +403,12 @@ function PlaceholderType(props) {
case textInputWidget:
return props.isSignYourself ||
(props.isNeedSign && props.data?.signerObjId === props.signerObjId) ? (
<input
className="inputPlaceholder"
<textarea
ref={inputRef}
placeholder={validatePlaceholder}
style={{ fontSize: calculateFontSize() }}
rows={1}
onKeyDown={handleEnterPress}
value={textValue}
type="text"
tabIndex="0"
disabled={
props.isNeedSign && props.data?.signerObjId !== props.signerObjId
? true
: props.isPlaceholder
}
onBlur={handleInputBlur}
onChange={(e) => {
setTextValue(e.target.value);
Expand All @@ -429,6 +422,13 @@ function PlaceholderType(props) {
false
);
}}
className={
isMobile
? "labelTextArea labelWidthMobile"
: "labelTextArea labelWidthDesktop"
}
style={{ whiteSpace: "pre-wrap" }}
cols="50"
/>
) : (
<div
Expand Down Expand Up @@ -506,15 +506,12 @@ function PlaceholderType(props) {
case "name":
return props.isSignYourself ||
(props.isNeedSign && props.data?.signerObjId === props.signerObjId) ? (
<input
tabIndex="0"
<textarea
ref={inputRef}
placeholder={"name"}
style={{ fontSize: calculateFontSize() }}
className="inputPlaceholder"
type="text"
rows={1}
onKeyDown={handleEnterPress}
value={textValue}
onBlur={handleInputBlur}
onChange={(e) => {
const isDefault = false;
handleTextValid(e);
Expand All @@ -528,6 +525,13 @@ function PlaceholderType(props) {
isDefault
);
}}
className={
isMobile
? "labelTextArea labelWidthMobile"
: "labelTextArea labelWidthDesktop"
}
style={{ whiteSpace: "pre-wrap" }}
cols="50"
/>
) : (
<div
Expand All @@ -542,14 +546,12 @@ function PlaceholderType(props) {
case "company":
return props.isSignYourself ||
(props.isNeedSign && props.data?.signerObjId === props.signerObjId) ? (
<input
className="inputPlaceholder"
type="text"
<textarea
ref={inputRef}
placeholder={"company"}
style={{ fontSize: calculateFontSize() }}
placeholder="Enter label"
rows={1}
onKeyDown={handleEnterPress}
value={textValue}
onBlur={handleInputBlur}
onChange={(e) => {
handleTextValid(e);
onChangeInput(
Expand All @@ -562,6 +564,13 @@ function PlaceholderType(props) {
false
);
}}
className={
isMobile
? "labelTextArea labelWidthMobile"
: "labelTextArea labelWidthDesktop"
}
style={{ whiteSpace: "pre-wrap" }}
cols="50"
/>
) : (
<div
Expand All @@ -576,14 +585,12 @@ function PlaceholderType(props) {
case "job title":
return props.isSignYourself ||
(props.isNeedSign && props.data?.signerObjId === props.signerObjId) ? (
<input
className="inputPlaceholder"
type="text"
<textarea
ref={inputRef}
placeholder={"job title"}
style={{ fontSize: calculateFontSize() }}
rows={1}
onKeyDown={handleEnterPress}
value={textValue}
onBlur={handleInputBlur}
onChange={(e) => {
handleTextValid(e);
onChangeInput(
Expand All @@ -596,6 +603,13 @@ function PlaceholderType(props) {
false
);
}}
className={
isMobile
? "labelTextArea labelWidthMobile"
: "labelTextArea labelWidthDesktop"
}
style={{ whiteSpace: "pre-wrap" }}
cols="50"
/>
) : (
<div
Expand Down Expand Up @@ -692,12 +706,11 @@ function PlaceholderType(props) {
case "email":
return props.isSignYourself ||
(props.isNeedSign && props.data?.signerObjId === props.signerObjId) ? (
<input
className="inputPlaceholder"
type="text"
<textarea
ref={inputRef}
placeholder={"email"}
style={{ fontSize: calculateFontSize() }}
rows={1}
onKeyDown={handleEnterPress}
value={textValue}
onBlur={handleInputBlur}
onChange={(e) => {
Expand All @@ -712,6 +725,13 @@ function PlaceholderType(props) {
false
);
}}
className={
isMobile
? "labelTextArea labelWidthMobile"
: "labelTextArea labelWidthDesktop"
}
style={{ whiteSpace: "pre-wrap" }}
cols="50"
/>
) : (
<div
Expand Down Expand Up @@ -782,7 +802,7 @@ function PlaceholderType(props) {
? "labelTextArea labelWidthMobile"
: "labelTextArea labelWidthDesktop"
}
style={{ whiteSpace: "pre-wrap" }}
style={{ whiteSpace: "pre-wrap", overflow: "hidden" }}
cols="50"
/>
);
Expand Down
21 changes: 3 additions & 18 deletions apps/OpenSign/src/constant/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1249,6 +1249,7 @@ export const multiSignEmbed = async (
}
};
const widgetTypeExist = [
textWidget,
textInputWidget,
"name",
"company",
Expand Down Expand Up @@ -1304,7 +1305,7 @@ export const multiSignEmbed = async (
checkbox.enableReadOnly();
});
}
} else if (position.type === textWidget) {
} else if (widgetTypeExist) {
const font = await pdfDoc.embedFont("Helvetica");
const fontSize = 12;
let textContent;
Expand Down Expand Up @@ -1380,24 +1381,8 @@ export const multiSignEmbed = async (
color: rgb(0, 0, 0),
size: fontSize
});
y -= 15; // Adjust the line height as needed
}
} else if (widgetTypeExist) {
const font = await pdfDoc.embedFont("Helvetica");
const fontSize = 12;
let textContent;
if (position?.options?.response) {
textContent = position.options?.response;
} else if (position?.options?.defaultValue) {
textContent = position?.options?.defaultValue;
y -= 18; // Adjust the line height as needed
}
page.drawText(textContent, {
x: xPos(position),
y: yPos(position) + 10,
size: fontSize,
font,
color: rgb(0, 0, 0)
});
} else if (position.type === "dropdown") {
const dropdownRandomId = "dropdown" + randomId();
const dropdown = form.createDropdown(dropdownRandomId);
Expand Down
9 changes: 7 additions & 2 deletions apps/OpenSign/src/styles/signature.css
Original file line number Diff line number Diff line change
Expand Up @@ -496,11 +496,15 @@
overflow: hidden !important;
text-overflow: ellipsis;
}

.disabled {
opacity: 0.5; /* Example: reduce opacity to visually indicate disabled state */
pointer-events: none; /* Prevents mouse clicks and other events */
opacity: 0.5;
/* Example: reduce opacity to visually indicate disabled state */
pointer-events: none;
/* Prevents mouse clicks and other events */
/* background-color: #888; */
}

.useEmail {
font-size: 10px;
color: #424242;
Expand Down Expand Up @@ -851,6 +855,7 @@ option {
z-index: 999;
border-radius: 2px;
resize: none;
overflow: hidden;
}

.labelTextArea:focus {
Expand Down
Binary file modified apps/OpenSignServer/test.pdf
Binary file not shown.