ソースを参照

Try to reconnect either on editor-cursor move, or when any thing in the page is clicked.

Shane Kilkelly 11 年 前
親
コミット
b4c7209a11

+ 1 - 1
services/web/app/views/project/editor.jade

@@ -23,7 +23,7 @@ block content
 			.alert.alert-warning.small(ng-if="connection.reconnection_countdown")
 				strong #{translate("lost_connection")}.
 				| #{translate("reconnecting_in_x_secs", {seconds:"{{ connection.reconnection_countdown }}"})}.
-				a.pull-right(href, ng-click="tryReconnectNow()") #{translate("try_now")}
+				a#try-reconnect-now-button.pull-right(href, ng-click="tryReconnectNow()") #{translate("try_now")}
 
 			.alert.alert-warning.small(ng-if="connection.reconnecting")
 				strong #{translate("reconnecting")}...

+ 3 - 4
services/web/public/coffee/ide/connection/ConnectionManager.coffee

@@ -19,13 +19,12 @@ define [], () ->
 			@$scope.tryReconnectNow = () =>
 				@tryReconnect()
 
-			@$scope.$on "editor:change", () =>
-				@lastUpdated = new Date()
+			@$scope.$on 'cursor:editor:update', () =>
 				if !@connected
 					@tryReconnect()
 
-			@$scope.$on 'cursor:editor:update', () =>
-				if !@connected
+			document.querySelector('body').addEventListener 'click', (e) =>
+				if !@connected and e.target.id != 'try-reconnect-now-button'
 					@tryReconnect()
 
 			@ide.socket = io.connect null,