1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 15:09:14 +00:00

[lib/dirent] improved 'rename'

This commit is contained in:
llj
2016-08-12 19:10:49 +08:00
parent c4ffca620e
commit ab380bf361
3 changed files with 18 additions and 4 deletions

View File

@@ -253,7 +253,6 @@ define([
},
rename: function() {
var is_dir = this.model.get('is_dir');
var dirent_name = this.model.get('obj_name');
var form = $(this.renameTemplate({
@@ -269,7 +268,14 @@ define([
}).append(form);
$op.hide();
$name.hide();
$('[name="newname"]', form).focus();
var $input = $('[name="newname"]', form);
var dot_index = dirent_name.lastIndexOf('.');
if (!this.model.get('is_dir') && dot_index != -1) {
$input[0].setSelectionRange(0, dot_index);
} else {
$input.select();
}
this._hideMenu();
app.ui.freezeItemHightlight = true;