madprops / grasshopper

Advanced Tab Manager For Firefox
https://addons.mozilla.org/firefox/addon/grasshopper-urls/
GNU General Public License v3.0
55 stars 2 forks source link

tabs to bookmarks bar #59

Closed N3C2L closed 12 months ago

N3C2L commented 12 months ago

I found a bug: If you drag and drop a tab from the native firefox tab bar into the firefox bookmark bar, the title of the tab will be used for the stored bookmark item. If you drag and drop a tab from the grasshopper sidebar to the firefox bookmark bar on top, then the bookmarked item in the bookmark bar rename themselves into the url instead of keeping the title. The tab inside the grasshopper sidebar also gets renamed to the url when bookmarked this way. The tab doesn't get renamed if the the tab is drag and dropped from the grasshopper popup Interface though.

But another problem occur if you want to drag and drop a tab into the firefox bookmark bar: If you are inside the grasshopper sidebar and want to drag and drop a tab straight above into the bookmark bar of firefox, then you accidentally move the tab inside the grasshopper interface (but that's not what you want, because you just wanted to move the tab into the firefox bookmark bar, and not moving the tab inside the grasshopper interface).

A solution could be that a dragged tab inside the grasshopper interface moves only when you release the mouse button, but doesn't move if you just hold the mouse button. A visual indicator (an arrow or a line between tabs) where the tabs then appear if the mouse button is released could be useful.

madprops commented 12 months ago

I didn't know it was possible to drag from grasshopper to other firefox components. Not sure I can do anything about the title vs url. I tried changing the text data to the title and it won't drop into the bookmarks bar, it needs to be the url to work for some reason.

Also I don't like the idea of not re-ordering the tabs instantly:

What I did is also enable dragging when using the Lock Drag setting. If you have this on, you will only re-order tabs when holding Ctrl key. You can use this to drag to the bookmark bar without messing your tabs by dragging without holding Ctrl.

This is on v2101.

Thanks.

N3C2L commented 12 months ago

Thanks. Maybe you can research the solution for keeping the titles in the bookmarks in the tree style tab addon, because it's working there: https://github.com/piroor/treestyletab https://addons.mozilla.org/en-us/firefox/addon/tree-style-tab/

madprops commented 12 months ago

This is now fixed. The code in that project was helpful.

N3C2L commented 5 months ago

I think I can put my problem here because it relates to this. The issue is as follows: when you select more than one tab, for example with shift key, and then drag these tabs into a folder at the top of the bookmark bar, only one of those tabs is saved in the bookmark bar, not the others. It would be wonderful if you could look into this, maybe check out the repro linked in the previous post where this also worked.

madprops commented 5 months ago

I'll take a look tomorrow.

N3C2L commented 5 months ago

Thanks!

madprops commented 5 months ago

It should work now.

        if (item.url) {
          urls.push(item.url)

          if (item.title) {
            moz_urls.push(`${item.url}\n${item.title}`)
          }
        }
  if (moz_urls.length) {
    e.dataTransfer.setData(`text/x-moz-url`, moz_urls.join(`\r\n`))
  }

  if (urls.length) {
    let uri_list = urls.join(`\r\n`)
    e.dataTransfer.setData(`text/uri-list`, uri_list)
    e.dataTransfer.setData(`text/plain`, uri_list)
  }

Also fixed some other stuff.

And added icon settings for the close button and hover button.

N3C2L commented 5 months ago

Works flawless, thanks!