mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-28 07:01:31 +00:00
Pass correct path to synctex when not in root folder
This commit is contained in:
parent
e1a547c202
commit
073b52e693
2 changed files with 12 additions and 0 deletions
|
@ -121,6 +121,7 @@ define [
|
|||
lastPart = parts.pop()
|
||||
|
||||
getChildWithName = (folder, name) ->
|
||||
return folder if name == "."
|
||||
foundChild = null
|
||||
for child in folder.get("children").models
|
||||
if child.get("name") == name
|
||||
|
@ -145,6 +146,10 @@ define [
|
|||
path = entity.get("name") + "/" + path
|
||||
return path
|
||||
|
||||
getRootFolderPath: () ->
|
||||
rootFilePath = @getPathOfEntityId(@project.get("rootDoc_id"))
|
||||
return rootFilePath.split("/").slice(0, -1).join("/")
|
||||
|
||||
getNameOfEntityId: (entity_id) ->
|
||||
entity = @getEntity(entity_id)
|
||||
return if !entity?
|
||||
|
|
|
@ -280,6 +280,13 @@ define [
|
|||
syncToPdf: () ->
|
||||
entity_id = @ide.editor.getCurrentDocId()
|
||||
file = @ide.fileTreeManager.getPathOfEntityId(entity_id)
|
||||
|
||||
# If the root file is folder/main.tex, then synctex sees the
|
||||
# path as folder/./main.tex
|
||||
rootFolderPath = @ide.fileTreeManager.getRootFolderPath()
|
||||
if rootFolderPath != ""
|
||||
file = file.replace(RegExp("^#{rootFolderPath}"), "#{rootFolderPath}/.")
|
||||
|
||||
line = @ide.editor.getCurrentLine()
|
||||
column = @ide.editor.getCurrentColumn()
|
||||
|
||||
|
|
Loading…
Reference in a new issue