From 9467839d6ca21a27a1b523941b908c06337007cc Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 28 Apr 2020 18:11:46 +0200 Subject: [PATCH] Fix size of the autocomplete dropdown for mentions --- customize.dist/src/less2/include/comments.less | 3 +++ www/common/common-ui-elements.js | 10 ++++++++++ www/pad/comments.js | 11 +++++++++++ 3 files changed, 24 insertions(+) diff --git a/customize.dist/src/less2/include/comments.less b/customize.dist/src/less2/include/comments.less index 82647e2b4..50164a05c 100644 --- a/customize.dist/src/less2/include/comments.less +++ b/customize.dist/src/less2/include/comments.less @@ -22,6 +22,9 @@ } .cp-comment-form-input { .avatar_main(40px); + .cp-avatar { + border: 1px solid transparent; + } display: flex; align-items: flex-start; div.cp-textarea { diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 63e110c0b..cb325af77 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -3893,6 +3893,16 @@ define([ results.sort(sort); } cb(results); + // Set max-height to the autocomplete dropdown + try { + var max = window.innerHeight; + var pos = $t[0].getBoundingClientRect(); + var menu = $t.autocomplete("instance").menu.activeMenu; + menu.css({ + 'overflow-y': 'auto', + 'max-height': (max-pos.bottom)+'px' + }); + } catch (e) {} }, focus: function() { // prevent value inserted on focus diff --git a/www/pad/comments.js b/www/pad/comments.js index 0133a47c4..894cea838 100644 --- a/www/pad/comments.js +++ b/www/pad/comments.js @@ -239,6 +239,11 @@ define([ var obj = Util.clone(Env.comments.authors[id]); authors[obj.curvePublic] = obj; }); + for (var i = 0; i< 30; i++) { + authors['test'+i] = { + name: "Name"+i + }; + } Env.common.addMentions({ $input: $text, contenteditable: true, @@ -429,7 +434,13 @@ define([ updateMetadata(Env); Env.framework.localChange(); }); + $div.append(form); + + // Make sure the submit button is visible: scroll by the height of the form + setTimeout(function () { + Env.$container.scrollTop(Env.$container.scrollTop() + 55); + }); }); UI.confirmButton(resolve, {