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

Retain formats with empty contents #4126

Open
pat-son opened this issue Apr 18, 2024 · 1 comment
Open

Retain formats with empty contents #4126

pat-son opened this issue Apr 18, 2024 · 1 comment
Labels

Comments

@pat-son
Copy link

pat-son commented Apr 18, 2024

Feature request

There should be a way to retain inline formats when the editor is empty of any text. Currently, if you apply formats to text in an editor (such as bold or color), then delete all the text, you lose any formats and any new text you type is unstyled. In addition, if you apply a format to an empty editor, that format is immediately lost if you click out of the editor without typing any text.

Here's an example of the issue: demo link

In the demo, I apply bold and color formats to the editor, but don't also insert any text, and those formats aren't there when you type text into the editor.

Use case

We have text fields that use Quill for rich text editing, and the user is able to define template text fields that are initially empty but can be styled ahead of time. We have an internal JSON model that we map to a Quill Delta at runtime, and after initializing the Quill editor, we use setContents to update the editor to be in sync with our model.

Why this should be in Quill

We did manage to get something working by duplicating all inline formats to also be supported as block formats, but the work required to add and maintain that logic is not something that we want to support long term, and such a feature seems like it should be supported by default.

@pat-son
Copy link
Author

pat-son commented Apr 18, 2024

This is a new feature request after #3307 was closed by the bot.

@luin luin added the feature label Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants