OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
682 stars 95 forks source link

Drag and Drop appears to be disabled or broken in my content pane add-in #2090

Closed Gregg8 closed 1 year ago

Gregg8 commented 3 years ago

The components in our add-in which make use of the browser drag/drop events currently don't work. The drag doesn't even start. It appears as if drag/drop is disabled in add-ins.

Your Environment

Expected behavior

Current behavior

Steps to reproduce

The simplest example I could come up with is the drag/drop demo in W3Schools:

https://www.w3schools.com/html/html5_draganddrop.asp

Open this in your browser, and you'll see you can drag and drop the W3Schools logo from one box to another.

I created an add-in manifest which points to this url.

Steps:

<?xml version="1.0" encoding="utf-8"?>
<OfficeApp xmlns="http://schemas.microsoft.com/office/appforoffice/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ContentApp">
  <Id>ab93afab-847d-42aa-972a-30a56098db83</Id>
  <AlternateId>en-US\WA123456789</AlternateId>
  <Version>1.0.0.0</Version>
  <ProviderName>W3Schools</ProviderName>
  <DefaultLocale>en-US</DefaultLocale>
  <DisplayName DefaultValue="HTML Drag and Drop API" />
  <Description DefaultValue="Testing" />
  <Hosts>
    <Host Name="Workbook" />
  </Hosts>
  <Requirements>
    <Sets DefaultMinVersion="1.1">
      <Set Name="TableBindings" />
    </Sets>
  </Requirements>
  <DefaultSettings>
    <SourceLocation DefaultValue="https://www.w3schools.com/html/html5_draganddrop.asp" />
    <RequestedWidth>400</RequestedWidth>
    <RequestedHeight>400</RequestedHeight>
  </DefaultSettings>
  <Permissions>ReadWriteDocument</Permissions>
  <AllowSnapshot>true</AllowSnapshot>
</OfficeApp>

Context

Related

I see a very recent similar issue here: #2059.

However, apart from being PowerPoint and making use of the MS Web Viewer add-in, other differences include:

Dengshan2018 commented 3 years ago

There is the issue to support ondrop/ondragover in in-content add-in on webview2. Working with webview2 team to see if there is workable solution. @Gregg8, as alternative solution, could you build similar experience through mouse event?

Gregg8 commented 3 years ago

Thanks @Dengshan2018. Yes, we are looking into simulating drag/drop in our code, as jQuery does.