Automattic / simplenote-electron

Simplenote for Web, Windows, and Linux
https://app.simplenote.com
GNU General Public License v2.0
4.69k stars 553 forks source link

Fix up editor padding and Safari right-click behavior #3192

Closed codebykat closed 1 month ago

codebykat commented 1 month ago

Fix

When testing the context menu fixes, I noticed that I wasn't able to display the right-click menu in Safari, though it worked in Electron and other browsers. It would flicker for a moment and then vanish again.

I don't have a real mouse and use ctrl+tap on my trackpad to right click. It turns out that this does not create a "true" right click event, and was therefore being erroneously picked up by the click and mousedown handlers.

In the process of fixing this I found a few opportunities to clean up the padding, though there is sadly no official way to add left/right padding via Monaco. I also tested and fixed the word-wrap setting in Safari in a separate PR, #3191 .

Test

In multiple browsers and on Electron:

n.b. We do not show the context menu after a right-click on the left gutter, because we are tricking Monaco into putting padding there by abusing the lineDecorationsWidth option.