Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var editor = new YAHOO.widget.Editor('editor', {
- height: '300px',
- width: '600px',
- dompath: true
- });
- editor.on('toolbarLoaded', function() {
- //Create a new Group of buttons
- var newGroup = {
- group: 'clearprint', label: 'Clear/Print',
- buttons: [
- //Add the Clear Button
- { type: 'push', label: 'Clear', value: 'clear' },
- //Add the Print Button
- { type: 'push', label: 'Print', value: 'print' }
- ]
- };
- //Add the group to the Toolbar
- editor.toolbar.addButtonGroup(newGroup);
- //Listen for the clear button click
- editor.toolbar.on('clearClick', function(ev) {
- //Clear the Editor
- editor.setEditorHTML('');
- //Focus the Editor
- editor.focus();
- });
- //Listen for the Print button click
- editor.toolbar.on('printClick', function(ev) {
- //Tell the window to print.
- editor._getWindow().print();
- });
- });
- editor.render();
Add Comment
Please, Sign In to add comment