Skip to content
This repository has been archived by the owner on May 5, 2022. It is now read-only.

fix: bump PDF.js version to enable IE11 #24

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"vaadin-lumo-styles": "vaadin/vaadin-lumo-styles#^1.3.3",
"vaadin-material-styles": "vaadin/vaadin-material-styles#^1.2.0",
"vaadin-license-checker": "^2.1.0",
"pdfjs-dist": "2.0.943",
"pdfjs-dist": "2.1.266",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also submit a PR to bundled-es-modules:
https://github.com/bundled-es-modules/pdfjs-dist

An then update it the dependency-map.json in magi.

"vaadin-text-field": "^2.1.7",
"vaadin-select": "^2.0.2",
"vaadin-item": "^2.1.0",
Expand Down
10 changes: 5 additions & 5 deletions src/vaadin-pdf-viewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
line-height: 1;
}

.textLayer > div {
.textLayer > span {
color: transparent;
position: absolute;
white-space: pre;
Expand Down Expand Up @@ -209,15 +209,15 @@
* The component needs pdf.worker.js sometimes, depending on the PDF being loaded. It is
* loaded lazily by telling the component where it is and it takes care of loading the file
* if needed. By default, it is loaded from a CDN,
* '//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.0.943/pdf.worker.min.js'. If you don't have
* '//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.1.266/pdf.worker.min.js'. If you don't have
* internet access or don't want to rely on a server, you can download the file and deploy
* it within your app. When you have it available on runtime, update `worker` to point to
* the url for the file.
*/
worker: {
type: String,
observer: '__workerChanged',
value: '//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.0.943/pdf.worker.min.js'
value: '//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.1.266/pdf.worker.min.js'
},
/**
* The viewer, which takes care of rendering content into a DOM element
Expand Down Expand Up @@ -308,11 +308,11 @@
textLayerMode: 2,
viewer: this.$.viewer
});
this.$.viewerContainer.addEventListener('pagesinit', () => {
this.__viewer.eventBus.on('pagesinit', () => {
this.__viewer.currentScaleValue = this.zoom;
this.__loading = false;
});
this.$.viewerContainer.addEventListener('pagechange', (event) => {
this.__viewer.eventBus.on('pagechanging', (event) => {
this.__currentPage = event.pageNumber;
this.__updatePageNumberStates();
});
Expand Down
8 changes: 6 additions & 2 deletions test/visual/pdf-viewer-small.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@
window.addEventListener('WebComponentsReady', function() {
var viewer = document.querySelector('vaadin-pdf-viewer');

Polymer.RenderStatus.afterNextRender(viewer, () => {
window.webComponentsAreReady = true;
// TODO(platosha): dispatch an event after initial PDF document rendering
// https://github.com/vaadin/vaadin-pdf-viewer/issues/25
viewer.__viewer.eventBus.on('pagesinit', () => {
viewer.__viewer.onePageRendered.then(() => {
window.webComponentsAreReady = true;
});
});
});
</script>
Expand Down
8 changes: 6 additions & 2 deletions test/visual/pdf-viewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@
window.addEventListener('WebComponentsReady', function() {
var viewer = document.querySelector('vaadin-pdf-viewer');

Polymer.RenderStatus.afterNextRender(viewer, () => {
window.webComponentsAreReady = true;
// TODO(platosha): dispatch an event after initial PDF document rendering
// https://github.com/vaadin/vaadin-pdf-viewer/issues/25
viewer.__viewer.eventBus.on('pagesinit', () => {
viewer.__viewer.onePageRendered.then(() => {
window.webComponentsAreReady = true;
});
});
});
</script>
Expand Down
4 changes: 2 additions & 2 deletions test/visual/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ gemini.suite('vaadin-pdf-viewer', function(rootSuite) {
['lumo', 'material'].forEach(theme => {
gemini.suite(`pdf-viewer-${theme}`, function(suite) {
suite
.setUrl(`/pdf-viewer.html?theme=${theme}`)
.setUrl(`pdf-viewer.html?theme=${theme}`)
.setCaptureElements('#pdf-viewer')
.capture(`vaadin-pdf-viewer`);
});

gemini.suite(`pdf-viewer-small-${theme}`, function(suite) {
suite
.setUrl(`/pdf-viewer-small.html?theme=${theme}`)
.setUrl(`pdf-viewer-small.html?theme=${theme}`)
.setCaptureElements('#pdf-viewer-small')
.capture(`vaadin-pdf-viewer`);
});
Expand Down
2 changes: 1 addition & 1 deletion theme/lumo/vaadin-pdf-viewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,4 @@
}
</style>
</template>
</dom-module>
</dom-module>
2 changes: 1 addition & 1 deletion wct.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module.exports = {

const saucelabsPlatformsMicrosoft = [
'Windows 10/microsoftedge@17',
// 'Windows 10/internet explorer@11'
'Windows 10/internet explorer@11'
];

const saucelabsPlatformsDesktop = [
Expand Down