I am planning on writing a script that uses PHP and Javascript to insert images to WYMeditor. My plan is for the PHP to search in a preset folder for all images, display them in a table and have each of the images clickable to be inserted into WYMeditor. I am happy to make it public when finished. I am however stuck at how to get the links in the popup to insert images into WYMeditor (interact with the original window).
So far I have got (the \'s are as it is in PHP, just ignore them):
var html = '<li class=\"wym_tools_gallery\">'
+ '<a href=\"#\"'
+ ' title=\"Add image from gallery\"'
+ ' style=\"background-image:'
+ ' url(wymeditor/skins/default/icons.png)\">'
+ 'Add image from gallery'
+ '</a></li>';
jQuery(wym._box)
.find(wym._options.toolsSelector + wym._options.toolsListSelector)
.append(html);
jQuery(wym._box)
.find('li.wym_tools_gallery a').click(function() {
alert('Test');
g_window = window.open('gallery.php', 'filebrowser', 'height=600,width=840,resizable=yes,scrollbars=yes');
g_window.focus();
return(false);
});
Does anyone know with javascript how to get a link on the gallery.php page to close the window (gallery page) and insert content to wymeditor? I am stuck with the interacting through javascript.