BitPhinix / slate-yjs

Yjs binding for Slate
https://docs.slate-yjs.dev
MIT License
514 stars 73 forks source link

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

Open Maryam-Yumna opened 1 year ago

Maryam-Yumna commented 1 year ago

Discussed in https://github.com/BitPhinix/slate-yjs/discussions/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": "" } ] } ] ```
BitPhinix commented 1 year ago

Duplicate of https://github.com/BitPhinix/slate-yjs/issues/385

BitPhinix commented 1 year ago

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