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

fix(designer-ui): Remove problematic call to setIsValuePlaintext #4979

Merged
merged 3 commits into from
Jun 14, 2024

Conversation

ek68794998
Copy link
Contributor

@ek68794998 ek68794998 commented Jun 14, 2024

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes/features)
  • Docs have been added / updated (for bug fixes / features)

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

Bug fix

What is the current behavior? (You can also link to an open issue here)

If you paste or type some HTML into the rich text editor which is not considered Lexical-safe, the HTML editor assumes that this is unsafe and forces the editor to switch to the code view (plaintext editor).

This is problematic from a technical point of view because it causes the editor to be deleted and recreated (firing blur events, re-renders, etc.), but also from a user point of view because it switches the user into the other mode without them being aware of it.

What is the new behavior (if this is a feature change)?

As it turns out, the above behavior is actually completely unneeded.

  • If you are typing in the rich text editor, everything you type should be Lexical-safe; that is, typing HTML there is not actually HTML, it's just plaintext (i.e., typing <div> is actually &lt;div&gt;). So, it's Lexical-safe and we don't need to force you to the code view.
  • If you are typing in the code view, you are... already in the code view, so we don't need to force you to the code view.

Therefore, the new behavior is that we don't check whether to forcibly switch the user to code view when new text is entered. The behavior that remains is whether the button to switch from code view to rich text view is enabled.

Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

No

Please Include Screenshots or Videos of the intended change:

Before

no-set-broken

After

no-set-working

@ek68794998 ek68794998 marked this pull request as ready for review June 14, 2024 00:41
Copy link
Contributor

@hartra344 hartra344 left a comment

Choose a reason for hiding this comment

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

If you get a chance, can you please work with @Eric-B-Wu and the 2 of you get some end to end tests on this component? I feel like it has a lot of flake and constant changes and it does seem like it may be difficult to unit test, though that would also be nice.

@ek68794998
Copy link
Contributor Author

If you get a chance, can you please work with @Eric-B-Wu and the 2 of you get some end to end tests on this component? I feel like it has a lot of flake and constant changes and it does seem like it may be difficult to unit test, though that would also be nice.

Yes, for sure. There are a lot of unit tests on the parts that can be unit tested, but so much of it is built around the UI that it needs E2E for true coverage. I'll sync with him when he's around so we can figure out a plan.

@ek68794998 ek68794998 merged commit 7ded280 into Azure:main Jun 14, 2024
12 checks passed
@ek68794998 ek68794998 deleted the ek/dont-call-set branch June 14, 2024 01:06
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.

2 participants