script: ace config
(function() {
  var aceEditorContent;

  wagn.addEditor('.ace-editor-textarea', function() {
    return wagn.initAce($(this));
  }, function() {
    return aceEditorContent(this[0]);
  });

  $.extend(wagn, {
    setAceConfig: function(string) {
      var setter;
      setter = function() {
        try {
          return $.parseJSON(string);
        } catch (error) {
          return {};
        }
      };
      return wagn.aceConfig = setter();
    },
    configAceEditor: function(editor, mode) {
      var conf, hard_conf, user_conf;
      conf = {
        showGutter: true,
        theme: "ace/theme/github",
        printMargin: false,
        tabSize: 2,
        useSoftTabs: true,
        maxLines: 30
      };
      hard_conf = {
        mode: "ace/mode/" + mode
      };
      user_conf = wagn.aceConfig != null ? wagn.aceConfig : {};
      $.extend(conf, user_conf['default'], user_conf[mode], hard_conf);
      return editor.setOptions(conf);
    },
    initAce: function(textarea) {
      var editDiv, editor, mode;
      mode = textarea.attr("data-ace-mode");
      if (!mode) {
        textarea.autosize();
        return;
      }
      editDiv = $("<div>", {
        position: "absolute",
        width: "auto",
        height: textarea.height()
      }).insertBefore(textarea);
      textarea.css("visibility", "hidden");
      textarea.css("height", "0px");
      ace.config.set('basePath', '/assets/ace');
      editor = ace.edit(editDiv[0]);
      editor.getSession().setValue(textarea.val());
      wagn.configAceEditor(editor, mode);
    }
  });

  aceEditorContent = function(element) {
    var ace_div, editor;
    ace_div = $(element).siblings(".ace_editor");
    editor = ace.edit(ace_div[0]);
    return editor.getSession().getValue();
  };

  $.extend(wagn, {
    initProseMirror: function(el_id) {
      var conf, hard_conf, user_conf;
      conf = {
        menuBar: true,
        tooltipMenu: false
      };
      hard_conf = {
        docFormat: "html"
      };
      user_conf = wagn.proseMirrorConfig != null ? wagn.proseMirrorConfig : {};
      $.extend(conf, user_conf, hard_conf);
      return createProseMirror(el_id, conf);
    }
  });

}).call(this);

All Cards on This Page

 

Journals

2110 medium
Full list of journal entries