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

Add Link then Undo Leaves Behind Background Color Highlight #1096

Open
chadrschroeder opened this issue Oct 2, 2023 · 1 comment
Open

Add Link then Undo Leaves Behind Background Color Highlight #1096

chadrschroeder opened this issue Oct 2, 2023 · 1 comment

Comments

@chadrschroeder
Copy link

chadrschroeder commented Oct 2, 2023

  1. Select text.
  2. Click the link icon and apply a link.
  3. Click the undo button.

This leaves behind a span with background-color: highlight;. If you have a background color picker, that can be used to remove the color. Otherwise, you have to delete the selection and re-enter it to get the highlighting to go away.

When the editor opens a dialog it calls freezeSelection it uses the frozen attribute which uses a background color of highlight. When the dialog is recording the undo entry recordUndoEntry -> createEntry -> this.composition.getSnapshot() gets the current snapshot of the rich text which includes attributes that include "frozen": true.

Maybe getSnapshot should ignore the frozen attribute since that's an internal attribute that is only used to keep the selected text highlighted while the dialog is open?

One way to work around the issue is to disable the frozen attribute during the trix-before-initialize event with:

Trix.config.textAttributes.frozen = {}
Details
  • Trix version: 2.0.5
@moladukes
Copy link

How do you change this background color of the selection UI? I think it would be cleaner if it was wrapped in a tag which could be styled in CSS and is a bit more semantic.

Screenshot 2024-05-30 at 8 44 05 AM

Sorry if this is unrelated but found this issue trying to figure out how to change the style of it.

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