mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-27 11:01:56 +02:00
Pass correct path to synctex when not in root folder
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user