From 5144f7915f73f2d4e2bd008d2cda0b2659b0dd49 Mon Sep 17 00:00:00 2001 From: rivexe Date: Fri, 21 Jun 2024 15:23:58 +0300 Subject: [PATCH 01/44] fix: hide popup menu when click outside --- src/share.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/share.js b/src/share.js index 4f305188..0da6c869 100644 --- a/src/share.js +++ b/src/share.js @@ -204,10 +204,24 @@ import AppDarkSvg from "!!raw-loader!../img/app-dark.svg"; }); }; + var listenOuterClicks = function(event) { + if (event.target.id === "onlyoffice-share-action") { + return; + } + let target = document.querySelector("#onlyoffice-share-popup-menu"); + if (target) { + let eventPath = event.composedPath().includes(target); + if (!eventPath && typeof(permissionsMenu)!=="undefined" && permissionsMenu.isOpen()) { + permissionsMenu.close(); + } + } + } + var onClickPermissionMenu = function (e) { if (!permissionsMenu) { permissionsMenu = getPermissionMenu(); } + window.addEventListener("click", listenOuterClicks); var shareNode = $(e.target).closest(".onlyoffice-share-item")[0]; var shareId = shareNode.id; @@ -297,7 +311,8 @@ import AppDarkSvg from "!!raw-loader!../img/app-dark.svg"; var getPermissionMenu = function () { var popup = $("
", { - class: "popovermenu onlyoffice-share-popup" + class: "popovermenu onlyoffice-share-popup", + id: "onlyoffice-share-popup-menu" }).append($("