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

Fix tags issue while alternating visual and text mode in the classic editor #139

Merged
merged 4 commits into from
May 5, 2020

Conversation

renatho
Copy link
Contributor

@renatho renatho commented Apr 14, 2020

Fixes #128 and fixes #127

Changes proposed in this Pull Request:

  • Fix some issues while alternating between visual and text mode in the classic editor. The main issue is that it was creating some new lines.
  • The other issue mentioned is that the angle brackets were appearing as <. I could not reproduce it, but I believe these changes will fix it as well.

The main idea of this solution was to restore the unfiltered codes after the afterWpautop.

  • I also identified that <p> and <br> tags were being removed in the core. So I replaced it temporarily to <wp-p> and <wp-br> tags. It'll appear only in the visual mode if the user changes from the text mode.

Testing instructions:

  • Install and active the classic editor.
  • Create a new post with the SyntaxHighlighter shortcode [code language="php"] or [html]. Please, test mixing and not mixing other texts in the post.
  • Also test using <p> and <br /> tags inner your code.
  • Make sure that the shortcodes are keeping the indentation and break lines correctly, as well the angle brackets. And the rest of the content continues being treated as before.
  • If possible, also test using the WP 4.2.3 (where the errors happened too) to confirm everything is working well. I tested here and it seems to be working fine as well.

@renatho renatho added this to the v3.5.4 milestone Apr 14, 2020
@renatho renatho self-assigned this Apr 14, 2020
@renatho renatho modified the milestones: v3.5.4, v3.5.5 Apr 17, 2020
@jom
Copy link
Member

jom commented May 4, 2020

I did some testing on this today. When I switched back to Visual the tags were replaced, is that expected? It looks like it didn't save with them though.

Screen Shot 2020-05-04 at 2 27 17 PM

@renatho
Copy link
Contributor Author

renatho commented May 4, 2020

I did some testing on this today. When I switched back to Visual the tags were replaced, is that expected? It looks like it didn't save with them though.

@jom, yes. It's expected because of that:

I also identified that

and
tags were being removed in the core. So I replaced it temporarily to and tags. It'll appear only in the visual mode if the user changes from the text mode.

Unfortunately, I didn't find a way to prevent it from being removed unless to replace it with a temporary mark.

Copy link
Member

@jom jom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, sorry I missed this. It works well! Nice reorganization, too.

@renatho renatho merged commit 52c46d4 into master May 5, 2020
@renatho renatho deleted the fix/alternate-visual-text branch May 5, 2020 21:56
@renatho renatho changed the title Fix alternating visual and text mode in the classic editor Fix tags issue while alternating visual and text mode in the classic editor Jun 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Switch from Visual to Text creates new lines Angle brackets get transformed into htmlentities
2 participants