Comments (4)
Currently, major functionality implementation in sora-editor is platform-dependent:
- rendering process uses Android specific skia API, and some Android internal graphics and text API
- user input are delivered by Android platform API
- user interaction logic is for touchscreen (though basic mouse support is recently added)
So we are unable to migrate sora-editor to a Kotlin Multiplatform application quickly.
However, we are planning to extract the common part of code editor and make a code editor library with Jetpack Compose to finally achieve the multiplatform goal.
from sora-editor.
1 - Jetpack compose uses skia for rendering actually, so you can use skia using Jetpack Compose
2 - expect functions and expect classes allow for taking input from multiple platforms, using different code
3 - Jetpack compose UI works with both (touch screen and mouse)
I want you to know that when using Kotlin Multiplatform, The platform dependent API's for example function calls can be made like
in common code
expect fun platformAdd(x : Int, y : Int) : Int
in android code
actual fun platformAdd(x : Int, y : Int) {
// you can use android api's here with IDE support
return x + y;
// but note that context is not part of common code, so having a context parameter is not possible
// by using jetpack compose, you can create composable functions, which allow you to gain context using LocalContext.current
}
in jvm code
actual fun platformAdd(x : Int, y : Int) {
// on jvm or desktop it will minus the thing
return x - y;
}
You can also write expect classes so it should be really easy !
from sora-editor.
Since you are already working with Jetpack Compose, I'll recommend that you add multiplatform support from the beginning so you don't use platform dependent API's deep in the code which will cause you to create "big refactors" later when porting to multiplatform
from sora-editor.
Since you are already working with Jetpack Compose
Actually, the new project haven't started yet... I'm planning to start the new project after code folding is done in sora-editor.
And thanks for your advice. The expect
and actual
declaration helps a lot in platform-specific logic.
from sora-editor.
Related Issues (20)
- Crash due to editor : java.lang.IllegalArgumentException: Not a valid Unicode code point: 0x800002C6 HOT 1
- Language pack for popular languages
- Refactor the language-textmate module with Kotlin?
- Crash HOT 14
- Enhance Pressing Down Logic of Selection Handle
- [Refactor] Editor Cache and Fields in `ContentLine`
- [Feature] Implement shallow copy and thread-safe shared data in `Content`
- Crash when reuse CodeEditor and Content object HOT 1
- Crash when settingText with less lines than previous Text HOT 2
- Crash when search thread running HOT 3
- Support Live Templates HOT 5
- Application Crashed HOT 1
- Make line separator compatible with windows CRLF = LF HOT 1
- .c或.cpp文件注释的字体颜色 HOT 2
- App crashes after calling setEditorLanguage method HOT 3
- Language-Textmate Desugar not work HOT 5
- [bug]: cannot display unicode symbols
- Is any plan to add AI code assistant, I which will improve typeing productivity on mobile devices HOT 1
- [bug] word wrap spillover
- OutOfMemoryError exception when opening 365M file
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sora-editor.