diff --git a/extensions/mentions/js/forum/dist/extension.js b/extensions/mentions/js/forum/dist/extension.js index 8e6668a7a..2785abf5f 100644 --- a/extensions/mentions/js/forum/dist/extension.js +++ b/extensions/mentions/js/forum/dist/extension.js @@ -1010,19 +1010,27 @@ System.register('flarum/mentions/components/PostQuoteButton', ['flarum/component $(document).on('mousedown', this.hide.bind(this)); } + }, { + key: 'show', + value: function show(left, top) { + var $this = this.$().show(); + var parentOffset = $this.offsetParent().offset(); + + $this.css('left', left - parentOffset.left).css('top', top - parentOffset.top); + } }, { key: 'showStart', value: function showStart(left, top) { var $this = this.$(); - $this.show().css('left', left).css('top', $(window).scrollTop() + top - $this.outerHeight() - 5); + this.show(left, $(window).scrollTop() + top - $this.outerHeight() - 5); } }, { key: 'showEnd', value: function showEnd(right, bottom) { var $this = this.$(); - $this.show().css('left', right - $this.outerWidth()).css('top', $(window).scrollTop() + bottom + 5); + this.show(right - $this.outerWidth(), $(window).scrollTop() + bottom + 5); } }, { key: 'hide', diff --git a/extensions/mentions/js/forum/src/components/PostQuoteButton.js b/extensions/mentions/js/forum/src/components/PostQuoteButton.js index 5ec66b6dc..cbd60d786 100644 --- a/extensions/mentions/js/forum/src/components/PostQuoteButton.js +++ b/extensions/mentions/js/forum/src/components/PostQuoteButton.js @@ -26,20 +26,25 @@ export default class PostQuoteButton extends Button { $(document).on('mousedown', this.hide.bind(this)); } + show(left, top) { + const $this = this.$().show(); + const parentOffset = $this.offsetParent().offset(); + + $this + .css('left', left - parentOffset.left) + .css('top', top - parentOffset.top); + } + showStart(left, top) { const $this = this.$(); - $this.show() - .css('left', left) - .css('top', $(window).scrollTop() + top - $this.outerHeight() - 5); + this.show(left, $(window).scrollTop() + top - $this.outerHeight() - 5); } showEnd(right, bottom) { const $this = this.$(); - $this.show() - .css('left', right - $this.outerWidth()) - .css('top', $(window).scrollTop() + bottom + 5) + this.show(right - $this.outerWidth(), $(window).scrollTop() + bottom + 5); } hide() {