Skip to content

Instantly share code, notes, and snippets.

@LukeTowers
Created June 13, 2017 23:55
Show Gist options
  • Save LukeTowers/78e60848003ba6ec91b08e810ba0ac54 to your computer and use it in GitHub Desktop.
Save LukeTowers/78e60848003ba6ec91b08e810ba0ac54 to your computer and use it in GitHub Desktop.
October Tricks
/*
|------------------
| Extend Richeditor
|------------------
*/
+function ($) {
var Plugins = {
init: function () {
$.FroalaEditor.DefineIcon('buttonIcon', {NAME: 'star'});
$.FroalaEditor.RegisterCommand('myButton', {
title: 'My Button',
icon: 'buttonIcon',
undo: true,
focus: true,
refreshAfterCallback: true,
callback: function () {
console.log(this.html.get());
},
refresh: function ($btn) {
console.log(this.selection.element());
}
});
console.log('BEFORE');
console.log($.oc.richEditorButtons);
$.oc.richEditorButtons.push('myButton');console.log($.oc.richEditorButtons);
}
};
$(document).on('render', function () {
Plugins.init();
});
}(jQuery);
@LukeTowers
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment