Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Simplify state machine implementation of prosemirror prompt input #7154

Merged
merged 1 commit into from
Feb 21, 2025

Conversation

fkling
Copy link
Contributor

@fkling fkling commented Feb 20, 2025

In this PR I'm reducing the API surface of the state machine and move most of the events related to
value and mentions changes out of it. Hopefully this makes the state machine easier to understand
and to work with.

Now the state machine exposes an document.update event whose payload is a function that gets passed
the current editor state and returns a transaction. Note however that these changes actions are still
tested toghether with the state machine in promptInput.test.ts. I think it's important to have one
place to test all the expected behavior of the prompt input.

The main reason behind this change is that the current implementation is very much driven by the current
API the PromptInput component exposes. But going forward we might change/reduce/expand this API.
Ideally the state machine won't have to be changed for that.

In an upcoming PR I plan to refactor the mentions menu implementation to be more generic to better
support menu items that are not ContextItems.

Test plan

Unit test

@fkling
Copy link
Contributor Author

fkling commented Feb 20, 2025

This change is part of the following stack:

Change managed by git-spice.

@fkling fkling requested a review from thenamankumar February 20, 2025 07:16
@fkling fkling self-assigned this Feb 20, 2025
Copy link
Member

@thenamankumar thenamankumar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fkling fkling merged commit c4d3516 into main Feb 21, 2025
21 checks passed
@fkling fkling deleted the fkling/refactor-prosemirror-implementation branch February 21, 2025 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants