• M
    Fix drag and dropping of editors for webviews (#82813) · cbda1fde
    Matt Bierner 提交于
    * Fix drag and dropping of editors for webviews
    
    Fixes #25854
    
    This change does the following:
    
    - Have the webview editor create an `EditorDropTarget`. This is required because the webview itself is not part of the normal editor dom (it exists as a top level node in the workbench so that we never reparent it). This means that the standard `EditorDropTarget` does not work.
    
    - Make webviews set `pointer-events: none` while a drag is happening. When a drag happens on Electron's webviews or a normal iframe, no  drag and drop events seem to get generated. The fix is to set `pointer-events: none` while the drag is happening. But it's also difficult to detect when the drag is happening because the  `EditorDropTargets` class eats the drop event itself. The only reliable seeming way I could find to determine when a drag starts and ends is looking at global events on the window.
    
    This workaround is pretty ugly. I'm not sure if there's some better approach that would work with webviews
    
    * Add public `createDropTargets` helper on editorPart
    
    Unfortunatly we can't add this method to IEditorGroupsService as it uses the `HTMLElement` type
    
    * Rename function to createEditorDropTarget
    
    * Use instanceof instead of cast
    cbda1fde
editorPart.ts 34.6 KB