Ticket #24062: 24062.diff
File 24062.diff, 2.7 KB (added by , 12 years ago) |
---|
-
wp-includes/js/media-editor.js
538 538 add: function( id, options ) { 539 539 var workflow = this.get( id ); 540 540 541 if ( workflow )542 return workflow;543 544 541 workflow = workflows[ id ] = wp.media( _.defaults( options || {}, { 545 542 frame: 'post', 546 543 state: 'insert', … … 692 689 } 693 690 }, 694 691 695 open: function( id ) {692 open: function( id, options ) { 696 693 var workflow, editor; 697 694 698 695 id = this.id( id ); 696 697 if ( ! options ) 698 var options = {}; 699 699 700 700 // Save a bookmark of the caret position in IE. 701 701 if ( typeof tinymce !== 'undefined' ) { … … 710 710 workflow = this.get( id ); 711 711 712 712 // Initialize the editor's workflow if we haven't yet. 713 if ( ! workflow ) 714 workflow = this.add( id ); 713 // Redo workflow if state has changed 714 if ( ! workflow || workflow.options && options.state !== workflow.options.state ) 715 workflow = this.add( id, options ); 715 716 716 717 return workflow.open(); 717 718 }, … … 719 720 init: function() { 720 721 $(document.body).on( 'click', '.insert-media', function( event ) { 721 722 var $this = $(this), 722 editor = $this.data('editor'); 723 editor = $this.data('editor'), 724 options = { 725 frame: 'post', 726 state: 'insert', 727 title: wp.media.view.l10n.addMedia, 728 multiple: true 729 }; 723 730 724 731 event.preventDefault(); 725 732 … … 729 736 // 730 737 // See: http://core.trac.wordpress.org/ticket/22445 731 738 $this.blur(); 739 740 if ( $this.hasClass( 'gallery' ) ) { 741 options = { 742 title: wp.media.view.l10n.createGalleryTitle, 743 state: 'gallery', 744 frame: 'post', 745 multiple: true 746 } 747 } 732 748 733 wp.media.editor.open( editor );749 wp.media.editor.open( editor, options ); 734 750 }); 735 751 } 736 752 }; -
wp-admin/js/post-formats.js
17 17 var $this = $(this), editor, body, 18 18 parent = $this.parent(), 19 19 format = $this.data('wp-format'), 20 insertMediaButton = $( '#insert-media-button' ), 20 21 description = $('.post-format-description'); 21 22 22 23 if ( typeof container === 'undefined' ) … … 57 58 editor.dom.addClass( body, 'post-format-' + format ); 58 59 } 59 60 } 61 62 // If gallery, force it to open to gallery state 63 if ( 'gallery' === format ) 64 insertMediaButton.addClass( 'gallery' ); 65 else 66 insertMediaButton.removeClass( 'gallery' ); 60 67 61 68 postFormats.currentPostFormat = format; 62 69 }).on('mouseenter focusin', 'a', function () {