Added option to disable WYSIWYG editor

This commit is contained in:
Andris Reinman 2016-04-11 21:35:04 -07:00
parent 58cce00829
commit 02c8fb4dda
20 changed files with 147 additions and 64 deletions

View file

@ -1,5 +1,6 @@
/* eslint-env browser */
/* globals $: false */
/* eslint no-invalid-this: 0, no-var: 0, prefer-arrow-callback: 0 */
/* globals $: false, ace: false */
'use strict';
@ -7,3 +8,16 @@ $('.summernote').summernote({
height: 400,
tabsize: 2
});
$('div.code-editor').each(function() {
var editor = ace.edit(this);
var textarea = document.querySelector('input[name=html]');
editor.setTheme('ace/theme/chrome');
editor.getSession().setMode('ace/mode/html');
editor.getSession().setUseWrapMode(true);
editor.getSession().setUseSoftTabs(true);
editor.getSession().on('change', function() {
textarea.value = editor.getSession().getValue();
});
textarea.value = editor.getSession().getValue();
});