konecny-ondrej / compose-markdown-editor

Wysiwyg Markdown editor component for Compose Multiplatform and components to build similar editors.
MIT License
6 stars 0 forks source link

Support for @mentions with dropdown support and replacement #1

Closed LaatonWalaBhoot closed 1 month ago

LaatonWalaBhoot commented 3 months ago

@konecny-ondrej Apologies since this is more of a discussion than issue. Since its not mentioned in the readme. Does this library support @mentions support for adding and removing MentionSpans while typing in TextField? Congratulations on some great work!

PS: Does this have iOS support?

konecny-ondrej commented 3 months ago

I have enabled Discussions so the next suggestion can be discussed there. Anyway this lib does not use TextField at all, all the text is rendered as InteractiveText composables according what the Flexmark parser returns (it is BasicText with some modifiers) and I style them in MarkdownView. Flexmark supports GfmUser extension. That being said it should be reasonably simple to implement the support for rendering @mention. As for autocompletion - this already designed with plugins in mind, so implementing another autocomplete plugin for user metnions should not be a problem - even without changes to the lib. So you can implement this yourself in your app, if you can do without the special rendering for now. Even emoji autocompletion is implemented as a plugin now. Regarding iOS support - I only have a Linux laptop to test, so the project is currently only developed on Linux/desktop/JVM. Also I need to write some automated tests before I get to supporting anything else...

Thanks for the encouragement :-)

konecny-ondrej commented 1 month ago

I have done some support for user mentions in 0.3.0. It is quite rudimentary, but now that it is possible to register custom renderers (also new in 0.3.0), the mentions' look can be fully customized. You can even make it an InlineTextContent, like the images are done, so you get the full spectrum of Compose rendering options. See the renderers parameter of MarkdownView, the autocompletePlugins parameter of MarkdownEditor for details.