Merge pull request #3102 from Hypolite/feature/3101-modal-auto-focus

Feature 3101 modal auto focus
This commit is contained in:
Michael Vogel 2017-01-22 22:51:24 +01:00 committed by GitHub
commit 6ff0cfb315

View file

@ -29,7 +29,7 @@
$('#character-counter').text(textlen); $('#character-counter').text(textlen);
}); });
return; return;
} }
tinyMCE.init({ tinyMCE.init({
theme : "advanced", theme : "advanced",
mode : "specific_textareas", mode : "specific_textareas",
@ -82,7 +82,7 @@
} }
else { else {
$('#profile-jot-desc').html(' '); $('#profile-jot-desc').html(' ');
} }
//Character count //Character count
@ -120,7 +120,7 @@
$("a#jot-perms-icon").colorbox({ $("a#jot-perms-icon").colorbox({
'inline' : true, 'inline' : true,
'transition' : 'elastic' 'transition' : 'elastic'
}); });
} else { } else {
if (typeof cb!="undefined") cb(); if (typeof cb!="undefined") cb();
@ -397,13 +397,18 @@
var modal = $('#jot-modal').modal(); var modal = $('#jot-modal').modal();
jotcache = $("#jot-sections"); jotcache = $("#jot-sections");
// Auto focus on the first enabled field in the modal
modal.on('shown.bs.modal', function (e) {
$('#jot-modal-content').find('select:not([disabled]), input:not([type=hidden]):not([disabled]), textarea:not([disabled])').first().focus();
})
modal modal
.find('#jot-modal-content') .find('#jot-modal-content')
.append(jotcache) .append(jotcache)
.modal.show; .modal.show;
} }
// the following functions show/hide the specific jot content // the following functions show/hide the specific jot content
// in dependence of the selected nav // in dependence of the selected nav
function aclActive() { function aclActive() {
$(".modal-body #profile-jot-wrapper, .modal-body #jot-preview-content, .modal-body #jot-fbrowser-wrapper").hide(); $(".modal-body #profile-jot-wrapper, .modal-body #jot-preview-content, .modal-body #jot-fbrowser-wrapper").hide();