Disarm click-to-close whilst opening an edit tray

This commit is contained in:
Nick O'Leary 2016-06-04 00:42:08 +01:00
parent 7402c27b6a
commit 7d9b90a1f3
1 changed files with 11 additions and 4 deletions

View File

@ -17,6 +17,7 @@ RED.tray = (function() {
var stack = [];
var editorStack = $("#editor-stack");
var openingTray = false;
function resize() {
@ -138,7 +139,7 @@ RED.tray = (function() {
});
$("#workspace").scrollLeft(0);
handleWindowResize();
openingTray = true;
setTimeout(function() {
setTimeout(function() {
if (!options.width) {
@ -150,6 +151,10 @@ RED.tray = (function() {
if (options.show) {
options.show();
}
setTimeout(function() {
// Delay resetting the flag, so we don't close prematurely
openingTray = false;
},200);
},150);
el.css({right:0});
},0);
@ -203,9 +208,11 @@ RED.tray = (function() {
$(window).resize(handleWindowResize);
RED.events.on("sidebar:resize",handleWindowResize);
$("#editor-shade").click(function() {
var tray = stack[stack.length-1];
if (tray && tray.primaryButton) {
tray.primaryButton.click();
if (!openingTray) {
var tray = stack[stack.length-1];
if (tray && tray.primaryButton) {
tray.primaryButton.click();
}
}
});
},