                     if $(event.target).attr('contenteditable') == "true"
                         containerElement = $(event.target)
                     else
-                        containerElement = $(event.target).parent('[contenteditable]').first()
+                        containerElement = $(event.target).parents('[contenteditable]').first()
 
                     containerPosition = containerElement.position()
                     return [containerPosition.left - @options.offset.x, containerPosition.top - @options.offset.y]


            position = [tmpSpan.offset().left, tmpSpan.offset().top]
            tmpSpan.remove()
            position

        _prepareToolbar: ->
            that = @
            @toolbar = jQuery('<div></div>').hide()
            @toolbar.css "position", "absolute"
            @toolbar.css "top", @element.offset().top - 20
            @toolbar.css "left", @element.offset().left

                    originalEvent: event
        _activated: (event) ->
            widget = event.data
            #  avoid jumping of the toolbar Todo:: look into jumpy toolbar
            #if widget.toolbar.html() isnt ""
                #widget.toolbar.css "top", widget.element.offset().top - widget.toolbar.height()
                #widget.toolbar.show()

            # add 'inEditMode' class onto the activated element
            $(@).addClass('inEditMode')
            widget.toolbar.css "width", $(@).width()+26
            widget._trigger "activated", event

        _deactivated: (event) ->
