Thursday, 15 May 2014

javascript - CKEditor - Only allow image to be 100% width when previewing -



javascript - CKEditor - Only allow image to be 100% width when previewing -

when using ckeditor , inserting image in editor, image displayed @ real size.

so if ckeditor 500px wide, , image 800, image displayed @ 800 wide , therefor there scroll bar in ckeditor.

is there way create inserted image show in editor width of editor itself?

thanks!

there 2 possible solutions this:

a) alter image widget, generates image tag specific class, eg. "imagepointer" , then, in widget, add together responding css, like:

ckeditor.plugins.add( 'image', { onload: function( editor ) { ckeditor.addcss( '.imagepointer {max-width:100%;}') } }

b) in contents.css file add together rule image tag:

img {max-width:100%}

javascript ckeditor text-editor

No comments:

Post a Comment