I asked this at the tinymce support forum for the imagemanager plugin, but the only advice the Moxiecode administrator gave me was "check the tinymce api". That's like a Chinese guy telling me to go learn the chinese language instead of translating a single word for me.
Here's the code that adds a custom button to TinyMCE:
ed.addButton('image_edit', {
title : 'image_tools.edit',
cmd : 'mceImage',
label : 'image_tools.edit_label',
image : url + '/img/image_edit.png'
});
Here's example code from Moxiecode to open a specific image in the imagemanager edit window where it can be cropped, resized, flipped, etc.
<script type="text/javascript" src="<yourinstallationpath>/js/mcimagemanager.js"></script>
<p>
<ahref="javascript:;"onclick="mcImageManager.edit({path :'{0}/teddybear.jpg', onsave :function(res){alert(res.file.url);}});">[Edit image]</a>
</p>
Here's how the command might look that is called when the custom button is clicked:
ed.addCommand('mceImage', function(){
mcImageManager.edit({
path : '{0}/',
onsave : function(res) {alert(res.file.url);}});
});
Obviously, that path : '{0}/', isn't going to do anything. What it needs to do, is get the path to an image that is already inserted into the tinyMCE editor window, and selected. The only place to get that would be from the scr attribute of the image.
I don't want anyone's time for free where real work is concerned, so I'll offer 50 bucks to anyone that helps me get this working.