 
 
   addNode: (node) ->
+    @endNodeEdit()
     @undoRedoManager.createAndExecuteCommand 'addNode',
       execute: => @_addNode node
       undo: => @_removeNode node
 
   removeNode: (nodeKey) ->
+    @endNodeEdit()
     node = @nodeKeys[nodeKey]
 
     # create a copy of the list of links

    @selectionManager.selectForTitleEditing(@nodeKeys[nodeKey])

  selectNode: (nodeKey) ->
    @selectionManager.selectForInspection(@nodeKeys[nodeKey])



    @updateListeners()

  moveNodeCompleted: (nodeKey, pos, originalPos) ->
    @endNodeEdit()
    node = @nodeKeys[nodeKey]
    return unless node
    @undoRedoManager.createAndExecuteCommand 'moveNode',
