Sha256: 21093a552112f8940a170dd19cde86f7e8d5ec4b46ddd5c179f77be7c4171206

Contents?: true

Size: 1.51 KB

Versions: 2

Compression:

Stored size: 1.51 KB

Contents

(function() {
  var COEXISTING_EDITORS, PRIMARY_EDITORS, default_editor;

  PRIMARY_EDITORS = ['date_editor', 'enum_editor', 'html_editor', 'image_editor', 'link_editor', 'linklist_editor', 'multienum_editor', 'permalink_editor', 'reference_editor', 'referencelist_editor', 'string_editor', 'stringlist_editor'];

  COEXISTING_EDITORS = ['binary_editor', 'image_drop_editor'];

  default_editor = {
    can_edit: function() {
      return true;
    },
    activate: function(element) {
      var editor, i, j, legacyApiEditor, len, len1, ref;
      legacyApiEditor = $(element).data('editor');
      if (legacyApiEditor) {
        editor = legacyApiEditor + "_editor";
        console.warn("data-editor is deprecated, please use scrivito_tag(tag, obj, html_options, editor: '" + legacyApiEditor + "')");
        if ((ref = scrivito.editors[editor]) != null) {
          ref.activate(element);
        }
        return;
      }
      for (i = 0, len = COEXISTING_EDITORS.length; i < len; i++) {
        editor = COEXISTING_EDITORS[i];
        if (scrivito.editors[editor].can_edit(element)) {
          scrivito.editors[editor].activate(element);
        }
      }
      for (j = 0, len1 = PRIMARY_EDITORS.length; j < len1; j++) {
        editor = PRIMARY_EDITORS[j];
        if (scrivito.editors[editor].can_edit(element)) {
          scrivito.editors[editor].activate(element);
          return;
        }
      }
    }
  };

  scrivito.on('load', function() {
    return scrivito.define_editor('default', default_editor);
  });

}).call(this);

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
scrivito_editors-0.90.0.rc2 app/assets/javascripts/scrivito_editors/default_editor.js
scrivito_editors-0.90.0.rc1 app/assets/javascripts/scrivito_editors/default_editor.js