add embed button to pdf viewer
This commit is contained in:
parent
5bc0b70d73
commit
47b348f724
5 changed files with 51 additions and 9 deletions
|
|
@ -4,6 +4,8 @@ var cache = {}
|
|||
var documentId
|
||||
var baseUrl = document.location.protocol + '//' + document.location.host
|
||||
|
||||
|
||||
|
||||
var div = document.createElement("div")
|
||||
div.innerHTML = `
|
||||
<button id="cropFile" class="toolbarButton cropFile hiddenLargeView" title="Crop" tabindex="30" data-l10n-id="crop_file">
|
||||
|
|
@ -14,6 +16,19 @@ var cropFile = div.querySelector("#cropFile")
|
|||
|
||||
document.querySelector('#toolbarViewerRight').insertBefore(cropFile, document.querySelector('#toolbarViewerRight').firstChild)
|
||||
|
||||
div.innerHTML = `
|
||||
<button id="embedPage" class="toolbarButton embedPage hiddenLargeView" title="Embed" tabindex="29" data-l10n-id="embed">
|
||||
<span data-l10n-id="embed_label">Embed</span>
|
||||
</button>
|
||||
`
|
||||
var embedPage = div.querySelector("#embedPage")
|
||||
document.querySelector('#toolbarViewerRight').insertBefore(embedPage, document.querySelector('#toolbarViewerRight').firstChild)
|
||||
embedPage.addEventListener("click", event => {
|
||||
Ox.$parent.postMessage('embed', {
|
||||
page: PDFViewerApplication.page
|
||||
});
|
||||
})
|
||||
|
||||
async function archiveAPI(action, data) {
|
||||
var url = baseUrl + '/api/'
|
||||
var key = JSON.stringify([action, data])
|
||||
|
|
@ -207,6 +222,9 @@ function initOverlay() {
|
|||
div.appendChild(overlay)
|
||||
renderCropOverlay(overlay, documentId, page)
|
||||
})
|
||||
PDFViewerApplication.pdfViewer.eventBus.on("pagechanging", function(event) {
|
||||
console.log("pagechanging", event, event.pageNumber.toString())
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue