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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow individual Typography rules to be disabled #2449

Merged
merged 1 commit into from
Feb 4, 2022
Merged

Allow individual Typography rules to be disabled #2449

merged 1 commit into from
Feb 4, 2022

Conversation

rfgamaral
Copy link
Contributor

@rfgamaral rfgamaral commented Jan 27, 2022

The Typography extension is a great extension, but it's not very customizable. It's all or nothing for the included input rules, and this doesn't really work for us. We want some rules enabled, but all of them. I thought it would be nice if the extension could be fully configurable, allowing one to disable specific rules if one desires.

Hopefully this is something you agree with including in the official extension, otherwise we'll have to maintain our own version of this. Which is not a big deal, but it would be awesome if this could be integrated 馃榾

@netlify
Copy link

netlify bot commented Jan 27, 2022

鉁旓笍 Deploy Preview for tiptap-embed ready!

馃敤 Explore the source changes: 574ed26

馃攳 Inspect the deploy log: https://app.netlify.com/sites/tiptap-embed/deploys/61f3011698ef2c0008f5789f

馃槑 Browse the preview: https://deploy-preview-2449--tiptap-embed.netlify.app

Comment on lines +3 to +26
export interface TypographyOptions {
emDash: false,
ellipsis: false,
openDoubleQuote: false,
closeDoubleQuote: false,
openSingleQuote: false,
closeSingleQuote: false,
leftArrow: false,
rightArrow: false,
copyright: false,
trademark: false,
registeredTrademark: false,
oneHalf: false,
plusMinus: false,
notEqual: false,
laquo: false,
raquo: false,
multiplication: false,
superscriptTwo: false,
superscriptThree: false,
oneQuarter: false,
threeQuarters: false,
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be boolean, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I followed the same approach used in StarterKit, where all rules are included by default and you can only disable the ones you don't want.

I can change this to boolean if you think that makes more sense. Let me know, and I'll make the change.

Comment on lines 133 to 135
name: 'typography',

addInputRules() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should also define addOptions() with its default values here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we keep the current approach where the options can only be set to false, I believe we don't need addOptions. Again, followed the exact same approach as StarterKit to keep things simple. But I can change to boolean and add addOptions with default set to true.

@philippkuehn philippkuehn merged commit 7ce6687 into ueberdosis:main Feb 4, 2022
@philippkuehn
Copy link
Contributor

Thanks!

@rfgamaral rfgamaral deleted the feature/typography-options branch February 4, 2022 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants