File tree Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Original file line number Diff line number Diff line change 7
7
8
8
<script type =" text/javascript" >
9
9
$ ().ready (function () {
10
+ var theme = ' default' ;
11
+
10
12
var elf = $ (' #elfinder' ).elfinder ({
11
13
// set your elFinder options here
12
14
@if ($locale )
39
41
default : ' https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme/manifests/material-gray.json' ,
40
42
dark : ' https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme/manifests/material-default.json' ,
41
43
},
42
- theme: ' default' ,
44
+ theme: theme,
45
+ },
46
+ function (fm , extraObj ) {
47
+ fm .bind (' open' , function () {
48
+ setElFinderColorMode ();
49
+ });
43
50
}).elfinder (' instance' );
44
51
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
+ }
46
67
});
47
68
</script >
48
69
You can’t perform that action at this time.
0 commit comments