qweasd1/hyper-drop-file

Doesn't work on Hyper 3.0.2

hieplpvip opened this issue · 1 comments

Hi,

This plugin doesn't work without some modifications for me. I'm using Hyper 3.0.2. Installed plugins are:

  • hypercwd (1.4.0)
  • hyperterm-dibdabs (0.0.8)
  • hyper-search (0.4.0)
  • hyper-quit (1.0.3)
  • hyper-savetext (1.1.2)
  • hyper-chesterish (1.2.8)
  • hyper-tabs-enhanced (0.4.2)
  • hyperterm-tabs (1.4.0)
  • hyper-font-ligatures (0.0.8)
  • hyperline (1.2.0)

I have to listen for events from hyper_main instead of hyper. My patch:

diff --git a/index.js b/index.js
index 71d68b7..e4b4402 100644
--- a/index.js
+++ b/index.js
@@ -33,12 +33,12 @@ function getCurrentWindow(){
 exports.onRendererWindow = (window) => {
   window.document.addEventListener('DOMContentLoaded', () => {
 
-    window.document.querySelector("#hyper").addEventListener("dragover", (e) => {
+    window.document.getElementsByClassName("hyper_main")[0].addEventListener("dragover", (e) => {
       e.preventDefault()
       e.stopPropagation()
     })
   //
-    window.document.querySelector("#hyper").addEventListener("drop", (e) => {
+    window.document.getElementsByClassName("hyper_main")[0].addEventListener("drop", (e) => {
       // e.preventDefault()
       // e.stopPropagation()
       for (let file of e.dataTransfer.files) {

Hi hieplpvip,
Thanks for your patch, I use hyper 3.0.2 too but never encounter this issue. I guess maybe one of the plugin you install might change the structure of the DOM tree and hide the "#hyper" element. So I merge your patch into my code and publish the hyper-drop-file 1.0.4 just in case someone encounter the same issue as you. Again, thank you for your patch!