-
Notifications
You must be signed in to change notification settings - Fork 33
0599 Drag and Drop #647
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
Open
triplingual
wants to merge
18
commits into
master
Choose a base branch
from
0599-drag-and-drop
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
0599 Drag and Drop #647
Changes from 2 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
c10de71
Started with the barest of possibly workable content ➕
triplingual 251105e
Switched to use IIIF icon for tractable CORS troubleshooting 🔀🖼️
triplingual 9359dbe
Added drag-and-drop recipe to links and ToC 📝
triplingual c2872dd
Extremely rough draft of a use case 📝
triplingual 4d30998
Started restrictions, rolled back draggable image 📝🖼️
triplingual c474dce
Added `JSON.stringify()` per @glenrobson ✨
triplingual b3bf320
Moved restriction text ➡️ implementation and drafted new restriction …
triplingual 770f280
Edited use case for readability 📝
triplingual dbd7185
Swapped test content for copy of content from JavaScript 🔀
triplingual 9558b95
Significant edits to flesh out the text 📝
triplingual aa83cc5
Expanded implementation notes, added new example 📝➕
triplingual 7f6046d
Corrected type for content per authors' call 🛠️
triplingual 6099f5a
Added text about lack of support per authors' call 📝
triplingual e1ee0ef
Made Example section text accurate, added visible markup for logo 📝
triplingual 1a0de93
Finished the incomplete thought of one graf, flowed through consequen…
triplingual 1d17da3
Explained why JSON in this example 📝
triplingual 5fe3e30
Expanded notes to viewer developers in Implementation and Restrictions 📝
triplingual 59ea17f
Added logo image used in recipe ➕🖼️
triplingual File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| --- | ||
| title: Name of Recipe | ||
| id: -1 | ||
| layout: recipe | ||
| tags: [tbc] | ||
| summary: "tbc" | ||
| viewers: | ||
| topic: | ||
| - basic | ||
| --- | ||
|
|
||
| ## Use Case | ||
|
|
||
| Describe the use case that the pattern is intended to solve. | ||
| Why is this pattern important? | ||
|
|
||
| ## Implementation Notes | ||
|
|
||
| What do you need to know to use this pattern? | ||
| How do you implement the pattern? | ||
|
|
||
| ## Restrictions | ||
|
|
||
| When is this pattern is usable / not usable? Is it deprecated? If it uses multiple specifications, which versions are needed, etc.? | ||
|
|
||
| Delete this section if it is not needed. | ||
| If you don't know what the restrictions might be initially, just leave the following line: | ||
| **Unknown - Help Needed** | ||
|
|
||
| ## Example | ||
|
|
||
| Describe the solution in prose and provide an example. | ||
| The example json document must be an external document, and imported with the following: | ||
|
|
||
| {% include manifest_links.html viewers="" manifest="manifest.json" %} | ||
|
|
||
|
|
||
| <img src="https://iiif.io/api/cookbook/assets/images/logos/logo-sm.png" draggable="true" ondragstart="drag(event)" alt="IIIF logo; drag and drop onto a supporting viewer to see this resource in that viewer"> | ||
|
|
||
| <script> | ||
| function drag(ev) { | ||
| ev.dataTransfer.setData("text/plain", { | ||
| "@context": "http://iiif.io/api/presentation/3/context.json", | ||
| "id": "https://example.org/content-states/1", | ||
| "type": "Annotation", | ||
| "motivation": ["contentState"], | ||
| "target": { | ||
| "id": "https://iiif.io/api/cookbook/recipe/0006-text-language/manifest.json", | ||
| "type": "Manifest" | ||
| } | ||
| }); | ||
| } | ||
| </script> | ||
|
|
||
| ## Related Recipes | ||
|
|
||
| Provide a bulleted list of related recipes and why they are relevant. | ||
|
|
||
| {% include acronyms.md %} | ||
| {% include links.md %} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| { | ||
| "@context": "http://iiif.io/api/presentation/3/context.json", | ||
| "id": "{{ id.url }}", | ||
| "type": "Manifest", | ||
| "label": { "en": [ "Visible Text Annotation" ] }, | ||
| "items": [ | ||
| { | ||
| "id": "{{ id.path }}/canvas", | ||
| "type": "Canvas", | ||
| "height": 31722, | ||
| "width": 70399, | ||
| "items": [ | ||
| { | ||
| "id": "{{ id.path }}/page/p1/1", | ||
| "type": "AnnotationPage", | ||
| "items": [ | ||
| { | ||
| "id": "{{ id.path }}/annotation/p0001-image", | ||
| "type": "Annotation", | ||
| "motivation": "painting", | ||
| "body": { | ||
| "id": "https://iiif.io/api/image/3.0/example/reference/36ca0a3370db128ec984b33d71a1543d-100320001004/full/max/0/default.jpg", | ||
| "type": "Image", | ||
| "format": "image/jpeg", | ||
| "height": 31722, | ||
| "width": 70399, | ||
| "service": [ | ||
| { | ||
| "id": "https://iiif.io/api/image/3.0/example/reference/36ca0a3370db128ec984b33d71a1543d-100320001004", | ||
| "profile": "level1", | ||
| "type": "ImageService3" | ||
| } | ||
| ] | ||
| }, | ||
| "target": "{{ id.path }}/canvas" | ||
| }, | ||
| { | ||
| "id": "{{ id.path }}/annotation/p0001-text", | ||
| "type": "Annotation", | ||
| "motivation": "painting", | ||
| "body": { | ||
| "type": "TextualBody", | ||
| "format": "text/html", | ||
| "value": "<p style='font-size:1000px; background-color: rgba(16, 16, 16, 0.5); padding:300px'>The koto is to the right, carried in a cloth wrapping.</p>", | ||
| "language": "en" | ||
| }, | ||
| "target": "{{ id.path }}/canvas#xywh=5500,12200,8000,5000" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was testing this with my demo site: https://iiif.gdmrdigital.com/import_to_viewers/DragDropDestination.html to see if I could get it working. I had to make an update as you set the data type as text/plain which I think is correct but my app didn't use that value so that should be fixed now.
The other issue I came across is that I think dataTransfer only transfers Strings so when you put the JSON in as the data it converts it to a string of
object [object]and you loose the data. I think you need to wrap that inJSON.stringify()to ensure the annotation is converted into a String before passing it .There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I was starting with the bits from that Slack conversation, so I'm happy to get updates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logo image has disappeared
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the other hand, when I drag from the recipe in progress I get a strange error in the browser tools:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://newspapers.library.wales/iiif/2.0/image/3412218/info.json. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 403.Even though the manifest in the script in the recipe is https://iiif.io/api/cookbook/recipe/0006-text-language/manifest.json, not the Wales library one.