mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Fix selection bugs
This commit is contained in:
parent
2520651ef2
commit
7104f458f7
2 changed files with 5 additions and 2 deletions
|
@ -62,11 +62,10 @@ define [
|
||||||
@_moveEntityInScope(entity, folder)
|
@_moveEntityInScope(entity, folder)
|
||||||
|
|
||||||
selectEntity: (entity) ->
|
selectEntity: (entity) ->
|
||||||
return if entity.selected # Don't get into a recursive event loop
|
@selected_entity_id = entity.id # For reselecting after a reconnect
|
||||||
@ide.fileTreeManager.forEachEntity (entity) ->
|
@ide.fileTreeManager.forEachEntity (entity) ->
|
||||||
entity.selected = false
|
entity.selected = false
|
||||||
entity.selected = true
|
entity.selected = true
|
||||||
@$scope.$emit "entity:selected", entity
|
|
||||||
|
|
||||||
findEntityById: (id) ->
|
findEntityById: (id) ->
|
||||||
@_findEntityByIdInFolder @$scope.rootFolder, id
|
@_findEntityByIdInFolder @$scope.rootFolder, id
|
||||||
|
@ -104,6 +103,7 @@ define [
|
||||||
id: rawFolder._id
|
id: rawFolder._id
|
||||||
type: "folder"
|
type: "folder"
|
||||||
children: []
|
children: []
|
||||||
|
selected: (rawFolder._id == @selected_entity_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
for doc in rawFolder.docs or []
|
for doc in rawFolder.docs or []
|
||||||
|
@ -111,6 +111,7 @@ define [
|
||||||
name: doc.name
|
name: doc.name
|
||||||
id: doc._id
|
id: doc._id
|
||||||
type: "doc"
|
type: "doc"
|
||||||
|
selected: (doc._id == @selected_entity_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
for file in rawFolder.fileRefs or []
|
for file in rawFolder.fileRefs or []
|
||||||
|
@ -118,6 +119,7 @@ define [
|
||||||
name: file.name
|
name: file.name
|
||||||
id: file._id
|
id: file._id
|
||||||
type: "file"
|
type: "file"
|
||||||
|
selected: (file._id == @selected_entity_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
for childFolder in rawFolder.folders or []
|
for childFolder in rawFolder.folders or []
|
||||||
|
|
|
@ -4,6 +4,7 @@ define [
|
||||||
App.controller "FileTreeEntityController", ["$scope", "ide", "$modal", ($scope, ide, $modal) ->
|
App.controller "FileTreeEntityController", ["$scope", "ide", "$modal", ($scope, ide, $modal) ->
|
||||||
$scope.select = () ->
|
$scope.select = () ->
|
||||||
ide.fileTreeManager.selectEntity($scope.entity)
|
ide.fileTreeManager.selectEntity($scope.entity)
|
||||||
|
$scope.$emit "entity:selected", $scope.entity
|
||||||
|
|
||||||
$scope.inputs =
|
$scope.inputs =
|
||||||
name: $scope.entity.name
|
name: $scope.entity.name
|
||||||
|
|
Loading…
Reference in a new issue