mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05: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()
|
lastPart = parts.pop()
|
||||||
|
|
||||||
getChildWithName = (folder, name) ->
|
getChildWithName = (folder, name) ->
|
||||||
|
return folder if name == "."
|
||||||
foundChild = null
|
foundChild = null
|
||||||
for child in folder.get("children").models
|
for child in folder.get("children").models
|
||||||
if child.get("name") == name
|
if child.get("name") == name
|
||||||
|
@ -145,6 +146,10 @@ define [
|
||||||
path = entity.get("name") + "/" + path
|
path = entity.get("name") + "/" + path
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
getRootFolderPath: () ->
|
||||||
|
rootFilePath = @getPathOfEntityId(@project.get("rootDoc_id"))
|
||||||
|
return rootFilePath.split("/").slice(0, -1).join("/")
|
||||||
|
|
||||||
getNameOfEntityId: (entity_id) ->
|
getNameOfEntityId: (entity_id) ->
|
||||||
entity = @getEntity(entity_id)
|
entity = @getEntity(entity_id)
|
||||||
return if !entity?
|
return if !entity?
|
||||||
|
|
|
@ -280,6 +280,13 @@ define [
|
||||||
syncToPdf: () ->
|
syncToPdf: () ->
|
||||||
entity_id = @ide.editor.getCurrentDocId()
|
entity_id = @ide.editor.getCurrentDocId()
|
||||||
file = @ide.fileTreeManager.getPathOfEntityId(entity_id)
|
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()
|
line = @ide.editor.getCurrentLine()
|
||||||
column = @ide.editor.getCurrentColumn()
|
column = @ide.editor.getCurrentColumn()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue