Skip to content

Commit

Permalink
docs: loadContent clarification (#2989)
Browse files Browse the repository at this point in the history
  • Loading branch information
ly3xqhl8g9 committed Sep 12, 2022
1 parent fab31c9 commit 7e27e56
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/lexical-website/docs/concepts/editor-state.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@ to deserialize stringified editor states.
Here's an example of how you can initialize editor with some state and then persist it:

```js
// Create editor with initial state (e.g. loaded from backend)
// Get editor initial state (e.g. loaded from backend)
const loadContent = async () => {
// 'empty' editor
const value = '{"root":{"children":[{"children":[],"direction":null,"format":"","indent":0,"type":"paragraph","version":1}],"direction":null,"format":"","indent":0,"type":"root","version":1}}';

return value;
}

const initialEditorState = await loadContent();
const editor = createEditor(...);
registerRichText(editor, initialEditorState);
Expand Down

2 comments on commit 7e27e56

@vercel
Copy link

@vercel vercel bot commented on 7e27e56 Sep 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

lexical – ./packages/lexical-website

www.lexical.dev
lexical-fbopensource.vercel.app
lexical-git-main-fbopensource.vercel.app
lexicaljs.com
lexical.dev
lexicaljs.org

@vercel
Copy link

@vercel vercel bot commented on 7e27e56 Sep 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

lexical-playground – ./packages/lexical-playground

lexical-playground-fbopensource.vercel.app
lexical-playground-git-main-fbopensource.vercel.app
playground.lexical.dev
lexical-playground.vercel.app

Please sign in to comment.