Fix TOC issues: add ScrollArea, fix section jump mechanism

This commit is contained in:
2026-05-22 17:28:44 +08:00
parent f12297d580
commit 21e9aba274
2 changed files with 42 additions and 23 deletions

View File

@@ -367,15 +367,24 @@ BgType::Custom(ref path) if !path.is_empty() => {
}
if action.toggle_theme {
self.settings.theme = match self.settings.theme {
theme::Theme::Light => theme::Theme::Dark,
theme::Theme::Dark => theme::Theme::Sepia,
theme::Theme::Sepia => theme::Theme::Light,
};
ctx.set_style(theme::create_style(&self.settings.theme));
}
self.settings.theme = match self.settings.theme {
theme::Theme::Light => theme::Theme::Dark,
theme::Theme::Dark => theme::Theme::Sepia,
theme::Theme::Sepia => theme::Theme::Light,
};
ctx.set_style(theme::create_style(&self.settings.theme));
}
if action.page_prev {
if action.toggle_sidebar {
self.state.sidebar_open = !self.state.sidebar_open;
}
if let Some(section) = action.jump_to_section {
self.state.current_section = section;
self.state.current_page = 0;
}
if action.page_prev {
self.state.prev_page();
}
if action.page_next {