1
0
mirror of https://github.com/flarum/core.git synced 2025-08-08 09:26:34 +02:00

Make sure the emoji popup doesn't go off the top of the screen on mobile

This commit is contained in:
Toby Zerner
2018-11-12 17:25:24 +10:30
parent b3d0dd3aa9
commit d3329fe11c

View File

@@ -11,7 +11,6 @@ import KeyboardNavigatable from 'flarum/utils/KeyboardNavigatable';
import AutocompleteDropdown from './components/AutocompleteDropdown'; import AutocompleteDropdown from './components/AutocompleteDropdown';
export default function addComposerAutocomplete() { export default function addComposerAutocomplete() {
const emojiKeys = Object.keys(emojiMap); const emojiKeys = Object.keys(emojiMap);
extend(ComposerBody.prototype, 'config', function(original, isInitialized) { extend(ComposerBody.prototype, 'config', function(original, isInitialized) {
@@ -150,6 +149,8 @@ export default function addComposerAutocomplete() {
if (left + width > parent.width()) { if (left + width > parent.width()) {
left = parent.width() - width; left = parent.width() - width;
} }
top = Math.max(-$(this).offset().top, top);
left = Math.max(-$(this).offset().left, left);
dropdown.show(left, top); dropdown.show(left, top);
} }
}; };