mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
MDL-63303 javascript: fix bug in auto_rows.js allowing it to shrink
This commit is contained in:
parent
91194bfd9f
commit
9d199fd2e7
2
lib/amd/build/auto_rows.min.js
vendored
2
lib/amd/build/auto_rows.min.js
vendored
@ -1 +1 @@
|
||||
define(["jquery"],function(a){var b={ELEMENT:"[data-auto-rows]"},c={ROW_CHANGE:"autorows:rowchange"},d=function(a){var b=a.attr("rows"),c=a.data("min-rows"),d=a.attr("data-max-rows"),e=a.height(),f=a.innerHeight(),g=f-e,h=a[0].scrollHeight,i=(h-g)/(e/b);return a.css("height",""),i<c?c:d&&i>=d?d:i},e=function(b){var e=a(b.target),f=e.data("min-rows"),g=e.attr("rows");"undefined"==typeof f&&e.data("min-rows",g);var h=d(e);h!=g&&(e.attr("rows",h),e.trigger(c.ROW_CHANGE))},f=function(c){a(c).data("auto-rows")?a(c).on("input propertychange",e.bind(this)):a(c).on("input propertychange",b.ELEMENT,e.bind(this))};return{init:f,events:c}});
|
||||
define(["jquery"],function(a){var b={ELEMENT:"[data-auto-rows]"},c={ROW_CHANGE:"autorows:rowchange"},d=function(a){var b=a.attr("rows"),c=a.data("min-rows"),d=a.attr("data-max-rows"),e=a.height(),f=a.innerHeight(),g=f-e,h=a[0].scrollHeight,i=(h-g)/(e/b);return a.css("height",""),i<c?c:d&&i>=d?d:i},e=function(b){var e=a(b.target),f=e.data("min-rows"),g=e.attr("rows");"undefined"==typeof f&&e.data("min-rows",g),e.attr("rows",1);var h=d(e);e.attr("rows",h),h!=g&&e.trigger(c.ROW_CHANGE)},f=function(c){a(c).data("auto-rows")?a(c).on("input propertychange",e.bind(this)):a(c).on("input propertychange",b.ELEMENT,e.bind(this))};return{init:f,events:c}});
|
@ -80,10 +80,14 @@ define(['jquery'], function($) {
|
||||
if (typeof minRows === "undefined") {
|
||||
element.data('min-rows', currentRows);
|
||||
}
|
||||
|
||||
// Reset element to single row so that the scroll height of the
|
||||
// element is correctly calculated each time.
|
||||
element.attr('rows', 1);
|
||||
var rows = calculateRows(element);
|
||||
element.attr('rows', rows);
|
||||
|
||||
if (rows != currentRows) {
|
||||
element.attr('rows', rows);
|
||||
element.trigger(EVENTS.ROW_CHANGE);
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user