Fix file rename focus and initial selection

This commit is contained in:
Johannes Zellner
2020-07-13 17:05:01 +02:00
parent da54699815
commit 3bcef3d9c3
2 changed files with 11 additions and 2 deletions

View File

@@ -416,9 +416,18 @@ app.controller('FileManagerController', ['$scope', 'Client', function ($scope, C
init();
// setup all the dialog focus handling
['newDirectoryModal'].forEach(function (id) {
['newDirectoryModal', 'renameEntryModal'].forEach(function (id) {
$('#' + id).on('shown.bs.modal', function () {
$(this).find("[autofocus]:first").focus();
});
});
// selects filename (without extension)
['renameEntryModal'].forEach(function (id) {
$('#' + id).on('shown.bs.modal', function () {
var elem = $(this).find("[autofocus]:first");
var text = elem.val();
elem[0].setSelectionRange(0, text.indexOf('.'));
});
});
}]);