Make WordPress Core

Ticket #28173: 28173.patch

File 28173.patch, 1.3 KB (added by azaozz, 10 years ago)
  • src/wp-includes/js/media-editor.js

     
    757757                 * @param {string} html Content to send to the editor
    758758                 */
    759759                insert: function( html ) {
    760                         var editor,
     760                        var editor, wpActiveEditor,
    761761                                hasTinymce = ! _.isUndefined( window.tinymce ),
    762                                 hasQuicktags = ! _.isUndefined( window.QTags ),
     762                                hasQuicktags = ! _.isUndefined( window.QTags );
     763
     764                        if ( this.activeEditor ) {
     765                                wpActiveEditor = window.wpActiveEditor = this.activeEditor;
     766                        } else {
    763767                                wpActiveEditor = window.wpActiveEditor;
     768                        }
    764769
    765770                        // Delegate to the global `send_to_editor` if it exists.
    766771                        // This attempts to play nice with any themes/plugins that have
     
    921926                        }
    922927
    923928                        // If an empty `id` is provided, default to `wpActiveEditor`.
    924                         id = wpActiveEditor;
     929                        id = window.wpActiveEditor;
    925930
    926931                        // If that doesn't work, fall back to `tinymce.activeEditor.id`.
    927932                        if ( ! id && ! _.isUndefined( window.tinymce ) && tinymce.activeEditor ) {
     
    10531058                        options = options || {};
    10541059
    10551060                        id = this.id( id );
     1061                        this.activeEditor = id;
    10561062
    10571063                        workflow = this.get( id );
    10581064