                 e.stopPropagation()
 
                 if e.target.href
-                    window.open(e.target.href)
-
-            mediumInstance.subscribe 'focus', (event) ->
-                $scope.$applyAsync () ->
-                    if !$scope.editMode
-                        setEditMode(true)
-                        refreshCodeBlocks(mediumInstance)
+                    window.open(e.target.href)                                                 
 
             mediumInstance.subscribe 'editableDrop', (event) ->
                 $scope.onUploadFile({files: event.dataTransfer.files, cb: uploadEnd})


        $scope.$on "$destroy", () ->
            if mediumInstance
                mediumInstance.destroy()

    return {

            $scope.$applyAsync () ->
                wysiwygCodeHightlighterService.addHightlighter(mediumInstance.elements[0])
                refreshCodeBlocks(mediumInstance)

        $(editorMedium[0]).on 'mousedown', (e) -> 
            if e.target.href
                e.preventDefault()
                e.stopPropagation()
            else
                $scope.$applyAsync () ->
                    if !$scope.editMode
                        setEditMode(true)
                        refreshCodeBlocks(mediumInstance)                   

        $(editorMedium[0]).on 'dblclick', 'pre', (e) ->
            $scope.$applyAsync () ->
