diff --git a/build.gradle.kts b/build.gradle.kts
index 1720884b..1b5bd40d 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,5 +1,5 @@
-group "com.mocoding"
-version "1.0-SNAPSHOT"
+group = "com.mohamedrejeb.richeditor"
+version = "0.1.0"
buildscript {
repositories {
@@ -20,4 +20,83 @@ allprojects {
mavenCentral()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
}
+
+ group = "com.mohamedrejeb.richeditor"
+ version = "0.1.0"
+
+// apply(plugin = "org.jetbrains.dokka")
+ apply(plugin = "maven-publish")
+ apply(plugin = "signing")
+
+ extensions.configure {
+ repositories {
+ maven {
+ val isSnapshot = version.toString().endsWith("SNAPSHOT")
+ url = uri(
+ if (!isSnapshot) "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2"
+ else "https://s01.oss.sonatype.org/content/repositories/snapshots"
+ )
+
+ credentials {
+ username = System.getenv("OssrhUsername")
+ password = System.getenv("OssrhPassword")
+ }
+ }
+ }
+
+ val javadocJar = tasks.register("javadocJar") {
+// dependsOn(tasks.dokkaHtml)
+ archiveClassifier.set("javadoc")
+// from("$buildDir/dokka")
+ }
+
+ publications {
+ withType {
+ artifact(javadocJar)
+
+ pom {
+ name.set("Compose Rich Editor")
+ description.set("A Compose multiplatform library that provides a rich text editor.")
+ licenses {
+ license {
+ name.set("Apache-2.0")
+ url.set("https://opensource.org/licenses/Apache-2.0")
+ }
+ }
+ url.set("https://github.com/MohamedRejeb/Compose-Rich-Editor")
+ issueManagement {
+ system.set("Github")
+ url.set("https://github.com/MohamedRejeb/Compose-Rich-Editor/issues")
+ }
+ scm {
+ connection.set("https://github.com/MohamedRejeb/Compose-Rich-Editor.git")
+ url.set("https://github.com/MohamedRejeb/Compose-Rich-Editor")
+ }
+ developers {
+ developer {
+ name.set("Mohamed Rejeb")
+ email.set("mohamedrejeb445@gmail.com")
+ }
+ }
+ }
+ }
+ }
+ }
+
+ val publishing = extensions.getByType()
+ extensions.configure {
+ useInMemoryPgpKeys(
+ System.getenv("SigningKeyId"),
+ System.getenv("SigningKey"),
+ System.getenv("SigningPassword"),
+ )
+
+ sign(publishing.publications)
+ }
+
+ // TODO: remove after https://youtrack.jetbrains.com/issue/KT-46466 is fixed
+// project.tasks.withType(AbstractPublishToMaven::class.java).configureEach {
+// dependsOn(project.tasks.withType(Sign::class.java))
+// }
+
}
\ No newline at end of file
diff --git a/richeditor/build.gradle.kts b/richeditor-compose/build.gradle.kts
similarity index 97%
rename from richeditor/build.gradle.kts
rename to richeditor-compose/build.gradle.kts
index c2b79266..9d7aee25 100644
--- a/richeditor/build.gradle.kts
+++ b/richeditor-compose/build.gradle.kts
@@ -5,8 +5,8 @@ plugins {
id("com.android.library")
}
-group = "com.mocoding"
-version = "1.0-SNAPSHOT"
+group = "com.mohamedrejeb.richeditor"
+version = "0.1.0"
kotlin {
android()
diff --git a/richeditor/src/commonMain/kotlin/com/mohamedrejeb/richeditor/model/RichTextPart.kt b/richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/model/RichTextPart.kt
similarity index 78%
rename from richeditor/src/commonMain/kotlin/com/mohamedrejeb/richeditor/model/RichTextPart.kt
rename to richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/model/RichTextPart.kt
index 90a48633..572ec929 100644
--- a/richeditor/src/commonMain/kotlin/com/mohamedrejeb/richeditor/model/RichTextPart.kt
+++ b/richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/model/RichTextPart.kt
@@ -1,6 +1,6 @@
package com.mohamedrejeb.richeditor.model
-data class RichTextPart(
+internal data class RichTextPart(
val fromIndex: Int,
val toIndex: Int,
val styles: Set,
diff --git a/richeditor/src/commonMain/kotlin/com/mohamedrejeb/richeditor/model/RichTextStyle.kt b/richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/model/RichTextStyle.kt
similarity index 100%
rename from richeditor/src/commonMain/kotlin/com/mohamedrejeb/richeditor/model/RichTextStyle.kt
rename to richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/model/RichTextStyle.kt
diff --git a/richeditor/src/commonMain/kotlin/com/mohamedrejeb/richeditor/model/RichTextValue.kt b/richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/model/RichTextValue.kt
similarity index 97%
rename from richeditor/src/commonMain/kotlin/com/mohamedrejeb/richeditor/model/RichTextValue.kt
rename to richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/model/RichTextValue.kt
index a6dab757..c2f2d6fe 100644
--- a/richeditor/src/commonMain/kotlin/com/mohamedrejeb/richeditor/model/RichTextValue.kt
+++ b/richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/model/RichTextValue.kt
@@ -12,12 +12,12 @@ import kotlin.math.min
@Immutable
data class RichTextValue internal constructor(
- val textFieldValue: TextFieldValue,
+ internal val textFieldValue: TextFieldValue,
val currentStyles: Set = emptySet(),
- val parts: List = emptyList(),
+ internal val parts: List = emptyList(),
) {
- val visualTransformation
+ internal val visualTransformation
get() = VisualTransformation {
TransformedText(
text = annotatedString,
@@ -25,7 +25,7 @@ data class RichTextValue internal constructor(
)
}
- val annotatedString
+ internal val annotatedString
get() = AnnotatedString(
text = textFieldValue.text,
spanStyles = parts.map { part ->
@@ -44,11 +44,10 @@ data class RichTextValue internal constructor(
constructor(
text: String = "",
currentStyles: Set = emptySet(),
- parts: List = emptyList(),
) : this(
textFieldValue = TextFieldValue(text = text),
currentStyles = currentStyles,
- parts = parts,
+ parts = emptyList(),
)
fun addStyle(vararg style: RichTextStyle): RichTextValue {
@@ -75,7 +74,7 @@ data class RichTextValue internal constructor(
return copy(currentStyles = newStyles)
}
- fun updateTextFieldValue(newTextFieldValue: TextFieldValue): RichTextValue {
+ internal fun updateTextFieldValue(newTextFieldValue: TextFieldValue): RichTextValue {
val newParts = parts.toMutableList()
if (newTextFieldValue.text.length > textFieldValue.text.length) {
diff --git a/richeditor/src/commonMain/kotlin/com/mohamedrejeb/richeditor/ui/BasicRichTextEditor.kt b/richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/ui/BasicRichTextEditor.kt
similarity index 100%
rename from richeditor/src/commonMain/kotlin/com/mohamedrejeb/richeditor/ui/BasicRichTextEditor.kt
rename to richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/ui/BasicRichTextEditor.kt
diff --git a/richeditor/src/commonMain/kotlin/com/mohamedrejeb/richeditor/ui/material/OutlinedRichTextEditor.kt b/richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/ui/material/OutlinedRichTextEditor.kt
similarity index 100%
rename from richeditor/src/commonMain/kotlin/com/mohamedrejeb/richeditor/ui/material/OutlinedRichTextEditor.kt
rename to richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/ui/material/OutlinedRichTextEditor.kt
diff --git a/richeditor/src/commonMain/kotlin/com/mohamedrejeb/richeditor/ui/material/RichText.kt b/richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/ui/material/RichText.kt
similarity index 100%
rename from richeditor/src/commonMain/kotlin/com/mohamedrejeb/richeditor/ui/material/RichText.kt
rename to richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/ui/material/RichText.kt
diff --git a/richeditor/src/commonMain/kotlin/com/mohamedrejeb/richeditor/ui/material/RichTextEditor.kt b/richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/ui/material/RichTextEditor.kt
similarity index 100%
rename from richeditor/src/commonMain/kotlin/com/mohamedrejeb/richeditor/ui/material/RichTextEditor.kt
rename to richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/ui/material/RichTextEditor.kt
diff --git a/richeditor/src/commonMain/kotlin/com/mohamedrejeb/richeditor/ui/material3/OutlinedRichTextEditor.kt b/richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/ui/material3/OutlinedRichTextEditor.kt
similarity index 100%
rename from richeditor/src/commonMain/kotlin/com/mohamedrejeb/richeditor/ui/material3/OutlinedRichTextEditor.kt
rename to richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/ui/material3/OutlinedRichTextEditor.kt
diff --git a/richeditor/src/commonMain/kotlin/com/mohamedrejeb/richeditor/ui/material3/RichText.kt b/richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/ui/material3/RichText.kt
similarity index 100%
rename from richeditor/src/commonMain/kotlin/com/mohamedrejeb/richeditor/ui/material3/RichText.kt
rename to richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/ui/material3/RichText.kt
diff --git a/richeditor/src/commonMain/kotlin/com/mohamedrejeb/richeditor/ui/material3/RichTextEditor.kt b/richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/ui/material3/RichTextEditor.kt
similarity index 100%
rename from richeditor/src/commonMain/kotlin/com/mohamedrejeb/richeditor/ui/material3/RichTextEditor.kt
rename to richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/ui/material3/RichTextEditor.kt
diff --git a/sample/android/build.gradle.kts b/sample/android/build.gradle.kts
index 20a733fb..3066d3e1 100644
--- a/sample/android/build.gradle.kts
+++ b/sample/android/build.gradle.kts
@@ -4,9 +4,6 @@ plugins {
kotlin("android")
}
-group "com.mocoding"
-version "1.0-SNAPSHOT"
-
android {
namespace = "com.mocoding.richeditor.android"
compileSdk = (findProperty("android.compileSdk") as String).toInt()
diff --git a/sample/common/build.gradle.kts b/sample/common/build.gradle.kts
index 28fde648..f2d98823 100644
--- a/sample/common/build.gradle.kts
+++ b/sample/common/build.gradle.kts
@@ -6,9 +6,6 @@ plugins {
id("com.android.library")
}
-group = "com.mocoding"
-version = "1.0-SNAPSHOT"
-
kotlin {
android()
jvm("desktop") {
@@ -43,7 +40,8 @@ kotlin {
api(compose.materialIconsExtended)
implementation(libs.kotlinx.serialization.json)
- implementation(project(":richeditor"))
+ implementation("com.mohamedrejeb.richeditor:richeditor-compose:0.1.0")
+// implementation(project(":richeditor-compose"))
}
}
@@ -61,7 +59,9 @@ kotlin {
val jsMain by getting {
dependsOn(commonMain)
- dependencies {}
+ dependencies {
+
+ }
}
val iosX64Main by getting
@@ -72,7 +72,9 @@ kotlin {
iosX64Main.dependsOn(this)
iosArm64Main.dependsOn(this)
iosSimulatorArm64Main.dependsOn(this)
- dependencies {}
+ dependencies {
+
+ }
}
}
}
diff --git a/sample/desktop/build.gradle.kts b/sample/desktop/build.gradle.kts
index ca3dc2a7..5731a24a 100644
--- a/sample/desktop/build.gradle.kts
+++ b/sample/desktop/build.gradle.kts
@@ -5,10 +5,6 @@ plugins {
id("org.jetbrains.compose")
}
-group = "com.mocoding"
-version = "1.0-SNAPSHOT"
-
-
kotlin {
jvm {
jvmToolchain(11)
diff --git a/sample/ios/Compose Rich Editor.xcworkspace/xcuserdata/mohamedbenrejeb.xcuserdatad/UserInterfaceState.xcuserstate b/sample/ios/Compose Rich Editor.xcworkspace/xcuserdata/mohamedbenrejeb.xcuserdatad/UserInterfaceState.xcuserstate
index f65a7b72..145a22bf 100644
Binary files a/sample/ios/Compose Rich Editor.xcworkspace/xcuserdata/mohamedbenrejeb.xcuserdatad/UserInterfaceState.xcuserstate and b/sample/ios/Compose Rich Editor.xcworkspace/xcuserdata/mohamedbenrejeb.xcuserdatad/UserInterfaceState.xcuserstate differ
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 4f217e82..9c84e609 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -14,5 +14,5 @@ include(
":sample:desktop",
":sample:web",
":sample:common",
- ":richeditor"
+ ":richeditor-compose"
)