Editor quickTags: when the user selects some text by triple-clicking, then wraps it in a tag, and the last selected char is `\n`, insert the closing tag before the line break.

Props JoshuaGoodwin azaozz.
Fixes #29571.

git-svn-id: https://develop.svn.wordpress.org/trunk@37661 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2016-06-09 00:24:56 +00:00
parent 8e380e50d8
commit 510cff5fe6
1 changed files with 5 additions and 0 deletions

View File

@ -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