mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 17:55:37 +02:00
Remove the data-pdfjsprinting
attribute on the <body>
when destroying FirefoxPrintService
/PDFPrintService
instances (issue 10948)
Also, cleans up variable definitions slightly in the `FirefoxPrintService.layout` method.
This commit is contained in:
parent
d7afb74a6e
commit
cd48f05597
2 changed files with 13 additions and 6 deletions
|
@ -77,18 +77,21 @@ function FirefoxPrintService(pdfDocument, pagesOverview, printContainer) {
|
||||||
|
|
||||||
FirefoxPrintService.prototype = {
|
FirefoxPrintService.prototype = {
|
||||||
layout() {
|
layout() {
|
||||||
let pdfDocument = this.pdfDocument;
|
const { pdfDocument, pagesOverview, printContainer, } = this;
|
||||||
let printContainer = this.printContainer;
|
|
||||||
let body = document.querySelector('body');
|
const body = document.querySelector('body');
|
||||||
body.setAttribute('data-pdfjsprinting', true);
|
body.setAttribute('data-pdfjsprinting', true);
|
||||||
|
|
||||||
for (let i = 0, ii = this.pagesOverview.length; i < ii; ++i) {
|
for (let i = 0, ii = pagesOverview.length; i < ii; ++i) {
|
||||||
composePage(pdfDocument, i + 1, this.pagesOverview[i], printContainer);
|
composePage(pdfDocument, i + 1, pagesOverview[i], printContainer);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy() {
|
destroy() {
|
||||||
this.printContainer.textContent = '';
|
this.printContainer.textContent = '';
|
||||||
|
|
||||||
|
const body = document.querySelector('body');
|
||||||
|
body.removeAttribute('data-pdfjsprinting');
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ PDFPrintService.prototype = {
|
||||||
layout() {
|
layout() {
|
||||||
this.throwIfInactive();
|
this.throwIfInactive();
|
||||||
|
|
||||||
let body = document.querySelector('body');
|
const body = document.querySelector('body');
|
||||||
body.setAttribute('data-pdfjsprinting', true);
|
body.setAttribute('data-pdfjsprinting', true);
|
||||||
|
|
||||||
let hasEqualPageSizes = this.pagesOverview.every(function(size) {
|
let hasEqualPageSizes = this.pagesOverview.every(function(size) {
|
||||||
|
@ -114,6 +114,10 @@ PDFPrintService.prototype = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.printContainer.textContent = '';
|
this.printContainer.textContent = '';
|
||||||
|
|
||||||
|
const body = document.querySelector('body');
|
||||||
|
body.removeAttribute('data-pdfjsprinting');
|
||||||
|
|
||||||
if (this.pageStyleSheet) {
|
if (this.pageStyleSheet) {
|
||||||
this.pageStyleSheet.remove();
|
this.pageStyleSheet.remove();
|
||||||
this.pageStyleSheet = null;
|
this.pageStyleSheet = null;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue