daily pastebin goal
11%
SHARE
TWEET

Untitled

a guest Apr 27th, 2018 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var editor = new YAHOO.widget.Editor('editor', {
  2.     height: '300px',
  3.     width: '600px',
  4.     dompath: true
  5. });
  6. editor.on('toolbarLoaded', function() {
  7.     //Create a new Group of buttons
  8.     var newGroup = {
  9.         group: 'clearprint', label: 'Clear/Print',
  10.         buttons: [
  11.             //Add the Clear Button
  12.             { type: 'push', label: 'Clear', value: 'clear' },
  13.             //Add the Print Button
  14.             { type: 'push', label: 'Print', value: 'print' }
  15.         ]
  16.     };
  17.     //Add the group to the Toolbar
  18.     editor.toolbar.addButtonGroup(newGroup);
  19.  
  20.     //Listen for the clear button click
  21.     editor.toolbar.on('clearClick', function(ev) {
  22.         //Clear the Editor
  23.         editor.setEditorHTML('');
  24.         //Focus the Editor
  25.         editor.focus();
  26.     });
  27.     //Listen for the Print button click
  28.     editor.toolbar.on('printClick', function(ev) {
  29.         //Tell the window to print.
  30.         editor._getWindow().print();
  31.     });
  32. });
  33. editor.render();
RAW Paste Data
Top