mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
0a4047ab31
Unfortunately the babel minify-mangle plugin seems to be abandoned and in certain circumstances can be very buggy. The only safe options are to disable it, or to switch to a different minification library. Not minifying our javascript is not ideal, so this commit updates the javascript tasks to use a rollup, combined with babel, and terser. Babel still converts code from ES/UMD/AMD to AMD modules with the relevant browser support, whilst terser minifies the code. The rollup bundler handles tracking and creation of sourcemaps, and supports better parallelisation of the tasks. Since the upgrade to Node LTS/Gallium requires an upgrade to @babel/core and eslint, which change the built files anyway, this seems like the ideal time to make this change.
11 lines
1.2 KiB
JavaScript
11 lines
1.2 KiB
JavaScript
/**
|
|
* Enhance a textarea with auto growing rows to fit the content.
|
|
*
|
|
* @module core/auto_rows
|
|
* @copyright 2016 Ryan Wyllie <ryan@moodle.com>
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
* @since 3.2
|
|
*/
|
|
define("core/auto_rows",["jquery"],(function($){var SELECTORS_ELEMENT="[data-auto-rows]",EVENTS={ROW_CHANGE:"autorows:rowchange"},changeListener=function(e){var element=$(e.target),minRows=element.data("min-rows"),currentRows=element.attr("rows");void 0===minRows&&element.data("min-rows",currentRows),element.attr("rows",1);var rows=function(element){var currentRows=element.attr("rows"),minRows=element.data("min-rows"),maxRows=element.attr("data-max-rows"),height=element.height(),padding=element.innerHeight()-height,rows=(element[0].scrollHeight-padding)/(height/currentRows);return element.css("height",""),rows<minRows?minRows:maxRows&&rows>=maxRows?maxRows:rows}(element);element.attr("rows",rows),rows!=currentRows&&element.trigger(EVENTS.ROW_CHANGE)};return{init:function(root){$(root).data("auto-rows")?$(root).on("input propertychange",changeListener.bind(this)):$(root).on("input propertychange",SELECTORS_ELEMENT,changeListener.bind(this))},events:EVENTS}}));
|
|
|
|
//# sourceMappingURL=auto_rows.min.js.map
|