diff --git a/js/elFinder.js b/js/elFinder.js index 014728ddc2..0cf3e71b88 100644 --- a/js/elFinder.js +++ b/js/elFinder.js @@ -3448,40 +3448,43 @@ var elFinder = function(elm, opts, bootCallback) { clearTimeout(heightBase.data('resizeTm')); } - if (typeof h === 'string') { - if (mt = h.match(/^([0-9.]+)%$/)) { - // setup heightBase - if (! heightBase || ! heightBase.length) { - heightBase = $(window); - } - if (! heightBase.data('marginToMyNode')) { - heightBase.data('marginToMyNode', getMargin()); - } - if (! heightBase.data('fitToBaseFunc')) { - heightBase.data('fitToBaseFunc', function(e) { - var tm = heightBase.data('resizeTm'); - e.preventDefault(); - e.stopPropagation(); - tm && cancelAnimationFrame(tm); - if (! node.hasClass('elfinder-fullscreen') && (!self.UA.Mobile || heightBase.data('rotated') !== self.UA.Rotated)) { - heightBase.data('rotated', self.UA.Rotated); - heightBase.data('resizeTm', requestAnimationFrame(function() { - self.restoreSize(); - })); - } - }); - } - if (typeof heightBase.data('rotated') === 'undefined') { - heightBase.data('rotated', self.UA.Rotated); + if (! self.options.noResizeBySelf) { + if (typeof h === 'string') { + if (mt = h.match(/^([0-9.]+)%$/)) { + // setup heightBase + if (! heightBase || ! heightBase.length) { + heightBase = $(window); + } + if (! heightBase.data('marginToMyNode')) { + heightBase.data('marginToMyNode', getMargin()); + } + if (! heightBase.data('fitToBaseFunc')) { + heightBase.data('fitToBaseFunc', function(e) { + var tm = heightBase.data('resizeTm'); + e.preventDefault(); + e.stopPropagation(); + tm && cancelAnimationFrame(tm); + if (! node.hasClass('elfinder-fullscreen') && (!self.UA.Mobile || heightBase.data('rotated') !== self.UA.Rotated)) { + heightBase.data('rotated', self.UA.Rotated); + heightBase.data('resizeTm', requestAnimationFrame(function() { + self.restoreSize(); + })); + } + }); + } + if (typeof heightBase.data('rotated') === 'undefined') { + heightBase.data('rotated', self.UA.Rotated); + } + h = heightBase.height() * (mt[1] / 100) - heightBase.data('marginToMyNode'); + + heightBase.off('resize.' + self.namespace, heightBase.data('fitToBaseFunc')); + fit && heightBase.on('resize.' + self.namespace, heightBase.data('fitToBaseFunc')); } - h = heightBase.height() * (mt[1] / 100) - heightBase.data('marginToMyNode'); - - heightBase.off('resize.' + self.namespace, heightBase.data('fitToBaseFunc')); - fit && heightBase.on('resize.' + self.namespace, heightBase.data('fitToBaseFunc')); } + + node.css({ width : w, height : parseInt(h) }); } - - node.css({ width : w, height : parseInt(h) }); + size.w = Math.round(node.width()); size.h = Math.round(node.height()); node.data('resizeSize', size); diff --git a/js/elFinder.options.js b/js/elFinder.options.js index a9c57bf5d0..8f99e02d1f 100644 --- a/js/elFinder.options.js +++ b/js/elFinder.options.js @@ -1111,6 +1111,15 @@ elFinder.prototype._options = { */ height : 400, + /** + * Do not resize the elFinder node itself on resize parent node + * Specify `true` when controlling with CSS such as Flexbox + * + * @type Boolean + * @default false + */ + noResizeBySelf : false, + /** * Base node object or selector * Element which is the reference of the height percentage