tomoki1207 / vscode-pdfviewer

Show PDF preview in VSCode.
https://marketplace.visualstudio.com/items/tomoki1207.pdf
Other
294 stars 69 forks source link

Expose API for registering callbacks when the PDF is clicked #155

Open JJK96 opened 1 year ago

JJK96 commented 1 year ago

Possibility for registering a callback for receiving the piece of text that was clicked.

I'm working on an extension to synchronize this to my source format (similar to synctex). Such an extension could hook into pdfviewer like this:

    var pdfviewer = vscode.extensions.getExtension('tomoki1207.pdf');
    if (pdfviewer) {
        pdfviewer.activate().then((api) => {
            api.registerOnClickCallback((content: string) => {
                channel.appendLine(content)
            })
        })
    }