Skip to content

Isolate all Diva.js calls behind a single viewer adapter - #969

Open
etosphere wants to merge 1 commit into
mainfrom
diva/1-adapter
Open

Isolate all Diva.js calls behind a single viewer adapter#969
etosphere wants to merge 1 commit into
mainfrom
diva/1-adapter

Conversation

@etosphere

Copy link
Copy Markdown
Contributor

Closes #963.

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.
@etosphere etosphere self-assigned this Jul 6, 2026
@etosphere
etosphere requested a review from kyrieb-ekat July 6, 2026 11:33

@kyrieb-ekat kyrieb-ekat left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment on lines -72 to -97
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
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why were these removed?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Isolate all Diva.js calls behind a single viewer adapter

2 participants