diff options
author | pravdomil <pravdomil.toman@gmail.com> | 2018-06-19 16:35:06 +0200 |
---|---|---|
committer | pravdomil <pravdomil.toman@gmail.com> | 2018-06-19 16:38:42 +0200 |
commit | 77ae6c17e718669edcae8898792e20be3db18053 (patch) | |
tree | dea5764b0bc398aa5ecb338750714752d077dad0 /client/lib | |
parent | 484d4952597b063d73ccc05bb0c8b80aa1811151 (diff) | |
download | wekan-77ae6c17e718669edcae8898792e20be3db18053.tar.gz wekan-77ae6c17e718669edcae8898792e20be3db18053.tar.bz2 wekan-77ae6c17e718669edcae8898792e20be3db18053.zip |
submit inline form on click outside
Diffstat (limited to 'client/lib')
-rw-r--r-- | client/lib/inlinedform.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/client/lib/inlinedform.js b/client/lib/inlinedform.js index 56768a13..c652c646 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); |