Changeset 24087
- Timestamp:
- 04/25/2013 05:43:14 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/js/post-formats.js
r24084 r24087 2 2 3 3 (function($) { 4 var container, $container, mediaFrame, lastMimeType, mediaPreview, lastHeight = 360, content, 4 var container, $container, mediaFrame, lastMimeType, mediaPreview, lastHeight = 360, content, insertMediaButton, 5 5 initialFormat = 'standard', 6 6 shortClass = 'short-format', … … 93 93 } 94 94 95 postFormats.currentPostFormat = format; 96 } 95 // If gallery, force it to open to gallery state 96 if ( 'gallery' === format ) 97 insertMediaButton.addClass( 'gallery' ); 98 else 99 insertMediaButton.removeClass( 'gallery' ); 100 101 postFormats.currentPostFormat = format; 102 } 103 104 97 105 98 106 $(function() { 107 insertMediaButton = $( '#insert-media-button' ); 99 108 $container = $( '.post-formats-fields' ); 100 109 -
trunk/wp-includes/js/media-editor.js
r24017 r24087 538 538 add: function( id, options ) { 539 539 var workflow = this.get( id ); 540 541 if ( workflow )542 return workflow;543 540 544 541 workflow = workflows[ id ] = wp.media( _.defaults( options || {}, { … … 693 690 }, 694 691 695 open: function( id ) {692 open: function( id, options ) { 696 693 var workflow, editor; 694 695 options = options || {}; 697 696 698 697 id = this.id( id ); … … 710 709 workflow = this.get( id ); 711 710 712 // Initialize the editor's workflow if we haven't yet.713 if ( ! workflow )714 workflow = this.add( id );711 // Redo workflow if state has changed 712 if ( ! workflow || ( workflow.options && options.state !== workflow.options.state ) ) 713 workflow = this.add( id, options ); 715 714 716 715 return workflow.open(); … … 720 719 $(document.body).on( 'click', '.insert-media', function( event ) { 721 720 var $this = $(this), 722 editor = $this.data('editor'); 721 editor = $this.data('editor'), 722 options = { 723 frame: 'post', 724 state: 'insert', 725 title: wp.media.view.l10n.addMedia, 726 multiple: true 727 }; 723 728 724 729 event.preventDefault(); … … 731 736 $this.blur(); 732 737 733 wp.media.editor.open( editor ); 738 if ( $this.hasClass( 'gallery' ) ) { 739 options.state = 'gallery'; 740 options.title = wp.media.view.l10n.createGalleryTitle; 741 } 742 743 wp.media.editor.open( editor, options ); 734 744 }); 735 745 }
Note: See TracChangeset
for help on using the changeset viewer.