feat: optimisations

This commit is contained in:
2026-07-19 18:08:52 +09:30
parent 10db972ef4
commit 824cedca2f
63 changed files with 1098 additions and 1719 deletions
@@ -304,7 +304,6 @@ const enhancedNavigationPlugin: Plugin<typeof settings> = {
injectStyles();
window.addEventListener("resize", positionArrows);
window.addEventListener("scroll", positionArrows, true);
const navObservers: MutationObserver[] = [];
const courseObservers: MutationObserver[] = [];
@@ -355,7 +354,6 @@ const enhancedNavigationPlugin: Plugin<typeof settings> = {
return () => {
window.removeEventListener("resize", positionArrows);
window.removeEventListener("scroll", positionArrows, true);
courseMount.unregister();
navObservers.forEach((observer) => observer.disconnect());
courseObservers.forEach((observer) => observer.disconnect());
@@ -0,0 +1,23 @@
import { defineLazyPlugin } from "../../core/dynamicLoader";
import { booleanSetting, defineSettings } from "../../core/settingsHelpers";
const settings = defineSettings({
autoScrollOnClick: booleanSetting({
default: false,
title: "Auto-scroll navigator on click",
description:
"When you click a lesson directly in the side panel, automatically scroll it to the centre. The prev/next arrows always centre the selected lesson regardless of this setting.",
}),
});
export default defineLazyPlugin({
id: "enhanced-navigation",
name: "Enhanced Navigation",
description:
"Keeps the course navigator focused on the current lesson and adds prev/next lesson arrows.",
version: "1.0.0",
disableToggle: true,
settings,
beta: false,
loader: () => import("./index"),
});