Delta error while inserting code block
Please describe the a concise description and fill out the details below. It will help others efficiently understand your request and get to an answer instead of repeated back and forth. Providing a minimal, complete and verifiable example will further increase your chances that someone can help.
Steps for Reproduction
-
Visit [quilljs.com, jsfiddle.net, codepen.io]
-
Step Two I created an initial example and wrote a number 1 into the content
-
Step Three I format the content as code block and listen to text change to obtain delta
-
Step Four I combined the initial delta with the changed delta to regenerate the content, and found that the editor did not show any code blocks
The delta obtained using the getContents method is
[
{
"insert": "1"
},
{
"attributes": {
"code-block": "plain"
},
"insert": "\n"
}
]
But the content I obtained by manually constructing delta is
{
"ops": [
{
"retain": 1
},
{
"retain": 1,
"attributes": {
"code-block": "plain"
}
}
]
}
Version: 2.0.2
Run Quill.version to find out
The same problem still appears in the list