WordPress Trac: Ticket #22199: Pasting text containing line breaks results in misplaced cursorhttps://core.trac.wordpress.org/ticket/22199
<p>
Steps to reproduce
</p>
<ul><li>Add or edit a post
</li><li>Switch to Visual Editor
</li><li>Paste some text that includes line breaks
</li><li>Notice that the cursor jumps to the beginning of the last line pasted, rather than the end of the line.
</li></ul><p>
Sample text to paste:
</p>
<pre class="wiki">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas non erat
ac felis cursus ornare. Nunc elementum, magna rhoncus imperdiet ultricies,
nisl nulla tempus dui, at mollis risus orci nec lectus.
</pre>en-usWordPress Trachttps://core.trac.wordpress.org/chrome/site/your_project_logo.pnghttps://core.trac.wordpress.org/ticket/22199
Trac 1.0.1chrisrudzkiMon, 15 Oct 2012 16:04:06 GMTversion sethttps://core.trac.wordpress.org/ticket/22199#comment:1
https://core.trac.wordpress.org/ticket/22199#comment:1
<ul>
<li><strong>version</strong>
set to <em>trunk</em>
</li>
</ul>
TicketobenlandThu, 25 Oct 2012 20:26:18 GMTcc, keywords sethttps://core.trac.wordpress.org/ticket/22199#comment:2
https://core.trac.wordpress.org/ticket/22199#comment:2
<ul>
<li><strong>cc</strong>
<em>azaozz</em> added
</li>
<li><strong>keywords</strong>
<em>needs-patch</em> <em>dev-feedback</em> added
</li>
</ul>
<p>
While I'd consider it a minor bug, it seems to be pretty annoying and I just had another user complain about it over at .com.
</p>
<p>
@azaozz, is there a chance we could look into that for 3.5?
</p>
TicketnacinThu, 25 Oct 2012 20:37:10 GMThttps://core.trac.wordpress.org/ticket/22199#comment:3
https://core.trac.wordpress.org/ticket/22199#comment:3
<p>
Is this a browser-specific thing?
</p>
TicketchrisrudzkiThu, 25 Oct 2012 20:44:49 GMThttps://core.trac.wordpress.org/ticket/22199#comment:4
https://core.trac.wordpress.org/ticket/22199#comment:4
<p>
@nacin:
</p>
<p>
No - I can reproduce it across the latest releases of Firefox, Chrome, and Safari.
</p>
<p>
As it turns out, I have a tricky time reproducing it by simply copying and directly pasting the "sample text" into the visual editor. You might want to try pasting it into a text editor first.
</p>
TicketobenlandThu, 25 Oct 2012 20:48:08 GMThttps://core.trac.wordpress.org/ticket/22199#comment:5
https://core.trac.wordpress.org/ticket/22199#comment:5
<p>
I can only reproduce it consistently in FF 16.0.1
</p>
<p>
It did occur in Chrome 22 too, though. Odd.
</p>
TicketazaozzThu, 25 Oct 2012 21:01:51 GMThttps://core.trac.wordpress.org/ticket/22199#comment:6
https://core.trac.wordpress.org/ticket/22199#comment:6
<p>
The only way I see to fix this is to insert another paragraph after the pasted text. The caret would go in the new paragraph then. Forcing new paragraphs after each pasted content may be a bit too drastic though.
</p>
<p>
Will pass that upstream, perhaps another fix would be possible.
</p>
Tickethd-JFri, 26 Oct 2012 17:15:59 GMTcc changedhttps://core.trac.wordpress.org/ticket/22199#comment:7
https://core.trac.wordpress.org/ticket/22199#comment:7
<ul>
<li><strong>cc</strong>
<em>jeremy@…</em> added
</li>
</ul>
<p>
I was able to reproduce the problem:
</p>
<ul><li>In Chrome/Mac and Safari/Mac
</li><li>With the latest version of Trunk.
</li><li>In the Visual Editor as well as in the DFW.
</li><li>Only after expanding the Text area thanks to the "handle" in the bottom right corner of the editor.
</li></ul><p>
I recorded myself and posted the video here, if that helps:
</p>
<ul><li><a class="ext-link" href="http://youtu.be/NjAsCHSIkp8"><span class="icon">​</span>http://youtu.be/NjAsCHSIkp8</a>
</li></ul><p>
As you can see, the screen also jumps back to the top of the Visual Editor when I paste in some content.
</p>
TicketnacinSun, 11 Nov 2012 18:17:22 GMThttps://core.trac.wordpress.org/ticket/22199#comment:8
https://core.trac.wordpress.org/ticket/22199#comment:8
<p>
Is this reproducible in WP 3.4?
</p>
TicketazaozzSun, 11 Nov 2012 18:51:50 GMThttps://core.trac.wordpress.org/ticket/22199#comment:9
https://core.trac.wordpress.org/ticket/22199#comment:9
<p>
Replying to <a class="closed" href="https://core.trac.wordpress.org/ticket/22199#comment:7" title="Comment 7 for Ticket #22199">hd-J</a>:
</p>
<p>
Could you confirm if this is happening in the TinyMCE demo: <a class="ext-link" href="http://www.tinymce.com/tryit/full.php"><span class="icon">​</span>http://www.tinymce.com/tryit/full.php</a>
</p>
<p>
I couldn't reproduce either problem (caret placement after pasting and scrolling to top) there.
</p>
Tickethd-JMon, 12 Nov 2012 06:33:10 GMThttps://core.trac.wordpress.org/ticket/22199#comment:10
https://core.trac.wordpress.org/ticket/22199#comment:10
<p>
I tested again in WordPress 3.4.2 and in the TinyMCE demo:
</p>
<ul><li>I wasn't able to reproduce the caret placement issue
</li><li>I could reproduce the pasting and scrolling to top issue
</li></ul>
TicketazaozzFri, 16 Nov 2012 00:28:11 GMTstatus, milestone changed; resolution sethttps://core.trac.wordpress.org/ticket/22199#comment:11
https://core.trac.wordpress.org/ticket/22199#comment:11
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>fixed</em>
</li>
<li><strong>milestone</strong>
changed from <em>Awaiting Review</em> to <em>3.5</em>
</li>
</ul>
<p>
This should be fixed after the TinyMCE update to 3.5.7. Feel free to reopen if the problem persists.
</p>
Ticket