-
-
Notifications
You must be signed in to change notification settings - Fork 71
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
Dynamic Text Insertion and Deletion #252
Comments
Hi, Thanks for the detailed suggestions. |
Hi, Thank you for considering of this feature in the next release! In the meantime, I was wondering if you could share an estimated release date for the next version? Having a rough timeline would help me plan my implementation accordingly. Additionally, while awaiting the official implementation, do you have any suggestions for alternative methods to observe the '@' character in the text editor? I'd appreciate any guidance or workaround you might have in mind. Thank you once again for your attention to this matter. |
Hopefully at the end of this week or the next week. LaunchedEffect(state.selection, state.annotatedString) {
// Use the current text and the cursor position to look for the first @ char before the cursor and then you can get the data that you want.
} |
Yes by your given suggestion I am able to observe text, but same way I want to observe that text is getting deleted because in mine case I want to hide Mention popup once someone is deleting @ from Editor. Can you suggest me something. |
Yes I think that you can do it with the same approach. I would suggest saving the @ index when it gets added to distinguish between multiple mentions. So let's say that you detected that there's an @ before the cursor, save that position when you open the popup, then if the cursor position is lower than the saved mention position, you hide the popup. |
I feel storing index of @ will be costly operation because any time user can change anything from contain I have to keep updating my @ index also. |
You can save it when you open the popup, just with the action of opening the popup. Then if the popup is opened and the cursor position is lower than the @ position, you can close the popup. |
yes that might be easier solution. Thanks |
@MohamedRejeb this feature you are releasing it in this week Right ? |
@MohamedRejeb I tried doing this by using Visual Transformation but got nowhere. The offset mapping usually results in regression. Plus deleting items completely screws up spans. There is no span listener in normal textFields. I have searched everywhere, there does not seem to be any working solution for compose anywhere |
Hi, |
https://github.com/linkedin/Spyglass This is already implemented for EditTexts. If you want to have a look at the API design. |
@MohamedRejeb Any timeline on this feature? It is highly requested by compose users and I don't think there is an existing solution |
I am working on implementing an @mention feature in a text editor and I have a few specific requirements and questions about handling user interactions and text manipulation:
Dynamic Text Appending: When a user selects a username from a popup after typing '@', how can I dynamically append the selected username into the text editor at the cursor's current position?
Detecting '@' in Text Editor: What method can I use to detect when a user types the '@' character, so that I can trigger the username suggestion popup?
Efficient Text Deletion: Is there a way to delete the entire username in one action (e.g., pressing backspace) instead of deleting character by character? I'd like to enhance the user experience by allowing for easier editing of mentions.
I am looking for suggestions or advice on how to implement these functionalities effectively, possibly with code examples or references to documentation. Any help would be greatly appreciated!
Thank you in advance for your assistance!
The text was updated successfully, but these errors were encountered: