Fix size of the autocomplete dropdown for mentions

pull/1/head
yflory 5 years ago
parent a05015ad3c
commit 9467839d6c

@ -22,6 +22,9 @@
} }
.cp-comment-form-input { .cp-comment-form-input {
.avatar_main(40px); .avatar_main(40px);
.cp-avatar {
border: 1px solid transparent;
}
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
div.cp-textarea { div.cp-textarea {

@ -3893,6 +3893,16 @@ define([
results.sort(sort); results.sort(sort);
} }
cb(results); 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() { focus: function() {
// prevent value inserted on focus // prevent value inserted on focus

@ -239,6 +239,11 @@ define([
var obj = Util.clone(Env.comments.authors[id]); var obj = Util.clone(Env.comments.authors[id]);
authors[obj.curvePublic] = obj; authors[obj.curvePublic] = obj;
}); });
for (var i = 0; i< 30; i++) {
authors['test'+i] = {
name: "Name"+i
};
}
Env.common.addMentions({ Env.common.addMentions({
$input: $text, $input: $text,
contenteditable: true, contenteditable: true,
@ -429,7 +434,13 @@ define([
updateMetadata(Env); updateMetadata(Env);
Env.framework.localChange(); Env.framework.localChange();
}); });
$div.append(form); $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, { UI.confirmButton(resolve, {

Loading…
Cancel
Save