Open miguelcmedeiros opened 8 months ago
Cc @matthew-carroll
@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 https://github.com/flutter/flutter/issues/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.
@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:
https://github.com/superlistapp/super_editor/assets/31278849/e43e43f6-a246-4de7-bf19-840f5c3d17f7
@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:
https://github.com/superlistapp/super_editor/assets/7597082/40f7c7f5-6a0a-4516-b390-4dfd3a8c035a
We can fix that, but it will still be an incomplete solution, because it will only work on web.
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? 🤷♂️
@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.
Package Version
main
branch with commit hash https://github.com/superlistapp/super_editor/commit/8a2a32fc2611f91de8834101f00d571845554b9bTo Reproduce
Actual behavior Nothing happens.
Expected behavior Assuming that "omw" is configured to be replaced as "On my way!", then the following should be shown:
Platform All platforms.
Flutter version Flutter master commit e278279a48f0479386c249cf18f26b29c6f9018f.
Additional context It's possible to check which text replacements are configured on macOS here: