mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 23:03:38 +08:00
DEV: Allow overiding calculation of top offset for card contents base (#11254)
This commit is contained in:
parent
de174ef0c4
commit
a9b20fa827
|
@ -5,7 +5,7 @@ import afterTransition from "discourse/lib/after-transition";
|
||||||
import DiscourseURL from "discourse/lib/url";
|
import DiscourseURL from "discourse/lib/url";
|
||||||
import Mixin from "@ember/object/mixin";
|
import Mixin from "@ember/object/mixin";
|
||||||
import { escapeExpression } from "discourse/lib/utilities";
|
import { escapeExpression } from "discourse/lib/utilities";
|
||||||
import outletHeights from "discourse/lib/header-outlet-height";
|
import headerOutletHeights from "discourse/lib/header-outlet-height";
|
||||||
import { inject as service } from "@ember/service";
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default Mixin.create({
|
export default Mixin.create({
|
||||||
|
@ -212,7 +212,10 @@ export default Mixin.create({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
position.top -= $("#main-outlet").offset().top - outletHeights();
|
position.top -= this._calculateTopOffset(
|
||||||
|
$("#main-outlet").offset(),
|
||||||
|
headerOutletHeights()
|
||||||
|
);
|
||||||
if (isFixed) {
|
if (isFixed) {
|
||||||
position.top -= $("html").scrollTop();
|
position.top -= $("html").scrollTop();
|
||||||
//if content is fixed and will be cut off on the bottom, display it above...
|
//if content is fixed and will be cut off on the bottom, display it above...
|
||||||
|
@ -261,6 +264,13 @@ export default Mixin.create({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// some plugins/themes modify the page layout and may
|
||||||
|
// need to override this calculation for the card to
|
||||||
|
// position correctly
|
||||||
|
_calculateTopOffset(mainOutletOffset, outletHeights) {
|
||||||
|
return mainOutletOffset.top - outletHeights;
|
||||||
|
},
|
||||||
|
|
||||||
_hide() {
|
_hide() {
|
||||||
if (!this.visible) {
|
if (!this.visible) {
|
||||||
$(this.element).css({ left: -9999, top: -9999 });
|
$(this.element).css({ left: -9999, top: -9999 });
|
||||||
|
|
Loading…
Reference in New Issue
Block a user