Quicktags: move focusing the editor after inserting content to the end of the code blocks.

Merges [29884] to the 4.0 branch.

Fixes a bug in Chrome where both the textarea and the window may auto-scroll to unexpected position on clicking a Quicktags button.

props azaozz, avryl.
fixes #29944.

Built from https://develop.svn.wordpress.org/branches/4.0@30250


git-svn-id: http://core.svn.wordpress.org/branches/4.0@30250 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2014-11-06 07:03:32 +00:00
parent aaec5126c6
commit e2c870f41b
2 changed files with 3 additions and 3 deletions

View File

@ -384,10 +384,10 @@ function edButton(id, display, tagStart, tagEnd, access) {
canvas.value = text.substring(0, startPos) + content + text.substring(endPos, text.length);
canvas.focus();
canvas.selectionStart = startPos + content.length;
canvas.selectionEnd = startPos + content.length;
canvas.scrollTop = scrollTop;
canvas.focus();
} else {
canvas.value += content;
canvas.focus();
@ -509,10 +509,10 @@ function edButton(id, display, tagStart, tagEnd, access) {
}
}
canvas.focus();
canvas.selectionStart = cursorPos;
canvas.selectionEnd = cursorPos;
canvas.scrollTop = scrollTop;
canvas.focus();
} else { // other browsers?
if ( !endTag ) {
canvas.value += t.tagStart;

File diff suppressed because one or more lines are too long