mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-28 01:31:19 +00:00
Refresh the references when the bib file is closed.
This commit is contained in:
parent
249dd638ec
commit
1ea13a74dd
4 changed files with 25 additions and 4 deletions
|
@ -21,9 +21,6 @@ module.exports = ReferencesSearchController =
|
|||
logger.err {err, project_id, user_id, doc_id}, "error finding element for downloading file"
|
||||
return res.send 500
|
||||
doc_url = ReferencesSearchController._buildDocUrl project_id, doc_id
|
||||
console.log ">>"
|
||||
console.log doc, doc_url
|
||||
console.log "<<"
|
||||
ReferencesSearchHandler.indexFile user_id, doc_url, (err) ->
|
||||
if err
|
||||
logger.err {err, project_id, user_id, doc_id}, "error indexing references file"
|
||||
|
|
|
@ -8,6 +8,7 @@ define [
|
|||
"ide/permissions/PermissionsManager"
|
||||
"ide/pdf/PdfManager"
|
||||
"ide/binary-files/BinaryFilesManager"
|
||||
"ide/references-search/ReferencesSearchManager"
|
||||
"ide/settings/index"
|
||||
"ide/share/index"
|
||||
"ide/chat/index"
|
||||
|
@ -37,6 +38,7 @@ define [
|
|||
PermissionsManager
|
||||
PdfManager
|
||||
BinaryFilesManager
|
||||
ReferencesSearchManager
|
||||
) ->
|
||||
|
||||
App.controller "IdeController", ($scope, $timeout, ide, localStorage) ->
|
||||
|
@ -80,7 +82,8 @@ define [
|
|||
ide.pdfManager = new PdfManager(ide, $scope)
|
||||
ide.permissionsManager = new PermissionsManager(ide, $scope)
|
||||
ide.binaryFilesManager = new BinaryFilesManager(ide, $scope)
|
||||
|
||||
ide.referencesSearchManager = new ReferencesSearchManager(ide, $scope)
|
||||
|
||||
inited = false
|
||||
$scope.$on "project:joined", () ->
|
||||
return if inited
|
||||
|
|
|
@ -36,6 +36,7 @@ define [
|
|||
@doc?.detachFromAce()
|
||||
editorDoc = @ace?.getSession().getDocument()
|
||||
editorDoc?.off "change", @_checkConsistency
|
||||
@ide.$scope.$emit 'document:closed', @doc
|
||||
|
||||
_checkConsistency: () ->
|
||||
# We've been seeing a lot of errors when I think there shouldn't be
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
define [
|
||||
], () ->
|
||||
class ReferencesSearchManager
|
||||
constructor: (@ide, @$scope) ->
|
||||
console.log ">> yay"
|
||||
|
||||
@$scope.$on 'document:closed', (e, doc) =>
|
||||
if doc.doc_id
|
||||
entity = @ide.fileTreeManager.findEntityById doc.doc_id
|
||||
if entity?.name?.match /.*\.bib$/
|
||||
@$scope.$emit 'references:changed', entity
|
||||
console.log ">> references changed"
|
||||
@indexReferences doc.doc_id
|
||||
|
||||
indexReferences: (doc_id) ->
|
||||
console.log ">> doc id #{doc_id}"
|
||||
$.post("/project/#{@$scope.project_id}/references", {
|
||||
docId: doc_id,
|
||||
_csrf: window.csrfToken
|
||||
}, (data) => console.log(data))
|
Loading…
Reference in a new issue