mirror of
https://github.com/discourse/discourse.git
synced 2025-01-16 00:52:58 +08:00
FIX: correctly position emoji picker when clicking more (#30724)
This commit is contained in:
parent
066ece95eb
commit
88888642f7
|
@ -346,7 +346,7 @@ export default class DEditor extends Component {
|
|||
}
|
||||
},
|
||||
|
||||
transformComplete: (v) => {
|
||||
transformComplete: (v, event) => {
|
||||
if (v.code) {
|
||||
this.emojiStore.trackEmojiForContext(v.code, "topic");
|
||||
return `${v.code}:`;
|
||||
|
@ -365,7 +365,26 @@ export default class DEditor extends Component {
|
|||
},
|
||||
};
|
||||
|
||||
const virtualElement = virtualElementFromTextRange();
|
||||
let virtualElement;
|
||||
if (event instanceof KeyboardEvent) {
|
||||
// when user selects more by pressing enter
|
||||
virtualElement = virtualElementFromTextRange();
|
||||
} else {
|
||||
// when user selects more by clicking on it
|
||||
virtualElement = {
|
||||
getBoundingClientRect: () => ({
|
||||
x: event.pageX,
|
||||
y: event.pageY,
|
||||
top: event.pageY,
|
||||
left: event.pageX,
|
||||
bottom: 0,
|
||||
right: 0,
|
||||
width: 0,
|
||||
height: 0,
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
this.menuInstance = this.menu.show(virtualElement, menuOptions);
|
||||
return "";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user