quill icon indicating copy to clipboard operation
quill copied to clipboard

Delta error while inserting code block

Open willjayyyy opened this issue 1 year ago • 1 comments

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

  1. Visit [quilljs.com, jsfiddle.net, codepen.io]

  2. Step Two I created an initial example and wrote a number 1 into the content image

  3. Step Three I format the content as code block and listen to text change to obtain delta image image

  4. 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 image

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

willjayyyy avatar Jun 13 '24 02:06 willjayyyy

The same problem still appears in the list

willjayyyy avatar Jun 13 '24 02:06 willjayyyy