Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random <p> and </p> tags in post editor pages #5

Closed
johnclause opened this issue Jan 14, 2015 · 3 comments
Closed

Random <p> and </p> tags in post editor pages #5

johnclause opened this issue Jan 14, 2015 · 3 comments

Comments

@johnclause
Copy link
Member

Theme: any, "Twenty Fifteen" would do.
Plugins: can be qTranslate-X only, I do not think it is a compatibility problem with other plugins.
At least two languages, for example, en and de, to be specific.

Steps to reproduce the problem:

  • Add New Post
  • Title: any, it is not a subject of the problem
  • Put Editor in "Text" mode
  • Description: type EN for "en" language and DE for "de", just as an example, any text would do.
  • Publish.
  • Go to database and see that 'post_content' field of that post has <!--:en-->EN<!--:--><!--:de-->DE<!--:-->, which is normal.
  • Open that post for editing.
  • Editor comes in "Text" mode, as it was left in "Text" mode before.
  • Switch to "Visual" mode
  • Click on description text, do not even need to do any typing, just press "Update" button right then.
  • Database now has: <!--:en--><p>EN</p><!--:--><!--:de-->DE<!--:-->, where EN was the active language at time of pressing "Update". This part is kind of explainable, TinyMCE embraced active text with <p></p>, although it does not do so, when plugin is deactivated.

But then something really strange happens:

  • click in editor again and then “Update” again, database now has:
    <!--:en--><p>EN</p><p> </p><!--:--><!--:de-->DE<!--:-->
  • And even more striking, do not click anywhere, just press “Update” again. database now has:
    <p><!--:en--><p>EN</p><p> </p><p><!--:--><!--:de-->DE<!--:--></p>
    Pay attention that <p> and </p> do not match anymore.

Further clicking “Update” does not modify this text anymore.

I have been printing various variables on java console, but those <p> did not show up anywhere I looked so far. I have no idea how they get into the database.

If people consistently keep editor at "Visual" mode, they apparently do not notice a problem. Nobody complained about this yet, but we'd better to clear it out before somebody does.

P. S. I first discovered this in the original qTranslate, and I thought that after cleaning the code, it will go away on its own, but it did not so far.

@johnclause
Copy link
Member Author

I see that some extra unmatched <p> tags coming after the line
$content = apply_filters( 'the_editor_content', $content ); in /wp-includes/class-wp-editor.php.

@johnclause
Copy link
Member Author

trunk now has a version 2.9.7b available for testing

@johnclause
Copy link
Member Author

2.9.8.0 has a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant