Files @ 448aa7255869
Branch filter:

Location: symposion_app/static/src/pyconau2017/js/load_editors.js

448aa7255869 1.3 KiB application/javascript Show Annotation Show as Raw Download as Raw
Nick Seidenman (N6)
Added favicon and special events pdf to bring this up to look/feel of wooden site.

Removed additional (and completely superfluous) styling in app.css that was otherwise making
our site look gluggy.

Mod'd fixtures (and updated db) to reflect PyCon rather than PinaxCon.

function setupEditor(editor, textarea) {
    const session = editor.getSession();
    //editor.setTheme('ace/theme/tomorrow');
    editor.$blockScrolling = Infinity;
    editor.setOption('scrollPastEnd', false);
    session.setMode('ace/mode/markdown');
    session.setValue(textarea.val());
    session.setUseWrapMode(true);
    session.on('change', () => {
        textarea.val(session.getValue());
    });
    editor.renderer.setShowGutter(true);
    session.setTabSize(4);
    session.setUseSoftTabs(true);
}

function setEditorSize(reportDiv, textArea)
{
  var w = textArea.width();
  var h = textArea.height();
  var border = textArea.css("border");

  reportDiv.width(w);
  reportDiv.height(h);

  reportDiv.css("position", "relative");
  reportDiv.css("border", border);
  textArea.css("display", "none");
}

function loadEditor(id) {
    var i = id;
    var el = `#${i}`;
    const editorId = `markdown-editor-${i}`;
    const reportDiv = $('<div>').attr('id', editorId);
    const $formGroup = $(el).closest('.form-group');
    const $textarea = $(el);

    $textarea.after(reportDiv);
    editor = ace.edit(editorId);

    setupEditor(editor, $textarea);

    $textarea.resize(() => {
        setEditorSize(reportDiv, $textarea);
        editor.resize();
    });

    $textarea.resize();

    return editor;
}