         @doc.sync () =>
             @save_button.icon_spin(false)
 
+    save: (cb) =>
+        obj = @to_obj()
+        v1 = misc.to_json(obj)
+        @doc.live(v1)
+        @save_button.icon_spin(start:true,delay:500)
+        @doc.save () =>
+            @save_button.icon_spin(false)
+            @save_button.addClass('disabled')
+            cb?()
+
     doc_sync: () =>
-        console.log("doc sync")
 
         v1 = @doc.live()
 

            project_id : @editor.project_id
            filename   : @filename
            cb         : () =>
                console.log('sync connected')

        @doc.on 'sync', @doc_sync



    focus: () =>
        # TODO
        # console.log("ipython notebook focus: todo")


    show: () =>
