.github-star {
padding-left: 15px;
margin-bottom: 15px;
}
API
Destroy / Init editor
Try it yourself:
The buttons below will destroy and init the rich text editor again.
HTML
<div id="froala-editor">
<p>The buttons below will destroy and init the rich text editor again.</p>
</div>
<p>
<a id="btn-destroy" href="#" class="btn r-btn highlight text-small">Destroy</a>
<a id="btn-init" href="#" class="btn r-btn text-small">Init</a>
</p>
JAVASCRIPT
<script>
var editor = new FroalaEditor('div#froala-editor')
// Destroy action.
document.querySelector('a#btn-destroy').addEventListener('click', function (e) {
e.preventDefault();
if (editor) {
editor.destroy()
}
});
// Initialize action.
document.querySelector('a#btn-init').addEventListener('click', function (e) {
e.preventDefault();
if (!editor) {
editor = new FroalaEditor('div#froala-editor')
}
})
</script>