Skip to content
This repository has been archived by the owner on Jan 5, 2023. It is now read-only.

Commit

Permalink
bugfix - change the editor mode (e.g. on acp >> page snippets)
Browse files Browse the repository at this point in the history
  • Loading branch information
patkon committed Apr 29, 2015
1 parent c9c092a commit bf3cdf7
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions acp/acp.php
Original file line number Diff line number Diff line change
@@ -193,19 +193,30 @@

<script type="text/javascript">

$(document).ready(function() {

/* toggle editor class [mceEditor|plain|aceEditor_html] */
var editor_mode = localStorage.getItem('editor_mode');
if(editor_mode == '') { editor_mode = 'optE1'; }
setAceEditor();
switchEditorMode(editor_mode);
$(document).ready(function() {

$('input[name="optEditor"]').on("change", function () {
var button = $("input[name='optEditor']:checked").val();
localStorage.setItem("editor_mode", button);
switchEditorMode(button);

if(button == 'optE1') {
tinymce.execCommand('mceAddEditor', false, "textEditor");
}

});


/* toggle editor class [mceEditor|plain|aceEditor_html] */
var editor_mode = localStorage.getItem('editor_mode');
if(!editor_mode) {
editor_mode = 'optE1';
localStorage.setItem("editor_mode", editor_mode);
}
setAceEditor();
switchEditorMode(editor_mode);



$("input[value="+editor_mode+"]").parent().addClass('active');

@@ -217,12 +228,9 @@ function switchEditorMode(mode) {
var divEditor = $('#aceCodeEditor');

if(mode == 'optE1') {
//tinymce.remove();
textEditor.addClass('mceEditor form-control');
textEditor.css("display","block");
tinymce.execCommand('mceAddEditor', false, "textEditor");
divEditor.remove();

}
if(mode == 'optE2') {
divEditor.remove();

0 comments on commit bf3cdf7

Please sign in to comment.