TinyMCE Image URL select
I have written my own image uploader for TinyMCE, but I am left with one dilemma: how do I select the image to show in the "Image URL" field of the TinyMCE advimage popup?
My image uploader opens in another popup when I click the button next to the "Image URL"开发者_如何转开发 field. So I need to get the image url from my popup and insert it in the other popup in that field. I can get the path very easy, but I don't know how to insert it in the other place.
Any thoughts?
I'm using the jQuery build, here is part of the code I'm using from within the custom filebrowser:
$('.my-image').click(function() {// Change this to your event/selector
var $src = $(this).val();// Change this to whatever the image path is
if ( ! $src) return false;
// Find the iframe within the popup
var $input = $(window.top.document)
.find('iframe[src*="advimage/image.htm"]')
.contents()
.find('input#src');
// Trigger the preview and fill in the image dimensions
$input.val($src).change();
return false;
});
Maybe not the most elegant solution, but it's been working for me for years. Hope this helps.
精彩评论