Update tinyfilemanager.php

enabled ace editor live autocomplete feature
This commit is contained in:
good2see 2023-07-11 10:56:31 +03:00 committed by GitHub
parent eb8f3d80bc
commit d71fc176bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -156,6 +156,7 @@ $external = array(
'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.6.0/styles/' . $highlightjs_style . '.min.css">',
'js-ace' => '<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.13.1/ace.js"></script>',
'js-aceext-language_tools' => '<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ext-language_tools.js"></script>',
'js-bootstrap' => '<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-OERcA2EqjJCMA+/3y+gxIOqMEjwtxJY7qPCqsdltbNJuaOe923+mo//f6V8Qbsw3" crossorigin="anonymous"></script>',
'js-dropzone' => '<script src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.9.3/min/dropzone.min.js"></script>',
'js-jquery' => '<script src="https://code.jquery.com/jquery-3.6.1.min.js" integrity="sha256-o88AwQnZB+VDvE9tvIXrMQaPlFFSUTR+nldQm1LuPXQ=" crossorigin="anonymous"></script>',
@ -4163,10 +4164,18 @@ $isStickyNavBar = $sticky_navbar ? 'navbar-fixed' : 'navbar-normal';
$ext = $ext == "js" ? "javascript" : $ext;
?>
<?php print_external('js-ace'); ?>
<?php print_external('js-aceext-language_tools'); ?>
<script>
ace.require("ace/ext/language_tools");
var editor = ace.edit("editor");
editor.getSession().setMode( {path:"ace/mode/<?php echo $ext; ?>", inline:true} );
//editor.setTheme("ace/theme/twilight"); //Dark Theme
// enable autocompletion and snippets
editor.setOptions({
enableBasicAutocompletion: true,
enableSnippets: true,
enableLiveAutocompletion: true
});
editor.setShowPrintMargin(false); // Hide the vertical ruler
function ace_commend (cmd) { editor.commands.exec(cmd, editor); }
editor.commands.addCommands([{