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

Adding a Tag for inlineConent #197

Open
adambrangenberg opened this issue Feb 5, 2024 · 1 comment
Open

Adding a Tag for inlineConent #197

adambrangenberg opened this issue Feb 5, 2024 · 1 comment

Comments

@adambrangenberg
Copy link

adambrangenberg commented Feb 5, 2024

Hallo,
we were trying to use inlineContent by passing in the String which should be replaced with the Composable, however it didn't work.

            inlineContent = mapOf("abc" to  InlineTextContent(
                Placeholder(
                    0.5.em,
                    MaterialTheme.typography.bodyMedium.lineHeight,
                    PlaceholderVerticalAlign.AboveBaseline,
                ),
                ::MyComposableElement
            ))

Since in BasicText it works with an annotatedString, we figured a possible solution would be adding a custom tag.

            buildAnnotatedString {
                append("Hello")
                appendInlineContent("abc", "[myBox]")
                append("World!")
            },
            inlineContent=mapOf("abc" to  InlineTextContent(
                Placeholder(
                    10.em,
                    MaterialTheme.typography.bodyMedium.lineHeight,
                    PlaceholderVerticalAlign.AboveBaseline,
                ),
               ::MyComposableElement
            ))

For Example:

HTML Input

<div>foo <appendInline id="abc">[myBox]</appendInline> bar</div>

Inline Content

            inlineContent = mapOf("abc" to  InlineTextContent(
                Placeholder(
                    0.5.em,
                    MaterialTheme.typography.bodyMedium.lineHeight,
                    PlaceholderVerticalAlign.AboveBaseline,
                ),
                ::MyComposableElement
            ))

Output

foo insert composable... bar

@KitsuneAlex
Copy link

Gonna give this a bump, any updates on this?

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

No branches or pull requests

2 participants