Skip to content

Commit

Permalink
[ui:dialog] fix #2124 missing dialog on fullscreen mode
Browse files Browse the repository at this point in the history
  • Loading branch information
nao-pon committed Aug 5, 2017
1 parent 098c062 commit b49d6a0
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions js/ui/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ $.fn.elfinderdialog = function(opts, fm) {
maximize: function() {
if (opts.allowMaximize) {
dialog.on('resize', function(e, data) {
var full, elm, pos;
var full, elm;
e.preventDefault();
e.stopPropagation();
if (data && data.maximize) {
Expand All @@ -187,11 +187,7 @@ $.fn.elfinderdialog = function(opts, fm) {
} else {
self.attr('style', elm.data('style'));
elm.removeData('style');
if (fm.getUI().hasClass('elfinder-fullscreen')) {
pos = dialog.position();
dialog.css('top', Math.max(pos.top, 0));
dialog.css('left', Math.max(pos.left, 0));
}
posCheck();
try {
dialog.hasClass('ui-draggable') && dialog.draggable('enable');
dialog.hasClass('ui-resizable') && dialog.resizable('enable');
Expand All @@ -218,7 +214,7 @@ $.fn.elfinderdialog = function(opts, fm) {
.prepend($('<span class="ui-widget-header ui-corner-all elfinder-titlebar-button elfinder-titlebar-minimize"><span class="ui-icon ui-icon-minusthick"/></span>')
.on('mousedown', function(e) {
var $this = $(this),
pos, w;
w;

e.preventDefault();
e.stopPropagation();
Expand All @@ -229,11 +225,7 @@ $.fn.elfinderdialog = function(opts, fm) {
.attr('style', $this.data('style'))
.removeClass('elfinder-dialog-minimized')
.off('mousedown.minimize');
if (fm.getUI().hasClass('elfinder-fullscreen')) {
pos = dialog.position();
dialog.css('top', Math.max(pos.top, 0));
dialog.css('left', Math.max(pos.left, 0));
}
posCheck();
$this.removeData('style').show();
titlebar.children('.elfinder-titlebar-full').show();
dialog.children('.ui-widget-content').slideDown('fast', function() {
Expand Down Expand Up @@ -475,6 +467,7 @@ $.fn.elfinderdialog = function(opts, fm) {
h = dialog.height() - oh - dialog.data('margin-y');
}
self.height(h);
posCheck();
setTimeout(function() { // Firefox need setTimeout to get new height value
minH = self.height();
minH = (h < minH)? (minH + oh + dialog.data('margin-y')) : opts.minHeight;
Expand Down Expand Up @@ -538,8 +531,16 @@ $.fn.elfinderdialog = function(opts, fm) {
}
}
})
.data({modal: opts.modal})
;
.data({modal: opts.modal}),
posCheck = function() {
var node = fm.getUI(),
pos;
if (node.hasClass('elfinder-fullscreen')) {
pos = dialog.position();
dialog.css('top', Math.max(Math.min(Math.max(pos.top, 0), node.height() - 100), 0));
dialog.css('left', Math.max(Math.min(Math.max(pos.left, 0), node.width() - 100), 0));
}
};

dialog.prepend(titlebar);

Expand Down

0 comments on commit b49d6a0

Please sign in to comment.