Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: OpenSeadragon attempts to attach the JS libraries to the page even when there is no tile sources #1975

Closed
jordandukart opened this issue Oct 26, 2021 · 1 comment
Labels
Type: bug identifies a problem in the software with clear steps to reproduce

Comments

@jordandukart
Copy link
Member

jordandukart commented Oct 26, 2021

To reproduce (tested on an islandora-playbook box):

  1. Place the OpenSeadragon block in the content region, configure the manifest url to be node/[node:nid]/manifest or whatever pattern doesn't really matter.
  2. Create a repository item (model can be anything).
  3. View the object.
  4. Note that the OSD block always renders regardless of model (design choice perhaps, doesn't really matter if using context / some other mechanisms).
  5. Open the developer tools console of your browser's choice and see (for reference this is the JS blowing up):

Screen Shot 2021-10-26 at 7 34 01 AM

This is due to the explict inclusion of the libraries in the template itself as opposed to the preprocess function. That is, the preprocess is what attaches the settings that the OSD JS requires to be present in order to instantiate itself. When there is no tile sources present (no media, no children in the paged content case) this will always blow up.

The formatter also does the same thing so could move things to the preprocess there as well.

Proposed resolution:
Remove the attach_library calls from the templates and move to the template_preprocess hooks.

This shouldn't necessarily cause any issues if someone had overridden a template already in a custom theme as worst case scenario the libraries would be "attached" twice which Drupal would de-dupe.

PR to come.

@jordandukart jordandukart added the Type: bug identifies a problem in the software with clear steps to reproduce label Oct 26, 2021
@jordandukart
Copy link
Member Author

PR: Islandora/openseadragon#39.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: bug identifies a problem in the software with clear steps to reproduce
Projects
None yet
Development

No branches or pull requests

1 participant