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 | Enable input rules for specific formatting options #1549

Merged
merged 21 commits into from
Sep 21, 2023

Conversation

vivinkrishna-ni
Copy link
Contributor

@vivinkrishna-ni vivinkrishna-ni commented Sep 19, 2023

Pull Request

🤨 Rationale

Fixes Bug 2525772: Rich text editor | Markdown input for bold and italics are converting the text to its formatting

By default, Tiptap enables input rules for all formatting options such as bold, italics, bullet list, and numbered list. Typing the following tests will convert the plain text to formatted texts in the editor,

  1. For bold - **Bold** or __Bold__
  2. For Italics - *Italics* or _Italics_
  3. For bullet list - * or + or -
  4. For numbered list - 1. or any number with a period

This might create confusion for the user, as it raises the question of whether all markdown input into the editor will change the formatting. However, these input rules will not work if we enter ***Bold and Italics*** because the combination of marks is not supported in the Tiptap editor.

👩‍💻 Implementation

  1. Enabling input rules only for necessary formatting options such as a bullet list and a numbered list by passing the extensions as an array to enableInputRules while initializing the editor.
  2. Disabling paste rules for all formatting options by setting false to enablePasteRules while initializing the editor.

🧪 Testing

  1. Written unit tests to check if the input rules for bold and italics are rendered as plain text.
  2. Written unit tests to check if the input rules for bullet and numbered lists are rendered as lists as it was before.
  3. Written unit tests to check if the paste rules for all formatting options are rendered as plain text.

✅ Checklist

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

Co-authored-by: vikisekarNI <94439533+vikisekarNI@users.noreply.github.com>
@vivinkrishna-ni
Copy link
Contributor Author

@m-akinc Can we get a buddy review for this PR?

@vivinkrishna-ni vivinkrishna-ni marked this pull request as ready for review September 20, 2023 02:29
@vivinkrishna-ni vivinkrishna-ni marked this pull request as draft September 20, 2023 18:06
@vivinkrishna-ni vivinkrishna-ni marked this pull request as ready for review September 20, 2023 18:42
@rajsite rajsite merged commit 94188a3 into main Sep 21, 2023
9 checks passed
@rajsite rajsite deleted the users/vivin/disable-input-rules-for-marks branch September 21, 2023 12:45
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.

5 participants