Commit 8f444815 authored by Tobias Munk's avatar Tobias Munk

updated ckeditor replacement

parent d69b02f7
...@@ -168,26 +168,44 @@ JS; ...@@ -168,26 +168,44 @@ JS;
</div> </div>
<?php <?php
$js = <<<JS $js = <<<JS
setTimeout(function(){
CKEDITOR.replaceAll();
for (var i in CKEDITOR.instances) {
CKEDITOR.instances[i].on('change', function() {
this.updateElement()
for (var name in editor.editors) {
editor.editors[name].refreshValue();
editor.editors[name].onChange(true);
}
}); editor.on('ready',function()
{
CKEDITOR.config.height = '400px';
CKEDITOR.config.toolbar = [
['Styles','Format'], ['Link','Image','Table','-','NumberedList','BulletedList','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], ['Source'],
'/',
['Bold','Italic','Underline','StrikeThrough','-','RemoveFormat','-','Undo','Redo','-', 'Paste', 'PasteText', 'PasteFromWord','-','Cut','Copy','Find','Replace','-','Outdent','Indent','-','Print']
] ;
CKEDITOR.replaceAll();
for (var i in CKEDITOR.instances) {
CKEDITOR.instances[i].on('change', function() {
this.updateElement()
for (var name in editor.editors) {
console.log(name);
editor.editors[name].refreshValue();
editor.editors[name].onChange(true);
}
});
}
} }
}, 10); );
JS; editor.on('change',function() {
console.log('change');
$this->registerJs($js, \yii\web\View::POS_READY) $.each($('textarea'),function(key, obj){
// workaround: visible textareas have not been replaced yet
if ($(obj).is(":visible")) {
CKEDITOR.replace(obj);
}
});
});
JS;
$this->registerJs($js, \yii\web\View::POS_READY)
?> ?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment