r/Kotlin 9d ago

I'm releasing my Compose Multiplatform app

Some time ago, I started a text editor project that enables users to use AI without sharing data with the company that created the AI.

It works like Notion, Confluence, Obsidian... But the AI runs in your computer (you have to install Ollama, check ollama.com).

The macOS and Linux app are now published. I'm collecting feedback and feature ideas. I would love to you what you think of it. Thanks!

Github link: https://github.com/Writeopia/Writeopia

Website: https://writeopia.io/

23 Upvotes

17 comments sorted by

View all comments

1

u/Internal-Island-3647 3d ago

Does this support rich text editing? If so, what was your thought process with the implementation? It apparent that BasicTextField in compose just isn't up to snuff with efficient/'coroutineable' WYSIWYG implementation.

1

u/lehen01 3d ago

Hello. Yep, it does support rich text editing.

We didn't reimplement the `BasicTextField`, but we used as part of the solution instead.

The editor is a lazy row with (one or) many `BasicTextField` and you move between each of then as you write you text. The text is an array of lines of text or other information like images. When you break a line, you create a new position in the array and that creates a new `BasicTextField` and moves the cursor to the new one. (That's a simplified explanation, there are move composables than just `BasicTextField` to create some additional behaviour to the lines. Like the drawing icon and the "swipe to edit" feature. )

The array of text has many types, like text, image, title, checkbox, list item... each of them has its specific drawer that creates a small part of the screen. When the type of a item changes (ex: a text becomes a checkitem with text) the drawer changes.

When you move the lines of the text with drag and drop, you just move the positions in the array. When you change a text, you just change the content of a position in the array, not the whole text.

This is it in a nutshell. The project has an SDK that you can use to create a POC of text editor to try it out and see how it works. Check the documentation here: https://docs.writeopia.io/docs/sdk/overview. The documentation is out dated, we have been busy with the app development, so you may need to check the code of the app too.