Sha256: 9d8ecefef2cff971e6d3ae4f3c341a00e6e1a7e8fe1b40fbf4f12258c8f1784b

Contents?: true

Size: 610 Bytes

Versions: 4

Compression:

Stored size: 610 Bytes

Contents

$ ->
  $(window).bind('body_loaded',
    =>
      te = new TextEditor()
  )

class TextEditor

  constructor: ->
    @el = $("#editor")
    @editor = ace.edit("editor")
    @resize()
    @hashchange()

  hashchange: =>
    location = window.location.hash
    location = location.slice(1,location.length)
    @load_file(location)

  resize: =>
    @el.width($(window).width())
    @el.height($(window).height() - 40)

  load_file: (location) =>
    $.ajax "/api/file_system/file?path="+location+""
      success: (data) =>
        @set_text(data)


  set_text: (text) =>
    @editor.getSession().setValue(text)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
daftos-0.4.1 lib/apps/texteditor/coffee/texteditor.coffee
daftos-0.4.0 lib/apps/texteditor/coffee/texteditor.coffee
daftos-0.3.0 lib/apps/texteditor/coffee/texteditor.coffee
daftos-0.2.0 lib/apps/texteditor/coffee/texteditor.coffee