Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#27378 closed defect (bug) (fixed)

<!--more--> displaced in editor when switching from Visual to Text mode

Reported by: natewr's profile NateWr Owned by: azaozz's profile azaozz
Milestone: 3.9 Priority: normal
Severity: normal Version: 3.9
Component: Editor Keywords:
Focuses: administration Cc:

Description

With the new TinyMCE in 3.9 beta 1, the <!--more--> tag is displaced when I switch from the Visual to Text mode. This only happens for more tags set in posts prior to upgrading to 3.9 beta 1. If I insert a more tag using the current editor, the position is restored.

Reproduction steps:

  1. Load post with a more tag set in 3.8.1.
  1. Switch from Visual to Text editor. Notice the more tag is now at the top.
  1. Switch back to Visual editor. Notice the more tag is now at the top.

Here is an image showing the process:

http://imagebin.org/298969

Here is the post_content entry in the database for this post, which was created normally through the editor in WordPress 3.8.1.

mysql> select post_content from wp_posts where ID=102;
+--------------------------------------------------------------------------------------------------------------+
| post_content                                                                                                 |
+--------------------------------------------------------------------------------------------------------------+
| It was blustery out there today, but we had a great time. Check out the photos!<!--more-->Here is some more. |
+--------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

And here is what the database entry looks like when I create a new post in 3.9 Beta 1 (this works fine when switching).

mysql> select post_content from wp_posts where ID=186;
+----------------------------------------------------------+
| post_content                                             |
+----------------------------------------------------------+
| Here is my awesome text.

<!--more-->

And some more |
+----------------------------------------------------------+
1 row in set (0.00 sec)

Please let me know if there is anything else I can do to help. But I have never looked at the TinyMCE code so I'm afraid I won't be much help there.

Attachments (1)

fix-tinymce-more-tag-bug-plugin.js.patch (636 bytes) - added by hauvong 11 years ago.
Patch fixed for more tag: wp-includes/js/tinymce/plugins/wordpress/plugin.js

Download all attachments as: .zip

Change History (8)

#1 @SergeyBiryukov
11 years ago

  • Milestone changed from Awaiting Review to 3.9

#2 @aesiobu
11 years ago

I will like to add that adding a more tag is also adding a new paragraph. Even if you remove the paragraph manually switching back and forth between visual mode and text mode puts the paragraph back and sometimes it ends up putting the more tag at the top of the copy. Added a video describing the issue here: https://www.youtube.com/watch?v=QJIKjOepNwA&feature=youtu.be

@hauvong
11 years ago

Patch fixed for more tag: wp-includes/js/tinymce/plugins/wordpress/plugin.js

#3 @azaozz
11 years ago

In 27729:

TinyMCE: fix the More and Next Page tags behavior:

  • Append them inside top level <p> tags.
  • If the caret is not in a top level <p>, create new paragraph after the current top level tag.
  • Do not change placement when edited in the Text editor.

See #27378

#4 @azaozz
11 years ago

@hauvong thanks for the patch but it would append <p> node inside another <p>. Also this needed more changes to get it working right.

Leaving open for now in case other tweaks are needed.

#5 follow-up: @kirasong
11 years ago

azaozz: Anything left here?

#6 @kirasong
11 years ago

  • Owner set to azaozz
  • Status changed from new to assigned

#7 in reply to: ↑ 5 @azaozz
11 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

Replying to DH-Shredder:

azaozz: Anything left here?

This should be done. No more unexpected behavior reported in the last 10 days. The best position for the <more> and <nextpage> tags is at the end of a paragraph that is a direct child of the body, however the tags are not moved if inserted in the Text editor (so the user can choose another position). Feel free to reopen if this still behaves unexpectedly.

Last edited 11 years ago by azaozz (previous) (diff)
Note: See TracTickets for help on using tickets.