@openeditor/react-native-prose-editor 0.0.7 → 0.0.8

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 (68) hide show
  1. package/android/build.gradle +35 -0
  2. package/android/src/main/java/com/apollohg/editor/CaretGeometry.kt +2 -2
  3. package/android/src/main/java/com/apollohg/editor/EditorEditText.kt +138 -597
  4. package/android/src/main/java/com/apollohg/editor/EditorInputConnection.kt +13 -3
  5. package/android/src/main/java/com/apollohg/editor/InputSnapshotSupport.kt +6 -0
  6. package/android/src/main/java/com/apollohg/editor/NativeBlockEditorSurface.kt +1086 -0
  7. package/android/src/main/java/com/apollohg/editor/NativeEditorExpoView.kt +1 -1
  8. package/android/src/main/java/com/apollohg/editor/NativeEditorModule.kt +26 -50
  9. package/android/src/main/java/com/apollohg/editor/NativeImageLoader.kt +89 -0
  10. package/android/src/main/java/com/apollohg/editor/RemoteSelectionOverlayView.kt +31 -66
  11. package/android/src/main/java/com/apollohg/editor/RichTextEditorView.kt +98 -33
  12. package/dist/EditorToolbar.d.ts +1 -1
  13. package/dist/EditorToolbar.js +19 -0
  14. package/dist/NativeEditorBridge.d.ts +62 -35
  15. package/dist/NativeEditorBridge.js +122 -79
  16. package/dist/NativeProseViewer.d.ts +13 -34
  17. package/dist/NativeProseViewer.js +40 -465
  18. package/dist/NativeRichTextEditor.d.ts +10 -1
  19. package/dist/NativeRichTextEditor.js +72 -34
  20. package/dist/index.d.ts +2 -2
  21. package/dist/index.js +2 -1
  22. package/dist/schemas.d.ts +11 -0
  23. package/dist/schemas.js +149 -0
  24. package/dist/useNativeEditor.d.ts +3 -3
  25. package/dist/useNativeEditor.js +3 -3
  26. package/ios/EditorCore.xcframework/ios-arm64/libeditor_core.a +0 -0
  27. package/ios/EditorCore.xcframework/ios-arm64_x86_64-simulator/libeditor_core.a +0 -0
  28. package/ios/Generated_editor_core.swift +97 -2
  29. package/ios/NativeBlockEditorSurface.swift +1393 -0
  30. package/ios/NativeEditorExpoView.swift +3 -3
  31. package/ios/NativeEditorModule.swift +30 -45
  32. package/ios/NativeInputSupport.swift +396 -0
  33. package/ios/PositionBridge.swift +4 -4
  34. package/ios/RichTextEditorView.swift +333 -786
  35. package/ios/editor_coreFFI/editor_coreFFI.h +147 -70
  36. package/package.json +1 -1
  37. package/rust/android/arm64-v8a/libeditor_core.so +0 -0
  38. package/rust/android/armeabi-v7a/libeditor_core.so +0 -0
  39. package/rust/android/x86_64/libeditor_core.so +0 -0
  40. package/rust/bindings/kotlin/uniffi/editor_core/editor_core.kt +2087 -1399
  41. package/android/src/androidTest/AndroidManifest.xml +0 -8
  42. package/android/src/androidTest/java/com/apollohg/editor/MeasureHeightInstrumentedTest.kt +0 -53
  43. package/android/src/androidTest/java/com/apollohg/editor/NativeDeviceCollaborationInitialSyncTest.kt +0 -241
  44. package/android/src/androidTest/java/com/apollohg/editor/NativeDeviceImeRegressionTest.kt +0 -338
  45. package/android/src/androidTest/java/com/apollohg/editor/NativeDeviceOutsideTapTest.kt +0 -789
  46. package/android/src/androidTest/java/com/apollohg/editor/NativeDevicePerformanceTest.kt +0 -350
  47. package/android/src/androidTest/java/com/apollohg/editor/NativeEditorOutsideTapActivity.kt +0 -5
  48. package/android/src/main/java/com/apollohg/editor/NativeProseViewerExpoView.kt +0 -315
  49. package/android/src/main/java/com/apollohg/editor/RenderBridge.kt +0 -2172
  50. package/android/src/sharedTest/java/com/apollohg/editor/NativePerformanceSupport.kt +0 -482
  51. package/android/src/test/java/com/apollohg/editor/CaretGeometryTest.kt +0 -137
  52. package/android/src/test/java/com/apollohg/editor/EditorEditTextHardwareKeyTest.kt +0 -321
  53. package/android/src/test/java/com/apollohg/editor/EditorInputConnectionTest.kt +0 -4202
  54. package/android/src/test/java/com/apollohg/editor/NativeEditorExpoViewTest.kt +0 -2581
  55. package/android/src/test/java/com/apollohg/editor/NativeEditorModuleTest.kt +0 -27
  56. package/android/src/test/java/com/apollohg/editor/NativePerformanceTest.kt +0 -197
  57. package/android/src/test/java/com/apollohg/editor/NativeProseViewerExpoViewTest.kt +0 -84
  58. package/android/src/test/java/com/apollohg/editor/NativeToolbarTest.kt +0 -544
  59. package/android/src/test/java/com/apollohg/editor/PositionBridgeTest.kt +0 -461
  60. package/android/src/test/java/com/apollohg/editor/RenderBridgeTest.kt +0 -2054
  61. package/android/src/test/java/com/apollohg/editor/RichTextEditorViewTest.kt +0 -1367
  62. package/ios/EditorLayoutManager.swift +0 -774
  63. package/ios/NativeProseViewerExpoView.swift +0 -276
  64. package/ios/RenderBridge.swift +0 -1708
  65. package/ios/Tests/NativePerformanceTests.swift +0 -687
  66. package/ios/Tests/PositionBridgeTests.swift +0 -706
  67. package/ios/Tests/RenderBridgeTests.swift +0 -2236
  68. package/ios/Tests/RichTextEditorViewTests.swift +0 -6548
@@ -62,8 +62,43 @@ dependencies {
62
62
 
63
63
  testImplementation "junit:junit:4.13.2"
64
64
  testImplementation "org.robolectric:robolectric:4.14.1"
65
+ // JVM unit tests execute UniFFI through JNA on the host. The Android AAR
66
+ // above only contains device .so files, so Robolectric also needs JNA's
67
+ // host JAR (including the macOS native dispatcher).
68
+ testRuntimeOnly "net.java.dev.jna:jna:5.18.1@jar"
65
69
 
66
70
  androidTestImplementation "androidx.test:core-ktx:1.6.1"
67
71
  androidTestImplementation "androidx.test:runner:1.6.2"
68
72
  androidTestImplementation "androidx.test.ext:junit:1.2.1"
69
73
  }
74
+
75
+ // Android's Gradle artifact transform strips the desktop dispatch library from
76
+ // JNA's JAR. Restore that host-only resource for Robolectric/UniFFI tests.
77
+ def hostJnaRuntime = configurations.detachedConfiguration(
78
+ dependencies.create("net.java.dev.jna:jna:5.18.1@jar")
79
+ )
80
+ def buildHostEditorCore = tasks.register("buildHostEditorCore", Exec) {
81
+ workingDir file("../rust/editor-core")
82
+ commandLine "cargo", "build", "--release"
83
+ }
84
+ tasks.withType(org.gradle.api.tasks.testing.Test).configureEach { test ->
85
+ def osName = System.getProperty("os.name").toLowerCase(Locale.ROOT)
86
+ def architecture = System.getProperty("os.arch").toLowerCase(Locale.ROOT)
87
+ def jnaPlatform = osName.contains("mac")
88
+ ? (architecture.contains("aarch64") || architecture.contains("arm64") ? "darwin-aarch64" : "darwin-x86-64")
89
+ : (architecture.contains("aarch64") || architecture.contains("arm64") ? "linux-aarch64" : "linux-x86-64")
90
+ def hostLibraryDir = layout.buildDirectory.dir("jna-host/${jnaPlatform}")
91
+
92
+ systemProperty "jna.boot.library.path", hostLibraryDir.get().asFile.absolutePath
93
+ systemProperty "jna.library.path", file("../rust/editor-core/target/release").absolutePath
94
+ dependsOn buildHostEditorCore
95
+ doFirst {
96
+ copy {
97
+ from zipTree(hostJnaRuntime.singleFile)
98
+ include "com/sun/jna/${jnaPlatform}/*"
99
+ eachFile { details -> details.path = details.name }
100
+ includeEmptyDirs = false
101
+ into hostLibraryDir
102
+ }
103
+ }
104
+ }
@@ -8,8 +8,8 @@ import android.text.Layout
8
8
  *
9
9
  * Android's [android.widget.Editor] draws the native caret from
10
10
  * `Layout.getLineTop(line)` to `Layout.getLineBottom(line)`. When a
11
- * [ParagraphSpacerSpan] inflates a line's descent to create inter-block
12
- * spacing, `getLineBottom` includes that gap and the caret stretches into it.
11
+ * line-height span inflates a line's descent, `getLineBottom` includes that
12
+ * extra space and the caret stretches into it.
13
13
  * `getLineBottomWithoutSpacing` cannot help: the inflation lives in the line's
14
14
  * DESCENT column, not the line-spacing EXTRA column it subtracts.
15
15
  *