File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
src/django_smartbase_admin/static/sb_admin/src/js Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -126,7 +126,7 @@ class Main {
126126 picker . addEventListener ( 'change' , ( e ) => {
127127 if ( e . target . value ) {
128128 document . documentElement . setAttribute ( 'data-theme' , e . target . value )
129- this . switchBodyColorSchemeClass ( )
129+ this . switchBodyColorSchemeClass ( true )
130130 this . switchCKEditorTheme ( )
131131 return
132132 }
@@ -136,12 +136,18 @@ class Main {
136136 this . switchCKEditorTheme ( )
137137 }
138138
139- switchBodyColorSchemeClass ( ) {
139+ switchBodyColorSchemeClass ( fireEvents = false ) {
140140 if ( this . isDarkMode ( ) ) {
141141 document . body . classList . add ( 'dark' )
142+ if ( fireEvents ) {
143+ document . body . dispatchEvent ( new CustomEvent ( 'color-scheme-change' , { detail : 'dark' } ) )
144+ }
142145 return
143146 }
144147 document . body . classList . remove ( 'dark' )
148+ if ( fireEvents ) {
149+ document . body . dispatchEvent ( new CustomEvent ( 'color-scheme-change' , { detail : 'light' } ) )
150+ }
145151 }
146152
147153 initInlines ( target ) {
You can’t perform that action at this time.
0 commit comments