Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
c10de71
Started with the barest of possibly workable content ➕
triplingual Oct 24, 2025
251105e
Switched to use IIIF icon for tractable CORS troubleshooting 🔀🖼️
triplingual Oct 24, 2025
9359dbe
Added drag-and-drop recipe to links and ToC 📝
triplingual Oct 31, 2025
c2872dd
Extremely rough draft of a use case 📝
triplingual Oct 31, 2025
4d30998
Started restrictions, rolled back draggable image 📝🖼️
triplingual Oct 31, 2025
c474dce
Added `JSON.stringify()` per @glenrobson ✨
triplingual Oct 31, 2025
b3bf320
Moved restriction text ➡️ implementation and drafted new restriction …
triplingual Oct 31, 2025
770f280
Edited use case for readability 📝
triplingual Nov 6, 2025
dbd7185
Swapped test content for copy of content from JavaScript 🔀
triplingual Nov 6, 2025
9558b95
Significant edits to flesh out the text 📝
triplingual Nov 6, 2025
aa83cc5
Expanded implementation notes, added new example 📝➕
triplingual Nov 14, 2025
7f6046d
Corrected type for content per authors' call 🛠️
triplingual Nov 18, 2025
6099f5a
Added text about lack of support per authors' call 📝
triplingual Nov 18, 2025
e1ee0ef
Made Example section text accurate, added visible markup for logo 📝
triplingual Nov 18, 2025
1a0de93
Finished the incomplete thought of one graf, flowed through consequen…
triplingual Nov 18, 2025
1d17da3
Explained why JSON in this example 📝
triplingual Nov 18, 2025
5fe3e30
Expanded notes to viewer developers in Implementation and Restrictions 📝
triplingual Nov 18, 2025
59ea17f
Added logo image used in recipe ➕🖼️
triplingual Nov 18, 2025
27e127b
Edited head section 📝
triplingual Dec 10, 2025
7554008
Added related recipes ➕
triplingual Dec 10, 2025
727e204
Set formatting for code and markup blocks 📝
triplingual Dec 10, 2025
6fe5772
Merge branch 'master' into 0599-drag-and-drop
glenrobson Dec 11, 2025
cda54b9
Capitalized word appropriately 📝
triplingual Dec 12, 2025
78a2bee
Changed cursor to pointer to emphasize draggability 🎨
triplingual Dec 12, 2025
bace288
Removed related item as insufficiently related 🚮
triplingual Dec 12, 2025
977ea48
Changed aside to encourage use of IIIF logo as the draggable item 📝
triplingual Dec 12, 2025
dfd3e52
Linked directly to manifest 🔗
triplingual Dec 12, 2025
1689756
Added pointer to @glenrobson implementation and screencast of using s…
triplingual Dec 12, 2025
bc5c6a1
Screencast showing how drag and drop could look 🎥
triplingual Dec 12, 2025
a93a11e
Added note about cursor transformation 📝
triplingual Dec 12, 2025
82492cf
Changed link to be full URI for validator 🔗
triplingual Dec 12, 2025
c571105
Changed link CORRECTLY to point to full MANIFEST for validator 🔗
triplingual Dec 12, 2025
2a48b21
Changed video source to point to new filename 🔗
triplingual Dec 12, 2025
c6b43e8
Changed cursor to `grad` 🤚🏻
triplingual Jan 16, 2026
6d615a4
Updated with working example viewer ⬆️
triplingual Jan 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions recipe/0599-drag-and-drop/index.md
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"
}
});
}
Copy link
Member

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 in JSON.stringify() to ensure the annotation is converted into a String before passing it .

Copy link
Contributor Author

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.

Copy link
Contributor Author

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

Copy link
Contributor Author

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.

</script>

## Related Recipes

Provide a bulleted list of related recipes and why they are relevant.

{% include acronyms.md %}
{% include links.md %}
54 changes: 54 additions & 0 deletions recipe/0599-drag-and-drop/manifest.json
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"
}
]
}
]
}
]
}
Loading