From 22c6898c9ff81dccece35e3fc8637824dec90aa4 Mon Sep 17 00:00:00 2001
From: Sebastien Curt <sebastien.curt@tetras-libre.fr>
Date: Thu, 5 May 2022 11:45:52 +0200
Subject: [PATCH] Fix refresh mosaic on editpopup closed by click on editspace
 or close button

---
 capsule-prototype/js/MosaicPanelWidget.js |  2 +-
 capsule-prototype/js/PopupPanelWidget.js  |  2 ++
 capsule-prototype/js/online-script.js     | 10 +++-------
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/capsule-prototype/js/MosaicPanelWidget.js b/capsule-prototype/js/MosaicPanelWidget.js
index de9d947..d9c8d41 100644
--- a/capsule-prototype/js/MosaicPanelWidget.js
+++ b/capsule-prototype/js/MosaicPanelWidget.js
@@ -164,7 +164,7 @@
                     localOptions.rekall().timeline.pause();
                     fillPanel();
                     localOptions.htmlElement().show();
-                    localOptions.updateObserver = localOptions.pubsub().subscribe('popupEdit.updated', this.refresh);
+                    localOptions.updateObserver = localOptions.pubsub().subscribe('popupEdit.Closed', this.refresh);
                     localOptions.isOpen = true;
                 },
                 hide: function () {
diff --git a/capsule-prototype/js/PopupPanelWidget.js b/capsule-prototype/js/PopupPanelWidget.js
index f5b7cf9..f73e5c1 100644
--- a/capsule-prototype/js/PopupPanelWidget.js
+++ b/capsule-prototype/js/PopupPanelWidget.js
@@ -941,6 +941,7 @@ PopupPanelWidget.prototype.createPopupContent = function (tag) {
 
     function createRightPopup(popupPanelWidget) {
         let popupRightTd = $('#popupRight');
+        popupRightTd.attr('keyDoc', tag.document.key)
         popupRightTd.empty();
 
         let commonDataForPanels = {
@@ -996,4 +997,5 @@ PopupPanelWidget.prototype.close = function() {
     if(this.videoWasPlayingOnContentCreation) {
         window.app.rekall.Rekall().timeline.play();
     }
+    window.app.rekall.Rekall('pubSub').publish('popupEdit.Closed', {});
 }
diff --git a/capsule-prototype/js/online-script.js b/capsule-prototype/js/online-script.js
index d2ac82c..4cd35c1 100644
--- a/capsule-prototype/js/online-script.js
+++ b/capsule-prototype/js/online-script.js
@@ -104,11 +104,7 @@ window.onload = function() {
 
 	$("#popupSpace").click(function(event){
 		event.stopPropagation();
-		closeEdit();
-	});
-	$("#closePopupEdit").click(function(event){
-		event.stopPropagation();
-		closeEdit();
+		popupPanel.close();
 	});
 
 	$("#popupAlertButtonCancel").click(function(){
@@ -699,7 +695,7 @@ function closeInputs() {
 
 function closeEdit() {
 	popupPanel.close();
-	window.app.rekall.Rekall('pubSub').publish('popupEdit.updated', {});
+	window.app.rekall.Rekall('pubSub').publish('popupEdit.Closed', {});
 }
 
 function openVideo() {
@@ -840,7 +836,7 @@ function deleteFromDom(keyDoc) {
 
 function deleteFromDomFinished() {
 	closeAlert();
-	closeEdit();
+	popupPanel.close();
 }
 
 //Gestion d'upload
-- 
GitLab