• Resolved Dean

    (@deanbolton)


    Hi,

    I have installed a clean WordPress instance and the latest version of this plugin. In testing the plugins functionality, I notice that the behavior of the editor in GCB is different to the editor in the pages/posts screens.

    If I enter a newline in the editor on the normal page/post screen, the content is rendered as expected.

    If I enter a newline in the editor on the GCB screen, the content is all rendered on the one line, i.e. line spacings shown in the editor screen are not honored.

    This is illustrated in the below screenshots:

    GCB Editor
    Page Editor
    Displayed Page

    When I enter a newline in the editor of the GCB editing screen I expect the same behavior as when entering a newline in the page/post editing screens.

    I see that I am not the first to report this – https://ww.wp.xz.cn/support/topic/paragraphs-not-inserted.

    In the post linked above Coen suggested a fix, but I don’t want to change the plugins core code as this will be lost with any future updates.

    Can you suggest a better option to make the functionality of the GCB editor and the page/post editors consistent?

    Thank you, Dean.

    https://ww.wp.xz.cn/plugins/global-content-blocks/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Dave Liske

    (@delmarliske)

    Hi Dean, I apologize for the delay in responding, I’ve been laptopless for a couple days … Go ahead and make that change in your version, beginning with line 520 in the Class file:

    array(<br />
         "wpautop"	=>	false,//we do not need auto paragraphs<br />
    )

    This is how the code reads now for the next update, so you’re safe to implement this. The comment in that code has me wondering if this property was set to False at some point.

    I’ll tell you what though, the use of TinyMCE in the plugin has always bothered me. I was unaware of the thread you pointed to, having only taken over the plugin a couple months back, and have gotten into the habit of editing in text and then switching to a browser tab displaying the result. Apparently the plugin needs a complete rebuild for security reasons (see Editors cannot edit blocks). Once I get to working on a version 3.0 update to solve that issue, I’m seriously considering removing TinyMCE altogether. There are too many autocorrect issues with it for my liking, so I would add my recommended workflow to the FAQ for use with a simple textarea.

    Plugin Author Dave Liske

    (@delmarliske)

    Dean, I did an update a bit ago to 2.1.5, showing compatability for WP 4.4 and implementing your requested change. Please let me know how that works for you.

    Thread Starter Dean

    (@deanbolton)

    Hi Dave,

    Thank you for your response and efforts. I have applied the latest update and can see your changes.

    This will be good for future saves, but content already saved will have the formatting already removed.

    As a workaround, I have added the below to my theme’s function file (in case it’s useful to someone else):

    /**
     * When content is stored using Global Content Blocks (GCB) the paragraph <p> and
     * break <br /> tags are not included or rendered on display. This results in the
     * content from a single block appearing on the one line.
     *
     * The below filter will add the proper line breaks to ensure the display is
     * what's expected and consistent with the usual WordPress editor behavious.
     */
    add_filter('gcb_block_output', 'alter_block_output');
    function alter_block_output($value) {
    	$new_value = nl2br($value);
    	return $new_value;
    }

    Thanks again, Dean.

    Plugin Author Dave Liske

    (@delmarliske)

    Hi Dean … I’m adding this and a couple other things to the FAQ for the next release. Thanks for the suggestion!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Paragraphs not inserted (continued)’ is closed to new replies.