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

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

Open
alilland opened this issue Aug 26, 2024 · 0 comments

Comments

@alilland
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant