🔥 The free & Open Source DocuSign alternative
JavaScript digital-signaturedocument-signingdocusign-alternativedocusign-freee-signatureelectronic-signatureelectronic-signaturesesignesignaturehacktoberfestjavascriptlegaltechmongodbnodejsopen-sourcepdf-signpdf-signaturereactjsself-hostedsign-pdf-files
fix: input text type regex issue
RaktimaNXGd5be7b8c573c
diff --git a/microfrontends/SignDocuments/src/Component/TemplatePlaceholder.js b/microfrontends/SignDocuments/src/Component/TemplatePlaceholder.jsindex 4e8c9a111..874cdb226 100644--- a/microfrontends/SignDocuments/src/Component/TemplatePlaceholder.js+++ b/microfrontends/SignDocuments/src/Component/TemplatePlaceholder.js@@ -133,31 +133,6 @@ const TemplatePlaceholder = () => {isDragStamp: !!monitor.isDragging()})});-- const [{ isDragSignatureSS }, dragSignatureSS] = useDrag({- type: "BOX",- item: {- type: "BOX",- id: 3,- text: "signature"- },- collect: (monitor) => ({- isDragSignatureSS: !!monitor.isDragging()- })- });-- const [{ isDragStampSS }, dragStampSS] = useDrag({- type: "BOX",- item: {- type: "BOX",- id: 4,- text: "stamp"- },- collect: (monitor) => ({- isDragStampSS: !!monitor.isDragging()- })- });-const [uniqueId, setUniqueId] = useState("");const [isModalRole, setIsModalRole] = useState(false);const [roleName, setRoleName] = useState("");@@ -171,7 +146,7 @@ const TemplatePlaceholder = () => {const [isDragging, setIsDragging] = useState(false);const [currWidgetsDetails, setCurrWidgetsDetails] = useState([]);const [isCheckbox, setIsCheckbox] = useState(false);- const checkboxType = ["Optional", "Required", "Read only"];+const senderUser =localStorage.getItem(`Parse/${localStorage.getItem("parseAppId")}/currentUser`@@ -338,12 +313,6 @@ const TemplatePlaceholder = () => {}};- const getDate = () => {- const date = new Date();- const milliseconds = date.getTime();- const newDate = moment(milliseconds).format("MM/DD/YYYY");- return newDate;- };//function for setting position after drop signature button over pdfconst addPositionOfSignature = (item, monitor) => {getSignerPos(item, monitor);@@ -393,8 +362,6 @@ const TemplatePlaceholder = () => {.getBoundingClientRect();const x = offset.x - containerRect.left;const y = offset.y - containerRect.top;- const ybottom = containerRect.bottom - offset.y;-const dropObj = {xPosition: signBtnPosition[0] ? x - signBtnPosition[0].xPos : x,yPosition: signBtnPosition[0] ? y - signBtnPosition[0].yPos : y,@@ -1401,9 +1368,6 @@ const TemplatePlaceholder = () => {dragRef={dragRef}isDragStamp={isDragStamp}isSignYourself={false}- isDragSignatureSS={isDragSignatureSS}- dragSignatureSS={dragSignatureSS}- dragStampSS={dragStampSS}addPositionOfSignature={addPositionOfSignature}signerPos={signerPos}signersdata={signersdata}diff --git a/microfrontends/SignDocuments/src/Component/WidgetComponent/placeholder.js b/microfrontends/SignDocuments/src/Component/WidgetComponent/placeholder.jsindex 7ea228e02..eec000558 100644--- a/microfrontends/SignDocuments/src/Component/WidgetComponent/placeholder.js+++ b/microfrontends/SignDocuments/src/Component/WidgetComponent/placeholder.js@@ -50,6 +50,8 @@ function Placeholder(props) {return "MMM dd, YYYY";case "DD MMMM, YYYY":return "dd MMMM, YYYY";+ default:+ return "dd/MM/yyyy";}};diff --git a/microfrontends/SignDocuments/src/Component/WidgetComponent/placeholderType.js b/microfrontends/SignDocuments/src/Component/WidgetComponent/placeholderType.jsindex c1e575fe9..21ddfcada 100644--- a/microfrontends/SignDocuments/src/Component/WidgetComponent/placeholderType.js+++ b/microfrontends/SignDocuments/src/Component/WidgetComponent/placeholderType.js@@ -57,19 +57,9 @@ function PlaceholderType(props) {}};- const handleTextValid = (e, regx) => {+ const handleTextValid = (e) => {const textInput = e.target.value;setTextValue(textInput);-- // console.log('textInput',textInput)- // let isValidate = regx.test(textValue);- // console.log('isValidate',isValidate,regx)- // if (isValidate) {- // const sanitizedValue = textInput.replace(regx, "");- // setTextValue(sanitizedValue);- // } else {- // setTextValue('');- // }};function checkRegularExpress(validateType) {switch (validateType) {@@ -81,6 +71,7 @@ function PlaceholderType(props) {break;case "text":setValidatePlaceholder("enter text");+ break;default:setValidatePlaceholder("enter text");}@@ -381,10 +372,6 @@ function PlaceholderType(props) {}onBlur={handleInputBlur}onChange={(e) => {- // props.pos?.validation && handleTextValid(e, props.pos?.validation);- // if (!props.pos.options?.validation) {- // setTextValue(e.target.value);- // }setTextValue(e.target.value);onChangeInput(e.target.value,@@ -486,7 +473,7 @@ function PlaceholderType(props) {}onBlur={handleInputBlur}onChange={(e) => {- handleTextValid(e, /[^a-zA-Z\s]/g);+ handleTextValid(e);onChangeInput(e.target.value,props.pos.key,@@ -524,7 +511,7 @@ function PlaceholderType(props) {}onBlur={handleInputBlur}onChange={(e) => {- handleTextValid(e, /[^a-zA-Z\s]/g);+ handleTextValid(e);onChangeInput(e.target.value,props.pos.key,@@ -562,7 +549,7 @@ function PlaceholderType(props) {}onBlur={handleInputBlur}onChange={(e) => {- handleTextValid(e, /[^a-zA-Z\s]/g);+ handleTextValid(e);onChangeInput(e.target.value,props.pos.key,@@ -653,10 +640,7 @@ function PlaceholderType(props) {}onBlur={handleInputBlur}onChange={(e) => {- handleTextValid(- e,- /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/- );+ handleTextValid(e);onChangeInput(e.target.value,props.pos.key,diff --git a/microfrontends/SignDocuments/src/Component/component/renderPdf.js b/microfrontends/SignDocuments/src/Component/component/renderPdf.jsindex ee39f0e89..847160da4 100644--- a/microfrontends/SignDocuments/src/Component/component/renderPdf.js+++ b/microfrontends/SignDocuments/src/Component/component/renderPdf.js@@ -1,15 +1,12 @@import React from "react";import RSC from "react-scrollbars-custom";import { Document, Page, pdfjs } from "react-pdf";-import {- addZIndex,defaultWidthHeight,handleImageResize,handleSignYourselfImageResize} from "../../utils/Utils";import EmailToast from "./emailToast";-// import PlaceholderBorder from "./placeholderBorder";import Placeholder from "../WidgetComponent/placeholder";pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.js`;diff --git a/microfrontends/SignDocuments/src/Component/placeHolderSign.js b/microfrontends/SignDocuments/src/Component/placeHolderSign.jsindex 29f66003e..6d3664bde 100644--- a/microfrontends/SignDocuments/src/Component/placeHolderSign.js+++ b/microfrontends/SignDocuments/src/Component/placeHolderSign.js@@ -1149,8 +1149,11 @@ function PlaceHolderSign() {//function for base on condition to add checkbox widget status and input text validation in signerPos arrayconst handleApplyWidgetsStatus = (textValidate) => {const options = ["email", "number", "text"];- const regexType = options.includes(textValidate);- let regularExpression = textValidate;+ let regularExpression, regexType;+ if (textValidate) {+ regexType = options.includes(textValidate);+ regularExpression = textValidate;+ }const filterSignerPos = signerPos.filter((data) => data.Id === uniqueId);if (filterSignerPos.length > 0) {@@ -1172,7 +1175,11 @@ function PlaceHolderSign() {...position.options,hint: hint,validation: {- type: regexType ? regularExpression : "regex",+ type: textValidate+ ? regexType+ ? regularExpression+ : "regex"+ : "text",pattern: !regexType ? regularExpression : ""}}