host: a pane's own theme wins over a theme preview
A preview (the Theme Builder's, developer mode's, or one an automation left on through theme_preview) replaced every site tab's theme, pane themes included, also on reload; "Theme for this pane" then showed its choice checked while the page kept the preview. Reproduced live: a preview of Windows 98 turned a Paper pane into Windows 98 until the preview ended. Now a pane with its own theme keeps it; every other tab shows the preview, as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
4d806b647d
commit
ef3a5f6f7a
2 changed files with 26 additions and 9 deletions
|
|
@ -59,17 +59,12 @@ pub fn scopes(app: &AppHandle) -> Result<ThemeScopes, String> {
|
|||
Ok(state(app)?.scopes.clone())
|
||||
}
|
||||
|
||||
/// The theme for site tab webview `label`: the Theme Builder's preview while one is open, else its
|
||||
/// pane's, its account's or the global theme.
|
||||
/// The theme for site tab webview `label`: its pane's own theme; else the Theme Builder's preview
|
||||
/// while one is open; else its account's or the global theme.
|
||||
fn tab_theme(app: &AppHandle, themes: &ThemeConfig, state: &Themes, label: &str) -> ThemeChoice {
|
||||
let global = state.theme.clone().unwrap_or_else(|| ThemeChoice::default_for(themes.site));
|
||||
match &state.preview {
|
||||
Some(preview) => preview.clone(),
|
||||
None => {
|
||||
let tab = crate::policy::tab_id(label).unwrap_or_default();
|
||||
state.scopes.for_tab(themes.site, &global, tab, tab_profile(app, label).as_deref())
|
||||
}
|
||||
}
|
||||
let tab = crate::policy::tab_id(label).unwrap_or_default();
|
||||
state.scopes.for_tab_with_preview(themes.site, &global, state.preview.as_ref(), tab, tab_profile(app, label).as_deref())
|
||||
}
|
||||
|
||||
fn background(theme: &ThemeChoice, themes: &ThemeConfig) -> Option<tauri::window::Color> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue