     return if not files?
     return if files.length <= 0
     file = files[0]
-    console.log "#{FS.readFileSync file}"
+    @file =
+     name: PATH.basename file, '.ds'
+     path: file
+    @editor.setText "#{FS.readFileSync file}"
+    @_editorChanged = false
+    @_changed = false
+    @elems.save.style.display = 'inline-block'
+    @elems.saveName.textContent = "#{@file.name}"
 
    @listen 'save', ->
+    text = @removeTrailingSpace @editor.getText()
+    @editor.setText text
+    @content = text
+    @send 'saveFileContent', content: text
    @listen 'saveAs', ->
    @listen 'print', ->
     @editor.on.print()

  ELECTRON = require 'electron'
  IPC = ELECTRON.ipcRenderer
  FS = require 'fs'

  PROTOCOLS = [
   'https://'

           @span ".icon.icon-upload", null
         @$.elems.save = @button ".btn.btn-default",
          title: "Save file"
          style: {display: 'none'}
          on: {click: @$.on.save}
          ->
           @span ".icon.icon-download.icon-text", null
           @$.elems.saveName = @span ""
         @button ".btn.btn-default",
          title: "Save file"
          on: {click: @$.on.saveAs}
          "SaveAs"
