' + __( 'To move focus to other buttons use Tab or the arrow keys. To return focus to the editor press Escape or use one of the buttons.' ) + '
\s*<(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre)( [^>]*)?>/gi, '<$1$2>' ) .replace( /<\/(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre)>\s*<\/p>/gi, '$1>' ); } }); if ( $ ) { $( document ).triggerHandler( 'tinymce-editor-init', [editor] ); } if ( window.tinyMCEPreInit && window.tinyMCEPreInit.dragDropUpload ) { dom.bind( doc, 'dragstart dragend dragover drop', function( event ) { if ( $ ) { // Trigger the jQuery handlers. $( document ).trigger( new $.Event( event ) ); } }); } if ( editor.getParam( 'wp_paste_filters', true ) ) { editor.on( 'PastePreProcess', function( event ) { // Remove trailing added by WebKit browsers to the clipboard event.content = event.content.replace( //gi, '' ); // In WebKit this is handled by removeWebKitStyles() if ( ! tinymce.Env.webkit ) { // Remove all inline styles event.content = event.content.replace( /(<[^>]+) style="[^"]*"([^>]*>)/gi, '$1$2' ); // Put back the internal styles event.content = event.content.replace(/(<[^>]+) data-mce-style=([^>]+>)/gi, '$1 style=$2' ); } }); editor.on( 'PastePostProcess', function( event ) { // Remove empty paragraphs editor.$( 'p', event.node ).each( function( i, node ) { if ( dom.isEmpty( node ) ) { dom.remove( node ); } }); if ( tinymce.isIE ) { editor.$( 'a', event.node ).find( 'font, u' ).each( function( i, node ) { dom.remove( node, true ); }); } }); } if ( editor.settings.wp_shortcut_labels && editor.theme.panel ) { var labels = {}; var access = 'Shift+Alt+'; var meta = 'Ctrl+'; // For Mac: ctrl = \u2303, cmd = \u2318, alt = \u2325 if ( tinymce.Env.mac ) { access = '\u2303\u2325'; meta = '\u2318'; } each( editor.settings.wp_shortcut_labels, function( value, name ) { labels[ name ] = value.replace( 'access', access ).replace( 'meta', meta ); } ); each( editor.theme.panel.find('button'), function( button ) { if ( button && button.settings.tooltip && labels.hasOwnProperty( button.settings.tooltip ) ) { // Need to translate now. We are changing the string so it won't match and cannot be translated later. button.settings.tooltip = editor.translate( button.settings.tooltip ) + ' (' + labels[ button.settings.tooltip ] + ')'; } } ); // listbox for the "blocks" drop-down each( editor.theme.panel.find('listbox'), function( listbox ) { if ( listbox && listbox.settings.text === 'Paragraph' ) { each( listbox.settings.values, function( item ) { if ( item.text && labels.hasOwnProperty( item.text ) ) { item.shortcut = '(' + labels[ item.text ] + ')'; } } ); } } ); } }); editor.on( 'SaveContent', function( event ) { // If editor is hidden, we just want the textarea's value to be saved if ( ! editor.inline && editor.isHidden() ) { event.content = event.element.value; return; } // Keep empty paragraphs :( event.content = event.content.replace( /
(?:|\u00a0|\uFEFF| )*<\/p>/g, '