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

feat(typography): allow overrides of inputRule outputs #4287

Merged
merged 1 commit into from
Aug 11, 2023

Conversation

bdbch
Copy link
Contributor

@bdbch bdbch commented Aug 4, 2023

Please describe your changes

This PR adds the option to replace the output of the inputRules used for the Typography extension.

With this PR users can now do something like this to add overrides to specific characters:

Typography.configure({
  oneHalf: "1 / 2", // this will insert "1 / 2" instead of the default "½"
})

How did you accomplish your changes

Instead of just passing static strings, I used callback functions that will return a new inputRule with said override (if it exists)

How have you tested your changes

I added a local test for my change which worked + I tried out the inputRule override manually.

How can we verify your changes

Check out this PR or go to the deployed demo and try out to replace -> to =====> on the TypographyWithOverrides demo page.

Remarks

/

Checklist

  • The changes are not breaking the editor
  • Added tests where possible
  • Followed the guidelines
  • Fixed linting issues

Related issues

closes #2598

@bdbch bdbch added Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Enhancement The issue or pullrequest is an enhancement to an existing feature labels Aug 4, 2023
@bdbch bdbch requested a review from svenadlung as a code owner August 4, 2023 23:30
@bdbch bdbch self-assigned this Aug 4, 2023
@netlify
Copy link

netlify bot commented Aug 4, 2023

Deploy Preview for tiptap-embed ready!

Name Link
🔨 Latest commit a5817cf
🔍 Latest deploy log https://app.netlify.com/sites/tiptap-embed/deploys/64cd8a08a012f000088b8d4e
😎 Deploy Preview https://deploy-preview-4287--tiptap-embed.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@bdbch bdbch merged commit 4fe87d3 into develop Aug 11, 2023
15 checks passed
@bdbch bdbch deleted the feature/typography-overrides branch August 11, 2023 03:30
@Haraldson
Copy link

Awesome work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Enhancement The issue or pullrequest is an enhancement to an existing feature
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Typography: Allow overriding replacements
2 participants