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 = $('