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 {
.avatar_main(40px);
.cp-avatar {
border: 1px solid transparent;
}
display: flex;
align-items: flex-start;
div.cp-textarea {

@ -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

@ -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, {

Loading…
Cancel
Save