@apollohg/react-native-prose-editor 0.5.7 → 0.5.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.
@@ -339,7 +339,7 @@ class EditorEditText @JvmOverloads constructor(
339
339
  val resolvedTypeface = resolvePlaceholderTypeface(textStyle)
340
340
 
341
341
  return TextPaint(paint).apply {
342
- color = currentHintTextColor
342
+ color = theme?.placeholderColor ?: currentHintTextColor
343
343
  textSize = resolvedTextSize
344
344
  typeface = resolvedTypeface
345
345
  }
@@ -304,6 +304,7 @@ data class EditorTheme(
304
304
  val mentions: EditorMentionTheme? = null,
305
305
  val links: EditorLinkTheme? = null,
306
306
  val toolbar: EditorToolbarTheme? = null,
307
+ val placeholderColor: Int? = null,
307
308
  val backgroundColor: Int? = null,
308
309
  val borderRadius: Float? = null,
309
310
  val contentInsets: EditorContentInsets? = null
@@ -335,6 +336,7 @@ data class EditorTheme(
335
336
  mentions = EditorMentionTheme.fromJson(root.optJSONObject("mentions")),
336
337
  links = EditorLinkTheme.fromJson(root.optJSONObject("links")),
337
338
  toolbar = EditorToolbarTheme.fromJson(root.optJSONObject("toolbar")),
339
+ placeholderColor = parseColor(root.optNullableString("placeholderColor")),
338
340
  backgroundColor = parseColor(root.optNullableString("backgroundColor")),
339
341
  borderRadius = root.optNullableFloat("borderRadius"),
340
342
  contentInsets = EditorContentInsets.fromJson(root.optJSONObject("contentInsets"))
@@ -405,8 +405,19 @@ class NativeEditorExpoView(
405
405
  return false
406
406
  }
407
407
  val toolbarFrame = toolbarFrameInWindow
408
- if (toolbarFrame != null && toolbarFrame.contains(event.rawX, event.rawY)) {
409
- return false
408
+ if (toolbarFrame != null) {
409
+ // toolbarFrame is in DP (from React Native's measureInWindow),
410
+ // but rawX/rawY are in pixels — convert before comparing.
411
+ val density = resources.displayMetrics.density
412
+ val frameInPx = RectF(
413
+ toolbarFrame.left * density,
414
+ toolbarFrame.top * density,
415
+ toolbarFrame.right * density,
416
+ toolbarFrame.bottom * density
417
+ )
418
+ if (frameInPx.contains(event.rawX, event.rawY)) {
419
+ return false
420
+ }
410
421
  }
411
422
  val rect = Rect()
412
423
  richTextView.editorEditText.getGlobalVisibleRect(rect)
@@ -96,6 +96,7 @@ export interface EditorTheme {
96
96
  mentions?: EditorMentionTheme;
97
97
  links?: EditorLinkTheme;
98
98
  toolbar?: EditorToolbarTheme;
99
+ placeholderColor?: string;
99
100
  backgroundColor?: string;
100
101
  borderRadius?: number;
101
102
  contentInsets?: EditorContentInsets;
@@ -299,6 +299,7 @@ struct EditorTheme {
299
299
  var mentions: EditorMentionTheme?
300
300
  var links: EditorLinkTheme?
301
301
  var toolbar: EditorToolbarTheme?
302
+ var placeholderColor: UIColor?
302
303
  var backgroundColor: UIColor?
303
304
  var borderRadius: CGFloat?
304
305
  var contentInsets: EditorContentInsets?
@@ -345,6 +346,7 @@ struct EditorTheme {
345
346
  if let toolbar = dictionary["toolbar"] as? [String: Any] {
346
347
  self.toolbar = EditorToolbarTheme(dictionary: toolbar)
347
348
  }
349
+ placeholderColor = EditorTheme.color(from: dictionary["placeholderColor"])
348
350
  backgroundColor = EditorTheme.color(from: dictionary["backgroundColor"])
349
351
  borderRadius = EditorTheme.cgFloat(dictionary["borderRadius"])
350
352
  if let contentInsets = dictionary["contentInsets"] as? [String: Any] {
@@ -865,6 +865,7 @@ final class EditorTextView: UITextView, UITextViewDelegate, UIGestureRecognizerD
865
865
  didSet {
866
866
  renderAppearanceRevision &+= 1
867
867
  placeholderLabel.font = resolvedDefaultFont()
868
+ placeholderLabel.textColor = theme?.placeholderColor ?? .placeholderText
868
869
  backgroundColor = theme?.backgroundColor ?? baseBackgroundColor
869
870
  if let contentInsets = theme?.contentInsets {
870
871
  textContainerInset = UIEdgeInsets(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apollohg/react-native-prose-editor",
3
- "version": "0.5.7",
3
+ "version": "0.5.8",
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",