Skip to content

Replace the doc content with the new content #320

Answered by BitPhinix
karthikcodes6 asked this question in Q&A
Discussion options

You must be logged in to vote

You do it in a pretty similar way using the slateNodesToInsertDelta helper:

provider.document.transact(() => {
  sharedType.delete(0, sharedType.length);
  const delta = slateNodesToInsertDelta([
    { type: 'paragraph', children: [{ text: 'Something' }] },
  ]);
  sharedType.applyDelta(delta);
});

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by BitPhinix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants