I want to integrate IMCE with widgeditor. Since widgeditor changes the textarea to an iframe and a hidden input field, IMCE throws an exception when it tries to add an img tag to the existing content.

I'm not sure of the best way to insert a bit of content to the existing widgeditor document via javascript. Anyone have any thoughts?

Thanks!

Comments

jeb-1’s picture

i hacked something together that works. I'd like get thoughts on TheRightWay to do this.

in widgEditor.js I needed to create a global - so IMCE can access the widgEditor instance(s).

-
setTimeout("new widgEditor('" + theTextarea.id + "')", 500 * (i));
+
setTimeout("var mywidgEditor = new widgEditor('" + theTextarea.id + "')", 500 * (i));

so, yeah, that's ugly, since a) it's a global and b) it only works for a single instance. I assume adding a widgEditor.getInstance(textarea_id) would be a nicer way to do this.

in imce_set_inline.js, I added the following to the start of imceInsertAtCursor()

+
if (mywidgEditor) {
mywidgEditor.theIframe.contentWindow.document.getElementsByTagName("body")[0].innerHTML += txt;
return;
}

so, yeah, it just appends the image to the end of the area. so, not great, but a start.

David Lesieur’s picture

Marking http://drupal.org/node/168541 as a duplicate.

Gurpartap Singh’s picture

Version: 5.x-1.x-dev » 6.x-1.0
Status: Active » Fixed

Added proper integration in Drupal 6 release.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.