Browse Source

Merge branch 'patch-6' of https://github.com/pravdomil/wekan into pravdomil-patch-6

Lauri Ojansivu 7 years ago
parent
commit
f629a7b3f7
1 changed files with 11 additions and 1 deletions
  1. 11 1
      client/lib/inlinedform.js

+ 11 - 1
client/lib/inlinedform.js

@@ -75,6 +75,16 @@ InlinedForm = BlazeComponent.extendComponent({
 EscapeActions.register('inlinedForm',
 EscapeActions.register('inlinedForm',
   () => { currentlyOpenedForm.get().close(); },
   () => { currentlyOpenedForm.get().close(); },
   () => { return currentlyOpenedForm.get() !== null; }, {
   () => { return currentlyOpenedForm.get() !== null; }, {
-    noClickEscapeOn: '.js-inlined-form',
+    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;
+  if (openedForm && isClickOutside) {
+    $('.js-inlined-form button[type=submit]').click();
+    openedForm.close();
+  }
+}, true);