987251f582
git-svn-id: https://develop.svn.wordpress.org/trunk@23753 602fd350-edb4-49c9-b593-d223f7449a82
32 lines
830 B
JavaScript
32 lines
830 B
JavaScript
(function($){
|
|
|
|
// Post formats selection
|
|
$('.post-format-select a').on( 'click.post-format', function(e) {
|
|
var $this = $(this),
|
|
editor,
|
|
body,
|
|
format = $this.data('wp-format'),
|
|
container = $('#post-body-content');
|
|
|
|
$('.post-format-select a.nav-tab-active').removeClass('nav-tab-active');
|
|
$this.addClass('nav-tab-active').blur();
|
|
$('#post_format').val(format);
|
|
|
|
container.get(0).className = container.get(0).className.replace( /\bwp-format-[^ ]+/, '' );
|
|
container.addClass('wp-format-' + format);
|
|
|
|
if ( typeof tinymce != 'undefined' ) {
|
|
editor = tinymce.get('content');
|
|
|
|
if ( editor ) {
|
|
body = editor.getBody();
|
|
body.className = body.className.replace( /\bpost-format-[^ ]+/, '' );
|
|
editor.dom.addClass( body, 'post-format-' + format );
|
|
}
|
|
}
|
|
|
|
e.preventDefault();
|
|
});
|
|
|
|
})(jQuery);
|