mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Allow RED.popover.panel to specify a closeButton to ignore click events on
This commit is contained in:
parent
2c710736e8
commit
1a27e60e55
@ -363,7 +363,6 @@ RED.popover = (function() {
|
|||||||
panel.css({ display: "none" });
|
panel.css({ display: "none" });
|
||||||
panel.appendTo(document.body);
|
panel.appendTo(document.body);
|
||||||
content.appendTo(panel);
|
content.appendTo(panel);
|
||||||
var closeCallback;
|
|
||||||
|
|
||||||
function hide(dispose) {
|
function hide(dispose) {
|
||||||
$(document).off("mousedown.red-ui-popover-panel-close");
|
$(document).off("mousedown.red-ui-popover-panel-close");
|
||||||
@ -378,6 +377,7 @@ RED.popover = (function() {
|
|||||||
}
|
}
|
||||||
function show(options) {
|
function show(options) {
|
||||||
var closeCallback = options.onclose;
|
var closeCallback = options.onclose;
|
||||||
|
var closeButton = options.closeButton;
|
||||||
var target = options.target;
|
var target = options.target;
|
||||||
var align = options.align || "right";
|
var align = options.align || "right";
|
||||||
var offset = options.offset || [0,0];
|
var offset = options.offset || [0,0];
|
||||||
@ -393,7 +393,7 @@ RED.popover = (function() {
|
|||||||
top -= (top+panelHeight)-$(window).height() + 5;
|
top -= (top+panelHeight)-$(window).height() + 5;
|
||||||
}
|
}
|
||||||
if (top < 0) {
|
if (top < 0) {
|
||||||
panelHeight.height(panelHeight+top)
|
panel.height(panelHeight+top)
|
||||||
top = 0;
|
top = 0;
|
||||||
}
|
}
|
||||||
if (align === "right") {
|
if (align === "right") {
|
||||||
@ -420,7 +420,8 @@ RED.popover = (function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$(document).on("mousedown.red-ui-popover-panel-close", function(event) {
|
$(document).on("mousedown.red-ui-popover-panel-close", function(event) {
|
||||||
if(!$(event.target).closest(panel).length && !$(event.target).closest(".red-ui-editor-dialog").length) {
|
var hitCloseButton = closeButton && $(event.target).closest(closeButton).length;
|
||||||
|
if(!hitCloseButton && !$(event.target).closest(panel).length && !$(event.target).closest(".red-ui-editor-dialog").length) {
|
||||||
if (closeCallback) {
|
if (closeCallback) {
|
||||||
closeCallback();
|
closeCallback();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user