fix: BlockNoteViewEditor mismatched editable value
#2357
+22
−31
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
When using
BlockNoteViewEditorand settingrenderEditor={false}inBlockNoteViewComponent, you currently have to pass the sameeditableprop to both, or it causes issues.Because it doesn't make sense to need to pass the same
editableprop to 2 different components in the first place, this PR removes the prop fromBlockNoteViewEditor. Instead, the editable value is passed in through theBlockNoteContextto ensure it's the same between the components.Rationale
There is currently an issue with the comments sidebar example caused by this mismatch in editable states, as the prop is passed to
BlockNoteViewComponentbut notBlockNoteViewEditor.This makes the editor not focusable while the user selected has only comment priviledges and
editableisfalse. That, in turn, prevents the editor from being focusable, meaning the formatting toolbar can't be shown, and so the user can't add comments.Changes
See above
Impact
Testing
Technically a breaking change since
BlockNoteViewEditorno longer supports theeditableprop? Shouldn't really matter though.Screenshots/Video
N/A
Checklist
Additional Notes