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

Empty text node added when replacing the doc content with the new content #388

Open
Maryam-Yumna opened this issue Apr 11, 2023 Discussed in #387 · 2 comments
Open

Empty text node added when replacing the doc content with the new content #388

Maryam-Yumna opened this issue Apr 11, 2023 Discussed in #387 · 2 comments

Comments

@Maryam-Yumna
Copy link

Discussed in #387

Originally posted by Maryam-Yumna April 11, 2023
There's an extra empty text node added everytime i try to delete all the content in a shared type and insert new content

const versionContent = [
    {
        "type": "p",
        "id": 1681200966756,
        "children": [
            {
                "text": "hi"
            }
        ]
    }
]
sharedType.delete(0, sharedType.length);
const delta = slateNodesToInsertDelta(versionContent);
sharedType.applyDelta(delta);

//expected

 [
    {
        "type": "p",
        "id": 1681200966756,
        "children": [
            {
                "text": "hi"
            }
        ]
]

//result I get

[
    {
        "type": "p",
        "id": 1681200966756,
        "children": [
            {
                "text": "hi"
            }
        ]
    },
    {
        "type": "p",
        "children": [
            {
                "text": ""
            }
        ]
    }
]
```</div>
@BitPhinix
Copy link
Owner

Duplicate of #385

@BitPhinix BitPhinix marked this as a duplicate of #385 May 6, 2023
@BitPhinix
Copy link
Owner

BitPhinix commented May 6, 2023

Nvm, could you provide a repo with a reproduction case?

@BitPhinix BitPhinix reopened this May 6, 2023
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

2 participants