@internetarchive/bookreader 5.0.0-32 → 5.0.0-33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BookReader/BookReader.js +1 -1
- package/BookReader/ia-bookreader-bundle.js +17 -17
- package/BookReader/ia-bookreader-bundle.js.map +1 -1
- package/CHANGELOG.md +3 -0
- package/package.json +1 -1
- package/src/BookNavigator/book-navigator.js +19 -10
- package/tests/karma/BookNavigator/book-navigator.test.js +0 -5
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
@@ -3,6 +3,7 @@ import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
|
|
3
3
|
// eslint-disable-next-line no-unused-vars
|
4
4
|
import { ModalManager } from '@internetarchive/modal-manager';
|
5
5
|
import { css, html, LitElement } from 'lit-element';
|
6
|
+
import { nothing } from 'lit-html';
|
6
7
|
import SearchProvider from './search/search-provider.js';
|
7
8
|
import DownloadProvider from './downloads/downloads-provider.js';
|
8
9
|
import VisualAdjustmentProvider from './visual-adjustments/visual-adjustments-provider.js';
|
@@ -417,6 +418,7 @@ export class BookNavigator extends LitElement {
|
|
417
418
|
this.lendingStatus = lendingStatus;
|
418
419
|
this.isAdmin = isAdmin;
|
419
420
|
this.bookReaderCannotLoad = previewType === 'singlePagePreview';
|
421
|
+
this.emitLoadingStatusUpdate(true);
|
420
422
|
});
|
421
423
|
window.addEventListener('BRJSIA:PostInit', ({ detail }) => {
|
422
424
|
const { isRestricted, downloadURLs } = detail;
|
@@ -491,20 +493,20 @@ export class BookNavigator extends LitElement {
|
|
491
493
|
this.dispatchEvent(event);
|
492
494
|
}
|
493
495
|
|
494
|
-
get
|
495
|
-
|
496
|
+
get itemImage() {
|
497
|
+
const identifier = this.itemMD?.metadata.identifier;
|
498
|
+
const url = `https://${this.baseHost}/services/img/${identifier}`;
|
499
|
+
return html`<img class="cover-img" src=${url} alt="cover image for ${identifier}">`;
|
496
500
|
}
|
497
501
|
|
498
|
-
get
|
499
|
-
|
500
|
-
return html`<img class="cover-img" src=${url} alt="cover image for ${this.item.metadata.identifier}">`;
|
502
|
+
get placeholder() {
|
503
|
+
return html`<div class="placeholder">${this.itemImage}</div>`;
|
501
504
|
}
|
502
505
|
|
503
506
|
render() {
|
504
|
-
|
505
|
-
|
506
|
-
${
|
507
|
-
<slot name="main"></slot>
|
507
|
+
return html`<div id="book-navigator__root">
|
508
|
+
${this.bookReaderCannotLoad ? this.placeholder : nothing}
|
509
|
+
${!this.bookReaderCannotLoad ? html`<slot name="main"></slot>` : nothing}
|
508
510
|
</div>
|
509
511
|
`;
|
510
512
|
}
|
@@ -512,13 +514,20 @@ export class BookNavigator extends LitElement {
|
|
512
514
|
static get styles() {
|
513
515
|
return css`
|
514
516
|
:host,
|
515
|
-
#book-
|
517
|
+
#book-navigator__root,
|
516
518
|
slot,
|
517
519
|
slot > * {
|
518
520
|
display: block;
|
519
521
|
height: inherit;
|
520
522
|
width: inherit;
|
521
523
|
}
|
524
|
+
.placeholder {
|
525
|
+
display: flex;
|
526
|
+
align-items: center;
|
527
|
+
justify-content: center;
|
528
|
+
flex-direction: column;
|
529
|
+
margin: 5%;
|
530
|
+
}
|
522
531
|
.cover-img {
|
523
532
|
max-height: 300px;
|
524
533
|
}
|
@@ -111,11 +111,6 @@ describe('<book-navigator>', () => {
|
|
111
111
|
|
112
112
|
it('creates an item image from metadata', async () => {
|
113
113
|
const el = fixtureSync(container());
|
114
|
-
el.item = {
|
115
|
-
metadata: { identifier: 'foo' },
|
116
|
-
};
|
117
|
-
await elementUpdated(el);
|
118
|
-
|
119
114
|
const itemImage = fixtureSync(el.itemImage);
|
120
115
|
expect(itemImage).to.be.instanceOf(HTMLImageElement);
|
121
116
|
expect(itemImage.getAttribute('class')).to.equal('cover-img');
|