         # Now that we've done that, we can annul stuff.
         @endDrag()
 
-  Editor::reparseRawReplace = (oldBlock) ->
+  Editor::reparseRawReplace = (oldBlock, originalTrigger = oldBlock) ->
+    # Get the parent in case we need to bubble
+    # up later
+    parent = oldBlock.visParent()
+
+    # Attempt to parse the block we are given out-of-context
     try
       newParse = @mode.parse(oldBlock.stringify(@mode), wrapAtRoot: true)
       newBlock = newParse.start.next.container


        # Substitute in expansion for this palette entry, if supplied.
        expansion = @clickedBlockPaletteEntry.expansion
        if 'function' is typeof expansion then expansion = expansion();
        if (expansion) then expansion = parseBlock(@mode, expansion);
        @draggingBlock = (expansion or @draggingBlock).clone()

      else

        head = head.prev

      if head?
        # Avoid problems with reparses by getting text offset location
        # of the given socket before reparsing and recovering it afterward.
        if @textFocus?
          chars = @getCharactersTo head.container.start
          @setTextInputFocus null
          socket = @getSocketAtChar chars
        else
          socket = head.container
          @setTextInputFocus null
