From a65f178bbbe120168fab64a226265e3874acee2f Mon Sep 17 00:00:00 2001 From: Ella Iseulde Van Dorpe Date: Tue, 16 Jun 2015 13:51:37 +0000 Subject: [PATCH] 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 --- .../js/tinymce/plugins/wptextpattern/plugin.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/js/tinymce/plugins/wptextpattern/plugin.js b/src/wp-includes/js/tinymce/plugins/wptextpattern/plugin.js index 819f130aae..7fac83774b 100644 --- a/src/wp-includes/js/tinymce/plugins/wptextpattern/plugin.js +++ b/src/wp-includes/js/tinymce/plugins/wptextpattern/plugin.js @@ -39,6 +39,14 @@ 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() { canUndo = false; } ); @@ -84,7 +92,11 @@ } 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 ) { return; @@ -105,7 +117,7 @@ editor.selection.setCursorLocation( parent ); - pattern.callback.apply( editor ); + pattern.callback.apply( editor, args ); } ); // We need to wait for native events to be triggered.