Hi there,
I have got a question. I am building a Youtube embed plugin, and added it to the toolbar. The plugin works fine. It puts the embed code in the textarea and shows a block with flash in it. So far so good.
But what i need to know is how to force ckeditor to "double mouse click" the flash block in the textarea and not open the "standard flash dialog" but my "youtube dialog". Anyone know how this is done?
This is my code:
( function(){ var exampleDialog = function(editor){ return { title : 'Youtube Video', minWidth : 200, minHeight : 175, onOk: function(){ var dialog = this; var embedId = dialog.getValueOf( 'tab1', 'embedId' ); var embedWidth = dialog.getValueOf('tab1','embedWidth'); var embedHeight = dialog.getValueOf('tab1','embedHeight'); var embedRelatedVideos = dialog.getValueOf('tab1','embedRelatedVideos'); var rel = 0; if(embedRelatedVideos === 'true'){ rel = 1; }else{ rel = 0; } var sHtml = '<p><object width="'+embedWidth+'" height="'+embedHeight+'" data="http://www.youtube.com/v/&rel=1" type="application/x-shockwave-flash"><param name="wmode" value="transparent" /><param name="src" value="http://www.youtube.com/v/'+embedId+'&rel='+rel+'" /></object></p>'; editor.insertHtml( sHtml ); } , onLoad: function(){}, onShow: function(){ }, onHide: function(){}, onCancel: function(){}, resizable: 'none', contents : [ { id : 'tab1', label : 'Insert Youtube Embedded Code', elements : [ { type: 'text', id: 'embedId', label: 'Youtube Embed Code', validate: CKEDITOR.dialog.validate.notEmpty("Youtube Embed Code is not filled in. This field cannot be empty") }, { type: 'text', id: 'embedWidth', label: 'Width', width: "50px", 'default': '450px' }, { type: 'text', id: 'embedHeight', label: 'Height', width: "50px", 'default': '320px' }, { type: 'radio', id: 'embedRelatedVideos', label: 'Show related videos?', items: [['Yes','true'],['No','false']], 'default' : 'false' } ] } ] } } CKEDITOR.dialog.add('youtube', function(editor){ return exampleDialog(editor); }); })();
Re: Youtube Plugin double click in editor
You should check out our Dialog samples below (check the source code for more explanations):
http://nightly.ckeditor.com/7608/_sampl ... ialog.html
Also use our tutorials on how to create custom plugins with dialogs:
http://docs.cksource.com/CKEditor_3.x/Tutorials
Also, if you check ckeditor\_source\plugins\link\plugin.js, line 88, you will see how double-clicks are setup.
Customer and Community Manager, CKSource
Follow us on: Facebook, Twitter, LinkedIn
If you think you found a bug in CKEditor, read this!