@lexical/file
Interfaces
SerializedDocument
Defined in: packages/lexical-file/src/fileImportExport.ts:15
Properties
editorState
editorState:
SerializedEditorState
Defined in: packages/lexical-file/src/fileImportExport.ts:17
The serialized editorState produced by editorState.toJSON()
lastSaved
lastSaved:
number
Defined in: packages/lexical-file/src/fileImportExport.ts:19
The time this document was created in epoch milliseconds (Date.now())
source
source:
string
Defined in: packages/lexical-file/src/fileImportExport.ts:21
The source of the document, defaults to Lexical
version
version:
string
Defined in: packages/lexical-file/src/fileImportExport.ts:23
The version of Lexical that produced this document
Functions
editorStateFromSerializedDocument()
editorStateFromSerializedDocument(
editor
,maybeStringifiedDocument
):EditorState
Defined in: packages/lexical-file/src/fileImportExport.ts:54
Parse an EditorState from the given editor and document
Parameters
editor
The lexical editor
maybeStringifiedDocument
The contents of a .lexical file (as a JSON string, or already parsed)
string
| SerializedDocument
Returns
exportFile()
exportFile(
editor
,config
):void
Defined in: packages/lexical-file/src/fileImportExport.ts:105
Generates a .lexical file to be downloaded by the browser containing the current editor state.
Parameters
editor
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
importFile()
importFile(
editor
):void
Defined in: packages/lexical-file/src/fileImportExport.ts:69
Takes a file and inputs its content into the editor state as an input field.
Parameters
editor
The lexical editor.
Returns
void
serializedDocumentFromEditorState()
serializedDocumentFromEditorState(
editorState
,config
):SerializedDocument
Defined in: packages/lexical-file/src/fileImportExport.ts:33
Generates a SerializedDocument from the given EditorState
Parameters
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.