@@ -1413,7 +1413,7 @@ MM.Action.SetStatus.prototype.undo = function() {
1413
1413
MM . Clipboard = {
1414
1414
_item : null ,
1415
1415
_mode : "" ,
1416
- _delay : 0 ,
1416
+ _delay : 50 ,
1417
1417
_node : document . createElement ( "textarea" )
1418
1418
} ;
1419
1419
@@ -1428,6 +1428,7 @@ MM.Clipboard.init = function() {
1428
1428
1429
1429
MM . Clipboard . focus = function ( ) {
1430
1430
this . _node . focus ( ) ;
1431
+ this . _empty ( ) ;
1431
1432
}
1432
1433
1433
1434
MM . Clipboard . copy = function ( sourceItem ) {
@@ -1441,7 +1442,7 @@ MM.Clipboard.copy = function(sourceItem) {
1441
1442
MM . Clipboard . paste = function ( targetItem ) {
1442
1443
setTimeout ( function ( ) {
1443
1444
var pasted = this . _node . value ;
1444
- this . _node . value = "" ;
1445
+ this . _empty ( ) ;
1445
1446
if ( ! pasted ) { return ; } /* nothing */
1446
1447
1447
1448
if ( this . _item && pasted == MM . Format . Plaintext . to ( this . _item . toJSON ( ) ) ) { /* pasted a previously copied/cut item */
@@ -1518,7 +1519,14 @@ MM.Clipboard._expose = function() {
1518
1519
this . _node . value = plaintext ;
1519
1520
this . _node . selectionStart = 0 ;
1520
1521
this . _node . selectionEnd = this . _node . value . length ;
1521
- setTimeout ( function ( ) { this . _node . value = "" ; } . bind ( this ) , this . _delay ) ;
1522
+ setTimeout ( this . _empty . bind ( this ) , this . _delay ) ;
1523
+ }
1524
+
1525
+ MM . Clipboard . _empty = function ( ) {
1526
+ /* safari needs a non-empty selection in order to actually perfrom a real copy on cmd+c */
1527
+ this . _node . value = "\n" ;
1528
+ this . _node . selectionStart = 0 ;
1529
+ this . _node . selectionEnd = this . _node . value . length ;
1522
1530
}
1523
1531
1524
1532
MM . Clipboard . _endCut = function ( ) {
@@ -1833,7 +1841,10 @@ MM.Command.Pan.handleEvent = function(e) {
1833
1841
MM . Command . Copy = Object . create ( MM . Command , {
1834
1842
label : { value : "Copy" } ,
1835
1843
prevent : { value : false } ,
1836
- keys : { value : [ { keyCode : "C" . charCodeAt ( 0 ) , ctrlKey :true } ] }
1844
+ keys : { value : [
1845
+ { keyCode : "C" . charCodeAt ( 0 ) , ctrlKey :true } ,
1846
+ { keyCode : "C" . charCodeAt ( 0 ) , metaKey :true }
1847
+ ] }
1837
1848
} ) ;
1838
1849
MM . Command . Copy . execute = function ( ) {
1839
1850
MM . Clipboard . copy ( MM . App . current ) ;
@@ -1842,7 +1853,10 @@ MM.Command.Copy.execute = function() {
1842
1853
MM . Command . Cut = Object . create ( MM . Command , {
1843
1854
label : { value : "Cut" } ,
1844
1855
prevent : { value : false } ,
1845
- keys : { value : [ { keyCode : "X" . charCodeAt ( 0 ) , ctrlKey :true } ] }
1856
+ keys : { value : [
1857
+ { keyCode : "X" . charCodeAt ( 0 ) , ctrlKey :true } ,
1858
+ { keyCode : "X" . charCodeAt ( 0 ) , metaKey :true }
1859
+ ] }
1846
1860
} ) ;
1847
1861
MM . Command . Cut . execute = function ( ) {
1848
1862
MM . Clipboard . cut ( MM . App . current ) ;
@@ -1851,7 +1865,10 @@ MM.Command.Cut.execute = function() {
1851
1865
MM . Command . Paste = Object . create ( MM . Command , {
1852
1866
label : { value : "Paste" } ,
1853
1867
prevent : { value : false } ,
1854
- keys : { value : [ { keyCode : "V" . charCodeAt ( 0 ) , ctrlKey :true } ] }
1868
+ keys : { value : [
1869
+ { keyCode : "V" . charCodeAt ( 0 ) , ctrlKey :true } ,
1870
+ { keyCode : "V" . charCodeAt ( 0 ) , metaKey :true }
1871
+ ] }
1855
1872
} ) ;
1856
1873
MM . Command . Paste . execute = function ( ) {
1857
1874
MM . Clipboard . paste ( MM . App . current ) ;
@@ -1969,7 +1986,7 @@ MM.Command.Strikethrough = Object.create(MM.Command.Style, {
1969
1986
1970
1987
MM . Command . Value = Object . create ( MM . Command , {
1971
1988
label : { value : "Set value" } ,
1972
- keys : { value : [ { charCode : "v" . charCodeAt ( 0 ) , ctrlKey :false } ] }
1989
+ keys : { value : [ { charCode : "v" . charCodeAt ( 0 ) , ctrlKey :false , metaKey : false } ] }
1973
1990
} ) ;
1974
1991
MM . Command . Value . execute = function ( ) {
1975
1992
var item = MM . App . current ;
@@ -2008,7 +2025,7 @@ MM.Command.No.execute = function() {
2008
2025
2009
2026
MM . Command . Computed = Object . create ( MM . Command , {
2010
2027
label : { value : "Computed" } ,
2011
- keys : { value : [ { charCode : "c" . charCodeAt ( 0 ) , ctrlKey :false } ] }
2028
+ keys : { value : [ { charCode : "c" . charCodeAt ( 0 ) , ctrlKey :false , metaKey : false } ] }
2012
2029
} ) ;
2013
2030
MM . Command . Computed . execute = function ( ) {
2014
2031
var item = MM . App . current ;
@@ -5008,11 +5025,11 @@ MM.Mouse._visualizeDragState = function(state) {
5008
5025
node . style . boxShadow = ( x * offset ) + "px " + ( y * offset ) + "px 2px " + spread + "px #000" ;
5009
5026
}
5010
5027
}
5011
-
5028
+ /*
5012
5029
setInterval(function() {
5013
5030
console.log(document.activeElement);
5014
5031
}, 1000);
5015
-
5032
+ */
5016
5033
5017
5034
/*
5018
5035
* Notes regarding app state/modes, activeElements, focusing etc.
0 commit comments