1

I developed a custom file manager for tinymce. But even if adding image to tinymce in firefox works, it does not work in ie with the following code block.

 tinyMCE.activeEditor.selection.setContent("<img src='" + $(this).attr("data-url") + "' style='width:150px; height:150px;' />");

In internet Explorer, it deletes all contents in tinymce and add the image because of empty "tinyMCE.activeEditor.selection". About this I found following post. What's the best way to set cursor/caret position?

But after user open file manager popup , s/he may want to close it without adding file. If this happens, I should delete the html that I add for cursor/caret position to find later selection in ie.

I tried add a click event to close link of the popup, however it does not work. I need to sense popup close and customize it.

Cœur
  • 37,241
  • 25
  • 195
  • 267
whitestream
  • 691
  • 1
  • 7
  • 14

1 Answers1

1

with this code , I am able to delete caret html.

 $($(parent.document).find("a.mceClose")[0]).mousedown(function () {
                if ($.browser.msie) {
                    var ed = tinyMCE.activeEditor;
                    var html = $(ed.dom.select('div#filemanager_wrapper')[0]).html();
                    $(ed.dom.select('div#filemanager_wrapper')[0]).replaceWith(html)
                }

            });
whitestream
  • 691
  • 1
  • 7
  • 14