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

Rich Text Editor | Added HardBreak extension in editor for force line break (<br> tag) #1517

Merged
merged 19 commits into from
Sep 15, 2023

Conversation

aagash-ni
Copy link
Contributor

@aagash-ni aagash-ni commented Sep 12, 2023

Pull Request

🤨 Rationale

Fix for Bug 2516897: Switching to a new line by pressing enter adds more spaces than expected.

  • Pressing enter in the editor for a new line adds a Paragraph tag which has more space than expected between lines.
  • Enabling HardBreak will allow the user to switch to a new line by pressing Shift/Ctrl/Cmd + Enter which will make minimal space between lines by adding <br> tag instead of Paragraph Tag.

👩‍💻 Implementation

  • Added HardBreak node in Tiptap Editor.
  • Enabled newline and escape rules in MarkdownIt for RichTextMarkdownParser to parse the HardBreak markdown syntax as per CommonMark Spec to <br> tag.
  • Added hardBreak node to RichTextMarkdownSerializer to serialize the <br> tag to respective hard break markdown syntax.
  • As we are using prosemirror-markdown, it serializes the <br> tag to backslash with line ending syntax as per the CommonMark Spec example 633.

In Windows Shift/Ctrl+ Enter and in Mac Cmd + Enter will switch to a new line (line break).

We are not exposing any format buttons to add line breaks (Hard Break), The only way to break the line is by using the Keys mentioned above.

🧪 Testing

  • Added unit tests and visual tests for the functionality.
  • Manually tested and verified the functionality of the supported features in Storybook build.

✅ Checklist

  • I have updated the project documentation to reflect my changes or determined no changes are needed.

@aagash-ni aagash-ni marked this pull request as ready for review September 13, 2023 13:41
@aagash-ni aagash-ni requested a review from m-akinc September 13, 2023 13:41
@m-akinc m-akinc marked this pull request as draft September 13, 2023 19:52
@m-akinc
Copy link
Contributor

m-akinc commented Sep 13, 2023

As a reminder, please create the PR in draft mode and let a buddy (me) review before publishing and adding owners.

@aagash-ni aagash-ni marked this pull request as ready for review September 14, 2023 12:44
@atmgrifter00
Copy link
Contributor

You can bypass me for this review.

Copy link
Member

@rajsite rajsite left a comment

Choose a reason for hiding this comment

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

Waiting to see results of test changes

@aagash-ni
Copy link
Contributor Author

aagash-ni commented Sep 15, 2023

Waiting to see results of test changes

Hi @rajsite , I hope you are waiting for Mert's test change comments to be addressed, please let us know if you have any other concerns. I have addressed all the comments that Mert mentioned.

@aagash-ni aagash-ni requested a review from rajsite September 15, 2023 10:36
@rajsite
Copy link
Member

rajsite commented Sep 15, 2023

Can bypass @mollykreis and @atmgrifter00, so ready to merge!

@rajsite rajsite enabled auto-merge (squash) September 15, 2023 20:38
@rajsite rajsite merged commit 129af80 into main Sep 15, 2023
@rajsite rajsite deleted the users/aagash/editor-newline-spacing branch September 15, 2023 20:57
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.

6 participants