Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
TwoDBlock "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 theenterMode
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.Comment #2
koffer CreditAttribution: koffer commentedThanks! Now I understand the limitation of editor!
Comment #3
TwoD