@apollohg/react-native-rich-text-editor 2.0.1 → 2.0.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.
- package/README.md +8 -116
- package/android/src/main/java/com/apollohg/editor/EditorEditTextImages.kt +25 -0
- package/android/src/main/java/com/apollohg/editor/EditorV2RenderValidation.kt +1 -0
- package/android/src/main/java/com/apollohg/editor/ImageResizeOverlayView.kt +101 -33
- package/android/src/main/java/com/apollohg/editor/RenderMediaSpans.kt +15 -3
- package/android/src/main/java/com/apollohg/editor/RichTextEditorView.kt +14 -0
- package/android/src/main/java/com/apollohg/editor/viewer/AndroidProseLayoutEngine.kt +1 -1
- package/dist/EditorStyleSheetNormalization.js +1 -1
- package/dist/EditorStyleSheetTypes.d.ts +1 -1
- package/ios/EditorCore.xcframework/Info.plist +5 -5
- 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/EditorInteractionOverlays.swift +114 -122
- package/ios/EditorLayoutManager.swift +13 -3
- package/ios/EditorStyleSheet.swift +12 -1
- package/ios/EditorTextView+Images.swift +32 -10
- package/ios/EditorTextView.swift +1 -1
- package/ios/EditorV2Adapter+RenderValidation.swift +2 -2
- package/ios/NativeToolbar+ButtonStyle.swift +17 -5
- package/ios/NativeToolbar+Diagnostics.swift +15 -0
- package/ios/RenderBridge+Atoms.swift +0 -1
- package/ios/RenderBridge+Attachments.swift +0 -29
- package/ios/RichTextEditorView.swift +4 -12
- package/ios/Viewer/CoreTextProseLayoutEngine+AttributedText.swift +3 -2
- 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/libeditor_core.so +0 -0
- package/rust/android/x86_64/libeditor_core.so +0 -0
- package/src/EditorStyleSheetNormalization.ts +1 -1
- package/src/EditorStyleSheetTypes.ts +1 -1
|
@@ -684,10 +684,6 @@ final class RichTextEditorView: UIView {
|
|
|
684
684
|
imageTapOverlayView.handleTapForTesting(convert(point, to: imageTapOverlayView))
|
|
685
685
|
}
|
|
686
686
|
|
|
687
|
-
func imageResizePreviewHasImageForTesting() -> Bool {
|
|
688
|
-
imageResizeOverlayView.previewHasImageForTesting
|
|
689
|
-
}
|
|
690
|
-
|
|
691
687
|
func refreshSelectionVisualStateForTesting() {
|
|
692
688
|
textView.refreshSelectionVisualState()
|
|
693
689
|
}
|
|
@@ -708,6 +704,10 @@ final class RichTextEditorView: UIView {
|
|
|
708
704
|
imageResizeOverlayView.simulatePreviewResizeForTesting(width: width, height: height)
|
|
709
705
|
}
|
|
710
706
|
|
|
707
|
+
func previewImageResizeDragForTesting(corner: ImageResizeOverlayView.Corner, translation: CGPoint) {
|
|
708
|
+
imageResizeOverlayView.simulatePreviewDragForTesting(corner: corner, translation: translation)
|
|
709
|
+
}
|
|
710
|
+
|
|
711
711
|
func commitPreviewResizeForTesting() {
|
|
712
712
|
imageResizeOverlayView.commitPreviewResizeForTesting()
|
|
713
713
|
}
|
|
@@ -803,14 +803,6 @@ final class RichTextEditorView: UIView {
|
|
|
803
803
|
textView.setImageResizePreviewActive(active)
|
|
804
804
|
}
|
|
805
805
|
|
|
806
|
-
func imagePreviewForResize(docPos: UInt32) -> UIImage? {
|
|
807
|
-
textView.imagePreviewForDocPos(docPos)
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
func imageResizePreviewBackgroundColor() -> UIColor {
|
|
811
|
-
textView.backgroundColor ?? .systemBackground
|
|
812
|
-
}
|
|
813
|
-
|
|
814
806
|
func maximumImageWidthForResizeGesture() -> CGFloat {
|
|
815
807
|
textView.maximumRenderableImageWidth()
|
|
816
808
|
}
|
|
@@ -79,8 +79,9 @@ extension CoreTextProseLayoutEngine {
|
|
|
79
79
|
let labelWidth = CGFloat(CTLineGetTypographicBounds(labelLine, &labelAscent, &labelDescent, &labelLeading))
|
|
80
80
|
let requestedHeight = EditorTheme.cgFloat(appearance.attributes[editorInlineLineHeightAttribute]) ?? 0
|
|
81
81
|
let extra = max(0, requestedHeight - labelAscent - max(labelDescent, 2)) / 2
|
|
82
|
+
let paddedWidth = labelWidth + appearance.padding.left + appearance.padding.right
|
|
82
83
|
let metrics = PreparedAtomMetrics(
|
|
83
|
-
width: max(paint.font.lineHeight,
|
|
84
|
+
width: nodeType == "mention" ? paddedWidth : max(paint.font.lineHeight, paddedWidth),
|
|
84
85
|
ascent: labelAscent + extra + appearance.padding.top,
|
|
85
86
|
descent: max(labelDescent, 2) + extra + appearance.padding.bottom
|
|
86
87
|
)
|
|
@@ -388,7 +389,7 @@ extension CoreTextProseLayoutEngine {
|
|
|
388
389
|
var boxValues = values
|
|
389
390
|
boxValues["backgroundColor"] = values["backgroundColor"] ?? "#007aff1f"
|
|
390
391
|
let box = EditorStyleBox(boxValues)
|
|
391
|
-
return PreparedAtomAppearance(styleBox: box, attributes: coreTextAttributes(styled), background: box.color("backgroundColor") ?? .clear, borderColor: nil, borderWidth: 0, radius: 0, padding:
|
|
392
|
+
return PreparedAtomAppearance(styleBox: box, attributes: coreTextAttributes(styled), background: box.color("backgroundColor") ?? .clear, borderColor: nil, borderWidth: 0, radius: 0, padding: box.mentionInsets)
|
|
392
393
|
}
|
|
393
394
|
return PreparedAtomAppearance(
|
|
394
395
|
attributes: attributes,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apollohg/react-native-rich-text-editor",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
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-rich-text-editor",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -70,7 +70,7 @@ const fields: Record<keyof EditorStyleMap, readonly string[]> = {
|
|
|
70
70
|
italic: inline,
|
|
71
71
|
underline: inline,
|
|
72
72
|
strike: inline,
|
|
73
|
-
mention: [ ...inline, ...border ],
|
|
73
|
+
mention: [ ...inline, ...border, ...spacing('padding') ],
|
|
74
74
|
placeholder: typography,
|
|
75
75
|
};
|
|
76
76
|
|
|
@@ -113,7 +113,7 @@ export interface EditorHorizontalRuleStyle extends EditorBorderStyle, EditorMarg
|
|
|
113
113
|
height?: number;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
export interface EditorMentionStyle extends EditorInlineStyle, EditorBorderStyle {}
|
|
116
|
+
export interface EditorMentionStyle extends EditorInlineStyle, EditorBorderStyle, EditorPaddingStyle {}
|
|
117
117
|
|
|
118
118
|
export interface EditorStyleMap {
|
|
119
119
|
content: EditorSurfaceStyle;
|