mirror of
https://github.com/overleaf/overleaf.git
synced 2025-01-30 18:10:57 +00:00
Fix the reloading of file view after refreshing linked file
This commit is contained in:
parent
2345b77ea7
commit
94a599d530
4 changed files with 34 additions and 4 deletions
|
@ -27,7 +27,7 @@ module.exports = LinkedFilesController = {
|
|||
if error?
|
||||
logger.error {err: error, project_id, name, linkedFileData, parent_folder_id, user_id}, 'error writing linked file to disk'
|
||||
return Agent.handleError(error, req, res, next)
|
||||
EditorController.upsertFile project_id, parent_folder_id, name, fsPath, linkedFileData, "upload", user_id, (error) ->
|
||||
EditorController.upsertFile project_id, parent_folder_id, name, fsPath, linkedFileData, "upload", user_id, (error, file) ->
|
||||
return next(error) if error?
|
||||
res.send(204) # created
|
||||
res.json(new_file_id: file._id) # created
|
||||
}
|
||||
|
|
|
@ -19,3 +19,17 @@ 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
|
||||
)
|
||||
|
|
|
@ -49,8 +49,15 @@ define [
|
|||
$scope.refreshFile = (file) ->
|
||||
$scope.refreshing = true
|
||||
ide.fileTreeManager.refreshLinkedFile(file)
|
||||
.then () ->
|
||||
loadTextFileFilePreview()
|
||||
.then (response) ->
|
||||
{ data } = response
|
||||
new_file_id = data.new_file_id
|
||||
$timeout(
|
||||
() ->
|
||||
ide.binaryFilesManager.openFileById(new_file_id)
|
||||
, 1000
|
||||
)
|
||||
# loadTextFileFilePreview()
|
||||
.finally () ->
|
||||
$scope.refreshing = false
|
||||
|
||||
|
|
|
@ -112,6 +112,15 @@ 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()
|
||||
|
|
Loading…
Reference in a new issue