From 1a27e60e55b6f94e85d689e5a551a8efe2fb9050 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Wed, 16 Jun 2021 11:34:41 +0100 Subject: [PATCH] Allow RED.popover.panel to specify a closeButton to ignore click events on --- .../@node-red/editor-client/src/js/ui/common/popover.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/common/popover.js b/packages/node_modules/@node-red/editor-client/src/js/ui/common/popover.js index 78aacba52..7049c3164 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/common/popover.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/common/popover.js @@ -363,7 +363,6 @@ RED.popover = (function() { panel.css({ display: "none" }); panel.appendTo(document.body); content.appendTo(panel); - var closeCallback; function hide(dispose) { $(document).off("mousedown.red-ui-popover-panel-close"); @@ -378,6 +377,7 @@ RED.popover = (function() { } function show(options) { var closeCallback = options.onclose; + var closeButton = options.closeButton; var target = options.target; var align = options.align || "right"; var offset = options.offset || [0,0]; @@ -393,7 +393,7 @@ RED.popover = (function() { top -= (top+panelHeight)-$(window).height() + 5; } if (top < 0) { - panelHeight.height(panelHeight+top) + panel.height(panelHeight+top) top = 0; } if (align === "right") { @@ -420,7 +420,8 @@ RED.popover = (function() { }); $(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) { closeCallback(); }