diff options
author | Minteck <nekostarfan@gmail.com> | 2021-08-24 15:38:16 +0200 |
---|---|---|
committer | Minteck <nekostarfan@gmail.com> | 2021-08-24 15:38:16 +0200 |
commit | 529ffcbfa97ab51a64a97f6dff08aeb2bc0cc105 (patch) | |
tree | 8a50c30271b9b328cde0d907b1441f2dabdc341b /Neutron-trunk/resources/private/CodeEditor.php | |
parent | 15e4724761c50b30803df1811a525c85058f70bf (diff) | |
download | electrode-529ffcbfa97ab51a64a97f6dff08aeb2bc0cc105.tar.gz electrode-529ffcbfa97ab51a64a97f6dff08aeb2bc0cc105.tar.bz2 electrode-529ffcbfa97ab51a64a97f6dff08aeb2bc0cc105.zip |
Update
Diffstat (limited to 'Neutron-trunk/resources/private/CodeEditor.php')
-rw-r--r-- | Neutron-trunk/resources/private/CodeEditor.php | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/Neutron-trunk/resources/private/CodeEditor.php b/Neutron-trunk/resources/private/CodeEditor.php new file mode 100644 index 0000000..9a915ed --- /dev/null +++ b/Neutron-trunk/resources/private/CodeEditor.php @@ -0,0 +1,44 @@ +<p><input type="checkbox" name="wordwrap" id="wordwrap" onchange="ace.edit("editor").getSession().setUseWrapMode(document.getElementById('wordwrap').checked);" checked><label for="wordwrap"><?= $lang["editor"]["wrap"] ?></label></p> + +<div id="editor"><?php echo(str_ireplace(">", ">", str_ireplace("<", "<", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pages/" . $currentSlug)))) ?></div> + +<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.6/ace.js" type="text/javascript" charset="utf-8"></script> +<script> + var codeeditor = ace.edit("editor"); + <?php + + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/darktheme-enabled")) { + echo("ace.edit(\"editor\").setTheme('ace/theme/monokai');"); + } + + ?> + codeeditor.session.setMode("ace/mode/html"); + codeeditor.session.setUseWrapMode(true); + function loadAce() {} +</script> +<script>setInterval(() => {ace.edit("editor").session.setMode("ace/mode/html");}, 100)</script> +<div style="text-align: center;"> + <a onclick="updatePageHTML();" class="mdc-button mdc-button--raised"> + <div class="mdc-button__ripple"></div> + <i class="material-icons-outlined mdc-button__icon" aria-hidden="true">publish</i> + <span class="mdc-button__label"><?= $lang["editor"]["publish"] ?></span> + </a> + <a onclick="updatePageHTMLNoBack();" class="mdc-button mdc-button--outlined"> + <div class="mdc-button__ripple"></div> + <i class="material-icons-outlined mdc-button__icon" aria-hidden="true">save</i> + <span class="mdc-button__label"><?= $lang["editor"]["publishnoback"] ?></span> + </a> +</div> +<script> + window.onbeforeunload = function (e) { + e = e || window.event; + + // For IE and Firefox prior to version 4 + if (e) { + e.returnValue = "<?= $lang["editor"]["exit"] ?>"; + } + + // For Safari + return "<?= $lang["editor"]["exit"] ?>"; + }; +</script>
\ No newline at end of file |