autosize-rails 1.18.6 → 1.18.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6321574b79af5e01dfcd3282bf575bd92745ddab
4
- data.tar.gz: 416b719a653054c3fe3b119706e66b52d84601a6
3
+ metadata.gz: 8705bce18670d6e76566e32d8e705898e7ee1cdb
4
+ data.tar.gz: a3c474ce295904f4bd5135c5d375d0f9a6ec71b0
5
5
  SHA512:
6
- metadata.gz: 5251ab29df5b786c923e8d1c8cef73332c4c4bc78595c0f76f66dd73435dcf50a8205dfa1850a74a57d0c0cfe194f0f68cf459fcf365660e76e03a02df8a0c52
7
- data.tar.gz: 15f512b7173425ee86a67040869449cb07c2f38a9e43f99b15615143b1fded1a59a7a0bfa0fd79c11c8acda31ebd707ee0baf0acae3afeff5f09448d228d2dbb
6
+ metadata.gz: f60ffdc75eee05f93bce60f26f494491976fa0d8b7fc604b4a2419e6ff743d9ecbaf10d85d57341f48bba5eceadae7ca078b93dd2169ef4fe265840af7f3dab0
7
+ data.tar.gz: b25a31b154f17f6bdbc5554e9e0944d73e330f3aac1a9a7fae0d77109e5748ee579cfb0dacae067d8caa8a8980a61c9405949e2fbb7af64c46a7611e65391ed4
data/README.md CHANGED
@@ -15,6 +15,10 @@ And then execute:
15
15
  Or install it yourself as:
16
16
 
17
17
  $ gem install autosize-rails
18
+
19
+ Finally, add this to your application.js file:
20
+
21
+ //= require jquery.autosize
18
22
 
19
23
  ## Usage
20
24
 
@@ -1,5 +1,5 @@
1
1
  module Autosize
2
2
  module Rails
3
- VERSION = "1.18.6"
3
+ VERSION = "1.18.8"
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Autosize v1.18.6 - 2014-03-13
2
+ Autosize v1.18.8 - 2014-05-20
3
3
  Automatically adjust textarea height based on user input.
4
4
  (c) 2014 Jack Moore - http://www.jacklmoore.com/autosize
5
5
  license: http://www.opensource.org/licenses/mit-license.php
@@ -8,8 +8,8 @@
8
8
  var
9
9
  defaults = {
10
10
  className: 'autosizejs',
11
- id: 'autosizejs',
12
- append: '',
11
+ id: 'autosizejs',
12
+ append: '\n',
13
13
  callback: false,
14
14
  resizeDelay: 10,
15
15
  placeholder: true
@@ -70,7 +70,8 @@
70
70
  resize: ta.style.resize
71
71
  },
72
72
  timeout,
73
- width = $ta.width();
73
+ width = $ta.width(),
74
+ taResize = $ta.css('resize');
74
75
 
75
76
  if ($ta.data('autosize')) {
76
77
  // exit if autosize has already been applied, or if the textarea is the mirror element.
@@ -88,10 +89,15 @@
88
89
  $ta.css({
89
90
  overflow: 'hidden',
90
91
  overflowY: 'hidden',
91
- wordWrap: 'break-word', // horizontal overflow is hidden, so break-word is necessary for handling words longer than the textarea width
92
- resize: ($ta.css('resize') === 'none' || $ta.css('resize') === 'vertical') ? 'none' : 'horizontal'
92
+ wordWrap: 'break-word' // horizontal overflow is hidden, so break-word is necessary for handling words longer than the textarea width
93
93
  });
94
94
 
95
+ if (taResize === 'vertical') {
96
+ $ta.css('resize','none');
97
+ } else if (taResize === 'both') {
98
+ $ta.css('resize', 'horizontal');
99
+ }
100
+
95
101
  // The mirror width must exactly match the textarea width, so using getBoundingClientRect because it doesn't round the sub-pixel value.
96
102
  // window.getComputedStyle, getBoundingClientRect returning a width are unsupported, but also unneeded in IE8 and lower.
97
103
  function setWidth() {
@@ -102,7 +108,7 @@
102
108
 
103
109
  width = ta.getBoundingClientRect().width;
104
110
 
105
- if (width === 0) {
111
+ if (width === 0 || typeof width !== 'number') {
106
112
  width = parseInt(style.width,10);
107
113
  }
108
114
 
@@ -121,7 +127,7 @@
121
127
 
122
128
  mirrored = ta;
123
129
  mirror.className = options.className;
124
- mirror.id = options.id;
130
+ mirror.id = options.id;
125
131
  maxHeight = parseInt($ta.css('maxHeight'), 10);
126
132
 
127
133
  // mirror is a duplicate textarea located off-screen that
@@ -132,8 +138,8 @@
132
138
  $.each(typographyStyles, function(i,val){
133
139
  styles[val] = $ta.css(val);
134
140
  });
135
-
136
- $(mirror).css(styles).attr('wrap', $ta.attr('wrap'));
141
+
142
+ $(mirror).css(styles).attr('wrap', $ta.attr('wrap'));
137
143
 
138
144
  setWidth();
139
145
 
@@ -163,7 +169,7 @@
163
169
  // If the textarea is empty, copy the placeholder text into
164
170
  // the mirror control and use that for sizing so that we
165
171
  // don't end up with placeholder getting trimmed.
166
- mirror.value = ($ta.attr("placeholder") || '') + options.append;
172
+ mirror.value = ($ta.attr("placeholder") || '') + options.append;
167
173
  } else {
168
174
  mirror.value = ta.value + options.append;
169
175
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autosize-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.18.6
4
+ version: 1.18.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Caleb Thompson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-14 00:00:00.000000000 Z
11
+ date: 2014-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails