PrivateconstructorCreates a new LexicalDocument instance.
Document URI
Initial document content as binary data
Delegate for webview interactions
Private Readonly_Protected_Collection of child disposables to clean up
Private_Private_Private_Private Readonly_Private Readonly_Private Readonly_Private Readonly_ReadonlyonReadonlyonReadonlyonCurrent document content as binary data.
Binary representation of the document content
Whether the document has unsaved changes.
In collaborative mode, this always returns false since changes are automatically synchronized to the platform.
True if document has unsaved changes, false otherwise
ProtectedisGets whether this instance has been disposed.
True if disposed, false otherwise
The document's URI.
The VS Code URI for this document
Protected_Creates a backup of the document.
Saves the current document state to a backup location and returns a backup descriptor that can be used for restoration.
URI for the backup location
Cancellation token for the operation
Promise resolving to backup descriptor
Disposes of the document and cleans up resources.
Fires disposal events and calls the parent disposable cleanup. Should be called when the document is no longer needed.
Records an edit operation on the document.
In non-collaborative mode, marks the document as dirty and fires change events. In collaborative mode, only fires change events since the document state is managed externally.
The edit operation (currently unused)
Reverts the document to its last saved state.
Reloads content from disk, clears the dirty state, and notifies listeners of the content change.
Cancellation token (currently unused)
Saves the document to its original location.
In collaborative mode, this operation is a no-op since changes are automatically synchronized. Otherwise, retrieves current content from the webview and writes it to the file system.
Cancellation token for the operation
Saves the document to a new location.
Retrieves current content from the webview and writes it to the specified target location. Does not change the document's original URI.
URI where to save the document
Cancellation token for the operation
Sets the collaborative mode for this document.
When collaborative mode is enabled, the document becomes read-only and changes are automatically synchronized to the Datalayer platform. The dirty state is cleared when entering collaborative mode.
Whether to enable collaborative mode
StaticcreateCreates a new LexicalDocument instance from a URI.
Handles both regular files and backup scenarios. For backup restoration, the backupId parameter should contain the backup file URI.
The document URI to open
Optional backup ID for document restoration
Delegate for webview content retrieval
Promise resolving to the created document instance
Private StaticgetPrivate StaticreadPrivate Staticread
Represents a lexical document in VS Code custom editor. Manages document lifecycle, content state, and collaboration features.
This class implements the VS Code CustomDocument interface to provide document management for Datalayer's lexical editor integration.
Example