Module: @lexical/file
Interfaces
Functions
editorStateFromSerializedDocument
▸ editorStateFromSerializedDocument(editor
, maybeStringifiedDocument
): EditorState
Parse an EditorState from the given editor and document
Parameters
Name | Type | Description |
---|---|---|
editor | LexicalEditor | The lexical editor |
maybeStringifiedDocument | string | SerializedDocument | The contents of a .lexical file (as a JSON string, or already parsed) |
Returns
Defined in
packages/lexical-file/src/fileImportExport.ts:54
exportFile
▸ exportFile(editor
, config?
): void
Generates a .lexical file to be downloaded by the browser containing the current editor state.
Parameters
Name | Type | Description |
---|---|---|
editor | LexicalEditor | The lexical editor. |
config | Readonly <{ fileName? : string ; source? : string }> | An object that optionally contains fileName and source. fileName defaults to the current date (as a string) and source defaults to Lexical. |
Returns
void
Defined in
packages/lexical-file/src/fileImportExport.ts:105
importFile
▸ importFile(editor
): void
Takes a file and inputs its content into the editor state as an input field.
Parameters
Name | Type | Description |
---|---|---|
editor | LexicalEditor | The lexical editor. |
Returns
void
Defined in
packages/lexical-file/src/fileImportExport.ts:69
serializedDocumentFromEditorState
▸ serializedDocumentFromEditorState(editorState
, config?
): SerializedDocument
Generates a SerializedDocument from the given EditorState
Parameters
Name | Type | Description |
---|---|---|
editorState | EditorState | the EditorState to serialize |
config | Readonly <{ lastSaved? : number ; source? : string }> | An object that optionally contains source and lastSaved. source defaults to Lexical and lastSaved defaults to the current time in epoch milliseconds. |