Skip to content

Commit fee4a9f

Browse files
authored
Updating Ace Editor for Dark Mode
1 parent 21b28b9 commit fee4a9f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

resources/views/components/config/advanced-config.blade.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
<p>Allows editing the frontend of your site. Amongst other things, this file allows customization of:<br>
1+
<p>Allows editing the frontend of your site. Amongst other things, this file allows customization of:<br>
22
Home Page, links, titles, Google Analytics and meta tags.</p>
33
<form action="{{ route('editAC') }}" method="post">
44
@csrf
55
<div class="form-group">
66
<label>Advanced Configuration file.</label>
77
<textarea style="width:100%;display:none;" class="form-control" name="AdvancedConfig" rows="280">{{ file_get_contents('config/advanced-config.php') }}</textarea>
8-
<div id="editor" style="width:100%; height:<?php echo count(file('config/advanced-config.php')) * 24 + 15;?>px;" class="form-control" name="AdvancedConfig" rows="280">{{ file_get_contents('config/advanced-config.php') }}</div>
8+
<div id="editor" style="width:100%; height:<?php echo count(file('config/advanced-config.php')) * 24 + 15;?>px; background-color:transparent !important;" class="form-control border-1 border-light" name="AdvancedConfig" rows="280">{{ file_get_contents('config/advanced-config.php') }}</div>
99
</div>
1010
<button type="submit" class="mt-3 ml-3 btn btn-info">Save</button>
1111
<a class="mt-3 ml-3 btn btn-primary confirmation" href="{{url('/panel/advanced-config?restore-defaults')}}">Restore defaults</a>
@@ -24,7 +24,13 @@
2424
<script src="{{ asset('studio/external-dependencies/ace.js') }}" type="text/javascript" charset="utf-8"></script>
2525
<script>
2626
var editor = ace.edit("editor");
27-
editor.setTheme("ace/theme/xcode");
27+
//if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
28+
if(!$('#toggle-switch').is(':checked')){
29+
// dark mode
30+
editor.setTheme("ace/theme/tomorrow_night");
31+
} else {
32+
editor.setTheme("ace/theme/xcode");
33+
}
2834
editor.getSession().setMode("ace/mode/javascript");
2935
editor.session.setUseWorker(false);
3036
</script>

0 commit comments

Comments
 (0)