Created
June 13, 2017 23:55
-
-
Save LukeTowers/78e60848003ba6ec91b08e810ba0ac54 to your computer and use it in GitHub Desktop.
October Tricks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
|------------------ | |
| 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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also see octobercms/october#2078