Last active
August 29, 2015 13:56
-
-
Save phylaxis/9237824 to your computer and use it in GitHub Desktop.
Add CKButton JS code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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( 'tmo-addpage', { | |
// Register the icons. They must match command names. | |
icons: 'page_add.png', | |
// The plugin initialization logic goes inside this method. | |
init: function( editor ) { | |
// Define an editor command that inserts a timestamp. | |
editor.addCommand( 'addPagebreak', { | |
// Define the function that will be fired when the command is executed. | |
exec: function( editor ) { | |
var now = new Date(); | |
// Insert the {pagebreak} tag into the document. | |
editor.insertHtml( '{pagebreak}' ); | |
} | |
}); | |
// Create the toolbar button that executes the above command. | |
editor.ui.addButton( 'Addpage', { | |
label: 'Add Pagebreak', | |
command: 'addPagebreak' | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment