Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#27856 closed defect (bug) (invalid)

gallery shortcode adding empty parapraphs when switching between text and visual editor

Reported by: robinroelofsen's profile robinroelofsen Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.9
Component: Gallery Keywords:
Focuses: Cc:

Description

Added a WP gallery to my post/page using the gallery shortcode. Looks good.

When I switch to the text editor, an empty paragraph is added above and below the shortcode. Switching back adds another empty paragraph above and below the shortcode, etcetera.

In short, switching between the two editors keeps adding paragraphs.

Does so using the default TinyMCE editor and using TinyMCE Advanced plugin.

Change History (10)

#1 @nacin
10 years ago

Hi robinroelofsen, are you reporting this as a bug that is new in 3.9?

#2 @robinroelofsen
10 years ago

Yes, I do.

I know it was working in 3.8.3 since I was creating a manual on adding and changing galleries while making screenshots on a test site, and this problem would have definitely showed (and annoyed me).

So yes, this is a new bug.

#3 @azaozz
10 years ago

  • Keywords reporter-feedback added

Cannot reproduce this with or without the TinyMCE Advanced plugin. Some more details may help: what other plugins are enabled, does it happen in all browsers, etc.

#4 @robinroelofsen
10 years ago

Wieird, seems like the issue has gone away. Maybe it was a plugin that was the culprit.

The only things I still see is that you cannot just have a gallery on a post, there needs to be a line before it, otherwise it sdds a non-breaking space.

Thanks for looking into this. The issue can be closed for now.

#5 @robinroelofsen
10 years ago

  • Resolution set to invalid
  • Status changed from new to closed

#6 @SergeyBiryukov
10 years ago

  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted

#7 follow-up: @yammy
10 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

Hi!
I'm trying to preserve the html editor with no paragraphs and brs stripped or added by editor.

WP 3.9.2 tested on two different installs - same behavior

Using plugins: Preserved Html editor / PS Disable Auto Formatting together, because each alone doesn't remove the paragraphs completely.

It's almost working, except for [gallery] shortcodes:

<h1>foo</h1>[gallery][gallery] becomes <h1>foo</h1><p>[gallery]</p><p></p><p>[gallery]</p><p>

Testing with default theme or another doesn't matter. Testing in Firefox last version.

The issue happens only when switching from text tab to visual tab, them back to text tab (some javascript replacer?)

Tried wpautop, tried advanced tinymce, tried filtering content replacing <p> with regex, but nothing works.

I can show you my screen with teamviewer, if you need it, just ask.

Thank you!

[]s

Last edited 10 years ago by yammy (previous) (diff)

#8 in reply to: ↑ 7 @azaozz
10 years ago

Replying to yammy:

I'm trying to preserve the html editor with no paragraphs and brs stripped or added by editor.

Perhaps start by setting wpautop to false in the TinyMCE init array (or unsetting it). The [gallery] shortcode works as expected here: <h1>foo</h1>[gallery][gallery] turns into <h1>foo</h1><p>[gallery]</p><p>[gallery]</p> after running it through the JS wpautop().

#9 follow-up: @yammy
10 years ago

wpautop is disabled in functions already, and i think the preserving plugins also turns this off. For all other tags there are no more <p>s, only for [gallery] they remain displaying.

Why gallery is ignoring wpautop false from php? Does it have another <p> includer that ignores wpautop then? Where? ><

[]s

#10 in reply to: ↑ 9 @azaozz
10 years ago

  • Resolution set to invalid
  • Status changed from reopened to closed

Replying to yammy:

This doesn't happen with no plugins enabled, just re-tested.

Note: See TracTickets for help on using tickets.