Support » Plugin: Preserved HTML Editor Markup Plus » Adds empty paragraphs when switching tabs in text widget

  • ResolvedPlugin Contributor Azragh

    (@azragh)


    I just recognized that in text widgets the plugin doesn’t work as expected – it seems like wpautop / wptexturize is still active here. If you enter two or more paragraphs in visual mode, it adds a linebreak after the closing </p> tags, instead of writing everything in one line. This repeats when switching between the visual and text tab, and the so generated empty lines get converted into <p>&nbsp;</p> every time.

    I’ve tried to fix it with remove_filter( 'widget_text_content', 'wpautop' ); and remove_filter( 'widget_text_content', 'wptexturize' ); in my custom themes, but had no success. Tested with WordPress 5.3, Twenty twenty theme and no other plugins active too – still an issue.

    As I’m using this plugin on every WordPress installation since about 8 years and had no problems instead of that, I would love to get rid of that issue. Maybe a good reason to remove that “not updated in 4 years” notice too? =)

    Edit: I’ve set the “new line on enter” setting to paragrahps btw.

    • This topic was modified 1 month, 1 week ago by Azragh.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author J-Ro

    (@j-ro)

    Hi there, I’m guessing text widgets work through a different system than the main editor, hence the trouble here. The code for the plugin is on github: https://github.com/j-ro/Preserved-HTML-Editor-Markup

    If you’re up for making a patch if you can figure out how to make it work, happy to merge it and get an update pushed!

    Plugin Contributor Azragh

    (@azragh)

    So I did. =]

    I simply replaced $('body') on line 249 in admin.js to $('body:not(.widgets-php)'), which prevents the whole formatting stuff from running over widgets. I know it’s kind of a dirty fix, but I think there shouldn’t be any issues with it. Developers should use the HTML widget anyway, and clients are not likely the ones to switch from visual to text tab to edit code (in fact that’s why I didn’t notice the issue earlier). Oh btw – in the customizer screen the plugin doesn’t run over the widgets content anyway.

    Plugin Author J-Ro

    (@j-ro)

    Thanks! I’ll try to find some time to build the plugin for a release (and remember how to do that!) soon.

    Plugin Author J-Ro

    (@j-ro)

    Updated and released and tagged you as a contributor. Thank you!

    Plugin Contributor Azragh

    (@azragh)

    Thank you too! I’m glad that I could help. =)

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.