-
-
Notifications
You must be signed in to change notification settings - Fork 80
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
base: main
Are you sure you want to change the base?
Handle link click in editor #194
Conversation
7d321cc
to
2c7e21e
Compare
I got this working again
|
Okay, I'm understanding the code base quite a bit better than before, I refactored things so I no longer have to make |
richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/model/RichTextState.kt
Outdated
Show resolved
Hide resolved
f849418
to
0940b42
Compare
Just rebased this to get the line-wrapping fix #436
|
Ha never mind, I think I fixed the |
16966e7
to
5514261
Compare
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.
5514261
to
32a1c14
Compare
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.HowevergetRichSpanByOffset()
only seems to work in theBasicRichTextEditor
, 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?