Skip to content

Commit

Permalink
Merge pull request #35 from MohamedRejeb/documentation
Browse files Browse the repository at this point in the history
Update README.md for 0.2.0
  • Loading branch information
MohamedRejeb authored May 21, 2023
2 parents c6e04c3 + 4ed3c84 commit b8abf52
Show file tree
Hide file tree
Showing 19 changed files with 186 additions and 59 deletions.
8 changes: 8 additions & 0 deletions .idea/artifacts/common_desktop_0_2_0.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/artifacts/common_desktop_0_2_1.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/artifacts/common_js_0_2_0.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/artifacts/common_js_0_2_1.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/artifacts/desktop_jvm_0_2_0.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/artifacts/desktop_jvm_0_2_1.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/artifacts/richeditor_compose_desktop_0_2_0.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/artifacts/richeditor_compose_desktop_0_2_1.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/artifacts/richeditor_compose_js_0_2_0.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/artifacts/richeditor_compose_js_0_2_1.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/artifacts/web_js_0_2_0.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/artifacts/web_js_0_2_1.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,22 @@ object SecondCustomStyle : RichTextStyle {
richTextValue = richTextValue.addStyle(SecondCustomStyle)
```

### Create `RichTextValue` from HTML String
We can create a `RichTextValue` from HTML string using `RichTextValue.fromHtml` factory method.

```kotlin
val html = "<b>Hello</b> <i>World</i>"
val richTextValue = RichTextValue.from(html)
```

### Export `RichTextValue` to HTML String
We can export a `RichTextValue` to HTML string using `RichTextValue.toHtml` method.

```kotlin
val richTextValue = RichTextValue()
val html = richTextValue.toHtml()
```

### Create Rich Text with Compose UI
The library provides a `RichText` composable that can be used to display rich text. It's similar to `Text` composable, but it supports rich text styles.

Expand All @@ -216,21 +232,22 @@ There are some supported features that you can use with `RichTextEditor`:
- [x] Background color
- [x] Font size
- [x] Create a custom style
- [X] Add unordered lists
- [X] Support importing and exporting HTML

## Coming Features
The library still in its early stages, so there are some features that are coming soon:

- [ ] Add link
- [ ] Add paragraph alignment (left, center, right)
- [ ] Add ordered and unordered lists
- [ ] Add ordered lists
- [ ] Add Blockquote
- [ ] Add code block style
- [ ] Add undo and redo
- [ ] Add checkbox
- [ ] Add image support
- [ ] Add video support
- [ ] Add audio support
- [ ] Support importing and exporting HTML
- [ ] Support importing and exporting Markdown
- [ ] Add add prebuilt styles panel

Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group = "com.mohamedrejeb.richeditor"
version = "0.1.0"
version = "0.2.0"

buildscript {
repositories {
Expand All @@ -24,7 +24,7 @@ allprojects {
}

group = "com.mohamedrejeb.richeditor"
version = "0.1.0"
version = "0.2.0"

// apply(plugin = "org.jetbrains.dokka")
apply(plugin = "maven-publish")
Expand Down
4 changes: 2 additions & 2 deletions sample/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ kotlin {
api(compose.materialIconsExtended)

implementation(libs.kotlinx.serialization.json)
// implementation("com.mohamedrejeb.richeditor:richeditor-compose:0.1.0")
implementation(project(":richeditor-compose"))
implementation("com.mohamedrejeb.richeditor:richeditor-compose:0.2.0")
// implementation(project(":richeditor-compose"))

val voyagerVersion = "1.0.0-rc05"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.mohamedrejeb.richeditor.sample.common.components

import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Circle
import androidx.compose.material.icons.outlined.*
Expand All @@ -18,58 +19,72 @@ fun RichTextStyleRow(
value: RichTextValue,
onValueChanged: (RichTextValue) -> Unit,
) {
Row(
LazyRow(
modifier = modifier
) {
RichTextStyleButton(
style = RichTextStyle.Bold,
value = value,
onValueChanged = onValueChanged,
icon = Icons.Outlined.FormatBold
)
item {
RichTextStyleButton(
style = RichTextStyle.Bold,
value = value,
onValueChanged = onValueChanged,
icon = Icons.Outlined.FormatBold
)
}

RichTextStyleButton(
style = RichTextStyle.Italic,
value = value,
onValueChanged = onValueChanged,
icon = Icons.Outlined.FormatItalic
)
item {
RichTextStyleButton(
style = RichTextStyle.Italic,
value = value,
onValueChanged = onValueChanged,
icon = Icons.Outlined.FormatItalic
)
}

RichTextStyleButton(
style = RichTextStyle.Underline,
value = value,
onValueChanged = onValueChanged,
icon = Icons.Outlined.FormatUnderlined
)
item {
RichTextStyleButton(
style = RichTextStyle.Underline,
value = value,
onValueChanged = onValueChanged,
icon = Icons.Outlined.FormatUnderlined
)
}

RichTextStyleButton(
style = RichTextStyle.Strikethrough,
value = value,
onValueChanged = onValueChanged,
icon = Icons.Outlined.FormatStrikethrough
)
item {
RichTextStyleButton(
style = RichTextStyle.Strikethrough,
value = value,
onValueChanged = onValueChanged,
icon = Icons.Outlined.FormatStrikethrough
)
}

RichTextStyleButton(
style = RichTextStyle.FontSize(28.sp),
value = value,
onValueChanged = onValueChanged,
icon = Icons.Outlined.FormatSize
)
item {
RichTextStyleButton(
style = RichTextStyle.FontSize(28.sp),
value = value,
onValueChanged = onValueChanged,
icon = Icons.Outlined.FormatSize
)
}

RichTextStyleButton(
style = RichTextStyle.TextColor(Color.Red),
value = value,
onValueChanged = onValueChanged,
icon = Icons.Filled.Circle,
tint = Color.Red
)
item {
RichTextStyleButton(
style = RichTextStyle.TextColor(Color.Red),
value = value,
onValueChanged = onValueChanged,
icon = Icons.Filled.Circle,
tint = Color.Red
)
}

RichTextStyleButton(
style = CustomStyle(color = Color.Blue, background = Color.Green),
value = value,
onValueChanged = onValueChanged,
icon = Icons.Outlined.Circle,
tint = Color.Green
)
item {
RichTextStyleButton(
style = CustomStyle(color = Color.Blue, background = Color.Green),
value = value,
onValueChanged = onValueChanged,
icon = Icons.Outlined.Circle,
tint = Color.Green
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,14 @@ fun RichTextToHtml(

Spacer(Modifier.height(8.dp))

SelectionContainer(
Text(
text = html,
modifier = Modifier
.fillMaxWidth()
.weight(1f)
.border(1.dp, MaterialTheme.colorScheme.outline, MaterialTheme.shapes.extraSmall)
.padding(vertical = 12.dp, horizontal = 12.dp)
) {
Text(
text = html,
modifier = Modifier
.fillMaxSize()
)
}
)
}
}
}
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b8abf52

Please sign in to comment.