@apollohg/react-native-prose-editor 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +21 -2
  2. package/android/build.gradle +23 -0
  3. package/android/src/main/java/com/apollohg/editor/EditorEditText.kt +502 -39
  4. package/android/src/main/java/com/apollohg/editor/NativeEditorExpoView.kt +56 -28
  5. package/android/src/main/java/com/apollohg/editor/NativeEditorModule.kt +6 -0
  6. package/android/src/main/java/com/apollohg/editor/PositionBridge.kt +57 -27
  7. package/android/src/main/java/com/apollohg/editor/RemoteSelectionOverlayView.kt +147 -78
  8. package/android/src/main/java/com/apollohg/editor/RenderBridge.kt +249 -71
  9. package/android/src/main/java/com/apollohg/editor/RichTextEditorView.kt +7 -6
  10. package/dist/NativeEditorBridge.d.ts +37 -1
  11. package/dist/NativeEditorBridge.js +192 -97
  12. package/dist/NativeRichTextEditor.d.ts +3 -2
  13. package/dist/NativeRichTextEditor.js +164 -56
  14. package/dist/YjsCollaboration.d.ts +2 -0
  15. package/dist/YjsCollaboration.js +142 -20
  16. package/dist/schemas.d.ts +2 -0
  17. package/dist/schemas.js +63 -0
  18. package/ios/EditorCore.xcframework/Info.plist +5 -5
  19. package/ios/EditorCore.xcframework/ios-arm64/libeditor_core.a +0 -0
  20. package/ios/EditorCore.xcframework/ios-arm64_x86_64-simulator/libeditor_core.a +0 -0
  21. package/ios/EditorLayoutManager.swift +3 -3
  22. package/ios/Generated_editor_core.swift +41 -0
  23. package/ios/NativeEditorExpoView.swift +43 -11
  24. package/ios/NativeEditorModule.swift +6 -0
  25. package/ios/PositionBridge.swift +310 -75
  26. package/ios/RenderBridge.swift +362 -27
  27. package/ios/RichTextEditorView.swift +1983 -187
  28. package/ios/editor_coreFFI/editor_coreFFI.h +33 -0
  29. package/package.json +11 -2
  30. package/rust/android/arm64-v8a/libeditor_core.so +0 -0
  31. package/rust/android/armeabi-v7a/libeditor_core.so +0 -0
  32. package/rust/android/x86_64/libeditor_core.so +0 -0
  33. package/rust/bindings/kotlin/uniffi/editor_core/editor_core.kt +63 -0
package/README.md CHANGED
@@ -49,7 +49,6 @@ The minimum tested Expo version is SDK 54.
49
49
  Required peer dependencies:
50
50
 
51
51
  - `expo`
52
- - `expo-modules-core`
53
52
  - `react`
54
53
  - `react-native`
55
54
  - `@expo/vector-icons`
@@ -57,7 +56,7 @@ Required peer dependencies:
57
56
  Install the package:
58
57
 
59
58
  ```sh
60
- npm install @apollohg/react-native-prose-editor
59
+ npm install @apollohg/react-native-prose-editor@0.4.2
61
60
  ```
62
61
 
63
62
  For local package development in this repo:
@@ -111,12 +110,16 @@ For setup and customization details, start with the [Documentation Index](./docs
111
110
 
112
111
  For realtime collaboration, including the correct `useYjsCollaboration()` wiring, encoded-state persistence, remote cursors, and automatic reconnect behavior, see the [Collaboration Guide](./docs/modules/collaboration.md).
113
112
 
113
+ For whole-document JSON loads, `initialJSON`, controlled `valueJSON`, and `setContentJson()` will normalize an empty root document like `{ type: 'doc', content: [] }` to the active schema's empty text block so block-constrained schemas still load a valid empty document.
114
+
114
115
  ## Development
115
116
 
116
117
  Common commands:
117
118
 
118
119
  ```sh
119
120
  npm run typecheck
121
+ npm run bench:rust -- --quick
122
+ npm run publish:prepare
120
123
  npm run example:start
121
124
  npm run example:ios
122
125
  npm run example:android
@@ -129,6 +132,22 @@ Tests:
129
132
  npm test # TypeScript unit tests
130
133
  cargo test --manifest-path rust/editor-core/Cargo.toml # Rust core tests
131
134
  npm run android:test # Android Robolectric tests
135
+ npm run android:test:perf # Android native perf test suite
136
+ npm run android:test:perf:device # Android on-device perf instrumentation suite
137
+ npm run ios:test:perf # iOS native perf XCTest suite
138
+ npm run ios:test:perf:device # iOS on-device perf XCTest suite
139
+ ```
140
+
141
+ Benchmarks:
142
+
143
+ ```sh
144
+ npm run bench:rust -- --quick
145
+ npm run bench:rust -- --filter collaboration
146
+ npm run bench:rust -- --json > perf-results.json
147
+ npm run android:test:perf
148
+ npm run android:test:perf:device
149
+ npm run ios:test:perf
150
+ npm run ios:test:perf:device
132
151
  ```
133
152
 
134
153
  ## Documentation
@@ -14,10 +14,19 @@ android {
14
14
  namespace "com.apollohg.editor"
15
15
  testOptions {
16
16
  unitTests.includeAndroidResources = true
17
+ unitTests.all { test ->
18
+ if (project.findProperty("apollohgShowPerfTestOutput") == "true") {
19
+ test.testLogging {
20
+ events "passed", "failed"
21
+ showStandardStreams = true
22
+ }
23
+ }
24
+ }
17
25
  }
18
26
  defaultConfig {
19
27
  versionCode 1
20
28
  versionName packageJson.version
29
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
21
30
  }
22
31
 
23
32
  // Include prebuilt Rust .so files from the package's rust/android/ directory
@@ -31,6 +40,16 @@ android {
31
40
  "${project.projectDir}/../rust/bindings/kotlin"
32
41
  ]
33
42
  }
43
+ test {
44
+ java.srcDirs += [
45
+ "${project.projectDir}/src/sharedTest/java"
46
+ ]
47
+ }
48
+ androidTest {
49
+ java.srcDirs += [
50
+ "${project.projectDir}/src/sharedTest/java"
51
+ ]
52
+ }
34
53
  }
35
54
  }
36
55
 
@@ -41,4 +60,8 @@ dependencies {
41
60
 
42
61
  testImplementation "junit:junit:4.13.2"
43
62
  testImplementation "org.robolectric:robolectric:4.14.1"
63
+
64
+ androidTestImplementation "androidx.test:core-ktx:1.6.1"
65
+ androidTestImplementation "androidx.test:runner:1.6.2"
66
+ androidTestImplementation "androidx.test.ext:junit:1.2.1"
44
67
  }