mirror of
https://github.com/WordPress/WordPress.git
synced 2024-10-30 15:31:04 +01:00
25c272856b
git-svn-id: http://core.svn.wordpress.org/trunk@23753 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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);
|