Add toggleLintPanel to alternate state. #15

Closed
gburtini wants to merge 1 commit from gburtini/add-toggle-export into main
gburtini commented 2023-07-18 20:16:46 +02:00 (Migrated from github.com)

openLintPanel and closeLintPanel do not seem to provide any indicator of whether the lint panel is open.

I considered trying to export some of the state fields themselves, so a consumer of the API could query, say, getPanel(view, LintPanel.open), but my actual use case only requires a toggle method and the encapsulation seems simpler this way.

This may not be quite as you intend, especially with respect to returning the handled boolean, but I'm happy to shepherd it until it is appropriate. If you'd prefer I try to export some useful state instead, I'm happy to go about that.

`openLintPanel` and `closeLintPanel` do not seem to provide any indicator of whether the lint panel is open. I considered trying to export some of the state fields themselves, so a consumer of the API could query, say, `getPanel(view, LintPanel.open)`, but my actual use case only requires a toggle method and the encapsulation seems simpler this way. This may not be quite as you intend, especially with respect to returning the handled boolean, but I'm happy to shepherd it until it is appropriate. If you'd prefer I try to export some useful state instead, I'm happy to go about that.
marijnh commented 2023-07-20 18:21:30 +02:00 (Migrated from github.com)

You can implement this without modifying the library as toggleLintPanel = view => closeLintPanel(view) || openLintPanel(view)

You can implement this without modifying the library as `toggleLintPanel = view => closeLintPanel(view) || openLintPanel(view)`

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
codemirror/lint!15
No description provided.