Skip to content

Commit

Permalink
[cmd:edit] correction of the option dialogWidth (percentage)
Browse files Browse the repository at this point in the history
  • Loading branch information
nao-pon committed Feb 26, 2018
1 parent 54d7ee6 commit fb2995a
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions js/commands/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,16 @@ elFinder.prototype.commands.edit = function() {
});
return sel;
},

getDlgWidth = function() {
var m, width;
if (typeof self.options.dialogWidth === 'string' && (m = self.options.dialogWidth.match(/(\d+)%/))) {
width = parseInt(fm.getUI().width() * (m[1] / 100));
} else {
width = parseInt(self.options.dialogWidth || 650);
}
return Math.min(width, $(window).width());
},

/**
* Return files acceptable to edit
*
Expand Down Expand Up @@ -159,7 +168,7 @@ elFinder.prototype.commands.edit = function() {
},
opts = {
title : fm.escape(file.name),
width : Math.min((self.options.dialogWidth || 650), $(window).width()),
width : getDlgWidth(),
buttons : {},
maxWidth : 'window',
maxHeight : 'window',
Expand Down Expand Up @@ -311,7 +320,7 @@ elFinder.prototype.commands.edit = function() {
}

})
.on('mouseenter', function(){this.trigger('focus');});
.on('mouseenter', function(){this.focus();});
}

ta.initEditArea = function(id, file, content) {
Expand Down

0 comments on commit fb2995a

Please sign in to comment.