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

fix: correctly format suggestions by mentions when submitted #2927

Draft
wants to merge 1 commit into
base: release-139
Choose a base branch
from

Conversation

cuserox
Copy link
Contributor

@cuserox cuserox commented Jun 27, 2024

Why does this PR exist?

Closes #2902

A previous fix to prevent trailing whitespace being added, had made the Mentions component misbehave. Inserting extra curly brackets at random spots when searching.

What does this pull request do?

  • Removes the trim prop in favour of trimming the raw value

Testing this change

Before After
https://github.com/tokens-studio/figma-plugin/assets/114073780/c1bde474-834c-4b70-b6a7-171d04ebd27c https://github.com/tokens-studio/figma-plugin/assets/114073780/893fae55-d55c-4add-ace7-56ddb4ceced1

Additional Notes (if any)

✨ 👀 Extra improvement: when typing in a search, ensure that if there is a full match, it is highlighted. Perhaps adding a custom filterOption prop to the Mentions component?

At the moment, even if there is a full match (i.e. colors.blue.500), the first one on the list is highlighted and submitted when pressing Enter:
Screenshot 2024-06-27 at 17 53 57

Copy link

changeset-bot bot commented Jun 27, 2024

⚠️ No Changeset found

Latest commit: e381c95

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Collaborator

@six7 six7 left a comment

Choose a reason for hiding this comment

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

Tested out the implementation and it has 2 major flaws:

  • Cannot type space anymore
  • The logic automatically adds a space between two token references. This isnt great because users might rely on their values being joined together.
CleanShot.2024-06-28.at.08.25.13.mp4

@cuserox cuserox force-pushed the fix/2902-correctly-format-suggestions-by-mentions branch from 89de19b to 20cf690 Compare July 2, 2024 09:59
@cuserox cuserox force-pushed the fix/2902-correctly-format-suggestions-by-mentions branch from 20cf690 to e381c95 Compare July 2, 2024 11:32
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