Luke Diebold
Luke Diebold

Reputation: 143

Adding options to Froala Editor v2 after initialize

Froala v2 has removed the "option" method in v2. Is it possible to change options after the editor has been initialized? Something like this:

var $title = $('#title');

$edit.on('froalaEditor.save.before', function (e, editor) {
   $edit.froalaEditor('option', 'saveParams', {
      title: $title.val()
   });
});

Upvotes: 0

Views: 2318

Answers (2)

evpozdniakov
evpozdniakov

Reputation: 543

How to get the Froala editor instance:

var editor = $('.textarea-selector').data('froala.editor')

Then you can reconfigure your Froala:

var newOpts = {saveParams: {title: $title.val()}}
$.extend(editor.opts, newOpts)

https://github.com/froala/wysiwyg-editor/issues/53

Upvotes: 3

largeden
largeden

Reputation: 1

Try as shown below.

var $title = $('#title');

$edit.on('froalaEditor.save.before', function (e, editor) {
    $.extend(editor.opts.saveParams, {
        title : $title.val()
    });
});

Upvotes: 0

Related Questions