$(element).wysiwyg({ classes: 'some-more-classes', // 'selection'|'top'|'top-selection'|'bottom'|'bottom-selection' toolbar: index == 0 ? 'top-selection' : (index == 1 ? 'bottom-focus' : 'selection'), buttons: { // Dummy-HTML-Plugin dummybutton1: index != 1 ? false : { html: $('').click(function() { // We simply make 'bold' if( $(element).wysiwyg('shell').getSelectedHTML() ) $(element).wysiwyg('shell').bold(); else alert( 'Seleccione algun texto' ); }), //showstatic: true, // wanted on the toolbar showselection: false // wanted on selection }, // Dummy-Button-Plugin dummybutton2: index != 1 ? false : { title: 'Dummy', image: '\uf1e7', click: function( $button ) { alert('Do something'); }, //showstatic: true, // wanted on the toolbar showselection: false // wanted on selection }, insertimage: { title: 'Insertar imagen', image: '', // // showstatic: true, // wanted on the toolbar showselection: index == 2 ? true : false // wanted on selection }, insertvideo: { title: 'Insertar video (Youtube, Vimeo, Dailymotion) ó codigo embed', image: '', // //showstatic: true, // wanted on the toolbar showselection: index == 2 ? true : false // wanted on selection }, insertlink: { title: 'Insertar vinculo', image: '' // },/* // Fontname plugin fontname: index == 1 ? false : { title: 'Fuente', image: '', // popup: function( $popup, $button ) { var list_fontnames = { // Name : Font 'Arial, Helvetica' : 'Arial,Helvetica', 'Verdana' : 'Verdana,Geneva', 'Georgia' : 'Georgia', 'Courier New' : 'Courier New,Courier', 'Times New Roman' : 'Times New Roman,Times' }; var $list = $('
').addClass('wysiwyg-plugin-list') .attr('unselectable','on'); $.each( list_fontnames, function( name, font ) { var $link = $('').attr('href','#') .css( 'font-family', font ) .html( name ) .click(function(event) { $(element).wysiwyg('shell').fontName(font).closePopup(); // prevent link-href-# event.stopPropagation(); event.preventDefault(); return false; }); $list.append( $link ); }); $popup.append( $list ); }, //showstatic: true, // wanted on the toolbar showselection: index == 0 ? true : false // wanted on selection },*/ // Fontsize plugin /*fontsize: index != 1 ? false : { title: 'Tamaño', image: '\uf034', // popup: function( $popup, $button ) { // Hack: http://stackoverflow.com/questions/5868295/document-execcommand-fontsize-in-pixels/5870603#5870603 var list_fontsizes = []; for( var i=8; i <= 11; ++i ) list_fontsizes.push(i+'px'); for( var i=12; i <= 28; i+=2 ) list_fontsizes.push(i+'px'); list_fontsizes.push('36px'); list_fontsizes.push('48px'); list_fontsizes.push('72px'); var $list = $('
').addClass('wysiwyg-plugin-list') .attr('unselectable','on'); $.each( list_fontsizes, function( index, size ) { var $link = $('').attr('href','#') .html( size ) .click(function(event) { $(element).wysiwyg('shell').fontSize(7).closePopup(); $(element).wysiwyg('container') .find('font[size=7]') .removeAttr("size") .css("font-size", size); // prevent link-href-# event.stopPropagation(); event.preventDefault(); return false; }); $list.append( $link ); }); $popup.append( $list ); } //showstatic: true, // wanted on the toolbar //showselection: true // wanted on selection },*/ // Header plugin /*header: index != 1 ? false : { title: 'Título', image: '\uf1dc', // popup: function( $popup, $button ) { var list_headers = { // Name : Font 'Título 1' : '

', 'Título 2' : '

', 'Título 3' : '

', 'Título 4' : '

', 'Título 5' : '

', 'Título 6' : '
', 'Codigo' : '
'
                                };
                            var $list = $('
').addClass('wysiwyg-plugin-list') .attr('unselectable','on'); $.each( list_headers, function( name, format ) { var $link = $('').attr('href','#') .css( 'font-family', format ) .html( name ) .click(function(event) { $(element).wysiwyg('shell').format(format).closePopup(); // prevent link-href-# event.stopPropagation(); event.preventDefault(); return false; }); $list.append( $link ); }); $popup.append( $list ); } //showstatic: true, // wanted on the toolbar //showselection: false // wanted on selection },*/ bold: { title: 'Negrita (Ctrl+B)', image: '', // hotkey: 'b' }, italic: { title: 'Cursiva (Ctrl+I)', image: '', // hotkey: 'i' }, underline: { title: 'Subrayado (Ctrl+U)', image: '', // hotkey: 'u' }, strikethrough: { title: 'Tachado (Ctrl+S)', image: '', // hotkey: 's' }, forecolor: { title: 'Color de texto', image: '' // }, highlight: { title: 'Color de fondo', image: '' // }, alignleft: index != 0 ? false : { title: 'Izquierda', image: '', // //showstatic: true, // wanted on the toolbar showselection: false // wanted on selection }, aligncenter: index != 0 ? false : { title: 'Centrado', image: '', // //showstatic: true, // wanted on the toolbar showselection: false // wanted on selection }, alignright: index != 0 ? false : { title: 'Derecha', image: '', // //showstatic: true, // wanted on the toolbar showselection: false // wanted on selection }, alignjustify: index != 0 ? false : { title: 'Justificado', image: '', // //showstatic: true, // wanted on the toolbar showselection: false // wanted on selection }, subscript: index == 1 ? false : { title: 'Sub', image: '', // //showstatic: true, // wanted on the toolbar showselection: true // wanted on selection }, superscript: index == 1 ? false : { title: 'Super', image: '', // //showstatic: true, // wanted on the toolbar showselection: true // wanted on selection }, indent: index != 0 ? false : { title: 'Sangria', image: '', // //showstatic: true, // wanted on the toolbar showselection: false // wanted on selection }, outdent: index != 0 ? false : { title: 'Anular sangria', image: '', // //showstatic: true, // wanted on the toolbar showselection: false // wanted on selection }, orderedList: index != 0 ? false : { title: 'Lista ordenada', image: '', // //showstatic: true, // wanted on the toolbar showselection: false // wanted on selection }, unorderedList: index != 0 ? false : { title: 'Lista no ordenada', image: '', // //showstatic: true, // wanted on the toolbar showselection: false // wanted on selection }, removeformat: { title: 'Limpiar formato', image: '' // } }, // Submit-Button submit: { title: 'Submit', image: 'OK' // }, // Other properties selectImage: 'Buscar imagen', placeholderUrl: 'http://', placeholderEmbed: '', maxImageSize: ['100%','auto'], onKeyDown: function( key, character, shiftKey, altKey, ctrlKey, metaKey ) { //alert(key) // E.g.: submit form on enter-key: //if( (key == 10 || key == 13) && !shiftKey && !altKey && !ctrlKey && !metaKey ) { // submit_form(); // return false; // swallow enter //} }, onKeyPress: function( key, character, shiftKey, altKey, ctrlKey, metaKey ) { }, onKeyUp: function( key, character, shiftKey, altKey, ctrlKey, metaKey ) { }, onAutocomplete: function( typed, key, character, shiftKey, altKey, ctrlKey, metaKey ) { if( typed.indexOf('@') == 0 ) // startswith '@' { var usernames = [ 'Evelyn', 'Harry', 'Amelia', 'Oliver', 'Isabelle', 'Eddie', 'Editha', 'Jacob', 'Emily', 'George', 'Edison' ]; var $list = $('
').addClass('wysiwyg-plugin-list') .attr('unselectable','on'); $.each( usernames, function( index, username ) { if( username.toLowerCase().indexOf(typed.substring(1).toLowerCase()) !== 0 ) // don't count first character '@' return; var $link = $('').attr('href','#') .text( username ) .click(function(event) { var url = 'http://example.com/user/' + username, html = '@' + username + ' '; var editor = $(element).wysiwyg('shell'); // Expand selection and set inject HTML editor.expandSelection( typed.length, 0 ).insertHTML( html ); editor.closePopup().getElement().focus(); // prevent link-href-# event.stopPropagation(); event.preventDefault(); return false; }); $list.append( $link ); }); if( $list.children().length ) { if( key == 13 ) { $list.children(':first').click(); return false; // swallow enter } // Show popup else if( character || key == 8 ) return $list; } } }, onImageUpload: function( insert_image ) { // Example client script (without upload-progressbar): var iframe_name = 'legacy-uploader-' + Math.random().toString(36).substring(2); $(''; // vimeo - http://embedresponsively.com/ var vimeo_match = url.match( /^(?:http(?:s)?:\/\/)?(?:[a-z0-9.]+\.)?vimeo\.com\/([0-9]+)$/ ); if( vimeo_match ) return ''; // dailymotion - http://embedresponsively.com/ var dailymotion_match = url.match( /^(?:http(?:s)?:\/\/)?(?:[a-z0-9.]+\.)?dailymotion\.com\/video\/([0-9a-z]+)$/ ); if( dailymotion_match ) return ''; // undefined -> create '