Skip to content

Commit

Permalink
Add useLexicalEditable docstring back that got lost in the merge
Browse files Browse the repository at this point in the history
  • Loading branch information
etrepum committed May 16, 2024
1 parent e49b7c8 commit 3319e2b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/lexical-react/src/useLexicalEditable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ function subscription(editor: LexicalEditor): LexicalSubscription<boolean> {
};
}

/**
* Get the current value for {@link LexicalEditor.isEditable}
* using {@link useLexicalSubscription}.
* You should prefer this over manually observing the value with
* {@link LexicalEditor.registerEditableListener},
* which is a bit tricky to do correctly, particularly when using
* React StrictMode (the default for development) or concurrency.
*/
export function useLexicalEditable(): boolean {
return useLexicalSubscription(subscription);
}
Expand Down

0 comments on commit 3319e2b

Please sign in to comment.