Make WordPress Core

Changeset 22905


Ignore:
Timestamp:
11/28/2012 09:45:10 PM (12 years ago)
Author:
azaozz
Message:

Media in Internet Explorer: ensure we save the caret bookmark for IE in TinyMCE for the right instance, fixes #22446

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/js/media-editor.js

    r22895 r22905  
    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                }
     525
     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            }
    520530
    521531            // Last but not least, fall back to the empty string.
    522532            id = id || '';
    523 
    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();
    527533
    528534            workflow = wp.media.editor.get( id );
Note: See TracChangeset for help on using the changeset viewer.