Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions tinyfilemanager.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
// highlight.js style
// for dark theme use 'ir-black'
$highlightjs_style = 'vs';
$highlightjs_style_dark = 'vs2015';

// Enable ace.js (https://ace.c9.io/) on view's page
$edit_files = true;
Expand Down Expand Up @@ -176,6 +177,7 @@
'css-dropzone' => '<link href="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.9.3/min/dropzone.min.css" rel="stylesheet">',
'css-font-awesome' => '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" crossorigin="anonymous">',
'css-highlightjs' => '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/' . $highlightjs_style . '.min.css">',
'css-highlightjs-dark' => '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/' . $highlightjs_style_dark . '.min.css">',
'js-ace' => '<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.32.2/ace.js"></script>',
'js-bootstrap' => '<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>',
'js-dropzone' => '<script src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.9.3/min/dropzone.min.js"></script>',
Expand Down Expand Up @@ -4028,7 +4030,7 @@ function fm_show_header()
<?php print_external('css-bootstrap'); ?>
<?php print_external('css-font-awesome'); ?>
<?php if (FM_USE_HIGHLIGHTJS && isset($_GET['view'])): ?>
<?php print_external('css-highlightjs'); ?>
<?php print_external(FM_THEME == 'dark' ? 'css-highlightjs-dark' : 'css-highlightjs'); ?>
<?php endif; ?>
<script type="text/javascript">
window.csrf = '<?php echo $_SESSION['token']; ?>';
Expand Down Expand Up @@ -4727,6 +4729,12 @@ function fm_show_header()
form.dropzone {
border-color: #79755e;
}

.theme-dark .file-preview-content pre {
background-color: #101518;
color: #CFD8DC;
padding: 1rem;
}
</style>
<?php endif; ?>
</head>
Expand Down Expand Up @@ -5202,7 +5210,7 @@ function confirmDialog(e, id = 0, title = "Action", content = "", action = null)
path: "ace/mode/<?php echo $ext; ?>",
inline: true
});
//editor.setTheme("ace/theme/twilight"); // Dark Theme
editor.setTheme("ace/theme/<?php echo FM_THEME == 'dark' ? 'twilight' : 'textmate'; ?>");
editor.setShowPrintMargin(false); // Hide the vertical ruler
function ace_commend(cmd) {
editor.commands.exec(cmd, editor);
Expand Down