bugfix multiple fields added after field type change: removed "drag drop" feeling handlers

This commit is contained in:
Timur Ercan
2023-03-19 11:08:15 +01:00
parent 6419d22155
commit 071398273a
2 changed files with 0 additions and 10 deletions

View File

@ -25,9 +25,6 @@ export default function FieldTypeSelector(props: any) {
onChange={(e: any) => { onChange={(e: any) => {
setSelectedFieldType(e); setSelectedFieldType(e);
}} }}
onMouseDown={(e: any) => {
if (e.button === 0) props.setAdding(true);
}}
> >
<div className="space-y-4"> <div className="space-y-4">
{fieldTypes.map((fieldType) => ( {fieldTypes.map((fieldType) => (

View File

@ -20,7 +20,6 @@ export default function PDFEditor(props: any) {
const noRecipients = const noRecipients =
props?.document.Recipient.length === 0 || props?.document.Recipient.length === 0 ||
props?.document.Recipient.every((e: any) => !e.email); props?.document.Recipient.every((e: any) => !e.email);
const [adding, setAdding] = useState(false);
function onPositionChangedHandler(position: any, id: any) { function onPositionChangedHandler(position: any, id: any) {
if (!position) return; if (!position) return;
@ -62,11 +61,6 @@ export default function PDFEditor(props: any) {
onMouseUp={(e: any, page: number) => { onMouseUp={(e: any, page: number) => {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
console.log(adding);
if (adding) {
addField(e, page);
setAdding(false);
}
}} }}
onMouseDown={(e: any, page: number) => { onMouseDown={(e: any, page: number) => {
if (e.button === 0) addField(e, page); if (e.button === 0) addField(e, page);
@ -82,7 +76,6 @@ export default function PDFEditor(props: any) {
/> />
<hr className="m-3 border-slate-300"></hr> <hr className="m-3 border-slate-300"></hr>
<FieldTypeSelector <FieldTypeSelector
setAdding={setAdding}
selectedRecipient={selectedRecipient} selectedRecipient={selectedRecipient}
onChange={setSelectedFieldType} onChange={setSelectedFieldType}
/> />