Skip to content

Commit

Permalink
Added publish action
Browse files Browse the repository at this point in the history
  • Loading branch information
Wavesonics committed Jun 23, 2022
1 parent 56fe91c commit fbb578d
Show file tree
Hide file tree
Showing 34 changed files with 331 additions and 157 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Publish packages to Repositories
env:
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_USER: ${{ secrets.SIGNING_USER }}
on:
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-latest
environment: Publish
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
- name: Publish package
uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee
with:
arguments: publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022-2022 Adam Brown

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Jetpack Compose Rich Text Editor

[![](https://jitpack.io/v/pChochura/richtext-compose.svg)](https://jitpack.io/#pChochura/richtext-compose)

# This is a hard fork of the fanstastic library of the same name from pChochura. This fork makes it into a multi-platform library
### This is a hard fork of the fantastic library of the same name from pChochura. This fork makes it into a multi-platform library https://github.com/pChochura/richtext-compose

I've been looking for a library that is able to deliver an editable component which can render rich
text in real time. The main issue with libraries I found was that they were using WebView and
Expand All @@ -16,14 +14,14 @@ So the only solution was to create my own library.

```groovy
repositories {
maven { url 'https://jitpack.io' }
mavenCentral()
}
```

2. Include link do the library (change the version to the current one)

```groovy
implementation "com.github.pChochura:richtext-compose:$version"
implementation "com.darkrockstudios:richtexteditor:$version"
```

# Usage
Expand Down
11 changes: 4 additions & 7 deletions androidExample/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
val compose_version: String by extra
val library_version: String by extra

plugins {
id("org.jetbrains.compose")
id("com.android.application")
kotlin("android")
}

group "com.darkrockstudios.example.richtexteditor"
version "1.0-SNAPSHOT"

repositories {

}
group = "com.darkrockstudios.example.richtexteditor"
version = library_version

dependencies {
implementation(project(":library"))
implementation(project(":richtexteditor"))
implementation("androidx.core:core-ktx:1.8.0")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.4.1")
implementation("androidx.activity:activity-compose:1.4.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.ExperimentalUnitApi
import androidx.compose.ui.unit.dp
import androidx.core.graphics.ColorUtils
import com.darkrockstudios.libraries.richtexteditor.mappers.StyleMapper
import com.darkrockstudios.libraries.richtexteditor.model.RichTextValue
import com.darkrockstudios.libraries.richtexteditor.model.Style
import com.darkrockstudios.libraries.richtexteditor.ui.RichText
import com.darkrockstudios.libraries.richtexteditor.ui.RichTextEditor
import com.darkrockstudios.libraries.richtexteditor.ui.defaultRichTextFieldStyle
import com.darkrockstudios.libraries.richtexteditor.ui.defaultRichTextStyle
import com.darkrockstudios.richtexteditor.mappers.StyleMapper
import com.darkrockstudios.richtexteditor.model.RichTextValue
import com.darkrockstudios.richtexteditor.model.Style
import com.darkrockstudios.richtexteditor.ui.RichText
import com.darkrockstudios.richtexteditor.ui.RichTextEditor
import com.darkrockstudios.richtexteditor.ui.defaultRichTextFieldStyle
import com.darkrockstudios.richtexteditor.ui.defaultRichTextStyle
import kotlin.random.Random

class MainActivity : ComponentActivity() {
Expand Down Expand Up @@ -234,6 +235,7 @@ class CustomStyleMapper : StyleMapper() {
else -> throw IllegalArgumentException()
}

@ExperimentalUnitApi
override fun toSpanStyle(style: Style) = super.toSpanStyle(style) ?: when (style) {
is BoldRedStyle -> SpanStyle(
color = Color.Red,
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
group "com.darkrockstudios.libraries.richtexteditor"
group "com.darkrockstudios.richtexteditor"
version "1.0-SNAPSHOT"

allprojects {
Expand Down
10 changes: 5 additions & 5 deletions desktopExample/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import org.jetbrains.compose.compose
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

val library_version: String by extra

plugins {
kotlin("multiplatform")
id("org.jetbrains.compose")
}

group = "com.darkrockstudios.example"
version = "1.0-SNAPSHOT"

version = library_version

kotlin {
jvm {
Expand All @@ -21,7 +21,7 @@ kotlin {
sourceSets {
val jvmMain by getting {
dependencies {
implementation(project(":library"))
implementation(project(":richtexteditor"))
implementation(compose.desktop.currentOs)
}
}
Expand All @@ -35,7 +35,7 @@ compose.desktop {
nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = "richtext-compose"
packageVersion = "1.0.0"
packageVersion = library_version
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package com.darkrockstudios.example
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.font.FontWeight
import com.darkrockstudios.libraries.richtexteditor.mappers.StyleMapper
import com.darkrockstudios.libraries.richtexteditor.model.Style
import androidx.compose.ui.unit.ExperimentalUnitApi
import com.darkrockstudios.richtexteditor.mappers.StyleMapper
import com.darkrockstudios.richtexteditor.model.Style

object BoldRedStyle : Style

Expand All @@ -16,6 +17,7 @@ class CustomStyleMapper : StyleMapper() {
else -> throw IllegalArgumentException()
}

@ExperimentalUnitApi
override fun toSpanStyle(style: Style) = super.toSpanStyle(style) ?: when (style) {
is BoldRedStyle -> SpanStyle(
color = Color.Red,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Window
import androidx.compose.ui.window.application
import com.darkrockstudios.libraries.richtexteditor.model.RichTextValue
import com.darkrockstudios.libraries.richtexteditor.model.Style
import com.darkrockstudios.libraries.richtexteditor.ui.RichText
import com.darkrockstudios.libraries.richtexteditor.ui.RichTextEditor
import com.darkrockstudios.libraries.richtexteditor.ui.defaultRichTextFieldStyle
import com.darkrockstudios.libraries.richtexteditor.ui.defaultRichTextStyle
import com.darkrockstudios.richtexteditor.model.RichTextValue
import com.darkrockstudios.richtexteditor.model.Style
import com.darkrockstudios.richtexteditor.ui.RichText
import com.darkrockstudios.richtexteditor.ui.RichTextEditor
import com.darkrockstudios.richtexteditor.ui.defaultRichTextFieldStyle
import com.darkrockstudios.richtexteditor.ui.defaultRichTextStyle
import kotlin.random.Random


Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
kotlin.code.style=official
kotlin.native.enableDependencyPropagation=false
library_version=1.3.0
android.useAndroidX=true
kotlin.version=1.6.10
agp.version=7.2.1
compose_version=1.1.0
compose_version=1.1.1
Empty file modified gradlew
100644 → 100755
Empty file.
66 changes: 0 additions & 66 deletions library/build.gradle.kts

This file was deleted.

2 changes: 0 additions & 2 deletions library/src/androidMain/AndroidManifest.xml

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit fbb578d

Please sign in to comment.