Guest User

Untitled

a guest
Mar 17th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. var editor = new YAHOO.widget.SimpleEditor('msgpost', {
  2. height: '250px',
  3. width: '465px',
  4. dompath: true,
  5. animate: true,
  6. handleSubmit: true
  7. toolbar: {
  8. titlebar: 'Write something.',
  9. buttons: [
  10. { group: 'textstyle', label: 'Font Style',
  11. buttons: [
  12. { type: 'push', label: 'Bold', value: 'bold' },
  13. { type: 'push', label: 'Italic', value: 'italic' },
  14. { type: 'separator' },
  15. { type: 'select', label: 'Arial', value: 'fontname', disabled: true,
  16. menu: [
  17. { text: 'Arial', checked: true },
  18. { text: 'Arial Black' },
  19. { text: 'Comic Sans MS' },
  20. { text: 'Courier New' },
  21. { text: 'Lucida Console' },
  22. { text: 'Tahoma' },
  23. { text: 'Times New Roman' },
  24. { text: 'Trebuchet MS' },
  25. { text: 'Verdana' }
  26. ]
  27. },
  28. { type: 'spin', label: '13', value: 'fontsize', range: [ 9, 75 ], disabled: true },
  29. { type: 'separator' },
  30. { type: 'color', label: 'Font Color', value: 'forecolor', disabled: true },
  31. { type: 'color', label: 'Background Color', value: 'backcolor', disabled: false },
  32. ]
  33. }
  34. ]
  35. }
  36. });
  37.  
  38. editor.on('toolbarLoaded', function() {
  39.  
  40. //Create a new Group of buttons
  41. var newGroup = {
  42. group: 'clearprint', label: 'Clear/Print',
  43. buttons: [
  44. //Add the Clear Button
  45. { type: 'push', label: 'Clear', value: 'clear' },
  46. //Add the Print Button
  47. { type: 'push', label: 'Print', value: 'print' }
  48. ]
  49. };
  50. //Add the group to the Toolbar
  51. editor.toolbar.addButtonGroup(newGroup);
  52.  
  53. //Listen for the clear button click
  54. editor.toolbar.on('clearClick', function(ev) {
  55. //Clear the Editor
  56. editor.setEditorHTML('');
  57. //Focus the Editor
  58. editor.focus();
  59. });
  60. //Listen for the Print button click
  61. editor.toolbar.on('printClick', function(ev) {
  62. //Tell the window to print.
  63. editor._getWindow().print();
  64. });
  65. });
  66.  
  67. editor.render();
Add Comment
Please, Sign In to add comment