question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Param to allow hotkeys in contenteditable?

See original GitHub issue

Hello @JohannesKlauss. I saw you disabled hotkeys for contenteditable in #438. Any way I can enable my hotkey inside contenteditable with enableOnTags or something?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
JohannesKlausscommented, Apr 22, 2021

Fixed in 3.3.1

You can now write something like this:

() => {
    const [amount, setAmount] = useState(0);
    useHotkeys('cmd+s', (e) => {
      e.preventDefault();
      setAmount(prevAmount => prevAmount + 100);
    }, {enableOnContentEditable: true});
    return (
      <>
        <div>
          {amount >= 0 ? 'Add' : 'Remove'} {Math.abs(amount)} dollars {amount >= 0 ? 'from' : 'to'} my bank account.
        </div>
        <div contentEditable={true}>Edit this text.</div>
      </>
    );
  }
1reaction
JohannesKlausscommented, Apr 22, 2021

Makes sense. I’ll check how wer could clenaly re enable this

Read more comments on GitHub >

github_iconTop Results From Across the Web

contentEditable keyboard shortcuts - javascript - Stack Overflow
I know three for Chrome (and maybe some other browsers): Ctrl+B, Ctrl+U, CTRL+I. Where can I find this information? I've tried to find...
Read more >
(feat) Add inContentEditable property by pdesgarets · Pull Request ...
Allowing hotkeys in contenteditable elements ... @param {boolean} inContentEditable Wether to allow combo in contenteditable elements. */. function Hotkey ...
Read more >
accesskey - HTML: HyperText Markup Language | MDN
The accesskey global attribute provides a hint for generating a keyboard shortcut for the current element. The attribute value must consist ...
Read more >
HTML Global contenteditable Attribute - W3Schools
The contenteditable attribute specifies whether the content of an element is editable or not. Note: When the contenteditable attribute is not set on...
Read more >
HTML contenteditable Attribute - W3docs
The contenteditable attribute can have two values: true (the content is editable) or false (the content is not editable). If this attribute is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found