Commit 99d76729 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Textarea: use a fixed size on focus

parent 94937af2
...@@ -323,7 +323,14 @@ select:-moz-focusring { ...@@ -323,7 +323,14 @@ select:-moz-focusring {
text-shadow: 0 0 0 #000; text-shadow: 0 0 0 #000;
} }
textarea { textarea {
word-wrap: break-word;
white-space: normal;
vertical-align: top; vertical-align: top;
transition: height 0.2s ease-out;
height: 4em;
}
textarea:focus {
height: 20em;
} }
::-webkit-input-placeholder { ::-webkit-input-placeholder {
color: #575757; color: #575757;
......
...@@ -259,7 +259,7 @@ vdf</string> </value> ...@@ -259,7 +259,7 @@ vdf</string> </value>
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>955.12311.36129.49083</string> </value> <value> <string>955.17985.54265.23893</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -277,7 +277,7 @@ vdf</string> </value> ...@@ -277,7 +277,7 @@ vdf</string> </value>
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1478793295.77</float> <float>1479134904.68</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
rJS(window) rJS(window)
.setState({ .setState({
editable: false, editable: false,
focused: false,
value: '' value: ''
}) })
...@@ -37,7 +36,6 @@ ...@@ -37,7 +36,6 @@
textarea.value = this.state.value; textarea.value = this.state.value;
textarea.setAttribute('name', this.state.name); textarea.setAttribute('name', this.state.name);
textarea.setAttribute('title', this.state.title); textarea.setAttribute('title', this.state.title);
textarea.setAttribute('wrap', 'off');
if (this.state.required) { if (this.state.required) {
textarea.setAttribute('required', 'required'); textarea.setAttribute('required', 'required');
...@@ -50,12 +48,6 @@ ...@@ -50,12 +48,6 @@
} else { } else {
textarea.setAttribute('readonly', 'readonly'); textarea.setAttribute('readonly', 'readonly');
} }
if (this.state.focused) {
textarea.setAttribute('rows', Math.max(this.state.value.split('\n').length, 2));
} else {
textarea.setAttribute('rows', 2);
}
}) })
.declareMethod('getContent', function () { .declareMethod('getContent', function () {
...@@ -90,13 +82,6 @@ ...@@ -90,13 +82,6 @@
return this.notifyInvalid(evt.target.validationMessage); return this.notifyInvalid(evt.target.validationMessage);
}, true, true) }, true, true)
.onEvent('focus', function () {
return this.changeState({focused: true, value: this.element.querySelector('textarea').value});
}, true, false)
.onEvent('blur', function () {
return this.changeState({focused: false, value: this.element.querySelector('textarea').value});
}, true, false)
.declareAcquiredMethod("notifySubmit", "notifySubmit") .declareAcquiredMethod("notifySubmit", "notifySubmit")
.onEvent('keydown', function (evt) { .onEvent('keydown', function (evt) {
if (evt.keyCode === 83 && (navigator.platform.match("Mac") ? evt.metaKey : evt.ctrlKey)) { if (evt.keyCode === 83 && (navigator.platform.match("Mac") ? evt.metaKey : evt.ctrlKey)) {
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>954.45675.44850.53452</string> </value> <value> <string>955.18001.28212.40413</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1478794055.21</float> <float>1479134598.21</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -405,10 +405,17 @@ select { ...@@ -405,10 +405,17 @@ select {
} }
textarea { textarea {
word-wrap: break-word;
white-space: normal;
// Fix inconsistent Textarea bottom margin in Firefox and Chrome // Fix inconsistent Textarea bottom margin in Firefox and Chrome
// http://stackoverflow.com/a/26904480 // http://stackoverflow.com/a/26904480
vertical-align: top; vertical-align: top;
// BUG: how to transition on textarea row property
transition: height @transition-timing;
height: 4em;
&:focus {
height: 20em;
}
} }
::-webkit-input-placeholder { ::-webkit-input-placeholder {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment