Skip to content

Commit 451ceab

Browse files
authored
Merge branch 'Writeopia:main' into main
2 parents 3cab0dd + 9e6bc65 commit 451ceab

File tree

12 files changed

+2731
-2677
lines changed

12 files changed

+2731
-2677
lines changed

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@
2525
This is the source code for Writopia, a text editing App and SDK.
2626

2727
# Application
28-
Writeopia is a project developed with Kotlin Multiplatform, most of the code is shared between all the apps.
28+
Writeopia is a modern text editor that integrates AI while prioritizing offline functionality and user privacy. Unlike cloud-based AI assistants, Writeopia allows you to choose your own AI model and interact with it locally, ensuring that your data stays on your device.
2929

30-
This is a project to save all your documents in one place providing you the freedom to choose where to store it. You can save your whole workspace with a button click and save it in your git repository (like Github) or a storage system like Dropbox or Google Drive.
31-
32-
A backend is also under development so you can self host it and have full controll how you share your documentations with work teams and friends.
30+
## Why Writeopia?
31+
Writeopia is built for writers, developers, and researchers who want the power of AI without sacrificing privacy. Whether you're drafting a novel, taking notes, or coding, Writeopia provides an intelligent and distraction-free environment.
3332

3433
## Documentation
3534
You can check the documentation of the project in the [application documentation](https://docs.writeopia.io/docs/application/overview).

application/composeApp/proguard-rules-desktop.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
-keepclassmembers public class **$$serializer {
1515
private ** descriptor;
1616
}
17+
-keep class coil3.network.ktor3.** { *; }
1718

1819
-dontwarn org.slf4j.**
1920
-dontwarn android.**

application/core/connection/src/commonMain/kotlin/io/writeopia/di/AppConnectionInjection.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ object ApiInjectorDefaults {
3939
apiLogger: Logger,
4040
) = HttpClient {
4141
install(HttpTimeout) {
42-
// requestTimeoutMillis = 30000
43-
// socketTimeoutMillis = 30000
42+
requestTimeoutMillis = 300000
43+
socketTimeoutMillis = 300000
4444
}
4545

4646
install(ContentNegotiation) {

application/core/resources/config/ktlint/baseline.xml

Lines changed: 2657 additions & 2641 deletions
Large diffs are not rendered by default.

application/core/resources/src/commonMain/composeResources/values-en/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
<string name="download_models">Download Model</string>
5252
<string name="suggestions">Suggestions:</string>
5353
<string name="error_model_download">Error when downloading model.</string>
54-
<string name="version">"Version: alpha32 - Amado, Jorge"</string>
54+
<string name="version">"Version: alpha33 - Amado, Jorge"</string>
5555
<string name="light_theme">Light</string>
5656
<string name="dark_theme">Dark</string>
5757
<string name="system_theme">System</string>

application/core/resources/src/commonMain/composeResources/values-pt/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
<string name="download_models">Baixar modelos</string>
5252
<string name="suggestions">Sugestões:</string>
5353
<string name="error_model_download">Error ao baixar modelo.</string>
54-
<string name="version">"Versão: alpha32 - Amado, Jorge"</string>
54+
<string name="version">"Versão: alpha33 - Amado, Jorge"</string>
5555
<string name="light_theme">Claro</string>
5656
<string name="dark_theme">Escuro</string>
5757
<string name="system_theme">Sistema</string>

application/core/resources/src/commonMain/composeResources/values/strings.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
<string name="download_models">Download Model</string>
5454
<string name="suggestions">Suggestions:</string>
5555
<string name="error_model_download">Error when downloading model.</string>
56-
<string name="version">Version: alpha32 - Amado, Jorge</string>
56+
<string name="version">Version: alpha33 - Amado, Jorge</string>
5757
<string name="light_theme">Light</string>
5858
<string name="dark_theme">Dark</string>
5959
<string name="system_theme">System</string>
@@ -75,6 +75,7 @@
7575
<string name="page">Page</string>
7676
<string name="ask_ai">Ask AI</string>
7777
<string name="json">JSON</string>
78+
<string name="markdown">Markdown</string>
7879
<string name="tap_to_start">Tap here to <font fgcolor='#FFFF3B30'>write</font> the next big thing</string>
7980
<string name="font">Font</string>
8081
<string name="actions">Actions</string>

application/core/resources/src/commonMain/kotlin/io/writeopia/resources/WrStrings.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@ object WrStrings {
187187
@Composable
188188
fun json() = stringResource(Res.string.json)
189189

190+
@Composable
191+
fun markdown() = stringResource(Res.string.json)
192+
190193
@Composable
191194
fun tapToStart() = stringResource(Res.string.tap_to_start)
192195

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package io.writeopia.common.utils.modifier
2+
3+
import androidx.compose.ui.Modifier
4+
import androidx.compose.ui.input.pointer.changedToUp
5+
import androidx.compose.ui.input.pointer.pointerInput
6+
7+
fun Modifier.clickableWithoutGettingFocus(block: () -> Unit): Modifier =
8+
this.pointerInput(Unit) {
9+
awaitPointerEventScope {
10+
while (true) {
11+
val event = awaitPointerEvent()
12+
event.changes.forEach { pointerInputChange ->
13+
if (pointerInputChange.changedToUp()) {
14+
block()
15+
}
16+
}
17+
}
18+
}
19+
}

application/features/editor/src/commonMain/kotlin/io/writeopia/editor/features/editor/ui/desktop/edit/menu/SideEditorOptions.kt

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import io.writeopia.common.utils.collections.inBatches
4747
import io.writeopia.common.utils.file.fileChooserLoad
4848
import io.writeopia.common.utils.file.fileChooserSave
4949
import io.writeopia.common.utils.icons.WrIcons
50+
import io.writeopia.common.utils.modifier.clickableWithoutGettingFocus
5051
import io.writeopia.model.Font
5152
import io.writeopia.resources.WrStrings
5253
import io.writeopia.sdk.models.span.Span
@@ -305,7 +306,9 @@ private fun TextChanges(spanClick: (Span) -> Unit) {
305306
modifier = Modifier.weight(1F)
306307
.clip(RoundedCornerShape(topStart = 6.dp, bottomStart = 6.dp))
307308
.size(32.dp)
308-
.clickable { spanClick(Span.BOLD) }
309+
.clickableWithoutGettingFocus {
310+
spanClick(Span.BOLD)
311+
}
309312
.padding(horizontal = 8.dp, vertical = 8.dp),
310313
tint = MaterialTheme.colorScheme.onBackground
311314
)
@@ -315,7 +318,7 @@ private fun TextChanges(spanClick: (Span) -> Unit) {
315318
contentDescription = "Italic",
316319
modifier = Modifier.weight(1F)
317320
.size(32.dp)
318-
.clickable { spanClick(Span.ITALIC) }
321+
.clickableWithoutGettingFocus { spanClick(Span.ITALIC) }
319322
.padding(horizontal = 8.dp, vertical = 8.dp),
320323
tint = MaterialTheme.colorScheme.onBackground
321324
)
@@ -326,7 +329,7 @@ private fun TextChanges(spanClick: (Span) -> Unit) {
326329
modifier = Modifier.weight(1F)
327330
.clip(RoundedCornerShape(topEnd = 6.dp, bottomEnd = 6.dp))
328331
.size(32.dp)
329-
.clickable { spanClick(Span.UNDERLINE) }
332+
.clickableWithoutGettingFocus { spanClick(Span.UNDERLINE) }
330333
.padding(horizontal = 8.dp, vertical = 8.dp),
331334
tint = MaterialTheme.colorScheme.onBackground
332335
)
@@ -601,32 +604,32 @@ private fun Actions(
601604

602605
Row {
603606
TextButton(
604-
modifier = Modifier.weight(1F),
605607
text = WrStrings.json(),
608+
modifier = Modifier.weight(1F),
606609
paddingValues = smallButtonPadding()
607610
) {
608611
fileChooserSave()?.let {
609612
exportJson(it)
610613
}
611614
}
612615

613-
// Text(
614-
// "Markdown",
615-
// textAlign = TextAlign.Center,
616-
// modifier = Modifier
617-
// .padding(2.dp)
618-
// .background(
619-
// MaterialTheme.colorScheme.surfaceVariant,
620-
// MaterialTheme.shapes.medium
621-
// ).weight(1F)
622-
// .clip(MaterialTheme.shapes.medium)
623-
// .clickable {
624-
// fileChooserSave()?.let(exportMarkdown)
625-
// }
626-
// .padding(4.dp),
627-
// color = MaterialTheme.colorScheme.onBackground,
628-
// style = buttonsTextStyle()
629-
// )
616+
Text(
617+
WrStrings.markdown(),
618+
textAlign = TextAlign.Center,
619+
modifier = Modifier
620+
.padding(2.dp)
621+
.background(
622+
MaterialTheme.colorScheme.surfaceVariant,
623+
MaterialTheme.shapes.medium
624+
).weight(1F)
625+
.clip(MaterialTheme.shapes.medium)
626+
.clickable {
627+
fileChooserSave()?.let(exportMarkdown)
628+
}
629+
.padding(4.dp),
630+
color = MaterialTheme.colorScheme.onBackground,
631+
style = buttonsTextStyle()
632+
)
630633
}
631634

632635
Spacer(modifier = Modifier.height(12.dp))

0 commit comments

Comments
 (0)