mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 16:23:06 +10:00
fix: clear invalid drawn signature when switching to typed signature (#1536)
This commit is contained in:
@ -351,10 +351,17 @@ export const SignaturePad = ({
|
|||||||
const newValue = event.target.value;
|
const newValue = event.target.value;
|
||||||
setTypedSignature(newValue);
|
setTypedSignature(newValue);
|
||||||
|
|
||||||
|
if ($el.current) {
|
||||||
|
const ctx = $el.current.getContext('2d');
|
||||||
|
ctx?.clearRect(0, 0, $el.current.width, $el.current.height);
|
||||||
|
}
|
||||||
|
|
||||||
if (newValue.trim() !== '') {
|
if (newValue.trim() !== '') {
|
||||||
onChange?.(newValue);
|
onChange?.(newValue);
|
||||||
|
onValidityChange?.(true);
|
||||||
} else {
|
} else {
|
||||||
onChange?.(null);
|
onChange?.(null);
|
||||||
|
onValidityChange?.(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user