Created
April 8, 2019 03:54
-
-
Save sean-gilmore/18edac69b8ff3a65793a92dea15efeb2 to your computer and use it in GitHub Desktop.
Froala Editor Wrapper
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
$.FroalaEditor.DefineIcon('alert', {NAME: 'info'}); | |
$.FroalaEditor.RegisterCommand('alert', { | |
title: 'Hello', | |
focus: false, | |
undo: false, | |
refreshAfterCallback: false, | |
callback: function () { | |
alert('Hello!'); | |
} | |
}); | |
$.FroalaEditor.DefineIcon('clear', {NAME: 'remove'}); | |
$.FroalaEditor.RegisterCommand('clear', { | |
title: 'Clear HTML', | |
focus: false, | |
undo: true, | |
refreshAfterCallback: true, | |
callback: function () { | |
this.html.set(''); | |
this.events.focus(); | |
} | |
}); | |
$.FroalaEditor.DefineIcon('insert', {NAME: 'plus'}); | |
$.FroalaEditor.RegisterCommand('insert', { | |
title: 'Insert HTML', | |
focus: true, | |
undo: true, | |
refreshAfterCallback: true, | |
callback: function () { | |
/* this.html.insert('<span style="bold"></'); */ | |
this.html.insert("<span class=\"highlight\">" + this.html.getSelected() + "</span>"); | |
} | |
}); | |
$('div#froala-editor').froalaEditor({ | |
// Add the custom buttons in the toolbarButtons list, after the separator. | |
toolbarButtons: ['undo', 'redo' , 'bold', '|', 'alert', 'clear', 'insert'] | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment