mirror of
https://github.com/flarum/framework.git
synced 2025-02-21 04:25:54 +08:00
Fix positioning of quote button when parents are positioned relatively
This commit is contained in:
parent
101af171b1
commit
14215773b3
12
extensions/mentions/js/forum/dist/extension.js
vendored
12
extensions/mentions/js/forum/dist/extension.js
vendored
@ -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',
|
||||
|
@ -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() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user