File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -35,11 +35,16 @@ function prepareTextForClipboard(text) {
3535 * Binds copy functionality to the given terminal.
3636 * @param {ClipboardEvent } ev The original copy event to be handled
3737 */
38- function copyHandler ( ev ) {
38+ function copyHandler ( ev , term ) {
3939 var copiedText = window . getSelection ( ) . toString ( ) ,
4040 text = prepareTextForClipboard ( copiedText ) ;
4141
42- ev . clipboardData . setData ( 'text/plain' , text ) ;
42+ if ( term . browser . isMSIE ) {
43+ window . clipboardData . setData ( 'Text' , text ) ;
44+ } else {
45+ ev . clipboardData . setData ( 'text/plain' , text ) ;
46+ }
47+
4348 ev . preventDefault ( ) ; // Prevent or the original text will be copied.
4449}
4550
@@ -57,8 +62,7 @@ function pasteHandler(ev, term) {
5762 return term . cancel ( ev ) ;
5863 } ;
5964
60- var userAgent = window . navigator . userAgent . toLowerCase ( ) ;
61- if ( userAgent . match ( / m s i e | M S I E / ) || userAgent . match ( / ( T | t ) r i d e n t / ) ) {
65+ if ( term . browser . isMSIE ) {
6266 if ( window . clipboardData ) {
6367 var text = window . clipboardData . getData ( 'Text' ) ;
6468 dispatchPaste ( text ) ;
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ let userAgent = (isNode) ? 'node' : navigator.userAgent;
1616let platform = ( isNode ) ? 'node' : navigator . platform ;
1717
1818export let isFirefox = ! ! ~ userAgent . indexOf ( 'Firefox' ) ;
19- export let isMSIE = ! ! ~ userAgent . indexOf ( 'MSIE' ) ;
19+ export let isMSIE = ! ! ~ userAgent . indexOf ( 'MSIE' ) || ! ! ~ userAgent . indexOf ( 'Trident' ) ;
2020
2121// Find the users platform. We use this to interpret the meta key
2222// and ISO third level shifts.
You can’t perform that action at this time.
0 commit comments