I am trying to use ckeditor with cakephp and I've written a helper. The problem is when I enter some line breaks or add checkboxes (or other html elements) with CKeditor, the editor crashes the next time I edit the content. Firefox returns the following error:
SyntaxError: unterminated string literal
and highlights }).setData("<p>test</p>
from the section below:
<script type="text/javascript">CKEDITOR.replace('data[Template][body]',{
toolbar: '',
toolbarGroups: '',
width: 950,
height: 500
}).setData("<p>test</p>
<p> </p>
<p>test</p>");</script>
Here is the code in the cake helper:
$code = "CKEDITOR.replace('{$id}',{
{$options['toolbar']},
{$options['toolbarGroups']},
width: {$options['width']},
height: {$options['height']}
}).setData('" . trim($value). "');";
return $this->Javascript->codeBlock($code);
Any help is greatly appreciated.