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

git-svn-id: https://develop.svn.wordpress.org/trunk@22905 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2012-11-28 21:45:10 +00:00
parent c121dfb0fc
commit f2c4ad72d6
1 changed files with 14 additions and 8 deletions

View File

@ -509,22 +509,28 @@
},
open: function( id ) {
var workflow;
var workflow, editor;
// If an empty `id` is provided, default to `wpActiveEditor`.
id = id || wpActiveEditor;
// If that doesn't work, fall back to `tinymce.activeEditor`.
if ( ! id && typeof tinymce !== 'undefined' && tinymce.activeEditor )
id = id || tinymce.activeEditor.id;
if ( typeof tinymce !== 'undefined' && tinymce.activeEditor ) {
// If that doesn't work, fall back to `tinymce.activeEditor`.
if ( ! id ) {
editor = tinymce.activeEditor;
id = id || editor.id;
} else {
editor = tinymce.get( id );
}
// Save a bookmark of the caret position, needed for IE
if ( tinymce.isIE && editor && ! editor.isHidden() )
editor.windowManager.insertimagebookmark = editor.selection.getBookmark();
}
// Last but not least, fall back to the empty string.
id = id || '';
// Save a bookmark of the caret position, needed for IE
if ( typeof tinymce !== 'undefined' && tinymce.activeEditor && tinymce.isIE && ! tinymce.activeEditor.isHidden() )
tinymce.activeEditor.windowManager.insertimagebookmark = tinymce.activeEditor.selection.getBookmark();
workflow = wp.media.editor.get( id );
// If the workflow exists, open it.