mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-28 03:21:56 +02:00
Better view refresh after refreshing linked file
This commit is contained in:
@@ -19,17 +19,3 @@ define [
|
||||
, 0
|
||||
, this
|
||||
)
|
||||
|
||||
openFileById: (id) ->
|
||||
file = @ide.fileTreeManager.selectEntityById(id)
|
||||
@$scope.ui.view = "file"
|
||||
@$scope.openFile = null
|
||||
@$scope.$apply()
|
||||
window.setTimeout(
|
||||
() =>
|
||||
@$scope.openFile = file
|
||||
@$scope.$apply()
|
||||
@$scope.$digest()
|
||||
, 0
|
||||
, this
|
||||
)
|
||||
|
||||
@@ -47,6 +47,18 @@ define [
|
||||
else
|
||||
return url
|
||||
|
||||
_tryOpenFile = (new_file_id) ->
|
||||
iterations = 0
|
||||
do tryOpen = () ->
|
||||
if iterations > 10
|
||||
return
|
||||
iterations += 1
|
||||
newFile = ide.fileTreeManager.findEntityById(new_file_id)
|
||||
if newFile?
|
||||
ide.binaryFilesManager.openFile(newFile)
|
||||
else
|
||||
setTimeout(tryOpen, 500)
|
||||
|
||||
$scope.refreshFile = (file) ->
|
||||
$scope.refreshing = true
|
||||
$scope.refreshError = null
|
||||
@@ -56,8 +68,8 @@ define [
|
||||
{ new_file_id } = data
|
||||
$timeout(
|
||||
() ->
|
||||
ide.binaryFilesManager.openFileById(new_file_id)
|
||||
, 1000
|
||||
_tryOpenFile(new_file_id)
|
||||
, 0
|
||||
)
|
||||
$scope.refreshError = null
|
||||
.catch (response) ->
|
||||
|
||||
@@ -87,15 +87,6 @@ define [
|
||||
entity.selected = false
|
||||
entity.selected = true
|
||||
|
||||
selectEntityById: (entity_id) ->
|
||||
@selected_entity_id = entity_id # For reselecting after a reconnect
|
||||
selected_entity = null
|
||||
@ide.fileTreeManager.forEachEntity (entity) ->
|
||||
if entity.id == entity_id
|
||||
selected_entity = entity
|
||||
entity.selected = true
|
||||
return selected_entity
|
||||
|
||||
toggleMultiSelectEntity: (entity) ->
|
||||
entity.multiSelected = !entity.multiSelected
|
||||
@$scope.multiSelectedCount = @multiSelectedCount()
|
||||
|
||||
Reference in New Issue
Block a user