Skip to content

Looking for Suggestions - Need to Store JSON delta's with linebreak mid sentence as multiple delta's #105

@alilland

Description

@alilland

I've been using delta/quilljs for about 7 months now, so much of my application is leaning on it pretty heavily at this point.

I am working on a feature where I cannot have linebreaks mid word, i need them to be split out into multiple delta's

{
    "ops": [
        {
            "insert": "Abraham the Man of Faith"
        },
        {
            "attributes": {
                "header": 3
            },
            "insert": "\n"
        },
        {
            "insert": "In many ways, the Binding of Isaac in Genesis 22 is the climax of Abrahams life. It constitutes the greatest test and crescendo for Abraham (and "
        },
        {
            "attributes": {
                "italic": true
            },
            "insert": "Isaac"
        },
        {
            "insert": ").\n\nContext"
        },
        {
            "attributes": {
                "header": 4
            },
            "insert": "\n"
        },
        {
            "insert": "Abraham had two sons, Ishmael and Isaac - we know that it was because Abraham disbelieved God that he had Ishmael by means of Hagar, which was his wife Sarah's maidservant.\n\n"
        },
        {
            "insert": {
                "image": "https://api.steppingstonesintl.com/v1/images/59f38f96-c323-45b2-8ea8-326485d98d4f/binding-of-isaac.webp"
            }
        }
    ]
}

the following two delta's represent a header, and the ending of the sentence above the header

{
  "insert": ").\n\nContext"
},
{
  "attributes": {
      "header": 4
  },
"insert": "\n"
},

i need to re-parse my delta structure to ensure that the <h4>Context</h4> element is its own delta

anyone ever come across a library that does this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions