1

I'm working on a plugin where we rely on the user's ability to drag-and-drop an image from our Google Docs plugin sidebar to their current Google Document, inserting it in the document when they drop.

This has worked fine up till now using HtmlService.SandboxMode.NATIVE, as the browser implements this natively, but that sandbox mode will soon be sunsetted in favor of HtmlService.SandboxMode.IFRAME.

In iFrame sandbox mode, this no longer works, as dragging and dropping between iFrames is disallowed by browser security.

I initially thought we might be able fake this by catching an event on drop, and inserting the image at the user's cursor location, but we're not getting any events for the drag and drop over the document.

It doesn't look like window messaging is an option.

Has anyone dealt with this or a similar situation? Any insight into how we might either a) make drag and drop work, or b) fake it?

4
  • possible duplicate stackoverflow.com/questions/16968818/…
    – abielita
    Mar 9, 2016 at 3:40
  • Thanks @abielita -- that's not a duplicate though as I specifically need options for within Google Docs Add-on's sandboxed environment.
    – renderf0x
    Mar 10, 2016 at 6:42
  • 1
    There is no work-around for this security-related restriction. Raising an issue on Google's issue tracker might get them to implement some trigger for drop actions... but since they have nothing like that currently, I would not expect the request to be taken seriously.
    – Mogsdad
    Jun 6, 2016 at 20:17
  • Thanks @Mogsdad -- I've raised the issue, but in the end it looks like we're going to have to go a different route (click to insert at cursor location instead of drag-n-drop). A shame for sure; like you say, there's no real work around.
    – renderf0x
    Jun 23, 2016 at 0:24

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.