Coder Social home page Coder Social logo

projectmirador / mirador-dl-plugin Goto Github PK

View Code? Open in Web Editor NEW
6.0 6.0 6.0 86 KB

a Mirador 3 plugin that adds manifest-provided download links to the window options menu

Home Page: https://mirador-download-plugin.netlify.com/

License: Other

JavaScript 100.00%
mirador mirador-3 mirador-plugins

mirador-dl-plugin's People

Contributors

camillevilla avatar cbeer avatar corylown avatar jkeck avatar mejackreed avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mirador-dl-plugin's Issues

Address dialog width

Split out from sul-dlss/sul-embed#982 (might be better to do this once the dialog has content)

Use a fixed width of 400px for the dialog. If the viewport is less than 400px, the dialog should adjust down in width and add a horizontal scrollbar, as the "Export workspace" dialog does.

Handle max-width restricted content

This is effectively a Stanford use case, but we have cases where image downloads are restricted to a max of 400px on the long edge. IIIF doesn't have a way of expressing this.

We want to look into some sort of configurable / extendable way to allow the consumers of this plugin to determine that this is the case for an image and display the appropriate links accordingly.

See Example: No-download object section in sul-dlss/sul-embed#983 for more details.

Example Manifest/Image API:
https://purl.stanford.edu/bb020ty1503/iiif/manifest
https://stacks.stanford.edu/image/iiif/bb020ty1503%252FFU.Roma.UM.1/info.json

Standalone JS Version?

Would it be possible to expose the plugin as a single js standalone file, too?

That way a user could just use the Mirador viewer via the mirador.min.js and an additional downloadPlugin.js in the header - instead of having to build his own framework (npm, react, etc.).

Just an idea - I understand using npm webpack/parcel is nicer and a better way in the long run (if someone wants to build his own frontend), but all this hassle for just a simple download button ...

Disable defaults links

Hi,

I'm using this plugin to provide my own download links with such and such size.
But is it possible to disable the links that are generated by default ?

Thank you.

Function components cannot be given refs

Hello! I'm seeing a new issue with Mirador 3.0.0-beta.6 and mirador-dl-plugin 0.11.0 (the latest releases). When I click on the vertical ellipse icon to toggle the download feature, I'm seeing the error written below.

Mirador configuration/instance is here:

Any help or suggestions would be greatly appreciated!

Screen Shot 2020-03-24 at 10 16 33 AM

Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?

Check the render method of `ForwardRef(Menu)`.
    in PluginHook (at WindowTopBarPluginMenu.js:82)
    in ul (created by ForwardRef(List))
    in ForwardRef(List) (created by WithStyles(ForwardRef(List)))
    in WithStyles(ForwardRef(List)) (created by ForwardRef(MenuList))
    in ForwardRef(MenuList) (created by ForwardRef(Menu))
    in div (created by ForwardRef(Paper))
    in ForwardRef(Paper) (created by WithStyles(ForwardRef(Paper)))
    in WithStyles(ForwardRef(Paper)) (created by Transition)
    in Transition (created by ForwardRef(Grow))
    in ForwardRef(Grow) (created by TrapFocus)
    in TrapFocus (created by ForwardRef(Modal))
    in div (created by ForwardRef(Modal))
    in ForwardRef(Portal) (created by ForwardRef(Modal))
    in ForwardRef(Modal) (created by ForwardRef(Popover))
    in ForwardRef(Popover) (created by WithStyles(ForwardRef(Popover)))
    in WithStyles(ForwardRef(Popover)) (created by ForwardRef(Menu))
    in ForwardRef(Menu) (created by WithStyles(ForwardRef(Menu)))
    in WithStyles(ForwardRef(Menu)) (at WindowTopBarPluginMenu.js:66)
    in WindowTopBarPluginMenu (at withPlugins.js:20)
    in WithPlugins(WindowTopBarPluginMenu) (created by ConnectFunction)
    in ConnectFunction (created by WithStyles(Connect(WithPlugins(WindowTopBarPluginMenu))))
    in WithStyles(Connect(WithPlugins(WindowTopBarPluginMenu))) (created by withI18nextTranslation(WithStyles(Connect(WithPlugins(WindowTopBarPluginMenu)))))
    in withI18nextTranslation(WithStyles(Connect(WithPlugins(WindowTopBarPluginMenu)))) (at WindowTopBar.js:63)
    in div (created by ForwardRef(Toolbar))
    in ForwardRef(Toolbar) (created by WithStyles(ForwardRef(Toolbar)))
    in WithStyles(ForwardRef(Toolbar)) (at WindowTopBar.js:37)
    in nav (at WindowTopBar.js:36)
    in header (created by ForwardRef(Paper))
    in ForwardRef(Paper) (created by WithStyles(ForwardRef(Paper)))
    in WithStyles(ForwardRef(Paper)) (created by ForwardRef(AppBar))
    in ForwardRef(AppBar) (created by WithStyles(ForwardRef(AppBar)))
    in WithStyles(ForwardRef(AppBar)) (at WindowTopBar.js:35)
    in WindowTopBar (at withPlugins.js:26)
    in WithPlugins(WindowTopBar) (created by ConnectFunction)
    in ConnectFunction (created by WithStyles(Connect(WithPlugins(WindowTopBar))))
    in WithStyles(Connect(WithPlugins(WindowTopBar))) (created by withI18nextTranslation(WithStyles(Connect(WithPlugins(WindowTopBar)))))
    in withI18nextTranslation(WithStyles(Connect(WithPlugins(WindowTopBar)))) (at Window.js:50)
    in div (at Window.js:49)
    in section (created by ForwardRef(Paper))
    in ForwardRef(Paper) (created by WithStyles(ForwardRef(Paper)))
    in WithStyles(ForwardRef(Paper)) (at Window.js:82)
    in Window (at withPlugins.js:49)
    in WithPlugins(Window) (created by ConnectFunction)
    in ConnectFunction (created by WithStyles(Connect(WithPlugins(Window))))
    in WithStyles(Connect(WithPlugins(Window))) (created by withI18nextTranslation(WithStyles(Connect(WithPlugins(Window)))))
    in withI18nextTranslation(WithStyles(Connect(WithPlugins(Window)))) (at WorkspaceMosaic.js:130)
    in div (created by InternalMosaicWindow)
    in div (created by InternalMosaicWindow)
    in InternalMosaicWindow (created by Context.Consumer)
    in DragSource(InternalMosaicWindow) (created by Context.Consumer)
    in DropTarget(DragSource(InternalMosaicWindow)) (created by MosaicWindow)
    in MosaicWindow (at WorkspaceMosaic.js:123)
    in div (created by MosaicRoot)
    in div (created by MosaicRoot)
    in MosaicRoot (created by Mosaic)
    in div (created by Mosaic)
    in Mosaic (created by DragDropContext(Mosaic))
    in DragDropContext(Mosaic) (at WorkspaceMosaic.js:151)
    in WorkspaceMosaic (at withPlugins.js:20)
    in WithPlugins(WorkspaceMosaic) (created by ConnectFunction)
    in ConnectFunction (created by WithStyles(Connect(WithPlugins(WorkspaceMosaic))))
    in WithStyles(Connect(WithPlugins(WorkspaceMosaic))) (at Workspace.js:32)
    in div (at Workspace.js:96)
    in Workspace (at withPlugins.js:26)
    in WithPlugins(Workspace) (created by ConnectFunction)
    in ConnectFunction (created by WithStyles(Connect(WithPlugins(Workspace))))
    in WithStyles(Connect(WithPlugins(Workspace))) (created by withI18nextTranslation(WithStyles(Connect(WithPlugins(Workspace)))))
    in withI18nextTranslation(WithStyles(Connect(WithPlugins(Workspace)))) (at WorkspaceArea.js:37)
    in main (at WorkspaceArea.js:26)
    in WorkspaceArea (at withPlugins.js:26)
    in WithPlugins(WorkspaceArea) (created by ConnectFunction)
    in ConnectFunction (created by WithStyles(Connect(WithPlugins(WorkspaceArea))))
    in WithStyles(Connect(WithPlugins(WorkspaceArea))) (created by withI18nextTranslation(WithStyles(Connect(WithPlugins(WorkspaceArea)))))
    in withI18nextTranslation(WithStyles(Connect(WithPlugins(WorkspaceArea)))) (at App.js:67)
    in ThemeProvider (at App.js:64)
    in LiveAnnouncer (at App.js:63)
    in I18nextProvider (at App.js:62)
    in div (created by FullScreen)
    in FullScreen (at App.js:58)
    in App (at withPlugins.js:26)
    in WithPlugins(App) (created by ConnectFunction)
    in ConnectFunction (at MiradorViewer.js:32)
    in PluginProvider (at MiradorViewer.js:31)
    in Provider (at MiradorViewer.js:30)

Handle "Zoomed image" download links in book mode

We currently do not render the "Zoomed image" link in book mode. The current method for getting the current viewer bounds (OSDViewer.viewer.viewport.getBounds()) doesn't work as-is in Book mode (e.g. it ends up giving us a wildly incorrect x parameter).

More info available in sul-dlss/sul-embed#983 (comment)

We have a few options:

  1. "Stitch" together any visible images between two canvases into one image (preferred by @ggeisler)
  2. Render a link in the download under each canvas section that would download the visible section for that particular canvas.
    • If we do this, then we need to know what to do when one canvas is not visible (e.g. not display a link)
  3. Other possibilities...?

Update Dependencies Branch - Invalid hook call...

I'm working to add the M3 mirador-dl-plugin to the B1G Geoportal. I'm running into some issues with the plugin that are beyond me.

I'm running: mirador@^3.0.0-beta.0 and a local build of the update-dependencies branch, because it appears to be the near future of this plugin.

Here's my WIP feature branch

Alone, the new Mirador beta runs well within my GeoBlacklight instance. When I add the download plugin branch webpack compiles correctly, but when you load a page with mirador in it you see: "Invalid hook call..." ... "... error occurred in the <WithStyles(MiradorDownloadDialog)> component".

Screen Shot 2019-12-18 at 12 18 02 PM

Maybe this is related to react-iframe-comm being generally unsupported and adding "Mismatching Versions of React and React DOM"...
https://reactjs.org/warnings/invalid-hook-call-warning.html
ProjectMirador/mirador#2863
pbojinov/react-iframe-comm#14

Screen Shot 2019-12-18 at 12 46 50 PM

I'm hoping someone else has encountered this before. If anyone has any advice on how to circumvent this issue, I'd greatly appreciate it.

Console Errors - Failed prop type and Function components cannot be given refs

Hello! I'm running into a two JS console errors attempting to run Mirador with the download plugin. The plugin actually works fine, but the errors are a bit disconcerting.

Screen Shot 2019-11-20 at 3 51 03 PM

Error 1 - Chrome 78 / FF 70 / Safari 13
"Failed prop type: Invalid prop infoResponse of type boolean supplied to MiradorDownloadDialog, expected object."

Error 2 - Chrome 78 (Only)
"Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?"

Please let me know if you need any additional information. My feature branch is linked above.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.