Skip to content

Commit 3808437

Browse files
swacClaudéric Demers
authored andcommitted
fix: do not copy canvas context if it has neither width nor height (#530)
1 parent d5d9a55 commit 3808437

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/utils.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,11 @@ export function cloneNode(node) {
296296
field.name = `__sortableClone__${field.name}`;
297297
}
298298

299-
if (field.tagName === NodeType.Canvas) {
299+
if (
300+
field.tagName === NodeType.Canvas &&
301+
fields[i].width > 0 &&
302+
fields[i].height > 0
303+
) {
300304
const destCtx = field.getContext('2d');
301305
destCtx.drawImage(fields[i], 0, 0);
302306
}

0 commit comments

Comments
 (0)