* @class elFinder command "undo"
elFinder.prototype.commands.undo = function() {
setTitle = function(undo) {
self.title = fm.i18n('cmdundo') + ' ' + fm.i18n('cmd'+undo.cmd);
self.title = fm.i18n('cmdundo');
this.alwaysEnabled = true;
this.updateOnSelect = false;
this.syncTitleOnChange = true;
this.getstate = function() {
return cmds.length? 0 : -1;
this.setUndo = function(undo, redo) {
if ($.isPlainObject(undo) && undo.cmd && undo.callback) {
Object.assign(_undo, undo);
fm.getCommand('redo').setRedo(null);
var redo = fm.getCommand('redo'),
Object.assign(_redo, undo.redo);
redo.setRedo(_redo, undo);
setTitle(cmds.length? cmds[cmds.length-1] : void(0));
this.update(0, cmds[cmds.length - 1].name);
fm.bind('exec', function(e) {
if (data.opts && data.opts._userAction) {
if (data.dfrd && data.dfrd.done) {
data.dfrd.done(function(res) {
if (res && res.undo && res.redo) {
res.undo.redo = res.redo;
* @class elFinder command "redo"
elFinder.prototype.commands.redo = function() {
setTitle = function(redo) {
if (redo && redo.callback) {
self.title = fm.i18n('cmdredo') + ' ' + fm.i18n('cmd'+redo.cmd);
self.title = fm.i18n('cmdredo');
this.alwaysEnabled = true;
this.updateOnSelect = false;
pattern : 'shift+ctrl+z ctrl+y'
this.syncTitleOnChange = true;
this.getstate = function() {
return cmds.length? 0 : -1;
this.setRedo = function(redo, undo) {
if (redo && redo.cmd && redo.callback) {
var undo = fm.getCommand('undo'),
redo, res, _undo = {}, _redo = {};
Object.assign(_undo, redo.undo);
Object.assign(_redo, redo);
undo.setUndo(_undo, _redo);
setTitle(cmds.length? cmds[cmds.length-1] : void(0));