I have a custom module to embed the latest version of Wymeditor and am having trouble using the imce api.
Here's the code that I have:
function _wymedit_ImceFinish(path, w, h, s, imceWin) {
document.getElementById('image_src').value = path;
preview();
imceWin.close();
}
$(document).ready( function() {
$(Drupal.settings["selector"]).wymeditor({
updateSelector: '.form-submit',
stylesheet: "/" + Drupal.settings["wymedit_path"] + '/wymedit_styles.css',
postInitDialog: function(wym,wdw) {
var body = wdw.document.body;
var imceLink = '<p style="width:100%;height: 1.5em;">'
+'<a href="javascript:;" onclick="window.open(\'/?q=imce/browse\', \'_wymedit_\', \'width=640, height=480, resizable=1\')" >File browser</a>'
+'</p>';
jQuery(body).filter('.wym_dialog_image').find('fieldset').eq(0).prepend(wym.replaceStrings(imceLink));
},
})
});
It's all working (the IMCE window pops up) but I get no 'add' operation. What am I doing wrong?
Thanks for your help.
Comments
Comment #1
ufku commentedimce looks for the _wymedit_ImceFinish function inside the referring window. if you open imce from a pop-up you should define _wymedit_ImceFinish inside the pop-up.
In your case i think you should define the function for the object "wdw" inside the postInitDialog function.
And you should also differentiate the variables and functions of the pop-up from that of the main window while using them.
Comment #2
bennybobw commentedOh okay. That makes perfect sense. I just tried it and it works. Thanks for your help on this.
Comment #3
(not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.