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:
David Taylor 2024-09-13 19:19:40 +01:00 committed by GitHub
parent a914d3230b
commit e7e9c99568
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 0 additions and 48 deletions

View File

@ -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,
});
}
}

View File

@ -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}}

View File

@ -1,5 +1,3 @@
<ScrollTracker @name="discourse-automation-edit" />
<section class="discourse-automation-form edit">
<form class="form-horizontal">
<FormError @error={{this.error}} />