File tree 2 files changed +7
-11
lines changed
2 files changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -896,18 +896,14 @@ function createSqueakDisplay(canvas, options) {
896
896
// more copy/paste
897
897
if ( navigator . clipboard ) {
898
898
// new-style copy/paste (all modern browsers)
899
- display . readFromSystemClipboard = ( ) => navigator . clipboard . readText ( )
899
+ display . readFromSystemClipboard = ( ) => display . handlingEvent &&
900
+ navigator . clipboard . readText ( )
900
901
. then ( text => display . clipboardString = text )
901
- . catch ( err => {
902
- if ( ! display . handlingEvent ) console . warn ( "reading from clipboard outside event handler" ) ;
903
- console . error ( "readFromSystemClipboard" + err . message ) ;
904
- } ) ;
905
- display . writeToSystemClipboard = ( ) => navigator . clipboard . writeText ( display . clipboardString )
902
+ . catch ( err => console . error ( "readFromSystemClipboard " + err . message ) ) ;
903
+ display . writeToSystemClipboard = ( ) => display . handlingEvent &&
904
+ navigator . clipboard . writeText ( display . clipboardString )
906
905
. then ( ( ) => display . clipboardStringChanged = false )
907
- . catch ( err => {
908
- if ( ! display . handlingEvent ) console . warn ( "writing to clipboard outside event handler" ) ;
909
- console . error ( "writeToSystemClipboard" + err . message ) ;
910
- } ) ;
906
+ . catch ( err => console . error ( "writeToSystemClipboard " + err . message ) ) ;
911
907
} else {
912
908
// old-style copy/paste
913
909
document . oncopy = function ( evt , key ) {
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ Object.extend(Squeak.Primitives.prototype,
43
43
clipBoardPromise
44
44
. then ( ( ) => this . vm . popNandPush ( 1 , this . makeStString ( this . display . clipboardString ) ) )
45
45
. catch ( ( ) => this . vm . popNandPush ( 1 , this . vm . nilObj ) )
46
- . finally ( ( ) => unfreeze ( ) ) ;
46
+ . finally ( unfreeze ) ;
47
47
} else {
48
48
if ( typeof ( this . display . clipboardString ) !== 'string' ) return false ;
49
49
this . vm . popNandPush ( 1 , this . makeStString ( this . display . clipboardString ) ) ;
You can’t perform that action at this time.
0 commit comments