Ticket #36585: 36585.diff
File 36585.diff, 994 bytes (added by , 8 years ago) |
---|
-
src/wp-includes/js/tinymce/plugins/wptextpattern/plugin.js
202 202 text = node.data; 203 203 204 204 tinymce.each( spacePatterns, function( pattern ) { 205 var match = text.match( pattern.regExp ); 205 var match = text.match( pattern.regExp ), 206 cursorOffset; 206 207 207 if ( ! match || rng.startOffset !== match[0].length) {208 if ( ! match ) { 208 209 return; 209 210 } 211 cursorOffset = rng.startOffset - match[0].length; 210 212 211 213 editor.undoManager.add(); 212 214 … … 217 219 parent.appendChild( document.createElement( 'br' ) ); 218 220 } 219 221 220 editor.selection.setCursorLocation( parent ); 222 if ( cursorOffset === 0 ) { 223 editor.selection.setCursorLocation( parent ); 224 } 221 225 editor.execCommand( pattern.cmd ); 222 226 } ); 223 227