@openeditor/react-native-prose-editor 0.0.9 → 0.0.11
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.
- package/README.md +5 -9
- package/android/src/main/java/com/apollohg/editor/EditorTheme.kt +23 -0
- package/android/src/main/java/com/apollohg/editor/ImageResizeOverlayView.kt +2 -2
- package/android/src/main/java/com/apollohg/editor/NativeBlockEditorSurface.kt +476 -53
- package/android/src/main/java/com/apollohg/editor/NativeEditorExpoView.kt +110 -169
- package/android/src/main/java/com/apollohg/editor/NativeEditorModule.kt +1 -1
- package/android/src/main/java/com/apollohg/editor/RichTextEditorView.kt +124 -337
- package/dist/EditorTheme.d.ts +8 -0
- package/ios/EditorCore.xcframework/ios-arm64/libeditor_core.a +0 -0
- package/ios/EditorCore.xcframework/ios-arm64_x86_64-simulator/libeditor_core.a +0 -0
- package/ios/Generated_editor_core.swift +15 -0
- package/ios/NativeBlockEditorSurface.swift +371 -60
- package/ios/NativeEditorExpoView.swift +114 -117
- package/ios/NativeInputSupport.swift +0 -302
- package/ios/PositionBridge.swift +22 -548
- package/ios/RichTextEditorView.swift +217 -4671
- package/ios/editor_coreFFI/editor_coreFFI.h +11 -0
- package/package.json +1 -1
- package/rust/android/arm64-v8a/libeditor_core.so +0 -0
- package/rust/android/armeabi-v7a/libeditor_core.so +0 -0
- package/rust/android/x86_64/libeditor_core.so +0 -0
- package/rust/bindings/kotlin/uniffi/editor_core/editor_core.kt +31 -0
- package/android/src/main/java/com/apollohg/editor/CaretGeometry.kt +0 -50
- package/android/src/main/java/com/apollohg/editor/EditorEditText.kt +0 -4068
- package/android/src/main/java/com/apollohg/editor/EditorInputConnection.kt +0 -1009
- package/android/src/main/java/com/apollohg/editor/InputSnapshotSupport.kt +0 -6
|
@@ -617,6 +617,11 @@ RustBuffer uniffi_editor_core_fn_func_editor_unwrap_from_list(uint64_t id, RustC
|
|
|
617
617
|
RustBuffer uniffi_editor_core_fn_func_editor_unwrap_from_list_at_selection_scalar(uint64_t id, uint32_t scalar_anchor, uint32_t scalar_head, RustCallStatus *_Nonnull out_status
|
|
618
618
|
);
|
|
619
619
|
#endif
|
|
620
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_EDITOR_CORE_FN_FUNC_EDITOR_UPDATE_NODE_ATTRS
|
|
621
|
+
#define UNIFFI_FFIDEF_UNIFFI_EDITOR_CORE_FN_FUNC_EDITOR_UPDATE_NODE_ATTRS
|
|
622
|
+
RustBuffer uniffi_editor_core_fn_func_editor_update_node_attrs(uint64_t id, uint32_t pos, RustBuffer attrs_json, RustCallStatus *_Nonnull out_status
|
|
623
|
+
);
|
|
624
|
+
#endif
|
|
620
625
|
#ifndef UNIFFI_FFIDEF_UNIFFI_EDITOR_CORE_FN_FUNC_EDITOR_WRAP_IN_LIST
|
|
621
626
|
#define UNIFFI_FFIDEF_UNIFFI_EDITOR_CORE_FN_FUNC_EDITOR_WRAP_IN_LIST
|
|
622
627
|
RustBuffer uniffi_editor_core_fn_func_editor_wrap_in_list(uint64_t id, RustBuffer list_type, RustCallStatus *_Nonnull out_status
|
|
@@ -1343,6 +1348,12 @@ uint16_t uniffi_editor_core_checksum_func_editor_unwrap_from_list(void
|
|
|
1343
1348
|
#define UNIFFI_FFIDEF_UNIFFI_EDITOR_CORE_CHECKSUM_FUNC_EDITOR_UNWRAP_FROM_LIST_AT_SELECTION_SCALAR
|
|
1344
1349
|
uint16_t uniffi_editor_core_checksum_func_editor_unwrap_from_list_at_selection_scalar(void
|
|
1345
1350
|
|
|
1351
|
+
);
|
|
1352
|
+
#endif
|
|
1353
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_EDITOR_CORE_CHECKSUM_FUNC_EDITOR_UPDATE_NODE_ATTRS
|
|
1354
|
+
#define UNIFFI_FFIDEF_UNIFFI_EDITOR_CORE_CHECKSUM_FUNC_EDITOR_UPDATE_NODE_ATTRS
|
|
1355
|
+
uint16_t uniffi_editor_core_checksum_func_editor_update_node_attrs(void
|
|
1356
|
+
|
|
1346
1357
|
);
|
|
1347
1358
|
#endif
|
|
1348
1359
|
#ifndef UNIFFI_FFIDEF_UNIFFI_EDITOR_CORE_CHECKSUM_FUNC_EDITOR_WRAP_IN_LIST
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openeditor/react-native-prose-editor",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"description": "OpenEditor-owned native rich text editor engine for React Native",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/EasyLink-HQ/openeditor",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -911,6 +911,8 @@ internal interface IntegrityCheckingUniffiLib : Library {
|
|
|
911
911
|
|
|
912
912
|
fun uniffi_editor_core_checksum_func_editor_unwrap_from_list_at_selection_scalar(): Short
|
|
913
913
|
|
|
914
|
+
fun uniffi_editor_core_checksum_func_editor_update_node_attrs(): Short
|
|
915
|
+
|
|
914
916
|
fun uniffi_editor_core_checksum_func_editor_wrap_in_list(): Short
|
|
915
917
|
|
|
916
918
|
fun uniffi_editor_core_checksum_func_editor_wrap_in_list_at_selection_scalar(): Short
|
|
@@ -1398,6 +1400,13 @@ internal interface UniffiLib : Library {
|
|
|
1398
1400
|
uniffi_out_err: UniffiRustCallStatus,
|
|
1399
1401
|
): RustBuffer.ByValue
|
|
1400
1402
|
|
|
1403
|
+
fun uniffi_editor_core_fn_func_editor_update_node_attrs(
|
|
1404
|
+
`id`: Long,
|
|
1405
|
+
`pos`: Int,
|
|
1406
|
+
`attrsJson`: RustBuffer.ByValue,
|
|
1407
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
1408
|
+
): RustBuffer.ByValue
|
|
1409
|
+
|
|
1401
1410
|
fun uniffi_editor_core_fn_func_editor_wrap_in_list(
|
|
1402
1411
|
`id`: Long,
|
|
1403
1412
|
`listType`: RustBuffer.ByValue,
|
|
@@ -1860,6 +1869,9 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) {
|
|
|
1860
1869
|
if (lib.uniffi_editor_core_checksum_func_editor_unwrap_from_list_at_selection_scalar() != 57899.toShort()) {
|
|
1861
1870
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1862
1871
|
}
|
|
1872
|
+
if (lib.uniffi_editor_core_checksum_func_editor_update_node_attrs() != 14684.toShort()) {
|
|
1873
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1874
|
+
}
|
|
1863
1875
|
if (lib.uniffi_editor_core_checksum_func_editor_wrap_in_list() != 32846.toShort()) {
|
|
1864
1876
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1865
1877
|
}
|
|
@@ -3212,6 +3224,25 @@ fun `editorUnwrapFromListAtSelectionScalar`(
|
|
|
3212
3224
|
},
|
|
3213
3225
|
)
|
|
3214
3226
|
|
|
3227
|
+
/**
|
|
3228
|
+
* Replace a node's attributes at its document position.
|
|
3229
|
+
*/
|
|
3230
|
+
fun `editorUpdateNodeAttrs`(
|
|
3231
|
+
`id`: kotlin.ULong,
|
|
3232
|
+
`pos`: kotlin.UInt,
|
|
3233
|
+
`attrsJson`: kotlin.String,
|
|
3234
|
+
): kotlin.String =
|
|
3235
|
+
FfiConverterString.lift(
|
|
3236
|
+
uniffiRustCall { _status ->
|
|
3237
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_update_node_attrs(
|
|
3238
|
+
FfiConverterULong.lower(`id`),
|
|
3239
|
+
FfiConverterUInt.lower(`pos`),
|
|
3240
|
+
FfiConverterString.lower(`attrsJson`),
|
|
3241
|
+
_status,
|
|
3242
|
+
)
|
|
3243
|
+
},
|
|
3244
|
+
)
|
|
3245
|
+
|
|
3215
3246
|
/**
|
|
3216
3247
|
* Wrap the current selection in a list. Returns an update JSON string.
|
|
3217
3248
|
*/
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
package com.openeditor.editor
|
|
2
|
-
|
|
3
|
-
import android.graphics.Paint
|
|
4
|
-
import android.text.Layout
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Vertical geometry for the text caret, clipped to the rendered glyph height.
|
|
8
|
-
*
|
|
9
|
-
* Android's [android.widget.Editor] draws the native caret from
|
|
10
|
-
* `Layout.getLineTop(line)` to `Layout.getLineBottom(line)`. When a
|
|
11
|
-
* line-height span inflates a line's descent, `getLineBottom` includes that
|
|
12
|
-
* extra space and the caret stretches into it.
|
|
13
|
-
* `getLineBottomWithoutSpacing` cannot help: the inflation lives in the line's
|
|
14
|
-
* DESCENT column, not the line-spacing EXTRA column it subtracts.
|
|
15
|
-
*
|
|
16
|
-
* The baseline is provably independent of descent inflation
|
|
17
|
-
* (`getLineBaseline(line) == getLineTop(line) - ascent`), so anchoring the
|
|
18
|
-
* caret bottom at `baseline + raw font descent` clips it to the glyph height.
|
|
19
|
-
* This mirrors the trim already used for blockquote stripes
|
|
20
|
-
* ([BlockquoteSpan.resolvedStripeBottom]).
|
|
21
|
-
*/
|
|
22
|
-
object CaretGeometry {
|
|
23
|
-
data class VerticalBounds(val top: Float, val bottom: Float)
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Whether the manually-drawn caret should be visible. The native caret is
|
|
27
|
-
* suppressed, so this gates our replacement: only when the field is focused,
|
|
28
|
-
* its window is focused, and the selection is a collapsed insertion point
|
|
29
|
-
* (a range selection shows the selection highlight instead).
|
|
30
|
-
*/
|
|
31
|
-
fun shouldRender(
|
|
32
|
-
focused: Boolean,
|
|
33
|
-
windowFocused: Boolean,
|
|
34
|
-
selectionStart: Int,
|
|
35
|
-
selectionEnd: Int
|
|
36
|
-
): Boolean = focused &&
|
|
37
|
-
windowFocused &&
|
|
38
|
-
selectionStart >= 0 &&
|
|
39
|
-
selectionStart == selectionEnd
|
|
40
|
-
|
|
41
|
-
fun verticalBounds(layout: Layout, offset: Int, paint: Paint): VerticalBounds {
|
|
42
|
-
val line = layout.getLineForOffset(offset.coerceIn(0, layout.text.length))
|
|
43
|
-
val top = layout.getLineTop(line).toFloat()
|
|
44
|
-
// Anchor the bottom at the glyph descent below the baseline. The baseline
|
|
45
|
-
// is independent of any ReplacementSpan descent inflation, so this clips
|
|
46
|
-
// the caret to the rendered text height instead of the inflated line bottom.
|
|
47
|
-
val bottom = layout.getLineBaseline(line) + paint.fontMetrics.descent
|
|
48
|
-
return VerticalBounds(top, bottom)
|
|
49
|
-
}
|
|
50
|
-
}
|