Skip to content

FAQ

Have a question that isn't part of the FAQ? Open an issue in our GitHub repository.

Common Questions

How do I get development snapshots?

Add the snapshots repository to your list of repositories in build.gradle.kts:

allprojects {
    repositories {
        maven("https://s01.oss.sonatype.org/content/repositories/snapshots")
    }
}

Or to your dependency resolution management in settings.gradle.kts:

dependencyResolutionManagement {
    repositories {
        maven("https://s01.oss.sonatype.org/content/repositories/snapshots")
    }
}

Use the snapshot version:

implementation("com.mohamedrejeb.richeditor:richeditor-compose:1.0.0-SNAPSHOT")

⚠️ Warning: Snapshots are deployed for each new commit on main that passes CI. They can potentially contain breaking changes or may be unstable. Use at your own risk.

You can customize link appearance using the config property of RichTextState:

richTextState.config.linkColor = Color.Blue
richTextState.config.linkTextDecoration = TextDecoration.Underline

By default, links are opened by your platform's UriHandler. To handle links yourself:

val myUriHandler = remember {
    object : UriHandler {
        override fun openUri(uri: String) {
            // Your custom link handling logic
        }
    }
}

CompositionLocalProvider(LocalUriHandler provides myUriHandler) {
    RichText(
        state = richTextState,
        modifier = Modifier.fillMaxWidth()
    )
}

How do I save/restore editor content?

You can convert the editor content to HTML or Markdown for storage:

// Save content
val html = richTextState.toHtml()
// or
val markdown = richTextState.toMarkdown()

// Restore content
richTextState.setHtml(savedHtml)
// or
richTextState.setMarkdown(savedMarkdown)