mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Position emoji-picker around d-editor.
This commit is contained in:
parent
7a08e23b4b
commit
43e33302e1
@ -514,6 +514,7 @@ export default Ember.Component.extend({
|
|||||||
|
|
||||||
const desktopPositioning = options => {
|
const desktopPositioning = options => {
|
||||||
let attributes = {
|
let attributes = {
|
||||||
|
position: "fixed",
|
||||||
width: windowWidth < 485 ? windowWidth - 12 : 400,
|
width: windowWidth < 485 ? windowWidth - 12 : 400,
|
||||||
marginLeft: "",
|
marginLeft: "",
|
||||||
marginTop: "",
|
marginTop: "",
|
||||||
@ -562,12 +563,30 @@ export default Ember.Component.extend({
|
|||||||
if (windowWidth < 485) {
|
if (windowWidth < 485) {
|
||||||
desktopModalePositioning();
|
desktopModalePositioning();
|
||||||
} else {
|
} else {
|
||||||
let previewInputOffset = $(".d-editor-input").offset();
|
const previewInputOffset = $(".d-editor-input").offset();
|
||||||
let left = previewInputOffset.left;
|
|
||||||
desktopPositioning({
|
const pickerHeight = $(".emoji-picker").height();
|
||||||
left,
|
const editorHeight = $(".d-editor-input").height();
|
||||||
bottom: $("#reply-control").height() - 45
|
const windowBottom = $(window).scrollTop() + $(window).height();
|
||||||
});
|
|
||||||
|
if (
|
||||||
|
previewInputOffset.top + editorHeight + pickerHeight <
|
||||||
|
windowBottom
|
||||||
|
) {
|
||||||
|
// position it below editor if there is enough space
|
||||||
|
desktopPositioning({
|
||||||
|
position: "absolute",
|
||||||
|
top: previewInputOffset.top + editorHeight,
|
||||||
|
left: previewInputOffset.left
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// try positioning it above
|
||||||
|
desktopPositioning({
|
||||||
|
position: "absolute",
|
||||||
|
top: -pickerHeight,
|
||||||
|
left: previewInputOffset.left
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user