diff --git a/js/wysiwyg-media.js b/js/wysiwyg-media.js index 66ef30b..5dae4e0 100644 --- a/js/wysiwyg-media.js +++ b/js/wysiwyg-media.js @@ -152,6 +152,9 @@ InsertMedia.prototype = { * TODO: Determine if this is actually necessary. */ prompt: function (settings) { + // TinyMCE only hack. + // Store a selection bookmark so we can restore it later when we insert. + this.bm = Drupal.wysiwyg.instances[this.instanceId].getSelectionBookmark(); Drupal.media.popups.mediaBrowser($.proxy(this, 'onSelect'), settings); }, @@ -178,6 +181,8 @@ InsertMedia.prototype = { var markup = outerHTML(element), macro = create_macro(element); + // TinyMCE only hack: + Drupal.wysiwyg.instances[this.instanceId].setSelectionBookmark(this.bm); // Insert placeholder markup into wysiwyg. Drupal.wysiwyg.instances[this.instanceId].insert(markup); // Store macro/markup pair in the tagmap.