diff options
| author | Christophe Simonis <chs@odoo.com> | 2016-01-27 12:27:01 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2016-01-27 12:27:01 +0100 |
| commit | 1231585df13081f922ba2c93e2f4c326202de2ef (patch) | |
| tree | e29c2775383d6111962534b9beab4c8301a1525b /addons/web/static/src/js/framework | |
| parent | 528111db69544f9a1c54b7c76f63c76691659fe0 (diff) | |
| parent | 78d20b552b4374b94aec7097c0e6a48a3dd2d961 (diff) | |
[MERGE] forward port of branch saas-9 up to 78d20b5
Diffstat (limited to 'addons/web/static/src/js/framework')
| -rw-r--r-- | addons/web/static/src/js/framework/utils.js | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/addons/web/static/src/js/framework/utils.js b/addons/web/static/src/js/framework/utils.js index 087d4c73d65..a0ab37a7dfb 100644 --- a/addons/web/static/src/js/framework/utils.js +++ b/addons/web/static/src/js/framework/utils.js @@ -411,6 +411,13 @@ var DropMisordered = Class.extend({ }, }); +function swap(array, elem1, elem2) { + var i1 = array.indexOf(elem1); + var i2 = array.indexOf(elem2); + array[i2] = elem1; + array[i1] = elem2; +} + return { divmod: divmod, @@ -437,6 +444,7 @@ return { assert: assert, xor: xor, DropMisordered: DropMisordered, + swap: swap, }; }); @@ -467,10 +475,16 @@ function autoresize ($textarea, options) { top: -10000, left: -10000, }); - $fixed_text_area.addClass($fixed_text_area[0].classList); + $fixed_text_area.addClass($textarea[0].className); $fixed_text_area.insertAfter($textarea); } + var style = window.getComputedStyle($textarea[0], null); + if (style.resize === 'vertical') { + $textarea[0].style.resize = 'none'; + } else if (style.resize === 'both') { + $textarea[0].style.resize = 'horizontal'; + } resize(); if ($textarea.__auto_resized) { return; @@ -491,7 +505,7 @@ function autoresize ($textarea, options) { } else { heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth); } - $fixed_text_area.width($textarea.outerWidth()); + $fixed_text_area.width($textarea.width()); $fixed_text_area.val($textarea.val()); var height = $fixed_text_area[0].scrollHeight; $textarea.css({height: Math.max(height + heightOffset, min_height)}); |
