       ctx: @mainCtx
       draw: @draw
 
+    @aceElement = document.createElement 'div'
+    @aceElement.className = 'droplet-ace'
+
+    @wrapperElement.appendChild @aceElement
+
+    @aceEditor = ace.edit @aceElement
+
+    @aceEditor.setTheme 'ace/theme/chrome'
+    @aceEditor.setFontSize 15
+    acemode = @options.mode
+    if acemode is 'coffeescript' then acemode = 'coffee'
+    @aceEditor.getSession().setMode 'ace/mode/' + acemode
+    @aceEditor.getSession().setTabSize 2
+
+    @currentlyAnimating = false
+
+    @transitionContainer = document.createElement 'div'
+    @transitionContainer.className = 'droplet-transition-container'
+
+    @dropletElement.appendChild @transitionContainer
+
     @session = new Session @, @options, @standardViewSettings
+    @sessions = new PairDict([
+      [@aceEditor.getSession(), @session]
+    ])
+
+    @blankSession = new Session @, {mode: '', palette: []}, @standardViewSettings
+
+    # Sessions are bound to other ace sessions;
+    # on ace session change Droplet will also change sessions.
+    @aceEditor.on 'changeSession', (e) =>
+      if @sessions.contains(e.session)
+        @session = @sessions.get(e.session)
+        @updateNewSession()
+      else
+        @setEditorState false
+        @session = @blankSession
 
     # Set up event bindings before creating a view
     @bindings = {}

  return null

Editor::handleTextInputClickInPalette = (palettePoint) ->
  for entry in @currentPaletteBlocks
    hitTestResult = @hitTestTextInputInPalette palettePoint, entry.block

    # If they have clicked a socket, check to see if it is a dropdown


hook 'redraw_palette', 0, ->
  bounds = new @draw.NoRectangle()
  for entry in @session.currentPaletteBlocks
    bounds.unite @session.paletteView.getViewNodeFor(entry.block).getBounds()

  # For now, we will comment out this line
