File tree Expand file tree Collapse file tree 4 files changed +250
-265
lines changed
javascripts/discourse/components Expand file tree Collapse file tree 4 files changed +250
-265
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,16 @@ export default class TocContents extends Component {
2222 @tracked headingPositions = [];
2323 @tracked activeAncestorIds = [];
2424
25+ willDestroy () {
26+ super .willDestroy (... arguments );
27+ window .removeEventListener (" scroll" , this .updateActiveHeadingOnScroll );
28+ window .removeEventListener (" resize" , this .calculateHeadingPositions );
29+ this .appEvents .off (
30+ " topic:current-post-changed" ,
31+ this .calculateHeadingPositions
32+ );
33+ }
34+
2535 get mappedToc () {
2636 return this .mappedTocStructure (this .args .tocStructure );
2737 }
@@ -35,16 +45,6 @@ export default class TocContents extends Component {
3545 this .updateActiveHeadingOnScroll (); // manual on setup so active class is added
3646 }
3747
38- willDestroy () {
39- super .willDestroy (... arguments );
40- window .removeEventListener (" scroll" , this .updateActiveHeadingOnScroll );
41- window .removeEventListener (" resize" , this .calculateHeadingPositions );
42- this .appEvents .off (
43- " topic:current-post-changed" ,
44- this .calculateHeadingPositions
45- );
46- }
47-
4848 @action
4949 listenForScroll () {
5050 window .addEventListener (" scroll" , this .updateActiveHeadingOnScroll );
Original file line number Diff line number Diff line change @@ -6,6 +6,11 @@ import DButton from "discourse/components/d-button";
66export default class TocMini extends Component {
77 @service tocProcessor;
88
9+ willDestroy () {
10+ super .willDestroy (... arguments );
11+ this .removeClickOutsideListener ();
12+ }
13+
914 @action
1015 clickOutside () {
1116 this .tocProcessor .setOverlayVisible (false );
@@ -32,11 +37,6 @@ export default class TocMini extends Component {
3237 document .removeEventListener (" click" , this .clickOutside );
3338 }
3439
35- willDestroy () {
36- super .willDestroy (... arguments );
37- this .removeClickOutsideListener ();
38- }
39-
4040 <template >
4141 {{#if this . tocProcessor.hasTOC }}
4242 <span class =" d-toc-mini" >
Original file line number Diff line number Diff line change 11{
22 "private" : true ,
33 "devDependencies" : {
4- "@discourse/lint-configs" : " 2.0 .1" ,
4+ "@discourse/lint-configs" : " 2.2 .1" ,
55 "ember-template-lint" : " 6.0.0" ,
66 "eslint" : " 9.14.0" ,
77 "prettier" : " 2.8.8"
You can’t perform that action at this time.
0 commit comments