mirror of
https://github.com/James-Yu/LaTeX-Workshop.git
synced 2024-10-05 07:37:24 +03:00
Extract to refreshPDFViewer.
This commit is contained in:
parent
b2bb4f2621
commit
81f3d3b31c
@ -242,24 +242,10 @@ class LateXWorkshopPdfViewer implements ILatexWorkshopPdfViewer {
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
private setupConnectionPort() {
|
||||
const openPack: ClientRequest = {
|
||||
type: 'open',
|
||||
path: this.pdfFilePath,
|
||||
viewer: (this.embedded ? 'tab' : 'browser')
|
||||
}
|
||||
this.send(openPack)
|
||||
this.connectionPort.onDidReceiveMessage((event: MessageEvent<string>) => {
|
||||
const data = JSON.parse(event.data) as ServerResponse
|
||||
switch (data.type) {
|
||||
case 'synctex': {
|
||||
this.forwardSynctex(data.data)
|
||||
break
|
||||
}
|
||||
case 'refresh': {
|
||||
private refreshPDFViewer() {
|
||||
if (!this.autoReloadEnabled) {
|
||||
this.addLogMessage('Auto reload temporarily disabled.')
|
||||
break
|
||||
return
|
||||
}
|
||||
const pack = {
|
||||
scale: PDFViewerApplication.pdfViewer.currentScaleValue,
|
||||
@ -294,6 +280,24 @@ class LateXWorkshopPdfViewer implements ILatexWorkshopPdfViewer {
|
||||
this.onDidRenderPdfFile( () => {
|
||||
this.send({type:'loaded', path:this.pdfFilePath})
|
||||
}, {once: true})
|
||||
}
|
||||
|
||||
private setupConnectionPort() {
|
||||
const openPack: ClientRequest = {
|
||||
type: 'open',
|
||||
path: this.pdfFilePath,
|
||||
viewer: (this.embedded ? 'tab' : 'browser')
|
||||
}
|
||||
this.send(openPack)
|
||||
this.connectionPort.onDidReceiveMessage((event: MessageEvent<string>) => {
|
||||
const data = JSON.parse(event.data) as ServerResponse
|
||||
switch (data.type) {
|
||||
case 'synctex': {
|
||||
this.forwardSynctex(data.data)
|
||||
break
|
||||
}
|
||||
case 'refresh': {
|
||||
this.refreshPDFViewer()
|
||||
break
|
||||
}
|
||||
case 'params': {
|
||||
|
Loading…
Reference in New Issue
Block a user