Make WordPress Core

Ticket #22446: 22446-ie789-insert-3.patch

File 22446-ie789-insert-3.patch, 1.5 KB (added by azaozz, 12 years ago)
  • wp-includes/js/media-editor.js

     
    509509                },
    510510
    511511                open: function( id ) {
    512                         var workflow;
     512                        var workflow, editor;
    513513
    514514                        // If an empty `id` is provided, default to `wpActiveEditor`.
    515515                        id = id || wpActiveEditor;
    516516
    517                         // If that doesn't work, fall back to `tinymce.activeEditor`.
    518                         if ( ! id && typeof tinymce !== 'undefined' && tinymce.activeEditor )
    519                                 id = id || tinymce.activeEditor.id;
     517                        if ( typeof tinymce !== 'undefined' && tinymce.activeEditor ) {
     518                                // If that doesn't work, fall back to `tinymce.activeEditor`.
     519                                if ( ! id ) {
     520                                        editor = tinymce.activeEditor;
     521                                        id = id || editor.id;
     522                                } else {
     523                                        editor = tinymce.get( id );
     524                                }
    520525
     526                                // Save a bookmark of the caret position, needed for IE
     527                                if ( tinymce.isIE && editor && ! editor.isHidden() )
     528                                        editor.windowManager.insertimagebookmark = editor.selection.getBookmark();
     529                        }
     530
    521531                        // Last but not least, fall back to the empty string.
    522532                        id = id || '';
    523533
    524                         // Save a bookmark of the caret position, needed for IE
    525                         if ( typeof tinymce !== 'undefined' && tinymce.activeEditor && tinymce.isIE && ! tinymce.activeEditor.isHidden() )
    526                                 tinymce.activeEditor.windowManager.insertimagebookmark = tinymce.activeEditor.selection.getBookmark();
    527 
    528534                        workflow = wp.media.editor.get( id );
    529535
    530536                        // If the workflow exists, open it.