4 posts by 2 authors in: Forums > CMS Builder
Last Post: April 18   (RSS)

By rez - April 17 - edited: April 17

Hi. I know if you use shift-enter you can avoid double lines in the text editor.  However, a client is complaining that this is weird / not normal.

Is there a way to stop all double lines? 

If I understand correctly, it's actually wrapping lines in paragraph tags when you press enter. I do see this when inspecting the code in Chrome. 

I added the following to a wysiwyg_custom.css I created (found this solution in google) but the lines when I press enter that are wrapped in <p> tags, still have more space than the text lines within a paragraph. They still appear as double lines.

/* -----------------------------------------------------------------------------------
   Add CSS rules for your custom 'style_formats' classes here.
   See the following for an example.
   ----------------------------------------------------------------------------------- */
p {
    margin: 0;
    padding: 0;
    border: 0;
}

Hi rez,

You're correct - by default in the WYSIWYG editor <enter> creates a paragraph break, whereas <shift+enter> creates a line break. From what I can see, the CSS you're using there should remove the spacing from around the paragraph elements; it's possible that the stylesheet is cached, so the first thing I'd check is if clearing your cache makes a difference.

Another option is to alter the behaviour, which is possible through TinyMCE configuration: https://www.tiny.cloud/docs-3x/reference/configuration/Configuration3x@force_br_newlines/

The configuration options you'd want to add to your wysiwyg_custom.php file are:

    force_br_newlines : true,
    force_p_newlines : false,
    forced_root_block : '',

This will reverse the default, so that <enter> creates a line break and <shift+enter> creates a paragraph break. 

Let me know if this helps with the issue, or if you have any questions!

Thanks,

Daniel
PHP Programmer
interactivetools.com

By rez - April 17 - edited: April 17

Thanks Daniel. I used your configuration and removed my css since Paragraphs are now Shit-Enter. I explained this to the client but I think she will just use Enter / line breaks every time.

I see that TinyMCE  suggests not to make this change and that Microsoft Word and others use Paragraph tags when you press enter. I'll have to check that out, I don't use Word much except when opening a customers file but it seems weird to me as well. I would expect one line when pressing enter and have always thought the default was strange.

Anyway, I think I'm good and my customer will probably get to this tomorrow and hopefully be happy. Thanks!