glacambre / firenvim

Embed Neovim in Chrome, Firefox & others.
GNU General Public License v3.0
4.55k stars 144 forks source link

[feature]: extend `selector`'s behavior to choose elements #1604

Open xudyang1 opened 2 months ago

xudyang1 commented 2 months ago

What I tried to do

Type <C-e> to open firenvim in page github.com/glacambre/firenvim/issues/ISSUE_NUMBERS to edit comment / post new comment

What happened

No window was open. Then, I typed <C-e> again, a firenvim window appeared at the upper left corner of the page. The filename contains selector TEXTAREA-id-feedback.

I tried to exclude the element, but the following config did not work:

vim.g.firenvim_config = {
  globalSettings = {
    alt = "all",
    cmdlineTimeout = 3000,
  },
  localSettings = {
    [".*"] = {
      cmdline = "neovim",
      content = "text",
      priority = 0,
      selector = "textarea",
      takeover = "never",
    },
    ["github.com/.*"] = {
      filename = "{hostname%32}_{pathname%32}_{selector%32}_{timestamp%32}.md",
      selector = "textarea:not(#feedback), textarea#new_comment_field",
    },
  },
}

Current solution is to manually click at the comment textarea and then type <C-e> to trigger firenvim.

glacambre commented 2 months ago

This is not a bug but the intended behavior, as this enables using Firenvim on elements whose selector cannot be decided. I can see how the behavior you expected is useful though, I'll try to implement it.

xudyang1 commented 2 months ago

This is not a bug but the intended behavior, as this enables using Firenvim on elements whose selector cannot be decided. I can see how the behavior you expected is useful though, I'll try to implement it.

Already changed it into a feature request!