TinyMCE: fix removing a space before inline tags when applying formatting shortcuts.

Fixes #35798.

git-svn-id: https://develop.svn.wordpress.org/trunk@36513 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2016-02-12 04:22:03 +00:00
parent 126193fa3c
commit 43dae50c0d
1 changed files with 9 additions and 1 deletions

View File

@ -156,13 +156,21 @@
refPattern = pattern;
}
function ltrim( text ) {
if ( text ) {
return text.replace( /^\s+/, '' );
}
return '';
}
function enter() {
if ( refNode ) {
editor.undoManager.add();
editor.undoManager.transact( function() {
editor.formatter.apply( refPattern.format, {}, refNode );
refNode.replaceData( 0, refNode.data.length, tinymce.trim( refNode.data.slice( refPattern.start.length ) ) );
refNode.replaceData( 0, refNode.data.length, ltrim( refNode.data.slice( refPattern.start.length ) ) );
} );
// We need to wait for native events to be triggered.