Skip to content

Commit b57634d

Browse files
committed
fix(tpl): skip upload if paste into text input
1 parent d03c046 commit b57634d

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/tpl/asset/main.js

+10
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;

src/tpl/asset/main.js.go

+10
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,17 @@ createTextFile = function (content) {
777777
return new File([content], textFilename, {type: typeTextPlain});
778778
}
779779
}
780+
var nonTextInputTypes = ['hidden', 'radio', 'checkbox', 'button', 'reset', 'submit', 'image'];
780781
document.documentElement.addEventListener('paste', function (e) {
782+
var tagName = e.target.tagName;
783+
if (tagName === 'INPUT') {
784+
if (nonTextInputTypes.indexOf(e.target.type) < 0) {
785+
return;
786+
}
787+
}
788+
if (tagName === 'TEXTAREA') {
789+
return;
790+
}
781791
var data = e.clipboardData;
782792
if (!data) {
783793
return;

0 commit comments

Comments
 (0)