Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
attach(element) {
this.loadRefs(element, { canvas: 'single', refresh: 'single', padBody: 'single', signatureImage: 'single' });
const superAttach = super.attach(element);
this.onDisabled();
// Create the signature pad.
if (this.refs.canvas) {
this.signaturePad = new SignaturePad(this.refs.canvas, {
minWidth: this.component.minWidth,
maxWidth: this.component.maxWidth,
penColor: this.component.penColor,
backgroundColor: this.component.backgroundColor
});
this.signaturePad.onEnd = () => this.setValue(this.signaturePad.toDataURL(), {
noSign: true
});
this.refs.signatureImage.setAttribute('src', this.signaturePad.toDataURL());
// Ensure the signature is always the size of its container.
if (this.refs.padBody) {
this.addEventListener(window, 'resize', _.debounce(() => this.checkSize(), 100));
setTimeout(function checkWidth() {
if (this.refs.padBody && this.refs.padBody.offsetWidth) {