Copy link to clipboard
Copied
I've seen there are demos about how to D&D from within the extension and from extension to host app, but not about how to do it from the host app. Is it possible to do? I'm using ondragover, ondragend and ondrop on the body and it only fires ondragover when I'm dragging something from the host. It is not even working with onmouseup.
Using CEP8 with Illustrator.
Did you prevent default event management on dragover ?
$("html").on("dragover", function(event) {
event.preventDefault();
event.stopPropagation();
});
$("html").on("dragleave", function(event) {
event.preventDefault();
event.stopPropagation();
});
$("html").on("drop", function(event) {
event.preventDefault();
event.stopPropagation();
//The jsx script to be run…
});
Otherwise the event is managed by the html engine thus ignoring
...Copy link to clipboard
Copied
When the drop event is fired, it generally means you have selected something inside the UI. Once that said, it should be all about getting html compliant data from the current selection. It may be SVG export or whatever that once exported is loaded inside the panel.
1. catch drop event
2. export current selection to HTML compliant format
3. Load data into HTML
One hiccup though, while exportFile is synchronous, file system operation may differ thus leading to out of date or missing ressources.
Copy link to clipboard
Copied
Thank you for your answer.
That's not what's happening. The problem is that the drop event is not being fired when I select something in Illustrator and drop it in my extension.
Copy link to clipboard
Copied
Did you prevent default event management on dragover ?
$("html").on("dragover", function(event) {
event.preventDefault();
event.stopPropagation();
});
$("html").on("dragleave", function(event) {
event.preventDefault();
event.stopPropagation();
});
$("html").on("drop", function(event) {
event.preventDefault();
event.stopPropagation();
//The jsx script to be run…
});
Otherwise the event is managed by the html engine thus ignoring your jsx call.
Copy link to clipboard
Copied
Thank you! That did the trick!
Is there any documentation where I could have seen this?
Copy link to clipboard
Copied
Well there are the SDK documentation (probably some D&D démos). But as CEP rely on HTML, most html "tricks" can find answers while googling them. There will be only little area where answers can only be found in the sdk docs.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more