Skip to content

Open configured PLUG_EDITOR doesn't "reset" properly #174

@eriknaslund

Description

@eriknaslund

The ability to hold down "c" or "d" and click somewhere on your website to open up the source file in your editor is really cool. However I had to make one change compared to the docs to get it working properly.

Using LibreWolf 143.0.3-1 (Firefox based) and PLUG_EDITOR="cursor://file/__FILE__:__LINE__" I got the behavior where the Javascript missed registering the keyup event after the editor was opened (and got the focus). This caused it to re-open the same file over and over again as soon as a clicked the page (no longer holding down "c"). I sprinkled some console.log statements, and saw that the "keyup" wasn't always triggered. I'm guessing this could depend on your browser, editor etc, but nonetheless it seems like a bit of a race condition in it's current state.

My very simple fix/workaround was to just add a blur event handler, like this: window.addEventListener("blur", e => keyDown = null). Maybe there's some more elegant solution, but this seems to work fine for me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions