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(core): added new options for nodeInputRules for block replacements #4289

Merged
merged 1 commit into from
Aug 10, 2023

Conversation

bdbch
Copy link
Member

@bdbch bdbch commented Aug 5, 2023

Please describe your changes

This PR adds two new options to the nodeInputRule function that help with nodeInput replacements. By default, nodeInputRules always try to replace into the current content which caused that extra <p> in front of the new <hr> because HR's can't be inserted into <p> tags and Prosemirror doing it's Schema magic moved the hr below the paragraph.

This change adds the following options:

blockReplace
Optional option which will replace the current node instead of inserting into it when set to true

addExtraNewline
Adds a new line with the schema's default node for the parent wrapper. (For example in doc that would be a paragraph).

How did you accomplish your changes

add those options to the nodeInputRule function.

How have you tested your changes

  • Tested non-block replacements and block replacements
  • Compared behavior with the setHorizontalRule function

How can we verify your changes

Test in the deployed demo

Remarks

Nothing really - should not change behavior for inputRules not using those options

Checklist

  • The changes are not breaking the editor
  • Followed the guidelines
  • Fixed linting issues

Related issues

fixes #1964
fixes #3809
fixes #1665

@bdbch bdbch requested a review from svenadlung as a code owner August 5, 2023 10:18
@bdbch bdbch self-assigned this Aug 5, 2023
@bdbch bdbch added Type: Feature The issue or pullrequest is a new feature Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. labels Aug 5, 2023
@netlify
Copy link

netlify bot commented Aug 5, 2023

Deploy Preview for tiptap-embed ready!

Name Link
🔨 Latest commit 8e4305f
🔍 Latest deploy log https://app.netlify.com/sites/tiptap-embed/deploys/64ce21e4d8fb100008ef5a96
😎 Deploy Preview https://deploy-preview-4289--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 a922f09 into develop Aug 10, 2023
@bdbch bdbch deleted the fix/hr-consistency branch August 10, 2023 23:45
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: Feature The issue or pullrequest is a new feature
Projects
No open projects
Archived in project
1 participant