About This Article
This article was created using an automated generation workflow leveraging generative AI. Official documentation and fixed learning materials were reviewed to organize operational and technical constraints.Verification Status: 📘 Official Information and Implementation Matching. Actual browser testing not performed.
Applying bold formatting to a portion of text changes not only its appearance but also its underlying data. We will observe how the styled range is recorded.
- Key Terms to Know First
- Thinking with a Processing Flowchart
- Operating the Live Demo
- Key Code Points
- When Using in Production
- Compare the data before and after applying bold formatting
- Difference between the Entire Document and Modification Operations
- Consider Saving for Re-editing
- Verify Display and Security
- Verification Scope
- References
- GitHub sample
Key Terms to Know First
Rich textis text that includes formatting.
Deltais the format Quill uses to represent text and formatting.
Thinking with a Processing Flowchart
Read from left to right. Anticipate how changes to the "bold range" affect the "Delta".
flowchart LR
A["入力した文"] --> B["太字の範囲"] --> C["Delta"]
Operating the Live Demo
Select characters and make them bold. Look for attributes in the output.
How to Read the Results
Attributes are assigned to the bold section. The final newline is also recorded.
Applying bold to only a portion splits the text into formatted and unformatted segments. The output of getContents represents the entire document rather than a history of modification operations. The trailing newline is also interpreted as part of the document structure.
Key Code Points
Display the value of getContents() in JSON format and compare the state before and after formatting.
The implementation can be viewed in the Implementation Code section of the demo screen.
When Using in Production
When deciding on the output format, also consider the requirements for resuming editing later.
Compare the data before and after applying bold formatting
The initial value is the verification result. Upon execution, the editor and the bold button are expected to appear. First, read the JSON in the result section without applying any formatting. Next, select the two characters for verification and click the bold button. Compare both the font weight on the screen and the attributes appearing in the result section. Also, confirm that the latter characters, representing the result, are not bolded. When changing the selection range, observe how the internal data interval changes.
For example, if you simplify the document before and after formatting, you can assume the following structure. The actual display may vary depending on how Quill handles operations.
{"ops":[{"insert":"確認結果\n"}]}
{"ops":[{"insert":"確認","attributes":{"bold":true}},{"insert":"結果\n"}]}
In this example, the string is the same, but formatting attributes have been added to the first half. You can confirm not just the visual appearance, but also the data indicating which characters have which formatting set. Clicking bold without making a selection may change the format of the characters you type next. If you want to compare existing characters, select the target text before performing the operation.
Difference between the Entire Document and Modification Operations
A Delta is a format that represents document content and changes. When representing the entire document, content can be described as a sequence of inserts, and when representing changes, operations such as retain or delete may be used. This demo calls getContents when the text-change event occurs. Therefore, what is displayed on the screen is the entire document at that moment, not just the changes passed as event arguments. Understanding this distinction makes it easier to avoid confusing saved data with the operation history.
Quill documents end with a newline. Because the format of an entire line can be associated with a newline, do not treat the final character as unnecessary data and delete it. This toolbar only provides bold formatting. This is not learning material that executes and verifies heading or link formatting, or image embedding.
Consider Saving for Re-editing
When incorporating rich text into a business form, decide whether to save only the HTML visible on the screen or the editing structure as well. If re-editing is anticipated, you can record the Delta, the library version used, and the allowed formatting. Converting to plain text removes formatting information such as bolding. Conversely, simply saving the display HTML may not fully restore the original editing structure. Choose the format according to the required features.
A mechanism for multiple users to co-edit or undo history is not automatically completed simply by using the document data format. This demo only displays input content, and there is no server persistence processing or collaborative editing. Recreating the editor field using the execution button will cause the previous state to be lost. Record the content you want to keep beforehand.
Verify Display and Security
If the initial value does not appear in the editor field, check the acquisition of Quill modules and CSS. If the result does not change even after selecting text and clicking bold, verify the target range and the occurrence of text-change. Try the same operation with a different input string. When converting a saved Delta to production HTML, separately design external input links, embeddings, and HTML sanitization. Security is not guaranteed simply because the data is in JSON format.
Use fictitious short text for public demos, and do not paste internal reports or personal information. To separate the roles of input, formatting, and saving, confirm visual changes and data changes as a pair.
Verification Scope
Material target: Quill 2.0.3. Static verification of fixed HTML setText, getContents, text-change, and the bold toolbar against official Delta documentation (2.0.3). Quill core, selection operations, and DOM display are not executed. External CDN acquisition, fixed-version licensing, actual browser rendering, and Mermaid rendering are unverified.
References
Official documentation(Confirmed on November 30, 2026)
