From 341046e3a0617030859fca3c1ff3d5c09b49060a Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 25 Aug 2019 21:01:59 -0400 Subject: [PATCH 1/2] [frio] Prevent Enter from sending the form in ACL tags input in /compose --- view/templates/item/compose-footer.tpl | 1 - .../frameworks/friendica-tagsinput/friendica-tagsinput.js | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/view/templates/item/compose-footer.tpl b/view/templates/item/compose-footer.tpl index 697be6fd10..9e950b98d2 100644 --- a/view/templates/item/compose-footer.tpl +++ b/view/templates/item/compose-footer.tpl @@ -118,7 +118,6 @@ $acl_allow_input.tagsinput({ confirmKeys: [13, 44], - cancelConfirmKeysOnEmpty: true, freeInput: false, tagClass: function(item) { switch (item.type) { diff --git a/view/theme/frio/frameworks/friendica-tagsinput/friendica-tagsinput.js b/view/theme/frio/frameworks/friendica-tagsinput/friendica-tagsinput.js index 2e83eedc64..af722d789e 100644 --- a/view/theme/frio/frameworks/friendica-tagsinput/friendica-tagsinput.js +++ b/view/theme/frio/frameworks/friendica-tagsinput/friendica-tagsinput.js @@ -481,9 +481,9 @@ var text = $input.val(), maxLengthReached = self.options.maxChars && text.length >= self.options.maxChars; - if (self.options.freeInput && (keyCombinationInList(event, self.options.confirmKeys) || maxLengthReached)) { + if (keyCombinationInList(event, self.options.confirmKeys) || maxLengthReached) { // Only attempt to add a tag if there is data in the field - if (text.length !== 0) { + if (self.options.freeInput && text.length !== 0) { self.add(maxLengthReached ? text.substr(0, self.options.maxChars) : text); $input.val(''); } From cba40dc9fd05f4fa97fbf7bc0aa75fee6136a958 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 25 Aug 2019 21:03:29 -0400 Subject: [PATCH 2/2] Prevents Enter from submitting the jot form in the ACL search field - Disable browser autocomplete in jot ACL search field --- view/js/acl.js | 9 ++++++++- view/templates/acl_selector.tpl | 2 +- view/theme/frio/templates/acl_selector.tpl | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/view/js/acl.js b/view/js/acl.js index d01ffe7cbd..b50dbaec8d 100644 --- a/view/js/acl.js +++ b/view/js/acl.js @@ -109,7 +109,14 @@ ACL.prototype.search = function(){ ACL.prototype.on_search = function(event){ if (this.kp_timer) clearTimeout(this.kp_timer); - this.kp_timer = setTimeout( this.search.bind(this), 1000); + + // Triggers an immediate search while preventing form submission + if (event.key === 'Enter') { + this.search(); + event.preventDefault(); + } else { + this.kp_timer = setTimeout( this.search.bind(this), 500); + } }; ACL.prototype.on_showall = function(event){ diff --git a/view/templates/acl_selector.tpl b/view/templates/acl_selector.tpl index 6755f2a198..da86a478bf 100644 --- a/view/templates/acl_selector.tpl +++ b/view/templates/acl_selector.tpl @@ -1,6 +1,6 @@
- + {{$showall}}
diff --git a/view/theme/frio/templates/acl_selector.tpl b/view/theme/frio/templates/acl_selector.tpl index a96271671b..47415634d1 100644 --- a/view/theme/frio/templates/acl_selector.tpl +++ b/view/theme/frio/templates/acl_selector.tpl @@ -4,7 +4,7 @@