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

Upgrade to compose 1.6.0-beta01 #186

Merged
merged 4 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
agp = "8.2.2"
kotlin = "1.9.21"
compose = "1.5.11"
agp = "8.2.1"
kotlin = "1.9.22"
compose = "1.6.0-beta01"
dokka = "1.9.0"

ksoup = "0.3.0"
Expand All @@ -11,7 +11,7 @@ nexus-publish = "2.0.0-rc-1"

# For sample
compose-compiler = "1.5.4"
activity-compose = "1.8.1"
activity-compose = "1.8.2"
voyager = "1.0.0"
richeditor = "1.0.0-beta05"
android-minSdk = "21"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ internal object CssEncoder {
*/
internal fun parseCssStyleMapToParagraphStyle(cssStyleMap: Map<String, String>): ParagraphStyle {
return ParagraphStyle(
textAlign = cssStyleMap["text-align"]?.let { parseCssTextAlign(it) },
textDirection = cssStyleMap["direction"]?.let { parseCssTextDirection(it) },
textAlign = cssStyleMap["text-align"]?.let { parseCssTextAlign(it) } ?: TextAlign.Unspecified,
textDirection = cssStyleMap["direction"]?.let { parseCssTextDirection(it) } ?: TextDirection.Unspecified,
lineHeight = cssStyleMap["line-height"]?.let { parseCssLineHeight(it) } ?: TextUnit.Unspecified,
textIndent = cssStyleMap["text-indent"]?.let { parseCssTextIndent(it) },
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.platform.LocalClipboardManager
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.text.*
import androidx.compose.ui.platform.*
import androidx.compose.ui.text.TextLayoutResult
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.unit.Density
Expand Down Expand Up @@ -189,6 +188,7 @@ internal fun BasicRichTextEditor(
maxLength: Int = Int.MAX_VALUE,
onTextLayout: (TextLayoutResult) -> Unit = {},
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
uriHandler: UriHandler = LocalUriHandler.current,
Wavesonics marked this conversation as resolved.
Show resolved Hide resolved
cursorBrush: Brush = SolidColor(Color.Black),
decorationBox: @Composable (innerTextField: @Composable () -> Unit) -> Unit =
@Composable { innerTextField -> innerTextField() },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
package com.mohamedrejeb.richeditor.ui.material

import androidx.compose.foundation.text.InlineTextContent
import androidx.compose.material.*
import androidx.compose.material.LocalContentAlpha
import androidx.compose.material.LocalContentColor
import androidx.compose.material.LocalTextStyle
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.takeOrElse
import androidx.compose.ui.text.*
import androidx.compose.ui.text.Paragraph
import androidx.compose.ui.text.TextLayoutResult
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.font.FontWeight
Expand Down Expand Up @@ -66,7 +71,7 @@ fun RichText(
fontFamily: FontFamily? = null,
letterSpacing: TextUnit = TextUnit.Unspecified,
textDecoration: TextDecoration? = null,
textAlign: TextAlign? = null,
textAlign: TextAlign = TextAlign.Unspecified,
lineHeight: TextUnit = TextUnit.Unspecified,
overflow: TextOverflow = TextOverflow.Clip,
softWrap: Boolean = true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@ import androidx.compose.foundation.layout.*
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.text.selection.LocalTextSelectionColors
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.LocalTextStyle
import androidx.compose.material3.TextFieldColors
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.TextFieldDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.remember
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.drawWithContent
Expand All @@ -24,7 +21,6 @@ import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.drawscope.clipRect
import androidx.compose.ui.graphics.takeOrElse
import androidx.compose.ui.layout.*
import androidx.compose.ui.layout.layoutId
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.TextLayoutResult
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,9 @@ import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.LocalTextStyle
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.takeOrElse
import androidx.compose.ui.input.pointer.PointerIcon
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.text.Paragraph
import androidx.compose.ui.text.TextLayoutResult
import androidx.compose.ui.text.TextStyle
Expand Down Expand Up @@ -72,7 +68,7 @@ fun RichText(
fontFamily: FontFamily? = null,
letterSpacing: TextUnit = TextUnit.Unspecified,
textDecoration: TextDecoration? = null,
textAlign: TextAlign? = null,
textAlign: TextAlign = TextAlign.Unspecified,
lineHeight: TextUnit = TextUnit.Unspecified,
overflow: TextOverflow = TextOverflow.Clip,
softWrap: Boolean = true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ internal fun List<RichParagraph>.getCommonStyle(): ParagraphStyle? {
}

return ParagraphStyle(
textAlign = textAlign,
textDirection = textDirection,
textAlign = textAlign ?: TextAlign.Unspecified,
textDirection = textDirection ?: TextDirection.Unspecified,
lineHeight = lineHeight,
textIndent = textIndent,
platformStyle = platformStyle,
lineHeightStyle = lineHeightStyle,
lineBreak = lineBreak,
hyphens = hyphens
lineBreak = lineBreak ?: LineBreak.Unspecified,
hyphens = hyphens ?: Hyphens.Unspecified,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ import androidx.compose.material.ripple.rememberRipple
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextDecoration
Expand All @@ -30,10 +28,10 @@ import cafe.adriel.voyager.navigator.currentOrThrow
import com.mohamedrejeb.richeditor.annotation.ExperimentalRichTextApi
import com.mohamedrejeb.richeditor.model.RichTextState
import com.mohamedrejeb.richeditor.model.rememberRichTextState
import com.mohamedrejeb.richeditor.sample.common.ui.theme.ComposeRichEditorTheme
import com.mohamedrejeb.richeditor.ui.material3.RichText
import com.mohamedrejeb.richeditor.ui.material3.RichTextEditor
import com.mohamedrejeb.richeditor.ui.material3.RichTextEditorDefaults
import org.jetbrains.compose.resources.DrawableResource
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.painterResource

Expand Down Expand Up @@ -123,7 +121,7 @@ fun SlackDemoContent() {
.background(Color.White)
) {
Image(
painterResource("slack-logo.png"),
painterResource(DrawableResource("slack-logo.png")),
contentDescription = "Slack Logo",
modifier = Modifier
.fillMaxSize()
Expand Down
Loading