Hi. I have this problem. Im using wsiwyg module with ckeditor. I add the styles button and edit the list to show only some few styles like h2, h3 etc. I want to allow my client to apply this styles but when Itry to apply it in a word or row the editor apply the style to all text in field! How can I fix it? or there is another way to let the final user apply some of this style without using code?

Comments

TwoD’s picture

Block "styles" are applied to paragraphs (in practice a <p>...</p> gets replaced by say <h2>...</h2>). If you have configured the editor to use linebreaks (<br />) instead of paragraphs when hitting [Enter], all you have is likely one huge paragraph.

There's currently no GUI option to toggle that behavior for CKEditor, but perhaps a module implements hook_wysiwyg_editor_settings_alter() and changes the enterMode setting?

That's the only reason I can think of as the cause for header tags being applied to all of the content, unless you have 3rd party plugins which affects this some way.

Inline "styles", like setting background color or making something bold can either be applied directly to a whole paragraph, or a section of it (<p style="font-weight:bold;">...<span style="background:red;">...</span>...</p>). To make that work you can't have the builtin "Limit allowed HTML tags"-filter enabled for your text format as it always removes style attributes when rendering your content. I would instead use the filter provided by WYSIWYG Filter module. It takes a bit longer to setup, but gives you the ability to whitelist each individual style property.

koffer’s picture

Thanks! Now I understand the limitation of editor!

TwoD’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.