DEV: Drop ScrollTracker component (#28911)
Restoring scroll position is now handled by the route-scroll-manager service, so this is unneeded
This commit is contained in:
parent
a914d3230b
commit
e7e9c99568
|
@ -1,40 +0,0 @@
|
|||
import Component from "@ember/component";
|
||||
import { next } from "@ember/runloop";
|
||||
import $ from "jquery";
|
||||
import Scrolling from "discourse/mixins/scrolling";
|
||||
|
||||
export default class ScrollTracker extends Component.extend(Scrolling) {
|
||||
didReceiveAttrs() {
|
||||
super.didReceiveAttrs(...arguments);
|
||||
|
||||
this.set("trackerName", `scroll-tracker-${this.name}`);
|
||||
}
|
||||
|
||||
didInsertElement() {
|
||||
super.didInsertElement(...arguments);
|
||||
|
||||
this.bindScrolling();
|
||||
}
|
||||
|
||||
didRender() {
|
||||
super.didRender(...arguments);
|
||||
|
||||
const data = this.session.get(this.trackerName);
|
||||
if (data && data.position >= 0 && data.tag === this.tag) {
|
||||
next(() => $(window).scrollTop(data.position + 1));
|
||||
}
|
||||
}
|
||||
|
||||
willDestroyElement() {
|
||||
super.willDestroyElement(...arguments);
|
||||
|
||||
this.unbindScrolling();
|
||||
}
|
||||
|
||||
scrolled() {
|
||||
this.session.set(this.trackerName, {
|
||||
position: $(window).scrollTop(),
|
||||
tag: this.tag,
|
||||
});
|
||||
}
|
||||
}
|
|
@ -5,12 +5,6 @@
|
|||
{{body-class "search-page"}}
|
||||
|
||||
<section class="search-container">
|
||||
<ScrollTracker
|
||||
@name="full-page-search"
|
||||
@tag={{this.searchTerm}}
|
||||
class="hidden"
|
||||
/>
|
||||
|
||||
<div class="search-header" role="search">
|
||||
<h1 class="search-page-heading">
|
||||
{{#if this.hasResults}}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
<ScrollTracker @name="discourse-automation-edit" />
|
||||
|
||||
<section class="discourse-automation-form edit">
|
||||
<form class="form-horizontal">
|
||||
<FormError @error={{this.error}} />
|
||||
|
|
Loading…
Reference in New Issue