cubing / cubing.js

🛠 A library for displaying and working with twisty puzzles. Also currently home to the code for Twizzle.
https://js.cubing.net/cubing/
GNU General Public License v3.0
232 stars 42 forks source link

[cubing.js issue] Support annoying single quote #285

Closed jgouly closed 10 months ago

jgouly commented 11 months ago

Steps to reproduce the issue

Lots of people post algs with ’ instead of '. This makes it impossible to paste into twizzle!

Observed behaviour

twizzle errors because it doesn't recognise ’

🖼 Screenshots

No response

Expected behaviour

Parse the alg as a '

Environment

None

Additional info

No response

lgarron commented 11 months ago

Based on previous discussions, I think I would be happiest with this compromise:

  1. Establish which quotes are actually common in the wild.
  2. Implement a paste listener in <twisty-alg-editor> and rewrite those quotes in non-comment parts of the pasted text.

I got stuck implementing this in https://github.com/cubing/cubing.js/compare/fix-quotes-on-paste but I'd love to see a PR that implements it reliably.

lgarron commented 11 months ago

I sunk an evening into this, and I think I finally have an implementation I'm okay with: https://github.com/cubing/cubing.js/commit/695d369e64d3e271ec8278fa3358ee922df3d75e

Going to leave this issue open for a bit while I shake out the edge cases that I haven't thought of yet.

lgarron commented 10 months ago

This has been stable enough — we can follow up in future issues.