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

Text replacement does not work #1890

Open
miguelcmedeiros opened this issue Mar 11, 2024 · 6 comments
Open

Text replacement does not work #1890

miguelcmedeiros opened this issue Mar 11, 2024 · 6 comments
Assignees
Labels
area_supereditor Pertains to SuperEditor area_supertextfield Pertains to SuperTextField awaiting-customer-feedback Waiting for the customer to respond to us bounty_junior f:superlist Funded by Superlist platform_mac Applies to use on Mac OS time: 5 type_bug Something isn't working

Comments

@miguelcmedeiros
Copy link
Collaborator

Package Version
main branch with commit hash 8a2a32f

To Reproduce

  1. Go to SuperEditor or SuperTextField demo
  2. On a new line type "omw"

Actual behavior
Nothing happens.

Expected behavior
Assuming that "omw" is configured to be replaced as "On my way!", then the following should be shown:
Screenshot 2024-03-11 at 13 08 44

Platform
All platforms.

Flutter version
Flutter master commit e278279a48f0479386c249cf18f26b29c6f9018f.

Additional context
It's possible to check which text replacements are configured on macOS here:
CleanShot 2023-08-17 at 13 02 51@2x

@miguelcmedeiros miguelcmedeiros added the type_bug Something isn't working label Mar 11, 2024
@miguelcmedeiros
Copy link
Collaborator Author

Cc @matthew-carroll

@matthew-carroll matthew-carroll added area_supereditor Pertains to SuperEditor area_supertextfield Pertains to SuperTextField platform_mac Applies to use on Mac OS bounty_junior f:superlist Funded by Superlist time: 5 labels Mar 11, 2024
@angelosilvestre
Copy link
Collaborator

@miguelcmedeiros I looked into this and it seems that the text input client doesn't call any callbacks when the user types a text that matches a configured replacement.

Even Flutter's TextField doesn't seem to support that. I filed flutter/flutter#145122

I'm not sure if there is some native API call for that, or if we need to query the configured replacements and implement the behavior ourselves.

@miguelcmedeiros
Copy link
Collaborator Author

@angelosilvestre I tried the sample app in DartPad: https://dartpad.dev/?sample=google-ai-sdk
It has a text field the text replacement worked fine there:

Screen.Recording.2024-03-19.at.18.11.47.mov

@angelosilvestre
Copy link
Collaborator

@miguelcmedeiros This seems to work on web only, it's the browser's hidden html input that makes it work.

If we run the example app on web it does show the popover, but selecting the value causes a crash and the text isn't replaced:

Screen.Recording.2024-03-19.at.20.48.27.mov

We can fix that, but it will still be an incomplete solution, because it will only work on web.

@cammcnab
Copy link

One minor detail is the same text replacements do work on iOS currently (in the Superlist app), likely because of the way the text suggestion bar above the keyboard handles replacements? 🤷‍♂️

@angelosilvestre
Copy link
Collaborator

@cammcnab Text replacement seems to work differently on iOS. On iOS, the IME generates the suggestions on the keyboard panel. On macOS, it seems the IME doesn't show automatically show the suggestion popover nor generate any signals for us to show a popover.

@angelosilvestre angelosilvestre added the awaiting-customer-feedback Waiting for the customer to respond to us label Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area_supereditor Pertains to SuperEditor area_supertextfield Pertains to SuperTextField awaiting-customer-feedback Waiting for the customer to respond to us bounty_junior f:superlist Funded by Superlist platform_mac Applies to use on Mac OS time: 5 type_bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants