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

Inline text filtering of mentions menu #4936

Merged

Conversation

skogsmaskin
Copy link
Member

@skogsmaskin skogsmaskin commented Sep 15, 2023

Description

This will build the mentions filter inside the actual text node of the editor.

Start with typing @ to activate the mentions menu, then type into the editor to do user filtering.

What to review

  • That the activation and deactivation of the mentions menu is working the way we want it to.
  • That it looks good (popover placement etc.)
  • Is adding the imperative handles the way to go to connect the MentionsMenu and context? Could the filtering be done directly into the provider? Especially, do we really need the added handle in CommandList?
  • That the changes for the Portable Text Editor module okay to do in this PR, or should be separated into their own PRs and reviewed as a separate concern?

@vercel
Copy link

vercel bot commented Sep 15, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
performance-studio ✅ Ready (Inspect) Visit Preview Sep 27, 2023 3:42pm
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 27, 2023 3:42pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Sep 27, 2023 3:42pm

@skogsmaskin skogsmaskin force-pushed the feat/comments-mvi-1-fix-mentions-menu branch from 347b3e2 to 519d6ad Compare September 15, 2023 11:51
@skogsmaskin skogsmaskin force-pushed the feat/comments-mvi-1-fix-mentions-menu branch from 519d6ad to f7f6b64 Compare September 15, 2023 11:54
@skogsmaskin skogsmaskin force-pushed the feat/comments-mvi-1-fix-mentions-menu branch from f7f6b64 to a766a38 Compare September 15, 2023 15:38
@skogsmaskin skogsmaskin force-pushed the feat/comments-mvi-1-fix-mentions-menu branch from a766a38 to 712f56d Compare September 18, 2023 12:50
@skogsmaskin skogsmaskin force-pushed the feat/comments-mvi-1-fix-mentions-menu branch 2 times, most recently from 712f56d to 7317290 Compare September 19, 2023 08:15
@skogsmaskin skogsmaskin force-pushed the feat/comments-mvi-1-fix-mentions-menu branch from 7317290 to 0873340 Compare September 26, 2023 13:05
@skogsmaskin skogsmaskin marked this pull request as ready for review September 26, 2023 13:06
@skogsmaskin skogsmaskin changed the title Feat/comments mvi 1 fix mentions menu Inline text filtering of mentions menu Sep 26, 2023
@github-actions
Copy link
Contributor

Package Documentation Change
sanity +1%
Full Report
sanity
This branch Next branch
111 documented 110 documented
855 not documented 834 not documented
@sanity/diff
This branch Next branch
13 documented 13 documented
16 not documented 16 not documented
@sanity/block-tools
This branch Next branch
4 documented 4 documented
9 not documented 9 not documented
@sanity/types
This branch Next branch
46 documented 46 documented
240 not documented 240 not documented
sanity/desk
This branch Next branch
83 documented 83 documented
54 not documented 54 not documented
@sanity/portable-text-editor
This branch Next branch
21 documented 21 documented
44 not documented 44 not documented
@sanity/mutator
This branch Next branch
7 documented 7 documented
4 not documented 4 not documented
@sanity/cli
This branch Next branch
1 documented 1 documented
30 not documented 30 not documented
@sanity/schema/_internal
This branch Next branch
0 documented 0 documented
9 not documented 9 not documented
@sanity/util/paths
This branch Next branch
1 documented 1 documented
15 not documented 15 not documented
sanity/router
This branch Next branch
15 documented 15 documented
21 not documented 21 not documented
@sanity/util/legacyDateFormat
This branch Next branch
0 documented 0 documented
3 not documented 3 not documented
@sanity/schema
This branch Next branch
0 documented 0 documented
2 not documented 2 not documented
sanity/cli
This branch Next branch
2 documented 2 documented
0 not documented 0 not documented
@sanity/vision
This branch Next branch
0 documented 0 documented
2 not documented 2 not documented
@sanity/util/fs
This branch Next branch
0 documented 0 documented
3 not documented 3 not documented
sanity/_internal
This branch Next branch
0 documented 0 documented
1 not documented 1 not documented
@sanity/util/content
This branch Next branch
1 documented 1 documented
5 not documented 5 not documented

@github-actions
Copy link
Contributor

github-actions bot commented Sep 26, 2023

Component Testing Report Updated Sep 27, 2023 3:46 PM (UTC)

File Status Duration Passed Skipped Failed
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 10s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 12s 3 0 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 13s 6 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 17s 9 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 58s 18 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 13s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 8s 3 0 0

Copy link
Member

@hermanwikner hermanwikner left a comment

Choose a reason for hiding this comment

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

Thank you, this is great 💯 I left a few minor comments, but otherwise I think this is good to go!

@@ -22,7 +24,7 @@ const EditableWrapStack = styled(Stack)(() => {
export const StyledPopover = styled(Popover)(() => {
return css`
// Position the Popover relative to the @
transform: translateX(6px); // todo: improve
transform: translate(6px, 6px); // todo: improve
Copy link
Member

Choose a reason for hiding this comment

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

Ideally we would configure this through a prop on the Popover component (offset), but @sanity/ui doesn't support this yet.

Copy link
Member

Choose a reason for hiding this comment

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

I'll look into this as a separate thing once this is merged

Copy link
Member

@sjelfull sjelfull left a comment

Choose a reason for hiding this comment

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

LGTM. Left a small comment about how we handle the popover offset. It's fine for now as long as we don't support it in @sanity/ui.

@skogsmaskin skogsmaskin force-pushed the feat/comments-mvi-1-fix-mentions-menu branch from cfe6c41 to 84b5cc2 Compare September 27, 2023 12:58
@skogsmaskin
Copy link
Member Author

I forced pushed a changed that gets rid of the selectCurrent imperative handle for the MentionsMenu. Works out of the box.

Make a explicit function to focus the editor at the end of the
edited comment content as focusEditor fn is now used internally
in the context provider.

Also simplify an effect that focuses the component this way.
@skogsmaskin skogsmaskin force-pushed the feat/comments-mvi-1-fix-mentions-menu branch from c01b264 to e543e5a Compare September 27, 2023 15:38
@skogsmaskin skogsmaskin merged commit ec15b9c into feat/comments-mvi-1 Sep 27, 2023
12 of 14 checks passed
@skogsmaskin skogsmaskin deleted the feat/comments-mvi-1-fix-mentions-menu branch September 27, 2023 15:44
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.

3 participants