File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -153,16 +153,22 @@ class InputWaiter {
153153 paste ( event , view ) {
154154 const clipboardData = event . clipboardData ;
155155 const items = clipboardData . items ;
156- const files = [ ] ;
156+ let files = [ ] ;
157157 for ( let i = 0 ; i < items . length ; i ++ ) {
158158 const item = items [ i ] ;
159- if ( item . kind === "file" ) {
160- const file = item . getAsFile ( ) ;
161- files . push ( file ) ;
162-
163- event . preventDefault ( ) ; // Prevent the default paste behavior
159+ if ( item . kind === "string" ) {
160+ // If there are any string items they should be preferred over
161+ // files.
162+ files = [ ] ;
163+ break ;
164+ } else if ( item . kind === "file" ) {
165+ files . push ( item . getAsFile ( ) ) ;
164166 }
165167 }
168+ if ( files . length > 0 ) {
169+ // Prevent the default paste behavior, afterPaste will load the files instead
170+ event . preventDefault ( ) ;
171+ }
166172 setTimeout ( ( ) => {
167173 self . afterPaste ( files ) ;
168174 } ) ;
You can’t perform that action at this time.
0 commit comments