From d131f9ef5830f813bdcd50db18f86ceb85d08b01 Mon Sep 17 00:00:00 2001
From: Chris Lawton <chris.lawton@torchbox.com>
Date: Thu, 9 May 2019 16:09:39 +0100
Subject: [PATCH] only allow one editor to be open ay any given time

---
 opentech/static_src/src/javascript/apply/edit-comment.js | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/opentech/static_src/src/javascript/apply/edit-comment.js b/opentech/static_src/src/javascript/apply/edit-comment.js
index 913745aa8..6ac527432 100644
--- a/opentech/static_src/src/javascript/apply/edit-comment.js
+++ b/opentech/static_src/src/javascript/apply/edit-comment.js
@@ -16,6 +16,8 @@
     $(editButton).click(function (e) {
         e.preventDefault();
 
+        closeAllEditors();
+
         const editBlockWrapper = $(this).closest(feedContent).find(editBlock);
         const commentWrapper = $(this).closest(feedContent).find(comment);
         const commentContents = $(commentWrapper).data('comment');
@@ -105,4 +107,11 @@
     const updateComment = (el, id, newComment) => {
         $(el).html(newComment).data('comment', newComment).data('id', id);
     };
+
+    const closeAllEditors = () => {
+        $(comment).show();
+        $(pageDown).remove();
+        $(editButton).show();
+    };
+
 })(jQuery);
-- 
GitLab