mirror of
https://github.com/flarum/framework.git
synced 2025-02-22 05:55:25 +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));
|
$(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',
|
key: 'showStart',
|
||||||
value: function showStart(left, top) {
|
value: function showStart(left, top) {
|
||||||
var $this = this.$();
|
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',
|
key: 'showEnd',
|
||||||
value: function showEnd(right, bottom) {
|
value: function showEnd(right, bottom) {
|
||||||
var $this = this.$();
|
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',
|
key: 'hide',
|
||||||
|
@ -26,20 +26,25 @@ export default class PostQuoteButton extends Button {
|
|||||||
$(document).on('mousedown', this.hide.bind(this));
|
$(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) {
|
showStart(left, top) {
|
||||||
const $this = this.$();
|
const $this = this.$();
|
||||||
|
|
||||||
$this.show()
|
this.show(left, $(window).scrollTop() + top - $this.outerHeight() - 5);
|
||||||
.css('left', left)
|
|
||||||
.css('top', $(window).scrollTop() + top - $this.outerHeight() - 5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
showEnd(right, bottom) {
|
showEnd(right, bottom) {
|
||||||
const $this = this.$();
|
const $this = this.$();
|
||||||
|
|
||||||
$this.show()
|
this.show(right - $this.outerWidth(), $(window).scrollTop() + bottom + 5);
|
||||||
.css('left', right - $this.outerWidth())
|
|
||||||
.css('top', $(window).scrollTop() + bottom + 5)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hide() {
|
hide() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user