mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-30 07:05:19 -05: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"
|
logger.err {err, project_id, user_id, doc_id}, "error finding element for downloading file"
|
||||||
return res.send 500
|
return res.send 500
|
||||||
doc_url = ReferencesSearchController._buildDocUrl project_id, doc_id
|
doc_url = ReferencesSearchController._buildDocUrl project_id, doc_id
|
||||||
console.log ">>"
|
|
||||||
console.log doc, doc_url
|
|
||||||
console.log "<<"
|
|
||||||
ReferencesSearchHandler.indexFile user_id, doc_url, (err) ->
|
ReferencesSearchHandler.indexFile user_id, doc_url, (err) ->
|
||||||
if err
|
if err
|
||||||
logger.err {err, project_id, user_id, doc_id}, "error indexing references file"
|
logger.err {err, project_id, user_id, doc_id}, "error indexing references file"
|
||||||
|
|
|
@ -8,6 +8,7 @@ define [
|
||||||
"ide/permissions/PermissionsManager"
|
"ide/permissions/PermissionsManager"
|
||||||
"ide/pdf/PdfManager"
|
"ide/pdf/PdfManager"
|
||||||
"ide/binary-files/BinaryFilesManager"
|
"ide/binary-files/BinaryFilesManager"
|
||||||
|
"ide/references-search/ReferencesSearchManager"
|
||||||
"ide/settings/index"
|
"ide/settings/index"
|
||||||
"ide/share/index"
|
"ide/share/index"
|
||||||
"ide/chat/index"
|
"ide/chat/index"
|
||||||
|
@ -37,6 +38,7 @@ define [
|
||||||
PermissionsManager
|
PermissionsManager
|
||||||
PdfManager
|
PdfManager
|
||||||
BinaryFilesManager
|
BinaryFilesManager
|
||||||
|
ReferencesSearchManager
|
||||||
) ->
|
) ->
|
||||||
|
|
||||||
App.controller "IdeController", ($scope, $timeout, ide, localStorage) ->
|
App.controller "IdeController", ($scope, $timeout, ide, localStorage) ->
|
||||||
|
@ -80,7 +82,8 @@ define [
|
||||||
ide.pdfManager = new PdfManager(ide, $scope)
|
ide.pdfManager = new PdfManager(ide, $scope)
|
||||||
ide.permissionsManager = new PermissionsManager(ide, $scope)
|
ide.permissionsManager = new PermissionsManager(ide, $scope)
|
||||||
ide.binaryFilesManager = new BinaryFilesManager(ide, $scope)
|
ide.binaryFilesManager = new BinaryFilesManager(ide, $scope)
|
||||||
|
ide.referencesSearchManager = new ReferencesSearchManager(ide, $scope)
|
||||||
|
|
||||||
inited = false
|
inited = false
|
||||||
$scope.$on "project:joined", () ->
|
$scope.$on "project:joined", () ->
|
||||||
return if inited
|
return if inited
|
||||||
|
|
|
@ -36,6 +36,7 @@ define [
|
||||||
@doc?.detachFromAce()
|
@doc?.detachFromAce()
|
||||||
editorDoc = @ace?.getSession().getDocument()
|
editorDoc = @ace?.getSession().getDocument()
|
||||||
editorDoc?.off "change", @_checkConsistency
|
editorDoc?.off "change", @_checkConsistency
|
||||||
|
@ide.$scope.$emit 'document:closed', @doc
|
||||||
|
|
||||||
_checkConsistency: () ->
|
_checkConsistency: () ->
|
||||||
# We've been seeing a lot of errors when I think there shouldn't be
|
# 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