     # ------------------------------------------------------------------------------------------------------------------
     # ace editor creation and conf
     # ------------------------------------------------------------------------------------------------------------------
-    editor = ace.edit("md_editor_div");
+    global.editor = ace.edit("md_editor_div");
+    editor = global.editor
     editor.renderer.setShowGutter(false);
     editor.setShowPrintMargin(false);
     editor.getSession().setMode("ace/mode/markdown");

        setTimeout (-> editor.session.on('changeScrollTop', editor_scroll_handler)), 20
    $html_div.scroll(html_scroll_handler)


global = this

$ ->
    ####################################################################################################################
    #                                                 DEFINE FUNCTIONS
