From 4828a00f9e5b4e65991bde43fd423c42da74a91b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Wed, 25 May 2016 10:41:35 +0200 Subject: [PATCH] [REF] web: move dom_utils to its own file --- .../web/static/src/js/framework/dom_utils.js | 67 ++++++++++++++++++ addons/web/static/src/js/framework/utils.js | 69 ------------------- addons/web/views/webclient_templates.xml | 1 + 3 files changed, 68 insertions(+), 69 deletions(-) create mode 100644 addons/web/static/src/js/framework/dom_utils.js diff --git a/addons/web/static/src/js/framework/dom_utils.js b/addons/web/static/src/js/framework/dom_utils.js new file mode 100644 index 00000000000..63a5c25a3d2 --- /dev/null +++ b/addons/web/static/src/js/framework/dom_utils.js @@ -0,0 +1,67 @@ +odoo.define('web.dom_utils', function (require) { +"use strict"; + +var core = require('web.core'); + +/** + * Autoresize a $textarea node, by recomputing its height when necessary + * @param {number} [options.min_height] by default, 50. + * @param {Widget} [options.parent] if set, autoresize will listen to some extra + * events to decide when to resize itself. This is useful for widgets that are + * not in the dom when the autoresize is declared. + */ +function autoresize ($textarea, options) { + options = options || {}; + + var $fixed_text_area; + var min_height = (options && options.min_height) || 50; + if (!$fixed_text_area) { + $fixed_text_area = $('