WebsiteBaker Support (2.12.x) > Modules

CKEditor - dimensions of images

(1/2) > >>

CodeALot:
In WB 2.21.2 there is a CKEditor active that handles images different than before, I think.
 
Images inserted inline get automatically

--- Code: ---class="img-responsive"
--- End code ---

Which is fine, since I can define that class myself.

Now before, CKeditor would add the HTML-tags

--- Code: ---width="1920" height="800"
--- End code ---

The new CKEditor however, now adds:

--- Code: ---style="width:1920px; height:800px;"
--- End code ---

And since that's after the class-declaration, the class img-reponsive gets overruled.
 
I do NOT want CKEditor to add image-dimensions at all. I can't find where I have to change that though.... Anyone?

crnogorac081:
a droplet can be made I will send you the code later

dbs:
Or maybe a piece of jquery.

--- Code: ---$('.img-responsive').removeAttr('style');
--- End code ---

jacobi22:
only, to say it... the output from width & height as inline-style is part of the new contentFilter-Rules in CKeditor and has nothing to do with WB

to change the output to the old format with extra width & height instead of a inline-style like style="width:1920px; height:800px;", go into
/modules/ckeditor/wb_config/wb_ckconfig.js ~ Line 254

and change the original code

--- Code: ---config.disallowedContent = 'script; *[on*]';
--- End code ---

to

--- Code: ---config.disallowedContent = 'script; *[on*];img{width,height}';
--- End code ---

add as next line this

--- Code: ---config.extraAllowedContent = 'img[width,height]';
--- End code ---

explanation for element-definition
element-name[attribute]{styles}classes

the code remove the style {...} from the img-element and add the attributes [...] width + height

P.S.1: it is very important, to close all CKeditor-Session after the changes (better: the complete browser) and clear the browser cache
or (at minimum) unload the wb_ckeditor.js from the cache

P.S.2: if you copy this file /modules/ckeditor/wb_config/wb_ckconfig.js into the root folder of your used frontend-template(s), the file will not be overwritten in the next upgrade of the editor

important hint: works only in ckeditor > Version 4.4 (not in FCKeditor or older ckeditor versions)

if you work with more then one frontend templates, copy this file into every used frontend-template-folder

IMPORTANT: to activate the "private" wb_ckconfig.js in the templates folder(s), set in /modules/ckeditor/include.php
the switch $bWbConfigSetting to true  (Ln 81)



CodeALot:
Thanks a lot! Your support is highly appreciated!

Navigation

[0] Message Index

[#] Next page

Go to full version