@@ -26,6 +26,7 @@ import padutils,{Cookies} from "./pad_utils";
2626const padcookie = require ( './pad_cookie' ) . padcookie ;
2727const Ace2Editor = require ( './ace' ) . Ace2Editor ;
2828import html10n from '../js/vendors/html10n'
29+ const skinVariants = require ( './skin_variants' ) ;
2930
3031const padeditor = ( ( ) => {
3132 let pad = undefined ;
@@ -86,11 +87,22 @@ const padeditor = (() => {
8687 $ ( '#delete-pad' ) . on ( 'click' , ( ) => {
8788 if ( window . confirm ( html10n . get ( 'pad.delete.confirm' ) ) ) {
8889 pad . collabClient . sendMessage ( { type : 'PAD_DELETE' , data :{ padId : pad . getPadId ( ) } } ) ;
89- // redirect to home page after deletion
90+ // redirect to home page after deletion
9091 window . location . href = '/' ;
9192 }
9293 } )
9394
95+ // theme switch
96+ $ ( '#theme-switcher' ) . on ( 'click' , ( ) => {
97+ if ( skinVariants . isDarkMode ( ) ) {
98+ skinVariants . setDarkModeInLocalStorage ( false ) ;
99+ skinVariants . updateSkinVariantsClasses ( [ 'super-light-toolbar super-light-editor light-background' ] ) ;
100+ } else {
101+ skinVariants . setDarkModeInLocalStorage ( true ) ;
102+ skinVariants . updateSkinVariantsClasses ( [ 'super-dark-editor' , 'dark-background' , 'super-dark-toolbar' ] ) ;
103+ }
104+ } )
105+
94106 // Language
95107 html10n . bind ( 'localized' , ( ) => {
96108 $ ( '#languagemenu' ) . val ( html10n . getLanguage ( ) ) ;
0 commit comments