Edit File by line
/home/barbar84/www/wp-conte.../plugins/file-man.../applicat.../library/js/commands
File: rename.js
/**
[0] Fix | Delete
* @class elFinder command "rename".
[1] Fix | Delete
* Rename selected file.
[2] Fix | Delete
*
[3] Fix | Delete
* @author Dmitry (dio) Levashov, dio@std42.ru
[4] Fix | Delete
* @author Naoki Sawada
[5] Fix | Delete
**/
[6] Fix | Delete
elFinder.prototype.commands.rename = function() {
[7] Fix | Delete
"use strict";
[8] Fix | Delete
[9] Fix | Delete
// set alwaysEnabled to allow root rename on client size
[10] Fix | Delete
this.alwaysEnabled = true;
[11] Fix | Delete
[12] Fix | Delete
this.syncTitleOnChange = true;
[13] Fix | Delete
[14] Fix | Delete
var self = this,
[15] Fix | Delete
fm = self.fm,
[16] Fix | Delete
request = function(dfrd, targtes, file, name) {
[17] Fix | Delete
var sel = targtes? [file.hash].concat(targtes) : [file.hash],
[18] Fix | Delete
cnt = sel.length,
[19] Fix | Delete
data = {}, rootNames;
[20] Fix | Delete
[21] Fix | Delete
fm.lockfiles({files : sel});
[22] Fix | Delete
[23] Fix | Delete
if (fm.isRoot(file) && !file.netkey) {
[24] Fix | Delete
if (!(rootNames = fm.storage('rootNames'))) {
[25] Fix | Delete
rootNames = {};
[26] Fix | Delete
}
[27] Fix | Delete
if (name === '') {
[28] Fix | Delete
if (rootNames[file.hash]) {
[29] Fix | Delete
file.name = file._name;
[30] Fix | Delete
file.i18 = file._i18;
[31] Fix | Delete
delete rootNames[file.hash];
[32] Fix | Delete
delete file._name;
[33] Fix | Delete
delete file._i18;
[34] Fix | Delete
} else {
[35] Fix | Delete
dfrd && dfrd.reject();
[36] Fix | Delete
fm.unlockfiles({files : sel}).trigger('selectfiles', {files : sel});
[37] Fix | Delete
return;
[38] Fix | Delete
}
[39] Fix | Delete
} else {
[40] Fix | Delete
if (typeof file._name === 'undefined') {
[41] Fix | Delete
file._name = file.name;
[42] Fix | Delete
file._i18 = file.i18;
[43] Fix | Delete
}
[44] Fix | Delete
file.name = rootNames[file.hash] = name;
[45] Fix | Delete
delete file.i18;
[46] Fix | Delete
}
[47] Fix | Delete
fm.storage('rootNames', rootNames);
[48] Fix | Delete
data = { changed: [file] };
[49] Fix | Delete
fm.updateCache(data);
[50] Fix | Delete
fm.change(data);
[51] Fix | Delete
dfrd && dfrd.resolve(data);
[52] Fix | Delete
fm.unlockfiles({files : sel}).trigger('selectfiles', {files : sel});
[53] Fix | Delete
return;
[54] Fix | Delete
}
[55] Fix | Delete
[56] Fix | Delete
data = {
[57] Fix | Delete
cmd : 'rename',
[58] Fix | Delete
name : name,
[59] Fix | Delete
target : file.hash
[60] Fix | Delete
};
[61] Fix | Delete
[62] Fix | Delete
if (cnt > 1) {
[63] Fix | Delete
data['targets'] = targtes;
[64] Fix | Delete
if (name.match(/\*/)) {
[65] Fix | Delete
data['q'] = name;
[66] Fix | Delete
}
[67] Fix | Delete
}
[68] Fix | Delete
[69] Fix | Delete
fm.request({
[70] Fix | Delete
data : data,
[71] Fix | Delete
notify : {type : 'rename', cnt : cnt},
[72] Fix | Delete
navigate : {}
[73] Fix | Delete
})
[74] Fix | Delete
.fail(function(error) {
[75] Fix | Delete
var err = fm.parseError(error);
[76] Fix | Delete
dfrd && dfrd.reject();
[77] Fix | Delete
if (! err || ! Array.isArray(err) || err[0] !== 'errRename') {
[78] Fix | Delete
fm.sync();
[79] Fix | Delete
}
[80] Fix | Delete
})
[81] Fix | Delete
.done(function(data) {
[82] Fix | Delete
var cwdHash;
[83] Fix | Delete
if (data.added && data.added.length && cnt === 1) {
[84] Fix | Delete
data.undo = {
[85] Fix | Delete
cmd : 'rename',
[86] Fix | Delete
callback : function() {
[87] Fix | Delete
return fm.request({
[88] Fix | Delete
data : {cmd : 'rename', target : data.added[0].hash, name : file.name},
[89] Fix | Delete
notify : {type : 'undo', cnt : 1}
[90] Fix | Delete
});
[91] Fix | Delete
}
[92] Fix | Delete
};
[93] Fix | Delete
data.redo = {
[94] Fix | Delete
cmd : 'rename',
[95] Fix | Delete
callback : function() {
[96] Fix | Delete
return fm.request({
[97] Fix | Delete
data : {cmd : 'rename', target : file.hash, name : name},
[98] Fix | Delete
notify : {type : 'rename', cnt : 1}
[99] Fix | Delete
});
[100] Fix | Delete
}
[101] Fix | Delete
};
[102] Fix | Delete
}
[103] Fix | Delete
dfrd && dfrd.resolve(data);
[104] Fix | Delete
if (!(cwdHash = fm.cwd().hash) || cwdHash === file.hash) {
[105] Fix | Delete
fm.exec('open', $.map(data.added, function(f) {
[106] Fix | Delete
return (f.mime === 'directory')? f.hash : null;
[107] Fix | Delete
})[0]);
[108] Fix | Delete
}
[109] Fix | Delete
})
[110] Fix | Delete
.always(function() {
[111] Fix | Delete
fm.unlockfiles({files : sel}).trigger('selectfiles', {files : sel});
[112] Fix | Delete
}
[113] Fix | Delete
);
[114] Fix | Delete
},
[115] Fix | Delete
getHint = function(name, target) {
[116] Fix | Delete
var sel = target || fm.selected(),
[117] Fix | Delete
splits = fm.splitFileExtention(name),
[118] Fix | Delete
f1 = fm.file(sel[0]),
[119] Fix | Delete
f2 = fm.file(sel[1]),
[120] Fix | Delete
ext, hint, add;
[121] Fix | Delete
[122] Fix | Delete
ext = splits[1]? ('.' + splits[1]) : '';
[123] Fix | Delete
if (splits[1] && splits[0] === '*') {
[124] Fix | Delete
// change extention
[125] Fix | Delete
hint = '"' + fm.splitFileExtention(f1.name)[0] + ext + '", ';
[126] Fix | Delete
hint += '"' + fm.splitFileExtention(f2.name)[0] + ext + '"';
[127] Fix | Delete
} else if (splits[0].length > 1) {
[128] Fix | Delete
if (splits[0].substr(-1) === '*') {
[129] Fix | Delete
// add prefix
[130] Fix | Delete
add = splits[0].substr(0, splits[0].length - 1);
[131] Fix | Delete
hint = '"' + add + f1.name+'", ';
[132] Fix | Delete
hint += '"' + add + f2.name+'"';
[133] Fix | Delete
} else if (splits[0].substr(0, 1) === '*') {
[134] Fix | Delete
// add suffix
[135] Fix | Delete
add = splits[0].substr(1);
[136] Fix | Delete
hint = '"'+fm.splitFileExtention(f1.name)[0] + add + ext + '", ';
[137] Fix | Delete
hint += '"'+fm.splitFileExtention(f2.name)[0] + add + ext + '"';
[138] Fix | Delete
}
[139] Fix | Delete
}
[140] Fix | Delete
if (!hint) {
[141] Fix | Delete
hint = '"'+splits[0] + '1' + ext + '", "' + splits[0] + '2' + ext + '"';
[142] Fix | Delete
}
[143] Fix | Delete
if (sel.length > 2) {
[144] Fix | Delete
hint += ' ...';
[145] Fix | Delete
}
[146] Fix | Delete
return hint;
[147] Fix | Delete
},
[148] Fix | Delete
batchRename = function() {
[149] Fix | Delete
var sel = fm.selected(),
[150] Fix | Delete
tplr = '<input name="type" type="radio" class="elfinder-tabstop">',
[151] Fix | Delete
mkChk = function(node, label) {
[152] Fix | Delete
return $('<label class="elfinder-rename-batch-checks">' + fm.i18n(label) + '</label>').prepend(node);
[153] Fix | Delete
},
[154] Fix | Delete
name = $('<input type="text" class="ui-corner-all elfinder-tabstop">'),
[155] Fix | Delete
num = $(tplr),
[156] Fix | Delete
prefix = $(tplr),
[157] Fix | Delete
suffix = $(tplr),
[158] Fix | Delete
extention = $(tplr),
[159] Fix | Delete
checks = $('<div></div>').append(
[160] Fix | Delete
mkChk(num, 'plusNumber'),
[161] Fix | Delete
mkChk(prefix, 'asPrefix'),
[162] Fix | Delete
mkChk(suffix, 'asSuffix'),
[163] Fix | Delete
mkChk(extention, 'changeExtention')
[164] Fix | Delete
),
[165] Fix | Delete
preview = $('<div class="elfinder-rename-batch-preview"></div>'),
[166] Fix | Delete
node = $('<div class="elfinder-rename-batch"></div>').append(
[167] Fix | Delete
$('<div class="elfinder-rename-batch-name"></div>').append(name),
[168] Fix | Delete
$('<div class="elfinder-rename-batch-type"></div>').append(checks),
[169] Fix | Delete
preview
[170] Fix | Delete
),
[171] Fix | Delete
opts = {
[172] Fix | Delete
title : fm.i18n('batchRename'),
[173] Fix | Delete
modal : true,
[174] Fix | Delete
destroyOnClose : true,
[175] Fix | Delete
width: Math.min(380, fm.getUI().width() - 20),
[176] Fix | Delete
buttons : {},
[177] Fix | Delete
open : function() {
[178] Fix | Delete
name.on('input', mkPrev).trigger('focus');
[179] Fix | Delete
}
[180] Fix | Delete
},
[181] Fix | Delete
getName = function() {
[182] Fix | Delete
var vName = name.val(),
[183] Fix | Delete
ext = fm.splitFileExtention(fm.file(sel[0]).name)[1];
[184] Fix | Delete
if (vName !== '' || num.is(':checked')) {
[185] Fix | Delete
if (prefix.is(':checked')) {
[186] Fix | Delete
vName += '*';
[187] Fix | Delete
} else if (suffix.is(':checked')) {
[188] Fix | Delete
vName = '*' + vName + '.' + ext;
[189] Fix | Delete
} else if (extention.is(':checked')) {
[190] Fix | Delete
vName = '*.' + vName;
[191] Fix | Delete
} else if (ext) {
[192] Fix | Delete
vName += '.' + ext;
[193] Fix | Delete
}
[194] Fix | Delete
}
[195] Fix | Delete
return vName;
[196] Fix | Delete
},
[197] Fix | Delete
mkPrev = function() {
[198] Fix | Delete
var vName = getName();
[199] Fix | Delete
if (vName !== '') {
[200] Fix | Delete
preview.html(fm.i18n(['renameMultiple', sel.length, getHint(vName)]));
[201] Fix | Delete
} else {
[202] Fix | Delete
preview.empty();
[203] Fix | Delete
}
[204] Fix | Delete
},
[205] Fix | Delete
radios = checks.find('input:radio').on('change', mkPrev),
[206] Fix | Delete
dialog;
[207] Fix | Delete
[208] Fix | Delete
opts.buttons[fm.i18n('btnApply')] = function() {
[209] Fix | Delete
var vName = getName(),
[210] Fix | Delete
file, targets;
[211] Fix | Delete
if (vName !== '') {
[212] Fix | Delete
dialog.elfinderdialog('close');
[213] Fix | Delete
targets = sel;
[214] Fix | Delete
file = fm.file(targets.shift());
[215] Fix | Delete
request(void(0), targets, file, vName);
[216] Fix | Delete
}
[217] Fix | Delete
};
[218] Fix | Delete
opts.buttons[fm.i18n('btnCancel')] = function() {
[219] Fix | Delete
dialog.elfinderdialog('close');
[220] Fix | Delete
};
[221] Fix | Delete
if ($.fn.checkboxradio) {
[222] Fix | Delete
radios.checkboxradio({
[223] Fix | Delete
create: function(e, ui) {
[224] Fix | Delete
if (this === num.get(0)) {
[225] Fix | Delete
num.prop('checked', true).change();
[226] Fix | Delete
}
[227] Fix | Delete
}
[228] Fix | Delete
});
[229] Fix | Delete
} else {
[230] Fix | Delete
checks.buttonset({
[231] Fix | Delete
create: function(e, ui) {
[232] Fix | Delete
num.prop('checked', true).change();
[233] Fix | Delete
}
[234] Fix | Delete
});
[235] Fix | Delete
}
[236] Fix | Delete
dialog = self.fmDialog(node, opts);
[237] Fix | Delete
};
[238] Fix | Delete
[239] Fix | Delete
this.noChangeDirOnRemovedCwd = true;
[240] Fix | Delete
[241] Fix | Delete
this.shortcuts = [{
[242] Fix | Delete
pattern : 'f2' + (fm.OS == 'mac' ? ' enter' : '')
[243] Fix | Delete
}, {
[244] Fix | Delete
pattern : 'shift+f2',
[245] Fix | Delete
description : 'batchRename',
[246] Fix | Delete
callback : function() {
[247] Fix | Delete
fm.selected().length > 1 && batchRename();
[248] Fix | Delete
}
[249] Fix | Delete
}];
[250] Fix | Delete
[251] Fix | Delete
this.getstate = function(select) {
[252] Fix | Delete
var sel = this.files(select),
[253] Fix | Delete
cnt = sel.length,
[254] Fix | Delete
phash, ext, mime, brk, state, isRoot;
[255] Fix | Delete
[256] Fix | Delete
if (!cnt) {
[257] Fix | Delete
return -1;
[258] Fix | Delete
}
[259] Fix | Delete
[260] Fix | Delete
if (cnt > 1 && sel[0].phash) {
[261] Fix | Delete
phash = sel[0].phash;
[262] Fix | Delete
ext = fm.splitFileExtention(sel[0].name)[1].toLowerCase();
[263] Fix | Delete
mime = sel[0].mime;
[264] Fix | Delete
}
[265] Fix | Delete
if (cnt === 1) {
[266] Fix | Delete
isRoot = fm.isRoot(sel[0]);
[267] Fix | Delete
}
[268] Fix | Delete
[269] Fix | Delete
state = (cnt === 1 && ((fm.cookieEnabled && isRoot) || !sel[0].locked) || (fm.api > 2.1030 && cnt === $.grep(sel, function(f) {
[270] Fix | Delete
if (!brk && !f.locked && f.phash === phash && !fm.isRoot(f) && (mime === f.mime || ext === fm.splitFileExtention(f.name)[1].toLowerCase())) {
[271] Fix | Delete
return true;
[272] Fix | Delete
} else {
[273] Fix | Delete
brk && (brk = true);
[274] Fix | Delete
return false;
[275] Fix | Delete
}
[276] Fix | Delete
}).length)) ? 0 : -1;
[277] Fix | Delete
[278] Fix | Delete
// because alwaysEnabled = true, it need check disabled on connector
[279] Fix | Delete
if (!isRoot && state === 0 && fm.option('disabledFlip', sel[0].hash)['rename']) {
[280] Fix | Delete
state = -1;
[281] Fix | Delete
}
[282] Fix | Delete
[283] Fix | Delete
if (state !== -1 && cnt > 1) {
[284] Fix | Delete
self.extra = {
[285] Fix | Delete
icon: 'preference',
[286] Fix | Delete
node: $('<span></span>')
[287] Fix | Delete
.attr({title: fm.i18n('batchRename')})
[288] Fix | Delete
.on('click touchstart', function(e){
[289] Fix | Delete
if (e.type === 'touchstart' && e.originalEvent.touches.length > 1) {
[290] Fix | Delete
return;
[291] Fix | Delete
}
[292] Fix | Delete
e.stopPropagation();
[293] Fix | Delete
e.preventDefault();
[294] Fix | Delete
fm.getUI().trigger('click'); // to close the context menu immediately
[295] Fix | Delete
batchRename();
[296] Fix | Delete
})
[297] Fix | Delete
};
[298] Fix | Delete
} else {
[299] Fix | Delete
delete self.extra;
[300] Fix | Delete
}
[301] Fix | Delete
[302] Fix | Delete
return state;
[303] Fix | Delete
};
[304] Fix | Delete
[305] Fix | Delete
this.exec = function(hashes, cOpts) {
[306] Fix | Delete
var cwd = fm.getUI('cwd'),
[307] Fix | Delete
sel = hashes || (fm.selected().length? fm.selected() : false) || [fm.cwd().hash],
[308] Fix | Delete
cnt = sel.length,
[309] Fix | Delete
file = fm.file(sel.shift()),
[310] Fix | Delete
filename = '.elfinder-cwd-filename',
[311] Fix | Delete
opts = cOpts || {},
[312] Fix | Delete
incwd = (fm.cwd().hash == file.hash),
[313] Fix | Delete
type = (opts._currentType === 'navbar' || opts._currentType === 'files')? opts._currentType : (incwd? 'navbar' : 'files'),
[314] Fix | Delete
navbar = (type !== 'files'),
[315] Fix | Delete
target = fm[navbar? 'navHash2Elm' : 'cwdHash2Elm'](file.hash),
[316] Fix | Delete
tarea = (!navbar && fm.storage('view') != 'list'),
[317] Fix | Delete
split = function(name) {
[318] Fix | Delete
var ext = fm.splitFileExtention(name)[1];
[319] Fix | Delete
return [name.substr(0, name.length - ext.length - 1), ext];
[320] Fix | Delete
},
[321] Fix | Delete
unselect = function() {
[322] Fix | Delete
requestAnimationFrame(function() {
[323] Fix | Delete
input && input.trigger('blur');
[324] Fix | Delete
});
[325] Fix | Delete
},
[326] Fix | Delete
rest = function(){
[327] Fix | Delete
if (!overlay.is(':hidden')) {
[328] Fix | Delete
overlay.elfinderoverlay('hide').off('click close', cancel);
[329] Fix | Delete
}
[330] Fix | Delete
pnode.removeClass('ui-front')
[331] Fix | Delete
.css('position', '')
[332] Fix | Delete
.off('unselect.'+fm.namespace, unselect);
[333] Fix | Delete
if (tarea) {
[334] Fix | Delete
node && node.css('max-height', '');
[335] Fix | Delete
} else if (!navbar) {
[336] Fix | Delete
pnode.css('width', '')
[337] Fix | Delete
.parent('td').css('overflow', '');
[338] Fix | Delete
}
[339] Fix | Delete
}, colwidth,
[340] Fix | Delete
dfrd = $.Deferred()
[341] Fix | Delete
.fail(function(error) {
[342] Fix | Delete
var parent = input.parent(),
[343] Fix | Delete
name = fm.escape(file.i18 || file.name);
[344] Fix | Delete
[345] Fix | Delete
input.off();
[346] Fix | Delete
if (tarea) {
[347] Fix | Delete
name = name.replace(/([_.])/g, '&#8203;$1');
[348] Fix | Delete
}
[349] Fix | Delete
requestAnimationFrame(function() {
[350] Fix | Delete
if (navbar) {
[351] Fix | Delete
input.replaceWith(name);
[352] Fix | Delete
} else {
[353] Fix | Delete
if (parent.length) {
[354] Fix | Delete
input.remove();
[355] Fix | Delete
parent.html(name);
[356] Fix | Delete
} else {
[357] Fix | Delete
target.find(filename).html(name);
[358] Fix | Delete
}
[359] Fix | Delete
}
[360] Fix | Delete
});
[361] Fix | Delete
error && fm.error(error);
[362] Fix | Delete
})
[363] Fix | Delete
.always(function() {
[364] Fix | Delete
rest();
[365] Fix | Delete
fm.unbind('resize', resize);
[366] Fix | Delete
fm.enable();
[367] Fix | Delete
}),
[368] Fix | Delete
blur = function(e) {
[369] Fix | Delete
var name = $.trim(input.val()),
[370] Fix | Delete
splits = fm.splitFileExtention(name),
[371] Fix | Delete
valid = true,
[372] Fix | Delete
req = function() {
[373] Fix | Delete
input.off();
[374] Fix | Delete
rest();
[375] Fix | Delete
if (navbar) {
[376] Fix | Delete
input.replaceWith(fm.escape(name));
[377] Fix | Delete
} else {
[378] Fix | Delete
node.html(fm.escape(name));
[379] Fix | Delete
}
[380] Fix | Delete
request(dfrd, sel, file, name);
[381] Fix | Delete
};
[382] Fix | Delete
[383] Fix | Delete
if (!overlay.is(':hidden')) {
[384] Fix | Delete
pnode.css('z-index', '');
[385] Fix | Delete
}
[386] Fix | Delete
if (name === '') {
[387] Fix | Delete
if (!fm.isRoot(file)) {
[388] Fix | Delete
return cancel();
[389] Fix | Delete
}
[390] Fix | Delete
if (navbar) {
[391] Fix | Delete
input.replaceWith(fm.escape(file.name));
[392] Fix | Delete
} else {
[393] Fix | Delete
node.html(fm.escape(file.name));
[394] Fix | Delete
}
[395] Fix | Delete
}
[396] Fix | Delete
if (!inError && pnode.length) {
[397] Fix | Delete
[398] Fix | Delete
input.off('blur');
[399] Fix | Delete
[400] Fix | Delete
if (cnt === 1 && name === file.name) {
[401] Fix | Delete
return dfrd.reject();
[402] Fix | Delete
}
[403] Fix | Delete
if (fm.options.validName && fm.options.validName.test) {
[404] Fix | Delete
try {
[405] Fix | Delete
valid = fm.options.validName.test(name);
[406] Fix | Delete
} catch(e) {
[407] Fix | Delete
valid = false;
[408] Fix | Delete
}
[409] Fix | Delete
}
[410] Fix | Delete
if (name === '.' || name === '..' || !valid) {
[411] Fix | Delete
inError = true;
[412] Fix | Delete
fm.error(file.mime === 'directory'? 'errInvDirname' : 'errInvName', {modal: true, close: function(){setTimeout(select, 120);}});
[413] Fix | Delete
return false;
[414] Fix | Delete
}
[415] Fix | Delete
if (cnt === 1 && fm.fileByName(name, file.phash)) {
[416] Fix | Delete
inError = true;
[417] Fix | Delete
fm.error(['errExists', name], {modal: true, close: function(){setTimeout(select, 120);}});
[418] Fix | Delete
return false;
[419] Fix | Delete
}
[420] Fix | Delete
[421] Fix | Delete
if (cnt === 1) {
[422] Fix | Delete
req();
[423] Fix | Delete
} else {
[424] Fix | Delete
fm.confirm({
[425] Fix | Delete
title : 'cmdrename',
[426] Fix | Delete
text : ['renameMultiple', cnt, getHint(name, [file.hash].concat(sel))],
[427] Fix | Delete
accept : {
[428] Fix | Delete
label : 'btnYes',
[429] Fix | Delete
callback : req
[430] Fix | Delete
},
[431] Fix | Delete
cancel : {
[432] Fix | Delete
label : 'btnCancel',
[433] Fix | Delete
callback : function() {
[434] Fix | Delete
setTimeout(function() {
[435] Fix | Delete
inError = true;
[436] Fix | Delete
select();
[437] Fix | Delete
}, 120);
[438] Fix | Delete
}
[439] Fix | Delete
}
[440] Fix | Delete
});
[441] Fix | Delete
setTimeout(function() {
[442] Fix | Delete
fm.trigger('unselectfiles', {files: fm.selected()})
[443] Fix | Delete
.trigger('selectfiles', {files : [file.hash].concat(sel)});
[444] Fix | Delete
}, 120);
[445] Fix | Delete
}
[446] Fix | Delete
}
[447] Fix | Delete
},
[448] Fix | Delete
input = $(tarea? '<textarea></textarea>' : '<input type="text"/>')
[449] Fix | Delete
.on('keyup text', function(){
[450] Fix | Delete
if (tarea) {
[451] Fix | Delete
this.style.height = '1px';
[452] Fix | Delete
this.style.height = this.scrollHeight + 'px';
[453] Fix | Delete
} else if (colwidth) {
[454] Fix | Delete
this.style.width = colwidth + 'px';
[455] Fix | Delete
if (this.scrollWidth > colwidth) {
[456] Fix | Delete
this.style.width = this.scrollWidth + 10 + 'px';
[457] Fix | Delete
}
[458] Fix | Delete
}
[459] Fix | Delete
})
[460] Fix | Delete
.on('keydown', function(e) {
[461] Fix | Delete
e.stopImmediatePropagation();
[462] Fix | Delete
if (e.keyCode == $.ui.keyCode.ESCAPE) {
[463] Fix | Delete
dfrd.reject();
[464] Fix | Delete
} else if (e.keyCode == $.ui.keyCode.ENTER) {
[465] Fix | Delete
e.preventDefault();
[466] Fix | Delete
input.trigger('blur');
[467] Fix | Delete
}
[468] Fix | Delete
})
[469] Fix | Delete
.on('mousedown click dblclick', function(e) {
[470] Fix | Delete
e.stopPropagation();
[471] Fix | Delete
if (e.type === 'dblclick') {
[472] Fix | Delete
e.preventDefault();
[473] Fix | Delete
}
[474] Fix | Delete
})
[475] Fix | Delete
.on('blur', blur)
[476] Fix | Delete
.on('dragenter dragleave dragover drop', function(e) {
[477] Fix | Delete
// stop bubbling to prevent upload with native drop event
[478] Fix | Delete
e.stopPropagation();
[479] Fix | Delete
}),
[480] Fix | Delete
select = function() {
[481] Fix | Delete
var name = fm.splitFileExtention(input.val())[0];
[482] Fix | Delete
if (!inError && fm.UA.Mobile && !fm.UA.iOS) { // since iOS has a bug? (z-index not effect) so disable it
[483] Fix | Delete
overlay.on('click close', cancel).elfinderoverlay('show');
[484] Fix | Delete
pnode.css('z-index', overlay.css('z-index') + 1);
[485] Fix | Delete
}
[486] Fix | Delete
! fm.enabled() && fm.enable();
[487] Fix | Delete
if (inError) {
[488] Fix | Delete
inError = false;
[489] Fix | Delete
input.on('blur', blur);
[490] Fix | Delete
}
[491] Fix | Delete
input.trigger('focus').trigger('select');
[492] Fix | Delete
input[0].setSelectionRange && input[0].setSelectionRange(0, name.length);
[493] Fix | Delete
},
[494] Fix | Delete
node = navbar? target.contents().filter(function(){ return this.nodeType==3 && $(this).parent().attr('id') === fm.navHash2Id(file.hash); })
[495] Fix | Delete
: target.find(filename),
[496] Fix | Delete
pnode = node.parent(),
[497] Fix | Delete
overlay = fm.getUI('overlay'),
[498] Fix | Delete
cancel = function(e) {
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function