Isolate all Diva.js calls behind a single viewer adapter - #969
Conversation
Cantus Ultimus displays manuscript page images with Diva.js. We want to upgrade the viewer from Diva v6 to v7, but v7 is a full rewrite with a completely different API. As the first step of that migration (issue #942), this commit collects every call into Diva behind a single class, DivaAdapter, without changing what the viewer does for users. Diva v6 remains the backend and this is meant to be behaviour-preserving. The two remaining v6-specific seams (the toolbar selector and changeView) are left for the later stage that moves the toolbar UI out of Diva. No user-facing behaviour change is intended. This commit contains only the JavaScript source; the built bundle under nginx/static is not regenerated in this commit.
There was a problem hiding this comment.
Clean, well-scoped extraction: DivaAdapter centralizes event-topic mapping, page navigation, and the (currently no-op) highlight/focus methods, and call sites (DivaFolioAdvancerView, ManuscriptDetailPageView, OMRSearchProvider) are updated consistently. OMRSearchProvider gets an improvement and looks up the adapter via the manuscriptChannel instead of holding a direct divaView reference, decoupling it from the view. Aside from the dropped options below, no functional issues.
Said dropped option being the thing with the download button; if we're fine with the removal then this can just be merged.
| var manifestUrl = this.manifestUrl; | ||
|
|
||
| var options = { | ||
| toolbarParentObject: this.toolbarParentObject[0], | ||
| viewerWidthPadding: 0, | ||
|
|
||
| enableAutoTitle: false, | ||
| enableAutoWidth: false, | ||
| enableAutoHeight: false, | ||
| enableFilename: false, | ||
| enableImageTitles: false, | ||
|
|
||
| enableHighlight: true, | ||
| enableDownload: true, | ||
|
|
||
| fixedHeightGrid: true, | ||
|
|
||
| enableKeyScroll: false, | ||
| enableSpaceScroll: false, | ||
| enableCanvas: true, | ||
|
|
||
| objectData: '/manifest-proxy/' + manifestUrl, | ||
|
|
||
| blockMobileMove: false | ||
| }; | ||
|
|
There was a problem hiding this comment.
Why were these removed?
There was a problem hiding this comment.
mostly because "Download" was user-facing, and we don't seem to return to featuring it; this is also present in #970 #971 #972 #973, so I think the download button was fully dropped, which is fine if we intended that. Even if it wasn't in scope for the original tools and capabilities, offering the ability to download an image isn't a bad idea to leave.
There was a problem hiding this comment.
I didn't find the Download button in the production version. On whether to add one, Diva v7 doesn't have an original image download, but we can download the image in the "Page View" modal by "Save View" (it will download the image with the filters and transformations you set, can proceed with zero filters). We could add our own Download button as a follow-up issue.
Closes #963.