From 77ae6c17e718669edcae8898792e20be3db18053 Mon Sep 17 00:00:00 2001 From: pravdomil Date: Tue, 19 Jun 2018 16:35:06 +0200 Subject: [PATCH 1/4] submit inline form on click outside --- client/lib/inlinedform.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/client/lib/inlinedform.js b/client/lib/inlinedform.js index 56768a13b..c652c6464 100644 --- a/client/lib/inlinedform.js +++ b/client/lib/inlinedform.js @@ -75,6 +75,16 @@ InlinedForm = BlazeComponent.extendComponent({ EscapeActions.register('inlinedForm', () => { currentlyOpenedForm.get().close(); }, () => { return currentlyOpenedForm.get() !== null; }, { - noClickEscapeOn: '.js-inlined-form', + enabledOnClick: false } ); + +// submit on click outside +document.addEventListener("click", function(evt) { + const formIsOpen = currentlyOpenedForm.get() && currentlyOpenedForm.get().isOpen.get(); + const isClickOutside = $(evt.target).closest(".js-inlined-form").length === 0; + if (formIsOpen && isClickOutside) { + $('.js-inlined-form button[type=submit]').click(); + currentlyOpenedForm.get().close(); + } +}, true); From 620bbb3394bdfabeb63eb7a43f822b37da7ceab5 Mon Sep 17 00:00:00 2001 From: pravdomil Date: Tue, 19 Jun 2018 16:41:27 +0200 Subject: [PATCH 2/4] refactor --- client/lib/inlinedform.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/lib/inlinedform.js b/client/lib/inlinedform.js index c652c6464..272d79f76 100644 --- a/client/lib/inlinedform.js +++ b/client/lib/inlinedform.js @@ -81,10 +81,10 @@ EscapeActions.register('inlinedForm', // submit on click outside document.addEventListener("click", function(evt) { - const formIsOpen = currentlyOpenedForm.get() && currentlyOpenedForm.get().isOpen.get(); + const openedForm = currentlyOpenedForm.get() const isClickOutside = $(evt.target).closest(".js-inlined-form").length === 0; - if (formIsOpen && isClickOutside) { + if (openedForm && isClickOutside) { $('.js-inlined-form button[type=submit]').click(); - currentlyOpenedForm.get().close(); + openedForm.close(); } }, true); From aa2a15bf1b1c7cc95bc6cb93a25c0932db402573 Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Tue, 26 Jun 2018 01:36:44 +0300 Subject: [PATCH 3/4] Fix lint errors. --- client/lib/inlinedform.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/lib/inlinedform.js b/client/lib/inlinedform.js index 272d79f76..e5e4d4edc 100644 --- a/client/lib/inlinedform.js +++ b/client/lib/inlinedform.js @@ -75,14 +75,14 @@ InlinedForm = BlazeComponent.extendComponent({ EscapeActions.register('inlinedForm', () => { currentlyOpenedForm.get().close(); }, () => { return currentlyOpenedForm.get() !== null; }, { - enabledOnClick: false + enabledOnClick: false, } ); // submit on click outside -document.addEventListener("click", function(evt) { - const openedForm = currentlyOpenedForm.get() - const isClickOutside = $(evt.target).closest(".js-inlined-form").length === 0; +document.addEventListener('click', function(evt) { + const openedForm = currentlyOpenedForm.get(); + const isClickOutside = $(evt.target).closest('.js-inlined-form').length === 0; if (openedForm && isClickOutside) { $('.js-inlined-form button[type=submit]').click(); openedForm.close(); From daa95c582e9f11e15bb67389de5a97ded45dbc42 Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Tue, 26 Jun 2018 01:40:13 +0300 Subject: [PATCH 4/4] - Submit inline form on click outside, fixes "You have an unsaved description" doesn't go away after saving. Thanks to pravdomil and xet7 ! Fixes #1287 --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a801988c9..e1fe261c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,9 @@ This release adds the following new features: and fixes the following bugs: * [Fix typo in English translation](https://github.com/wekan/wekan/pull/1710); -* [Fix vertical align of user avatar initials](https://github.com/wekan/wekan/pull/1714). +* [Fix vertical align of user avatar initials](https://github.com/wekan/wekan/pull/1714); +* [Submit inline form on click outside]https://github.com/wekan/wekan/pull/1717), fixes + ["You have an unsaved description" doesn't go away after saving](https://github.com/wekan/wekan/issues/1287). Thanks to GitHub users pravdomil, xet7 and zypA13510 for their contributions.