Dont try to load CodeMirror on non-existent DOM element

This commit is contained in:
Riyyi
2021-03-03 19:56:36 +01:00
parent a8056b66cc
commit 6f81c3472e
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
<?php
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://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<?php if ($this->adminSection) { ?>
+3 -3
View File
@@ -104,13 +104,13 @@ $(document).ready(function() {
// Enable CodeMirror Editor
$.fn.codeMirror = function() {
if (this.length === 0) return;
editor = CodeMirror.fromTextArea($(this)[0], editorOptions);
editor.setSize('100%', '500');
registerEditorCopy();
return editor;
}
$('textarea#syntax-code').codeMirror().setOption('mode', 'text/x-csrc');
$('textarea#syntax-code').codeMirror();
// Enable WYSIWYG Editor
$('textarea#summernote').summernote({