File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77
88 <script type =" text/javascript" >
99 $ ().ready (function () {
10+ var theme = ' default' ;
11+
1012 var elf = $ (' #elfinder' ).elfinder ({
1113 // set your elFinder options here
1214 @if ($locale )
3941 default : ' https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme/manifests/material-gray.json' ,
4042 dark : ' https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme/manifests/material-default.json' ,
4143 },
42- theme: ' default' ,
44+ theme: theme,
45+ },
46+ function (fm , extraObj ) {
47+ fm .bind (' open' , function () {
48+ setElFinderColorMode ();
49+ });
4350 }).elfinder (' instance' );
4451
45- // elf.changeTheme('dark').storage('theme', 'dark');
52+ function isElfinderInDarkMode () {
53+ return typeof window .parent .colorMode !== ' undefined' && window .parent .colorMode .result === ' dark' ;
54+ }
55+
56+ function setElFinderColorMode () {
57+ theme = isElfinderInDarkMode () ? ' dark' : ' default' ;
58+ let instance = $ (' #elfinder' ).elfinder (' instance' );
59+ instance .changeTheme (theme).storage (' theme' , theme);
60+ }
61+
62+ if (typeof window .parent .colorMode !== ' undefined' ) {
63+ window .parent .colorMode .onChange (function () {
64+ setElFinderColorMode ();
65+ });
66+ }
4667 });
4768 </script >
4869
You can’t perform that action at this time.
0 commit comments