@apollohg/react-native-prose-editor 0.2.0 → 0.3.0

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 (32) hide show
  1. package/android/src/main/java/com/apollohg/editor/EditorEditText.kt +228 -2
  2. package/android/src/main/java/com/apollohg/editor/ImageResizeOverlayView.kt +199 -0
  3. package/android/src/main/java/com/apollohg/editor/NativeEditorExpoView.kt +4 -0
  4. package/android/src/main/java/com/apollohg/editor/NativeEditorModule.kt +3 -0
  5. package/android/src/main/java/com/apollohg/editor/NativeToolbar.kt +6 -0
  6. package/android/src/main/java/com/apollohg/editor/RenderBridge.kt +347 -10
  7. package/android/src/main/java/com/apollohg/editor/RichTextEditorView.kt +76 -8
  8. package/dist/EditorToolbar.d.ts +9 -2
  9. package/dist/EditorToolbar.js +20 -10
  10. package/dist/NativeEditorBridge.d.ts +2 -0
  11. package/dist/NativeEditorBridge.js +3 -0
  12. package/dist/NativeRichTextEditor.d.ts +17 -1
  13. package/dist/NativeRichTextEditor.js +94 -37
  14. package/dist/index.d.ts +2 -2
  15. package/dist/index.js +5 -1
  16. package/dist/schemas.d.ts +12 -0
  17. package/dist/schemas.js +45 -1
  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 +0 -16
  22. package/ios/Generated_editor_core.swift +20 -2
  23. package/ios/NativeEditorExpoView.swift +51 -16
  24. package/ios/NativeEditorModule.swift +3 -0
  25. package/ios/RenderBridge.swift +208 -0
  26. package/ios/RichTextEditorView.swift +896 -15
  27. package/ios/editor_coreFFI/editor_coreFFI.h +11 -0
  28. package/package.json +1 -1
  29. package/rust/android/arm64-v8a/libeditor_core.so +0 -0
  30. package/rust/android/armeabi-v7a/libeditor_core.so +0 -0
  31. package/rust/android/x86_64/libeditor_core.so +0 -0
  32. package/rust/bindings/kotlin/uniffi/editor_core/editor_core.kt +25 -2
@@ -457,6 +457,11 @@ RustBuffer uniffi_editor_core_fn_func_editor_replace_selection_text(uint64_t id,
457
457
  RustBuffer uniffi_editor_core_fn_func_editor_replace_text_scalar(uint64_t id, uint32_t scalar_from, uint32_t scalar_to, RustBuffer text, RustCallStatus *_Nonnull out_status
458
458
  );
459
459
  #endif
460
+ #ifndef UNIFFI_FFIDEF_UNIFFI_EDITOR_CORE_FN_FUNC_EDITOR_RESIZE_IMAGE_AT_DOC_POS
461
+ #define UNIFFI_FFIDEF_UNIFFI_EDITOR_CORE_FN_FUNC_EDITOR_RESIZE_IMAGE_AT_DOC_POS
462
+ RustBuffer uniffi_editor_core_fn_func_editor_resize_image_at_doc_pos(uint64_t id, uint32_t doc_pos, uint32_t width, uint32_t height, RustCallStatus *_Nonnull out_status
463
+ );
464
+ #endif
460
465
  #ifndef UNIFFI_FFIDEF_UNIFFI_EDITOR_CORE_FN_FUNC_EDITOR_SCALAR_TO_DOC
461
466
  #define UNIFFI_FFIDEF_UNIFFI_EDITOR_CORE_FN_FUNC_EDITOR_SCALAR_TO_DOC
462
467
  uint32_t uniffi_editor_core_fn_func_editor_scalar_to_doc(uint64_t id, uint32_t scalar, RustCallStatus *_Nonnull out_status
@@ -1081,6 +1086,12 @@ uint16_t uniffi_editor_core_checksum_func_editor_replace_selection_text(void
1081
1086
  #define UNIFFI_FFIDEF_UNIFFI_EDITOR_CORE_CHECKSUM_FUNC_EDITOR_REPLACE_TEXT_SCALAR
1082
1087
  uint16_t uniffi_editor_core_checksum_func_editor_replace_text_scalar(void
1083
1088
 
1089
+ );
1090
+ #endif
1091
+ #ifndef UNIFFI_FFIDEF_UNIFFI_EDITOR_CORE_CHECKSUM_FUNC_EDITOR_RESIZE_IMAGE_AT_DOC_POS
1092
+ #define UNIFFI_FFIDEF_UNIFFI_EDITOR_CORE_CHECKSUM_FUNC_EDITOR_RESIZE_IMAGE_AT_DOC_POS
1093
+ uint16_t uniffi_editor_core_checksum_func_editor_resize_image_at_doc_pos(void
1094
+
1084
1095
  );
1085
1096
  #endif
1086
1097
  #ifndef UNIFFI_FFIDEF_UNIFFI_EDITOR_CORE_CHECKSUM_FUNC_EDITOR_SCALAR_TO_DOC
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apollohg/react-native-prose-editor",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Native rich text editor with Rust core for React Native",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/apollohg/react-native-prose-editor",
@@ -830,6 +830,8 @@ internal interface UniffiForeignFutureCompleteVoid : com.sun.jna.Callback {
830
830
 
831
831
 
832
832
 
833
+
834
+
833
835
 
834
836
 
835
837
 
@@ -930,6 +932,8 @@ fun uniffi_editor_core_checksum_func_editor_replace_selection_text(
930
932
  ): Short
931
933
  fun uniffi_editor_core_checksum_func_editor_replace_text_scalar(
932
934
  ): Short
935
+ fun uniffi_editor_core_checksum_func_editor_resize_image_at_doc_pos(
936
+ ): Short
933
937
  fun uniffi_editor_core_checksum_func_editor_scalar_to_doc(
934
938
  ): Short
935
939
  fun uniffi_editor_core_checksum_func_editor_set_html(
@@ -1097,6 +1101,8 @@ fun uniffi_editor_core_fn_func_editor_replace_selection_text(`id`: Long,`text`:
1097
1101
  ): RustBuffer.ByValue
1098
1102
  fun uniffi_editor_core_fn_func_editor_replace_text_scalar(`id`: Long,`scalarFrom`: Int,`scalarTo`: Int,`text`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1099
1103
  ): RustBuffer.ByValue
1104
+ fun uniffi_editor_core_fn_func_editor_resize_image_at_doc_pos(`id`: Long,`docPos`: Int,`width`: Int,`height`: Int,uniffi_out_err: UniffiRustCallStatus,
1105
+ ): RustBuffer.ByValue
1100
1106
  fun uniffi_editor_core_fn_func_editor_scalar_to_doc(`id`: Long,`scalar`: Int,uniffi_out_err: UniffiRustCallStatus,
1101
1107
  ): Int
1102
1108
  fun uniffi_editor_core_fn_func_editor_set_html(`id`: Long,`html`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
@@ -1308,7 +1314,7 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) {
1308
1314
  if (lib.uniffi_editor_core_checksum_func_editor_core_version() != 41638.toShort()) {
1309
1315
  throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1310
1316
  }
1311
- if (lib.uniffi_editor_core_checksum_func_editor_create() != 23908.toShort()) {
1317
+ if (lib.uniffi_editor_core_checksum_func_editor_create() != 19812.toShort()) {
1312
1318
  throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1313
1319
  }
1314
1320
  if (lib.uniffi_editor_core_checksum_func_editor_delete_and_split_scalar() != 13764.toShort()) {
@@ -1386,6 +1392,9 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) {
1386
1392
  if (lib.uniffi_editor_core_checksum_func_editor_replace_text_scalar() != 45475.toShort()) {
1387
1393
  throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1388
1394
  }
1395
+ if (lib.uniffi_editor_core_checksum_func_editor_resize_image_at_doc_pos() != 36353.toShort()) {
1396
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1397
+ }
1389
1398
  if (lib.uniffi_editor_core_checksum_func_editor_scalar_to_doc() != 40126.toShort()) {
1390
1399
  throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1391
1400
  }
@@ -1832,12 +1841,14 @@ public object FfiConverterString: FfiConverter<String, RustBuffer.ByValue> {
1832
1841
  /**
1833
1842
  * Create a new editor from a JSON config object.
1834
1843
  *
1835
- * Config fields (all optional — empty object `{}` creates a default editor):
1844
+ * Config fields (all optional):
1836
1845
  * - `"schema"`: custom schema definition (see `Schema::from_json`)
1837
1846
  * - `"maxLength"`: maximum document length in characters
1838
1847
  * - `"readOnly"`: if `true`, rejects non-API mutations
1839
1848
  * - `"inputFilter"`: regex pattern; only matching characters are inserted
1849
+ * - `"allowBase64Images"`: if `true`, parses `<img src="data:image/...">` as image nodes
1840
1850
  *
1851
+ * An empty object creates a default editor.
1841
1852
  * Falls back to the default Tiptap schema when `"schema"` is absent or invalid.
1842
1853
  */ fun `editorCreate`(`configJson`: kotlin.String): kotlin.ULong {
1843
1854
  return FfiConverterULong.lift(
@@ -2150,6 +2161,18 @@ public object FfiConverterString: FfiConverter<String, RustBuffer.ByValue> {
2150
2161
  }
2151
2162
 
2152
2163
 
2164
+ /**
2165
+ * Resize an image node at a document position. Returns an update JSON string.
2166
+ */ fun `editorResizeImageAtDocPos`(`id`: kotlin.ULong, `docPos`: kotlin.UInt, `width`: kotlin.UInt, `height`: kotlin.UInt): kotlin.String {
2167
+ return FfiConverterString.lift(
2168
+ uniffiRustCall() { _status ->
2169
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_resize_image_at_doc_pos(
2170
+ FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`docPos`),FfiConverterUInt.lower(`width`),FfiConverterUInt.lower(`height`),_status)
2171
+ }
2172
+ )
2173
+ }
2174
+
2175
+
2153
2176
  /**
2154
2177
  * Convert a rendered-text scalar offset to a document position.
2155
2178
  */ fun `editorScalarToDoc`(`id`: kotlin.ULong, `scalar`: kotlin.UInt): kotlin.UInt {