Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not create typography fractions mid-word? #3674

Closed
1 task done
georgemandis opened this issue Jan 30, 2023 · 1 comment · Fixed by #3762
Closed
1 task done

Not create typography fractions mid-word? #3674

georgemandis opened this issue Jan 30, 2023 · 1 comment · Fixed by #3762
Assignees
Labels
Type: Feature The issue or pullrequest is a new feature

Comments

@georgemandis
Copy link
Contributor

What problem are you facing?

The TipTap Typography extension will auto-convert fractions into single-character entities:

  • 1/2 → ½
  • 1/4 → ¼

This is sometimes convenient, but it's very inconvient when these shortcuts are triggered in the middle of a word.

Here is a video demonstrating how it inserts itself when typing a date:

Screen.Recording.2023-01-30.at.9.55.20.AM.mov

What’s the solution you would like to see?

I would like to see these shortcuts triggered only when they are initiated at the beginning of a word-break and not when they occur within the middle of a word.

What alternatives did you consider?

I considered overriding and amending the regex myself, but thought it would be faster and more effective if this were the default behavior. It feels sensible?

The regex would have to be something like this I think:

/(^|\s)(1\/2)$/

Could we do that for fractions... and possibly most of the shortcuts?

Anything to add? (optional)

No response

Are you sponsoring us?

  • Yes, I’m a sponsor. 💖
@georgemandis georgemandis added the Type: Feature The issue or pullrequest is a new feature label Jan 30, 2023
@bdbch bdbch self-assigned this Jan 30, 2023
@bdbch bdbch added this to the 2.0.0 milestone Jan 30, 2023
@bdbch
Copy link
Contributor

bdbch commented Jan 30, 2023

Hey @georgemandis good find! I'll see if I can take a quick look after I'm done with my current PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature The issue or pullrequest is a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants