mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 06:53:25 +00:00
Remove lightbox.is_open property.
Outside of lightbox.js, we now use modals.lightbox_open() to detect that the lightbox modal is open.
This commit is contained in:
@@ -307,6 +307,7 @@ function stubbing(func_name_to_stub, test_function) {
|
|||||||
global.drafts.drafts_overlay_open = return_false;
|
global.drafts.drafts_overlay_open = return_false;
|
||||||
modals.settings_open = return_false;
|
modals.settings_open = return_false;
|
||||||
hotkey.is_subs = return_false;
|
hotkey.is_subs = return_false;
|
||||||
|
modals.lightbox_open = return_false;
|
||||||
|
|
||||||
assert_unmapped('down_arrow');
|
assert_unmapped('down_arrow');
|
||||||
assert_unmapped('end');
|
assert_unmapped('end');
|
||||||
@@ -341,10 +342,10 @@ function stubbing(func_name_to_stub, test_function) {
|
|||||||
assert_mapping('down_arrow', 'subs.switch_rows');
|
assert_mapping('down_arrow', 'subs.switch_rows');
|
||||||
hotkey.is_subs = return_false;
|
hotkey.is_subs = return_false;
|
||||||
|
|
||||||
hotkey.is_lightbox_open = return_true;
|
modals.lightbox_open = return_true;
|
||||||
assert_mapping('left_arrow', 'lightbox.prev');
|
assert_mapping('left_arrow', 'lightbox.prev');
|
||||||
assert_mapping('right_arrow', 'lightbox.next');
|
assert_mapping('right_arrow', 'lightbox.next');
|
||||||
hotkey.is_lightbox_open = return_false;
|
modals.lightbox_open = return_false;
|
||||||
|
|
||||||
hotkey.is_editing_stream_name = return_true;
|
hotkey.is_editing_stream_name = return_true;
|
||||||
assert_unmapped('down_arrow');
|
assert_unmapped('down_arrow');
|
||||||
|
|||||||
@@ -25,10 +25,6 @@ function open_reactions() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.is_lightbox_open = function () {
|
|
||||||
return lightbox.is_open;
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.is_subs = function () {
|
exports.is_subs = function () {
|
||||||
return subs.is_open;
|
return subs.is_open;
|
||||||
};
|
};
|
||||||
@@ -497,7 +493,7 @@ exports.process_hotkey = function (e, hotkey) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (event_name === 'left_arrow') {
|
if (event_name === 'left_arrow') {
|
||||||
if (exports.is_lightbox_open()) {
|
if (modals.lightbox_open()) {
|
||||||
lightbox.prev();
|
lightbox.prev();
|
||||||
return true;
|
return true;
|
||||||
} else if (exports.is_subs()) {
|
} else if (exports.is_subs()) {
|
||||||
@@ -510,7 +506,7 @@ exports.process_hotkey = function (e, hotkey) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (event_name === 'right_arrow') {
|
if (event_name === 'right_arrow') {
|
||||||
if (exports.is_lightbox_open()) {
|
if (modals.lightbox_open()) {
|
||||||
lightbox.next();
|
lightbox.next();
|
||||||
return true;
|
return true;
|
||||||
} else if (exports.is_subs()) {
|
} else if (exports.is_subs()) {
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ exports.open = function (image) {
|
|||||||
|
|
||||||
function lightbox_close_modal() {
|
function lightbox_close_modal() {
|
||||||
$(".player-container iframe").remove();
|
$(".player-container iframe").remove();
|
||||||
lightbox.is_open = false;
|
is_open = false;
|
||||||
document.activeElement.blur();
|
document.activeElement.blur();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ exports.open = function (image) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
popovers.hide_all();
|
popovers.hide_all();
|
||||||
lightbox.is_open = true;
|
is_open = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.show_from_selected_message = function () {
|
exports.show_from_selected_message = function () {
|
||||||
@@ -136,17 +136,6 @@ exports.next = function () {
|
|||||||
$(".image-list .image.selected").next().click();
|
$(".image-list .image.selected").next().click();
|
||||||
};
|
};
|
||||||
|
|
||||||
Object.defineProperty(exports, "is_open", {
|
|
||||||
get: function () {
|
|
||||||
return is_open;
|
|
||||||
},
|
|
||||||
set: function (value) {
|
|
||||||
if (typeof value === "boolean") {
|
|
||||||
is_open = value;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
// this is a block of events that are required for the lightbox to work.
|
// this is a block of events that are required for the lightbox to work.
|
||||||
$(function () {
|
$(function () {
|
||||||
$("#main_div").on("click", ".message_inline_image a", function (e) {
|
$("#main_div").on("click", ".message_inline_image a", function (e) {
|
||||||
|
|||||||
@@ -24,6 +24,10 @@ exports.settings_open = function () {
|
|||||||
return open_modal_name === 'settings';
|
return open_modal_name === 'settings';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.lightbox_open = function () {
|
||||||
|
return open_modal_name === 'lightbox';
|
||||||
|
};
|
||||||
|
|
||||||
exports.open_overlay = function (opts) {
|
exports.open_overlay = function (opts) {
|
||||||
if (!opts.name || !opts.overlay || !opts.on_close) {
|
if (!opts.name || !opts.overlay || !opts.on_close) {
|
||||||
blueslip.error('Programming error in open_modal');
|
blueslip.error('Programming error in open_modal');
|
||||||
|
|||||||
Reference in New Issue
Block a user