Commits

funkybob  committed 34f1e6d

Fix guards for missing scripts
Improve codemirror settings

  • Participants
  • Parent commits 37558ed

Comments (0)

Files changed (3)

File gnocchi/cms/static/gnocchi/ckeditor_page.js

 django.jQuery(document).ready(function () {
-	if ( document.CKEDITOR === undefined ) { return; }
-	CKEDITOR.replace('id_content', {
-		shiftEnterMode: CKEDITOR.ENTER_BR
-	});
+	try {
+		CKEDITOR.replace('id_content', {
+			shiftEnterMode: CKEDITOR.ENTER_BR
+		});
+	}
 });
 

File gnocchi/cms/static/gnocchi/codemirror_stylesheet.js

 django.jQuery(document).ready(function () {
-        if( document.CodeMirror === undefined ) { return; }
-	editor = CodeMirror.fromTextArea(document.getElementById('id_content'), {
-		lineNumbers: true,
-		mode: 'text/css'
-	});
-	django.jQuery('#id_content').after('<button type="button" class="button" title="Reindent" onClick="reindent();">Reindent</button>');
+	try {
+		editor = CodeMirror.fromTextArea(document.getElementById('id_content'), {
+			lineNumbers: true,
+			lineWrapping: true,
+			autoClearEmptyLines: true,
+			matchBrackets: true,
+			mode: 'text/css'
+		});
+		django.jQuery('#id_content').after('<button type="button" class="button" title="Reindent" onClick="reindent();">Reindent</button>');
+	}
 });

File gnocchi/cms/static/gnocchi/codemirror_template.js

 django.jQuery(document).ready(function () {
-        if( document.CodeMirror === undefined ) { return; }
-	editor = CodeMirror.fromTextArea(document.getElementById('id_content'), {
-		lineNumbers: true,
-		mode: 'text/html'
-	});
-	django.jQuery('#id_content').after('<button type="button" class="button" title="Reindent" onClick="reindent();">Reindent</button>');
+	try {
+		editor = CodeMirror.fromTextArea(document.getElementById('id_content'), {
+			lineNumbers: true,
+			lineWrapping: true,
+			autoClearEmptyLines: true,
+			matchBrackets: true,
+			mode: 'text/html'
+		});
+		django.jQuery('#id_content').after('<button type="button" class="button" title="Reindent" onClick="reindent();">Reindent</button>');
+	}
 });