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

Highlighting a piece of text and typing over it/replacing it doesn't maintain the text's formatting treatments. #2862

Open
bateau opened this issue Nov 4, 2024 · 1 comment

Comments

@bateau
Copy link
Member

bateau commented Nov 4, 2024

Describe the bug
For example, if you type over "A" in situation like this:
Image

New text will be blue and bold rather than black and normal. I can repro this in rooster demo site with attached HTML

To Reproduce
Steps to reproduce the behavior:

  1. Load the attached HTML file into demo site foo.txt
  2. Locate text "What is it?" with bold like image above. Select text after it that's not bold and type something to replace it.

Expected behavior
New text should be plain, like the original, not bold and blue like preceding text.

Screenshots
If applicable, add screenshots to help explain your problem.

Device Information

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@JiuqingSong
Copy link
Collaborator

JiuqingSong commented Nov 14, 2024

Thanks. Minimum repro:

<div><span style="color: rgb(12, 100, 192);"><b>What is it? </b></span><span style="font-size: 14.6667px; background-color: rgb(255, 255, 255);">A</span></div><!--{"type":"range","start":[0,1,0,0],"end":[0,1,0,1],"isReverted":true,"isDarkMode":false}-->

It is because we first delete selected content, then let browser handle the input. If the content before selection has different format, this can happen. Maybe we need to place a ZeroWidthSpace to replace the selection instead of just a selection marker after delete. I need to try it

JiuqingSong added a commit that referenced this issue Nov 14, 2024
JiuqingSong added a commit that referenced this issue Nov 16, 2024
JiuqingSong added a commit that referenced this issue Nov 21, 2024
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

No branches or pull requests

2 participants