diff --git a/src/wp-includes/js/quicktags.js b/src/wp-includes/js/quicktags.js index 11f8785059..6d00901a78 100644 --- a/src/wp-includes/js/quicktags.js +++ b/src/wp-includes/js/quicktags.js @@ -526,6 +526,11 @@ function edButton(id, display, tagStart, tagEnd, access) { } else if ( canvas.selectionStart || canvas.selectionStart === 0 ) { // FF, WebKit, Opera startPos = canvas.selectionStart; endPos = canvas.selectionEnd; + + if ( startPos < endPos && v.charAt( endPos - 1 ) === '\n' ) { + endPos -= 1; + } + cursorPos = endPos; scrollTop = canvas.scrollTop; l = v.substring(0, startPos); // left of the selection