mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Set up feature flag for references autocomplete.
This commit is contained in:
parent
d1e53f0cb8
commit
6e3dba52e5
2 changed files with 13 additions and 24 deletions
|
@ -72,13 +72,15 @@ define [
|
|||
result.push(referenceKeyToAutocompleteEntry(key))
|
||||
callback null, result
|
||||
else
|
||||
# get keys from the backend
|
||||
referencesSearch = window?._ide?.referencesSearchManager
|
||||
if referencesSearch
|
||||
referencesSearch.getReferenceKeys (keys) =>
|
||||
keys.forEach (key) ->
|
||||
result.push(referenceKeyToAutocompleteEntry(key))
|
||||
callback null, result
|
||||
callback null, result
|
||||
# else
|
||||
# # get keys from the backend
|
||||
# referencesSearch = window?._ide?.referencesSearchManager
|
||||
# if referencesSearch
|
||||
# referencesSearch.getReferenceKeys (keys) =>
|
||||
# keys.forEach (key) ->
|
||||
# result.push(referenceKeyToAutocompleteEntry(key))
|
||||
# callback null, result
|
||||
|
||||
@editor.completers = [@suggestionManager, SnippetCompleter, ReferencesCompleter]
|
||||
|
||||
|
|
|
@ -24,12 +24,13 @@ define [
|
|||
)
|
||||
|
||||
_storeReferencesKeys: (newKeys) ->
|
||||
if window._ENABLE_REFERENCES_AUTOCOMPLETE != true
|
||||
return
|
||||
console.log '>> storing references keys'
|
||||
@$scope.$root._references.keys = newKeys
|
||||
|
||||
# docIds: List[String]|String('ALL'), shouldBroadcast: Bool
|
||||
indexReferences: (docIds, shouldBroadcast) ->
|
||||
if window._ENABLE_REFERENCES_AUTOCOMPLETE != true
|
||||
return
|
||||
opts =
|
||||
docIds: docIds
|
||||
shouldBroadcast: shouldBroadcast
|
||||
|
@ -38,20 +39,6 @@ define [
|
|||
"/project/#{@$scope.project_id}/references/index",
|
||||
opts,
|
||||
(data) =>
|
||||
console.log ">> done ", data
|
||||
console.log ">> got keys ", data
|
||||
@_storeReferencesKeys(data.keys)
|
||||
)
|
||||
|
||||
getReferenceKeys: (callback=(keys)->) ->
|
||||
if window._ENABLE_REFERENCES_AUTOCOMPLETE != true
|
||||
return
|
||||
$.get(
|
||||
"/project/#{@$scope.project_id}/references/keys",
|
||||
{
|
||||
_csrf: window.csrfToken
|
||||
},
|
||||
(data) =>
|
||||
@_storeReferencesKeys(data.keys)
|
||||
if callback
|
||||
callback(data.keys)
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue