TinyMCE: wptextpattern: Add blockquote and headings

As discussed in the editor meeting 9 June.
We should re-evaluate these additions towards the end of the release.

See #31441.


git-svn-id: https://develop.svn.wordpress.org/trunk@32795 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ella Iseulde Van Dorpe 2015-06-16 13:51:37 +00:00
parent 8235387ee4
commit a65f178bbb
1 changed files with 14 additions and 2 deletions

View File

@ -39,6 +39,14 @@
this.execCommand( 'InsertOrderedList' ); this.execCommand( 'InsertOrderedList' );
} ); } );
add( /^>\s/, function() {
this.formatter.toggle( 'blockquote' );
} );
add( /^(#{2,6})\s/, function() {
this.formatter.toggle( 'h' + arguments[1].length );
} );
editor.on( 'selectionchange', function() { editor.on( 'selectionchange', function() {
canUndo = false; canUndo = false;
} ); } );
@ -84,7 +92,11 @@
} }
tinymce.each( patterns, function( pattern ) { tinymce.each( patterns, function( pattern ) {
var replace = text.replace( pattern.regExp, '' ); var args,
replace = text.replace( pattern.regExp, function() {
args = arguments;
return '';
} );
if ( text === replace ) { if ( text === replace ) {
return; return;
@ -105,7 +117,7 @@
editor.selection.setCursorLocation( parent ); editor.selection.setCursorLocation( parent );
pattern.callback.apply( editor ); pattern.callback.apply( editor, args );
} ); } );
// We need to wait for native events to be triggered. // We need to wait for native events to be triggered.