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:
parent
8e380e50d8
commit
510cff5fe6
|
@ -526,6 +526,11 @@ function edButton(id, display, tagStart, tagEnd, access) {
|
||||||
} else if ( canvas.selectionStart || canvas.selectionStart === 0 ) { // FF, WebKit, Opera
|
} else if ( canvas.selectionStart || canvas.selectionStart === 0 ) { // FF, WebKit, Opera
|
||||||
startPos = canvas.selectionStart;
|
startPos = canvas.selectionStart;
|
||||||
endPos = canvas.selectionEnd;
|
endPos = canvas.selectionEnd;
|
||||||
|
|
||||||
|
if ( startPos < endPos && v.charAt( endPos - 1 ) === '\n' ) {
|
||||||
|
endPos -= 1;
|
||||||
|
}
|
||||||
|
|
||||||
cursorPos = endPos;
|
cursorPos = endPos;
|
||||||
scrollTop = canvas.scrollTop;
|
scrollTop = canvas.scrollTop;
|
||||||
l = v.substring(0, startPos); // left of the selection
|
l = v.substring(0, startPos); // left of the selection
|
||||||
|
|
Loading…
Reference in New Issue