diff --git a/wagtail/wagtailadmin/static_src/wagtailadmin/js/core.js b/wagtail/wagtailadmin/static_src/wagtailadmin/js/core.js index 51f114e825..09dd2a1912 100644 --- a/wagtail/wagtailadmin/static_src/wagtailadmin/js/core.js +++ b/wagtail/wagtailadmin/static_src/wagtailadmin/js/core.js @@ -50,10 +50,6 @@ $(function() { fitNav(); }); - // Apply auto-height sizing to text areas - // NB .richtext (hallo.js-enabled) divs do not need this as they expand to fit their content by default - // $('.page-editor textarea').autosize(); - // Enable nice focus effects on all fields. This enables help text on hover. $(document).on('focus mouseover', 'input,textarea,select', function() { $(this).closest('.field').addClass('focused'); @@ -137,4 +133,12 @@ $(function() { }); } } + + /* Functions that need to run/rerun when active tabs are changed */ + $(document).on('shown.bs.tab', function(e) { + // Resize autosize textareas + $('textarea[data-autosize-on]').each(function() { + autosize.update($(this).get()); + }); + }); }); diff --git a/wagtail/wagtailadmin/static_src/wagtailadmin/js/vendor/jquery.autosize.js b/wagtail/wagtailadmin/static_src/wagtailadmin/js/vendor/jquery.autosize.js index d0fa9645fc..053cf81555 100644 --- a/wagtail/wagtailadmin/static_src/wagtailadmin/js/vendor/jquery.autosize.js +++ b/wagtail/wagtailadmin/static_src/wagtailadmin/js/vendor/jquery.autosize.js @@ -1,242 +1,213 @@ /*! - Autosize v1.17.2 - 2013-07-30 - Automatically adjust textarea height based on user input. - (c) 2013 Jack Moore - http://www.jacklmoore.com/autosize - license: http://www.opensource.org/licenses/mit-license.php + Autosize 3.0.4 + license: MIT + http://www.jacklmoore.com/autosize */ -(function (factory) { +(function (global, factory) { if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(['jquery'], factory); + define(['exports', 'module'], factory); + } else if (typeof exports !== 'undefined' && typeof module !== 'undefined') { + factory(exports, module); } else { - // Browser globals: jQuery or jQuery-like library, such as Zepto - factory(window.jQuery || window.$); + var mod = { + exports: {} + }; + factory(mod.exports, mod); + global.autosize = mod.exports; } -}(function ($) { - var - defaults = { - className: 'autosizejs', - append: '', - callback: false, - resizeDelay: 10 - }, +})(this, function (exports, module) { + 'use strict'; - // border:0 is unnecessary, but avoids a bug in FireFox on OSX - copy = '