Hack the drawer to close it when clicking outside

pull/1/head
yflory 8 years ago
parent 472a62730b
commit 335898a4c7

@ -21,6 +21,10 @@
margin-right: 0px; margin-right: 0px;
margin-left: 5px; margin-left: 5px;
} }
* {
.unselectable();
cursor: default;
}
} }
.dropdown-bar-content { .dropdown-bar-content {

@ -912,7 +912,7 @@ body .cryptpad-toolbar {
background: @dropdown-bg; background: @dropdown-bg;
display: flex; display: flex;
flex-flow: column; flex-flow: column;
z-index:1000; z-index:10000;
color: black; color: black;
.fa { .fa {
font-size: 17px; font-size: 17px;
@ -920,7 +920,7 @@ body .cryptpad-toolbar {
&> span { &> span {
box-sizing: border-box; box-sizing: border-box;
min-width: 150px; min-width: 150px;
height: 26px; height: 32px;
border-radius: 0; border-radius: 0;
border: 0; border: 0;
} }

@ -81,15 +81,31 @@ define([
var $rightside = $toolbar.find('.'+RIGHTSIDE_CLS); var $rightside = $toolbar.find('.'+RIGHTSIDE_CLS);
if (!config.hideDrawer) { if (!config.hideDrawer) {
var $drawerContent = $('<div>', {'class': DRAWER_CLS}).appendTo($rightside).hide(); var $drawerContent = $('<div>', {
'class': DRAWER_CLS,// + ' dropdown-bar-content cryptpad-dropdown'
'tabindex': 1
}).appendTo($rightside).hide();
var $drawer = Cryptpad.createButton('more', true).appendTo($rightside); var $drawer = Cryptpad.createButton('more', true).appendTo($rightside);
$drawer.click(function () { $drawer.click(function () {
$drawerContent.toggle(); $drawerContent.toggle();
$drawer.removeClass('active'); $drawer.removeClass('active');
if ($drawerContent.is(':visible')) { if ($drawerContent.is(':visible')) {
$drawer.addClass('active'); $drawer.addClass('active');
$drawerContent.focus();
} }
}); });
var onBlur = function (e) {
if (e.relatedTarget) {
if ($(e.relatedTarget).is('.drawer-button')) { return; }
if ($(e.relatedTarget).parents('.'+DRAWER_CLS).length) {
$(e.relatedTarget).blur(onBlur);
return;
}
}
$drawer.removeClass('active');
$drawerContent.hide();
};
$drawerContent.blur(onBlur);
} }
// The 'notitle' class removes the line added for the title with a small screen // The 'notitle' class removes the line added for the title with a small screen

Loading…
Cancel
Save