WebsiteBaker Community Forum

WebsiteBaker Support (2.12.x) => Modules => Topic started by: CodeALot on May 18, 2019, 07:55:01 PM

Title: CKEditor: Change the height of the editor
Post by: CodeALot on May 18, 2019, 07:55:01 PM
From ckeditor/wb_config/wb_config.js:

Code: [Select]
   // The standard height and width of CKEditor in pixels.
    config.height           = '600';
    config.width            = '100%';


Whatever I put there, it doesn't have any effect. Once I use the  "resize"-arrow at the lower-right corner, the width also jumps back to about 80% of the window.

Any suggestions? I think the standard height of CKEditor is way too small, that's why I want to change it...
Title: Re: CKEditor: Change the height of the editor
Post by: Gast on May 19, 2019, 02:13:56 PM
Quote
Any suggestions? I think the standard height of CKEditor is way too small, that's why I want to change it..

the values from editor height & width comes from the editor-call in the modules

here an example from modules/wysiwyg/modify.php

<?php
echo show_wysiwyg_editor('content'.$section_id,'content'.$section_id,$content,'100%','258px', false);
?>

inside of the function show_wysiwyg_editor() it works at $height / $width
If no height or width defined in the editor-call, the function use the default height & width in the show_wysiwyg_editor() (modules/ckeditor/include.php)
you can change the height & width only with the changing of $height / $width in modules/ckeditor/include.php before this lines ( ~ Ln 360), maybe with this line 
Code: [Select]
$height = '400px';

Quote
$ckeditor->config['height'] = $height;
$ckeditor->config['width']  = $width;

or with the changing of
$ckeditor->config['height'] &&  $ckeditor->config['width'] behind this lines


another solution is wysiwyg_admin (see attachement)
wysiwyg-admin is a admintool. you can change some base settings for the used wysiwyg editor like width, height, uicolor. you can also define here font and colors for the select-fields in the editor, so that the user can only select the defined font and font-colors (if he dont work in the source-code..)
the module works in former ckeditor-versions, but in the actual version, the order is a little bit wrong in modules/ckeditor/include.php, so, that wysiwyg_admin doesn't work for width & height, but i'll talk with dietmar about this, so he can change it for the next wb-version (i hope...)

but here a fix for it
cut off these line here in modules/ckeditor/include.php ~ Ln 360

Quote
$ckeditor->config['height'] = $height;
$ckeditor->config['width']  = $width;

and move it ~Ln 333, before the script ask for the wysiwyg_admin_modul e. it start's with this line

Code: [Select]
if (isset($database) && $ckeditor->wysiwyg_admin_exists ) {
in this part, the script read the definitions from the wysiwyg-admin-module and write the config-keys new, but this will be overwritten from this two lines in the top
Quote
$ckeditor->config['height'] = $height;
$ckeditor->config['width']  = $width;

you have also to activate the wysiwyg-admin-module in modules/ckeditor/include.php ~ Ln 156  (is deactivated  with a double slash in the front, remove this double slash)
Code: [Select]
        $ckeditor->looking_for_wysiwyg_admin( $database );
dont forget: if you change the width & height with the admintool wysiwyg_admin, it works globale in wb, that means: also the wysiwyg_editor in news module has then the new height & width.
P.S.: wysiwyg_admin doesnt work in the editor in WB-Options / WB_Settings, for this editor you have a own setting in DefaultTheme

Screenshot from WysiwygAdmin ->https://i.gyazo.com/eafd3f1570ddcb91e10f4279bf6e1411.png
Screenshot from the result -> https://i.gyazo.com/4c10a448ff10209155053c66e0864e69.png
Title: Re: CKEditor: Change the height of the editor
Post by: CodeALot on May 19, 2019, 02:53:10 PM
Thanks a million again. Problem solved! :-)  (Y) (Y)