I need a little help! I've written a plugin to hit some ajax and return a list of images, in an iFrame. That all works. The users selects their image and more ajax goes away and gets the file path and writes it as an image.
All ok to here. Then I want to insert this into the editor, which I don't seem to be able to do no matter what I try. Any ideas?
Thanks in advance!
All ok to here. Then I want to insert this into the editor, which I don't seem to be able to do no matter what I try. Any ideas?
Thanks in advance!
/* * @example An iframe-based dialog with custom button handling logics. */ ( function() { CKEDITOR.plugins.add( 'cmsimages', { requires: [ 'iframedialog' ], init: function( editor ) { editor.insertHtml('<p>fdhjsk</p>'); var me = this; CKEDITOR.dialog.add( 'cmsimagesDialog', function () { return { title : 'Insert Image from Library', minWidth : 550, minHeight : 200, contents : [ { id : 'iframe', label : 'Insert YouTube Movie...', expand : true, elements : [ { type : 'iframe', src : ADMINPATH + 'editor/image_lib', width : '100%', height : '100%', onContentLoad : function() { // Iframe is loaded... } } ] } ], onOk : function( editor ) { var asset = { id: $('iframe').contents().find('.selected').attr('href')}; $.ajax({ url: ADMINPATH + 'editor/insertasset', data: asset, type: 'POST', dataType: 'HTML', success: function(img){ // insert the image into the editor editor.insertHtml(img); } }); } }; }); editor.addCommand( 'cmsimages', new CKEDITOR.dialogCommand( 'cmsimagesDialog' ) ); editor.ui.addButton( 'cmsimages', { label: 'Insert Image from Library', command: 'cmsimages', icon: this.path + 'images/icon.png' } ); } } ); } )();
Re: Return html to editor