Skip to content

Commit 2d3c24b

Browse files
committed
fix(tpl): skip upload if paste into text input
1 parent 0425782 commit 2d3c24b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/tpl/frontend/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,17 @@
876876
}
877877
}
878878

879+
var nonTextInputTypes = ['hidden', 'radio', 'checkbox', 'button', 'reset', 'submit', 'image'];
879880
document.documentElement.addEventListener('paste', function (e) {
881+
var tagName = e.target.tagName;
882+
if (tagName === 'INPUT') {
883+
if (nonTextInputTypes.indexOf(e.target.type) < 0) {
884+
return;
885+
}
886+
}
887+
if (tagName === 'TEXTAREA') {
888+
return;
889+
}
880890
var data = e.clipboardData;
881891
if (!data) {
882892
return;

0 commit comments

Comments
 (0)