sproutcore 1.8.1 → 1.8.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -913,6 +913,9 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
913
913
  // our key/mouse down/up handlers (such as the user choosing Select All
914
914
  // from a menu).
915
915
  SC.Event.add(input, 'select', this, this._textField_selectionDidChange);
916
+
917
+ // handle a "paste" from app menu and context menu
918
+ SC.Event.add(input, 'input', this, this._textField_inputDidChange);
916
919
  },
917
920
 
918
921
  /**
@@ -926,6 +929,7 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
926
929
  SC.Event.remove(input, 'blur', this, this._textField_fieldDidBlur);
927
930
  SC.Event.remove(input, 'select', this, this._textField_selectionDidChange);
928
931
  SC.Event.remove(input, 'keypress', this, this._firefox_dispatch_keypress);
932
+ SC.Event.remove(input, 'input', this, this._textField_inputDidChange);
929
933
  },
930
934
 
931
935
  /** @private
@@ -1004,6 +1008,20 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
1004
1008
  }
1005
1009
  this.updateHintOnFocus();
1006
1010
  },
1011
+
1012
+ /** @private
1013
+ Context-menu paste does not trigger fieldValueDidChange normally. To do so, we'll capture the
1014
+ input event and avoid duplicating the "fieldValueDidChange" call if it was already issued elsewhere.
1015
+
1016
+ I welcome someone else to find a better solution to this problem. However, please make sure that it
1017
+ works with pasting via shortcut, context menu and the application menu on *All Browsers*.
1018
+ */
1019
+ _textField_inputDidChange: function() {
1020
+ var timerNotPending = SC.empty(this._fieldValueDidChangeTimer) || !this._fieldValueDidChangeTimer.get('isValid');
1021
+ if(this.get('applyImmediately') && timerNotPending) {
1022
+ this.invokeLater(this.fieldValueDidChange, 10);
1023
+ }
1024
+ },
1007
1025
 
1008
1026
  /** @private
1009
1027
  Make sure to update visibility of hint if it changes
@@ -1166,12 +1184,10 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
1166
1184
  }
1167
1185
 
1168
1186
  if (this.get('applyImmediately')) {
1169
- // There used to be an invokeLater here instead of setTimeout. What we
1170
- // really need is setTimeout.
1171
- var self = this;
1172
- setTimeout(function () {
1173
- self.fieldValueDidChange();
1174
- }, 10);
1187
+ // This has gone back and forth several times between invokeLater and setTimeout.
1188
+ // Now we're back to invokeLater, please read the code comment above
1189
+ // this._textField_inputDidChange before changing it again.
1190
+ this._fieldValueDidChangeTimer = this.invokeLater(this.fieldValueDidChange, 10);
1175
1191
  }
1176
1192
 
1177
1193
  return YES;
@@ -59,7 +59,7 @@ window.SproutCore = window.SproutCore || SC ;
59
59
  */
60
60
  SC = window.SC; // This is dumb but necessary for jsdoc to get it right
61
61
 
62
- SC.VERSION = '1.8.1';
62
+ SC.VERSION = '1.8.2';
63
63
 
64
64
  /**
65
65
  @private
@@ -24,7 +24,7 @@
24
24
  left: -25px;
25
25
  right: -25px;
26
26
 
27
- @include slices("popover_notoolbar.png", $left: 40, $top: 40, $bottom: 40, $right: 40, $fill: 1 1, $skip: middle);
27
+ @include slices("popover_notoolbar.png", $left: 30, $top: 34, $bottom: 34, $right: 30, $fill: 1 1, $skip: middle);
28
28
 
29
29
  .middle { display: none }
30
30
 
@@ -34,24 +34,20 @@
34
34
  &.top-toolbar .popover-background {
35
35
  top: -20px;
36
36
  @include slices(
37
- "popover.png", $left: 40, $top: 75, $bottom: 40, $right: 40,
37
+ "popover.png", $left: 30, $top: 75, $bottom: 34, $right: 30,
38
38
  $skip: left middle right bottom-left bottom bottom-left bottom-right
39
39
  );
40
-
41
- .left { top: 75px; }
42
- .right { top: 75px; }
40
+
43
41
  }
44
42
 
45
43
 
46
44
  &.bottom-toolbar .popover-background {
47
45
  bottom: -20px;
48
46
  @include slices(
49
- "popover.png", $left: 40, $bottom: 75, $top: 40, $right: 40,
47
+ "popover.png", $left: 30, $bottom: 75, $top: 34, $right: 30,
50
48
  $skip: left middle right top-left top top-right
51
49
  );
52
50
 
53
- .left { bottom: 75px; }
54
- .right { bottom: 75px; }
55
51
  }
56
52
 
57
53
  }
@@ -63,7 +59,7 @@
63
59
  top: -25px;
64
60
  bottom: -25px;
65
61
 
66
- @include slices("popover_empty.png", $left: 40, $top: 75, $bottom: 40, $right: 40, $fill: 1 1);
62
+ @include slices("popover_empty.png", $left: 30, $top: 75, $bottom: 40, $right: 30, $fill: 1 1);
67
63
  }
68
64
  }
69
65
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: sproutcore
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.8.1
5
+ version: 1.8.2.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Strobe, Inc., Apple Inc. and contributors
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-03-26 00:00:00 Z
13
+ date: 2012-05-13 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rack