mirror of
https://github.com/WordPress/WordPress.git
synced 2024-10-02 17:47:50 +02:00
Quicktags: move focusing the editor after inserting content to the end of the code blocks. Fixes a bug in Chrome where both the textarea and the window may auto-scroll to unexpected position on clicking a Quicktags button. Part props avryl, fixes #29944 for trunk.
Built from https://develop.svn.wordpress.org/trunk@29884 git-svn-id: http://core.svn.wordpress.org/trunk@29640 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
912ffccdf6
commit
f1c169f2ac
@ -384,10 +384,10 @@ function edButton(id, display, tagStart, tagEnd, access) {
|
|||||||
|
|
||||||
canvas.value = text.substring(0, startPos) + content + text.substring(endPos, text.length);
|
canvas.value = text.substring(0, startPos) + content + text.substring(endPos, text.length);
|
||||||
|
|
||||||
canvas.focus();
|
|
||||||
canvas.selectionStart = startPos + content.length;
|
canvas.selectionStart = startPos + content.length;
|
||||||
canvas.selectionEnd = startPos + content.length;
|
canvas.selectionEnd = startPos + content.length;
|
||||||
canvas.scrollTop = scrollTop;
|
canvas.scrollTop = scrollTop;
|
||||||
|
canvas.focus();
|
||||||
} else {
|
} else {
|
||||||
canvas.value += content;
|
canvas.value += content;
|
||||||
canvas.focus();
|
canvas.focus();
|
||||||
@ -510,10 +510,10 @@ function edButton(id, display, tagStart, tagEnd, access) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
canvas.focus();
|
|
||||||
canvas.selectionStart = cursorPos;
|
canvas.selectionStart = cursorPos;
|
||||||
canvas.selectionEnd = cursorPos;
|
canvas.selectionEnd = cursorPos;
|
||||||
canvas.scrollTop = scrollTop;
|
canvas.scrollTop = scrollTop;
|
||||||
|
canvas.focus();
|
||||||
} else { // other browsers?
|
} else { // other browsers?
|
||||||
if ( !endTag ) {
|
if ( !endTag ) {
|
||||||
canvas.value += t.tagStart;
|
canvas.value += t.tagStart;
|
||||||
|
2
wp-includes/js/quicktags.min.js
vendored
2
wp-includes/js/quicktags.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user