Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var editor = new YAHOO.widget.SimpleEditor('msgpost', {
- height: '250px',
- width: '465px',
- dompath: true,
- animate: true,
- handleSubmit: true
- toolbar: {
- titlebar: 'Write something.',
- buttons: [
- { group: 'textstyle', label: 'Font Style',
- buttons: [
- { type: 'push', label: 'Bold', value: 'bold' },
- { type: 'push', label: 'Italic', value: 'italic' },
- { type: 'separator' },
- { type: 'select', label: 'Arial', value: 'fontname', disabled: true,
- menu: [
- { text: 'Arial', checked: true },
- { text: 'Arial Black' },
- { text: 'Comic Sans MS' },
- { text: 'Courier New' },
- { text: 'Lucida Console' },
- { text: 'Tahoma' },
- { text: 'Times New Roman' },
- { text: 'Trebuchet MS' },
- { text: 'Verdana' }
- ]
- },
- { type: 'spin', label: '13', value: 'fontsize', range: [ 9, 75 ], disabled: true },
- { type: 'separator' },
- { type: 'color', label: 'Font Color', value: 'forecolor', disabled: true },
- { type: 'color', label: 'Background Color', value: 'backcolor', disabled: false },
- ]
- }
- ]
- }
- });
- 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