Skip to content

Commit

Permalink
Merge pull request #89 from MohamedRejeb/1.x
Browse files Browse the repository at this point in the history
Fix an issue with setHtml in release mode
  • Loading branch information
MohamedRejeb authored Aug 5, 2023
2 parents 3244b6c + 4045f96 commit 9df6238
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 5 deletions.
1 change: 1 addition & 0 deletions richeditor-compose/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,6 @@ android {

defaultConfig {
minSdk = libs.versions.android.minSdk.get().toInt()
consumerProguardFile("proguard-rules.pro")
}
}
1 change: 1 addition & 0 deletions richeditor-compose/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-keep class com.mohamedrejeb.ksoup.html.** { *; }
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ internal object RichTextStateHtmlParser : RichTextStateParser<String> {
override fun encode(input: String): RichTextState {
val openedTags = mutableListOf<Pair<String, Map<String, String>>>()
val stringBuilder = StringBuilder()
val currentStyles: MutableList<RichTextStyle> = mutableListOf()
val richParagraphList = mutableListOf<RichParagraph>()
var currentRichSpan: RichSpan? = null
var lastClosedTag: String? = null
Expand Down Expand Up @@ -147,7 +146,6 @@ internal object RichTextStateHtmlParser : RichTextStateParser<String> {
}
.onCloseTag { name, _ ->
openedTags.removeLastOrNull()
currentStyles.removeLastOrNull()
lastClosedTag = name

if (name == "ul" || name == "ol") {
Expand Down
17 changes: 17 additions & 0 deletions sample/android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,23 @@ android {
kotlinOptions {
jvmTarget = "1.8"
}
packagingOptions {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
buildTypes {
getByName("release") {
isMinifyEnabled = true
isShrinkResources = true
isDebuggable = false

proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
dependencies {
implementation(project(":sample:common"))

Expand Down
Empty file.
6 changes: 4 additions & 2 deletions sample/android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.mohamedrejeb.richeditor.android">
<manifest xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:allowBackup="false"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
android:enableOnBackInvokedCallback="true"
tools:targetApi="tiramisu">
<activity
android:name="com.mohamedrejeb.richeditor.sample.MainActivity"
android:exported="true"
Expand Down
4 changes: 4 additions & 0 deletions sample/android/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Compose Rich Editor</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.unit.dp
import com.mohamedrejeb.richeditor.model.RichTextValue
import com.mohamedrejeb.richeditor.model.rememberRichTextState
import com.mohamedrejeb.richeditor.ui.material3.RichText

Expand Down

0 comments on commit 9df6238

Please sign in to comment.