mirror of
https://github.com/gabriele-cusato/HandTranscriptMd.git
synced 2026-07-22 14:30:25 +00:00
fixato il bug del tema sul pad 5 e anche reso piu solido il cambio tema in generale per altri dispositivi
This commit is contained in:
parent
86e207c5ce
commit
382d4d528a
1 changed files with 8 additions and 2 deletions
|
|
@ -51,8 +51,14 @@ export default class HandwritingPlugin extends Plugin {
|
|||
// Applica la lingua interfaccia salvata (o la lingua di sistema se 'auto')
|
||||
setLocale(this.settings.uiLanguage);
|
||||
|
||||
// Rileva cambio tema Obsidian (aggiunta/rimozione classe 'theme-dark' sul body).
|
||||
// Se bgMode è 'auto', notifica tutti i listener per aggiornare colori e SVG.
|
||||
// Rileva cambio tema Obsidian. Doppio meccanismo per massima compatibilità Android:
|
||||
// - css-change: evento Obsidian garantito al cambio tema (più affidabile su alcuni WebView Android)
|
||||
// - MutationObserver: fallback per cambii di classe body da plugin terzi o versioni vecchie
|
||||
this.registerEvent(
|
||||
this.app.workspace.on('css-change', () => {
|
||||
if (this.settings.bgMode === 'auto') this.notifyBgModeChange();
|
||||
})
|
||||
);
|
||||
const themeObserver = new MutationObserver(() => {
|
||||
if (this.settings.bgMode === 'auto') this.notifyBgModeChange();
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue