                     @doc.live(misc.to_json(@to_obj()))
 
                 apply_edits = @doc.dsync_client._apply_edits_to_live
-
                 @doc.dsync_client._apply_edits_to_live = (patch, cb) =>
                     console.log("_apply_edits_to_live -- #{JSON.stringify(patch)}")
                     obj = @to_obj()

    from_obj: (obj) =>
        nb = @frame.IPython.notebook
        i = nb.get_selected_index()
        console.log("cell = ", i)
        st = nb.element.scrollTop()
        console.log("st = ", st)
        nb.fromJSON(obj)
        nb.dirty = false
        nb.element.scrollTop(st)
        nb.select(i)

    focus: () =>
        # TODO

                        try
                            @from_obj(JSON.parse(@doc.dsync_client.live))
                        catch e
                            console.log("patch rejected", e)
                            @doc.dsync_client.live = before
                            @from_obj(obj)
                            # convince hub to reset.
                            @doc.dsync_client.push_edits (err) =>
                                console.log("attempted to reset.", err)
                    cb?()


