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

Handle link click in editor #194

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Wavesonics
Copy link
Contributor

@Wavesonics Wavesonics commented Feb 3, 2024

I don't think this is ready to merge yet, but take a look at the current approach.

I added a new listener: RichSpanClickListener

Which gets clicks on all RichSpans, and lets the user sort them out.

I have an example in RichEditorContent.kt using this new listener to show a popup simulating a spellchecker.

However getRichSpanByOffset() only seems to work in the BasicRichTextEditor, The Outline variant which I think has extra padding maybe? The clicks return the wrong span. It appears to me to be offset by maybe the amount of padding? Not sure.

In order to make all of this work I had to make more classes public, which might be fine? But if we decide we don't want to expose all of those internal workings, maybe we'd have some stripped down classes to return instead in the click listener?

This update introduces a callback function `onRichSpanClick` to allow apps to handle clicks on RichSpans in the RichTextEditor. The updates also modify the visibility of some classes and properties to support this- `RichSpan`, `ParagraphType` and `getRichSpanByOffset` method in `RichTextState` are now publicly visible.
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.

None yet

1 participant