GET CODE
Examples:
$.wysiwyg(): Toolbar on top and on selection, smiley+fontname plugin:
insert html
// create editor:
$(element).wysiwyg({
classes: 'some-more-classes',
toolbar: 'selection'|'top'|'top-focus'|'top-selection'|'top-focus-selection'|'bottom'|'bottom-focus'|'bottom-selection'|'bottom-focus-selection',
buttons: {
buttonname: {
title: 'tooltip text',
// How should the button look like?
image: '\u1234' | '<img src="path/to/image.jpg">',
html: '<raw html>',
// What should the button do?
popup: function( $popup, $button ) { ... },
click: function( $button ) { ... },
// Where should the button be placed?
showstatic: true, // on the static toolbar
showselection: true // on selection toolbar
},
// build-in:
insertimage: { ... },
insertvideo: { ... },
insertlink: { ... },
bold: { ... },
italic: { ... },
underline: { ... },
strikethrough: { ... },
forecolor: { ... },
highlight: { ... },
alignleft: { ... },
aligncenter: { ... },
alignright: { ... },
alignjustify: { ... },
subscript: { ... },
superscript: { ... },
indent: { ... },
outdent: { ... },
orderedList: { ... },
unorderedList: { ... },
removeformat: { ... }
},
submit: { ... },
selectImage: 'Click or drop image',
placeholderUrl: 'www.example.com',
placeholderEmbed: '<embed/>',
maxImageSize: [600,200],
onKeyDown: function( key, character, shiftKey, altKey, ctrlKey, metaKey ) { ... },
onKeyPress: function( key, character, shiftKey, altKey, ctrlKey, metaKey ) { ... },
onKeyUp: function( key, character, shiftKey, altKey, ctrlKey, metaKey ) { ... },
onAutocomplete: function( tyed, key, character, shiftKey, altKey, ctrlKey, metaKey ) { ... },
onImageUpload: function( insert_image ) { ... },
forceImageUpload: false,
videoFromUrl: function( url ) { ... }
});
// surrounding div:
$(element).wysiwyg('container');
// accessing 'wysiwyg.js':
$(element).wysiwyg('shell').bold();
$(element).wysiwyg('shell').forecolor( '#ff0000' );
$(element).wysiwyg('shell').insertHTML( '<b>some text</b>' );