/** * Basic sample plugin inserting current date and time into CKEditor editing area. * * Created out of the CKEditor Plugin SDK: * http://docs.ckeditor.com/#!/guide/plugin_sdk_intro */ // Register the plugin within the editor. CKEDITOR.plugins.add( 'timestamp', { // Register the icons. They must match command names. icons: 'timestamp', // The plugin initialization logic goes inside this method. init: function( editor ) { // Define an editor command that inserts a timestamp. editor.addCommand( 'insertTimestamp', { // Define the function that will be fired when the command is executed. exec: function( editor ) { var URL = "./?cmd=gettimedate"; $.ajax({ url: URL, context: document.body, success: function(data) { editor.insertHtml(data); } }); } }); // Create the toolbar button that executes the above command. editor.ui.addButton( 'Timestamp', { label: 'Insert Timestamp', command: 'insertTimestamp', toolbar: 'insert' }); } });