assets/js/jquery.hotkeys.js
assets/js/bootstrap-wysiwyg.js
$('#my-editor').ace_wysiwyg();
wysiwyg options to send to the pluginspeech_button whether to add speech input button in Chrometoolbar an array of toolbar buttons and optionstoolbar_place optional toolbar placement function
$('#my-editor').ace_wysiwyg({
toolbar: {
'bold',
'italic',
null,
{
name: 'font',
title: 'Custom tooltip',
values: ['Some Font!', 'Arial', 'Verdana', 'Comic Sans MS', 'Custom Font!']
}
}
});
title which is button's tooltip texticon which is button's iconclassName which is button's class namenull value puts a separator(space) between buttons.
font which takes an array as font names:
{
name: 'font',
title: 'optional custom tooltip',
icon: 'fa-leaf', //some custom icon
values: ['Some Font!', 'Arial', 'Verdana', 'Comic Sans MS', 'Custom Font!']
}
fontSize which takes an array as font sizes:
{
name: 'fontSize',
title: 'optional custom tooltip',
values:{1 : 'Size#1' , 2 : 'Size#2' , 3 : 'Size#3' , 4 : 'Size#4' , 5 : 'Size#5'}
}
bold:
'bold',
//or
{
name: 'bold',
title: 'optional custom tooltip',
icon: 'fa-leaf' //some custom icon
}
italicstrikethroughunderlineinsertunorderedlistinsertorderedlistoutdentindentjustifyleftjustifycenterjustifyrightjustifyfullcreateLink which inserts a link:
{
name: 'createLink',
title: 'optional custom tooltip',
placeholder: 'link input placeholder',
button_class: 'btn-purple',//insert button's class
button_text: 'Add Link'//insert button's text
}
unlinkinsertImage which inserts an image:
{
name: 'createLink',
title: 'optional custom tooltip',
placeholder: 'image url input placeholder',
button_insert_class: 'btn-purple',//insert button's class
button_insert: 'Add Link',//insert button's text
choose_file: true,//'Whether there should be a "Choose File" button
button_class: 'btn-success',//choose button's class
button_text: 'Choose an Image'//choose button's text
}
foreColor and backColor
which have a list of color values:
{
name: 'foreColor',
title: 'optional custom tooltip',
values: ['red', 'blue', '#FF7721']
}
undoredoviewSourceexamples/wysiwyg.html
toolbar_place you can put the toolbar somewhere else:
$('#editor2').css({'height':'200px'}).ace_wysiwyg({
toolbar_place: function(toolbar) {
//for example put the toolbar inside '.widget-header'
return $(this).closest('.widget-box')
.find('.widget-header').prepend(toolbar)
.find('.wysiwyg-toolbar').addClass('inline');
}
});
It should return the new toolbar
.wysiwyg-style1 and .wysiwyg-style2
to toolbar for alternative styles:
$('#editor2').ace_wysiwyg().prev().addClass('wysiwyg-style2');
$('#myform').on('submit', function() {
var hidden_input =
$('<input type="hidden" name="my-html-content" />')
.appendTo('#myform');
var html_content = $('#myeditor').html();
hidden_input.val( html_content );
//put the editor's HTML into hidden_input and it will be sent to server
});
mustache/app/views/assets/scripts/wysiwyg.js
enableImageResize function inside it
assets/js/markdown/markdown.js
and
assets/js/markdown/bootstrap-markdown.js
and optionally
assets/js/bootbox.js
if you prefer bootstrap modals to default browser dialogs
data-provide="markdown" attribute for the textarea element,
markdown editor will automatically be initiated.