diff --git a/addons/web/static/src/js/framework/utils.js b/addons/web/static/src/js/framework/utils.js index f1f28d83613..087d4c73d65 100644 --- a/addons/web/static/src/js/framework/utils.js +++ b/addons/web/static/src/js/framework/utils.js @@ -441,3 +441,65 @@ return { }); +odoo.define('web.dom_utils', function (require) { +"use strict"; + +var core = require('web.core'); + +// TO DO: move this into new file dom_utils.js +/** + * 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 = $('