Sha256: d5ad1556a6f4524fe81d3e3383a37689d24f2d93370d7b80b21e51409f3ef847

Contents?: true

Size: 760 Bytes

Versions: 2

Compression:

Stored size: 760 Bytes

Contents

//= require medium-editor
//= require_self

;(function() {

scrivito.on('content', function(content) {
  if (!scrivito.in_editable_view()) { return; }

  $(content).find('[data-editor=medium]').each(function() {
    var contenteditable = $(this);

    var config;
    if (contenteditable.attr('data-medium-editor')) {
      config = JSON.parse(contenteditable.attr('data-medium-editor'));
    } else {
      config = {buttons: [
        'bold',
        'italic',
        'underline',
        'header1',
        'header2',
        'unorderedlist',
        'orderedlist'
      ]};
    }

    new MediumEditor(contenteditable, config);

    contenteditable.on('input', function() {
      contenteditable.scrivito('save', $(this).html());
    });
  });
});

}());

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
scrivito-medium-editor-0.0.3 app/assets/javascripts/scrivito-medium-editor.js
scrivito-medium-editor-0.0.2 app/assets/javascripts/scrivito-medium-editor.js