$(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 = $('
'
};
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);
$('