News for hackers. Stuff that matters.
Re:Show HN: Scratch.js – Interactive JavaScript Scratchpad by OzzyB on Wednesday November 18, 2020 @12:49PM (#25139848)
Can you give us Mac users some love and replace ctrl w/ command ? My muscle memory is giving me a hard time xD
Re:Show HN: Scratch.js – Interactive JavaScript Scratchpad by kahole on Wednesday November 18, 2020 @12:58PM (#25139989)
The source is very small and can be used both through the file:// and hosted http protocols. So you can easily make it do whatever you like. I could maybe expose some global variables to make it customizable, but I went for simplicity and smaller source instead.
Re:Show HN: Scratch.js – Interactive JavaScript Scratchpad by kamikaz1k on Wednesday November 18, 2020 @01:16PM (#25140239)
if it helps, all you need to do is add this listener to support the cmd key:

`document.addEventListener('keydown', (e) => (e.metaKey && e.code === 'Enter' && evaluate() && e.preventDefault()));`

The metaKey[1] is only accessible for keydown.

[1] https://stackoverflow.com/questions/3902635/how-does-one-cap...

Re:Show HN: Scratch.js – Interactive JavaScript Scratchpad by kahole on Thursday November 19, 2020 @04:23AM (#25147705)
Fixed
Re:Show HN: Scratch.js – Interactive JavaScript Scratchpad by bikeshaving on Wednesday November 18, 2020 @03:16PM (#25141876)
Ctrl-Enter is the shortcut for inserting a soft newline for content-editables on Safari btw. You might want to consider supporting command-enter for this reason alone.