Browse Source

Dont try to load CodeMirror on non-existent DOM element

master
Riyyi 4 years ago
parent
commit
6f81c3472e
  1. 2
      app/views/partials/script.php
  2. 6
      public/js/app.js

2
app/views/partials/script.php

@ -1,7 +1,7 @@
<?php <?php
use App\Classes\Config; use App\Classes\Config;
?> ?>
<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script> <script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha384-vk5WoKIaW/vJyUAd9n/wmopsmNhiy+L2Z+SBxGYnUkunIxVxAv/UtMOhba/xskxh" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<?php if ($this->adminSection) { ?> <?php if ($this->adminSection) { ?>

6
public/js/app.js

@ -104,13 +104,13 @@ $(document).ready(function() {
// Enable CodeMirror Editor // Enable CodeMirror Editor
$.fn.codeMirror = function() { $.fn.codeMirror = function() {
if (this.length === 0) return;
editor = CodeMirror.fromTextArea($(this)[0], editorOptions); editor = CodeMirror.fromTextArea($(this)[0], editorOptions);
editor.setSize('100%', '500'); editor.setSize('100%', '500');
registerEditorCopy(); registerEditorCopy();
return editor;
} }
$('textarea#syntax-code').codeMirror().setOption('mode', 'text/x-csrc'); $('textarea#syntax-code').codeMirror();
// Enable WYSIWYG Editor // Enable WYSIWYG Editor
$('textarea#summernote').summernote({ $('textarea#summernote').summernote({

Loading…
Cancel
Save