react-native-enriched-markdown-scaffold 0.7.4-scaffold.10 → 0.7.4-scaffold.12

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 (74) hide show
  1. package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownManagerDelegate.java +3 -0
  2. package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownManagerInterface.java +1 -0
  3. package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownTextInputManagerDelegate.java +6 -0
  4. package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownTextInputManagerInterface.java +2 -0
  5. package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownTextManagerDelegate.java +3 -0
  6. package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownTextManagerInterface.java +1 -0
  7. package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/EventEmitters.cpp +10 -0
  8. package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/EventEmitters.h +7 -0
  9. package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/Props.cpp +15 -0
  10. package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/Props.h +3 -0
  11. package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdown.kt +39 -0
  12. package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownInternalText.kt +11 -0
  13. package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownManager.kt +8 -0
  14. package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownText.kt +14 -0
  15. package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownTextManager.kt +8 -0
  16. package/android/src/main/java/com/swmansion/enriched/markdown/input/EnrichedMarkdownTextInputManager.kt +18 -0
  17. package/android/src/main/java/com/swmansion/enriched/markdown/input/EnrichedMarkdownTextInputView.kt +128 -0
  18. package/android/src/main/java/com/swmansion/enriched/markdown/input/events/OnPasteEvent.kt +24 -0
  19. package/android/src/main/java/com/swmansion/enriched/markdown/input/layout/InputEventEmitter.kt +8 -0
  20. package/android/src/main/java/com/swmansion/enriched/markdown/utils/input/PasteTextUtils.kt +20 -0
  21. package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/view/SelectionActionMode.kt +19 -2
  22. package/android/src/main/java/com/swmansion/enriched/markdown/views/TableContainerView.kt +2 -0
  23. package/android/src/math/java/com/swmansion/enriched/markdown/views/MathContainerView.kt +2 -0
  24. package/docs/API_REFERENCE.md +64 -0
  25. package/docs/COPY_OPTIONS.md +13 -0
  26. package/docs/INPUT.md +39 -0
  27. package/docs/WEB.md +1 -0
  28. package/ios/EnrichedMarkdown.mm +14 -0
  29. package/ios/EnrichedMarkdownText.mm +10 -0
  30. package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/EventEmitters.cpp +10 -0
  31. package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/EventEmitters.h +7 -0
  32. package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/Props.cpp +15 -0
  33. package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/Props.h +3 -0
  34. package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/RCTComponentViewHelpers.h +29 -0
  35. package/ios/input/ENRMInputTextView.mm +11 -1
  36. package/ios/input/EnrichedMarkdownTextInput.h +5 -0
  37. package/ios/input/EnrichedMarkdownTextInput.mm +33 -0
  38. package/ios/views/ENRMMathContainerView.h +4 -0
  39. package/ios/views/ENRMMathContainerView.m +11 -0
  40. package/ios/views/TableContainerView.h +4 -0
  41. package/ios/views/TableContainerView.m +7 -0
  42. package/lib/module/EnrichedMarkdownNativeComponent.ts +4 -0
  43. package/lib/module/EnrichedMarkdownTextInput.js +15 -0
  44. package/lib/module/EnrichedMarkdownTextInput.js.map +1 -1
  45. package/lib/module/EnrichedMarkdownTextInputNativeComponent.ts +22 -0
  46. package/lib/module/EnrichedMarkdownTextNativeComponent.ts +4 -0
  47. package/lib/module/index.js.map +1 -1
  48. package/lib/module/native/EnrichedMarkdownText.js +2 -0
  49. package/lib/module/native/EnrichedMarkdownText.js.map +1 -1
  50. package/lib/typescript/src/EnrichedMarkdownNativeComponent.d.ts +4 -0
  51. package/lib/typescript/src/EnrichedMarkdownNativeComponent.d.ts.map +1 -1
  52. package/lib/typescript/src/EnrichedMarkdownTextInput.d.ts +24 -1
  53. package/lib/typescript/src/EnrichedMarkdownTextInput.d.ts.map +1 -1
  54. package/lib/typescript/src/EnrichedMarkdownTextInputNativeComponent.d.ts +16 -0
  55. package/lib/typescript/src/EnrichedMarkdownTextInputNativeComponent.d.ts.map +1 -1
  56. package/lib/typescript/src/EnrichedMarkdownTextNativeComponent.d.ts +4 -0
  57. package/lib/typescript/src/EnrichedMarkdownTextNativeComponent.d.ts.map +1 -1
  58. package/lib/typescript/src/index.d.ts +1 -1
  59. package/lib/typescript/src/index.d.ts.map +1 -1
  60. package/lib/typescript/src/native/EnrichedMarkdownText.d.ts +1 -1
  61. package/lib/typescript/src/native/EnrichedMarkdownText.d.ts.map +1 -1
  62. package/lib/typescript/src/types/MarkdownTextProps.d.ts +16 -0
  63. package/lib/typescript/src/types/MarkdownTextProps.d.ts.map +1 -1
  64. package/lib/typescript/src/types/events.d.ts +15 -0
  65. package/lib/typescript/src/types/events.d.ts.map +1 -1
  66. package/package.json +1 -1
  67. package/src/EnrichedMarkdownNativeComponent.ts +4 -0
  68. package/src/EnrichedMarkdownTextInput.tsx +37 -0
  69. package/src/EnrichedMarkdownTextInputNativeComponent.ts +22 -0
  70. package/src/EnrichedMarkdownTextNativeComponent.ts +4 -0
  71. package/src/index.tsx +1 -0
  72. package/src/native/EnrichedMarkdownText.tsx +2 -0
  73. package/src/types/MarkdownTextProps.ts +16 -0
  74. package/src/types/events.ts +16 -0
@@ -4,6 +4,6 @@ import type { LinkPressEvent, LinkLongPressEvent, TaskListItemPressEvent } from
4
4
  export type { MarkdownStyle, Md4cFlags };
5
5
  export type { EnrichedMarkdownTextProps, StreamingConfig, ContextMenuItem, SelectionMenuConfig, SelectionMenuPluralLabels, };
6
6
  export type { LinkPressEvent, LinkLongPressEvent, TaskListItemPressEvent };
7
- export declare const EnrichedMarkdownText: ({ markdown, markdownStyle, containerStyle, onLinkPress, onLinkLongPress, onTaskListItemPress, enableLinkPreview, selectable, md4cFlags, allowFontScaling, maxFontSizeMultiplier, allowTrailingMargin, flavor, streamingAnimation, streamingConfig, spoilerOverlay, contextMenuItems, selectionMenuConfig, accessibilityLabels, selectionColor, selectionHandleColor, textBreakStrategy, lineBreakStrategyIOS, writingDirection, ...rest }: EnrichedMarkdownTextProps) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const EnrichedMarkdownText: ({ markdown, markdownStyle, containerStyle, onLinkPress, onLinkLongPress, onTaskListItemPress, enableLinkPreview, selectable, md4cFlags, allowFontScaling, maxFontSizeMultiplier, allowTrailingMargin, flavor, streamingAnimation, streamingConfig, spoilerOverlay, contextMenuItems, contextMenuHidden, selectionMenuConfig, accessibilityLabels, selectionColor, selectionHandleColor, textBreakStrategy, lineBreakStrategyIOS, writingDirection, ...rest }: EnrichedMarkdownTextProps) => import("react/jsx-runtime").JSX.Element;
8
8
  export default EnrichedMarkdownText;
9
9
  //# sourceMappingURL=EnrichedMarkdownText.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EnrichedMarkdownText.d.ts","sourceRoot":"","sources":["../../../../src/native/EnrichedMarkdownText.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAK,EACV,yBAAyB,EACzB,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EAEvB,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC;AACzC,YAAY,EACV,yBAAyB,EACzB,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,yBAAyB,GAC1B,CAAC;AACF,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,CAAC;AAuE3E,eAAO,MAAM,oBAAoB,GAAI,2aA0BlC,yBAAyB,4CAuK3B,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"EnrichedMarkdownText.d.ts","sourceRoot":"","sources":["../../../../src/native/EnrichedMarkdownText.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAK,EACV,yBAAyB,EACzB,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EAEvB,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC;AACzC,YAAY,EACV,yBAAyB,EACzB,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,yBAAyB,GAC1B,CAAC;AACF,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,CAAC;AAuE3E,eAAO,MAAM,oBAAoB,GAAI,8bA2BlC,yBAAyB,4CAwK3B,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -253,6 +253,22 @@ export interface EnrichedMarkdownTextProps extends Omit<ViewProps, 'style'> {
253
253
  * @platform ios, android
254
254
  */
255
255
  contextMenuItems?: ContextMenuItem[];
256
+ /**
257
+ * Hides the text selection context menu. Text stays selectable (and stays
258
+ * reachable by TalkBack / VoiceOver) — only the menu is suppressed. Use
259
+ * `selectable={false}` instead if you want to disable selection itself.
260
+ *
261
+ * This hides the whole menu, including the custom items from
262
+ * `contextMenuItems` and the built-in items from `selectionMenuConfig`,
263
+ * since they all share one menu. It also covers the copy menus on table
264
+ * and math blocks.
265
+ *
266
+ * It does not suppress the system "Save to Camera Roll / Copy" sheet that
267
+ * UIKit shows when long-pressing an image.
268
+ * @default false
269
+ * @platform ios, android, macos
270
+ */
271
+ contextMenuHidden?: boolean;
256
272
  /**
257
273
  * Controls the built-in items added to the native text selection menu and
258
274
  * lets you localize their labels. Custom app-provided actions are controlled
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownTextProps.d.ts","sourceRoot":"","sources":["../../../../src/types/MarkdownTextProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACvB,MAAM,UAAU,CAAC;AAElB;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,CAAC,KAAK,EAAE;QACf,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE,CAAC;KAC3C,KAAK,IAAI,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAA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W,GAAG,OAAO,CAAC;IACvC;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;IACrC;;;;;;;;;;;;;;OAcG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C;;;;;;;OAOG;IACH,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C;;;;;OAKG;IACH,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;IAC7B;;;;;;;;;;OAUG;IACH,iBAAiB,CAAC,EAAE,QAAQ,GAAG,aAAa,GAAG,UAAU,CAAC;IAC1D;;;;;;;;OAQG;IACH,oBAAoB,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,aAAa,GAAG,UAAU,CAAC;IACxE;;;;;;;;;;;;;OAaG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,cAAc,CAAC;CAC5D"}
@@ -26,4 +26,19 @@ export interface OnContextMenuItemPressEvent {
26
26
  selectionStart: number;
27
27
  selectionEnd: number;
28
28
  }
29
+ /**
30
+ * Event payload fired by the native component when the user pastes while
31
+ * `interceptPaste` is on. Native does not touch the buffer — it only reports
32
+ * what the clipboard held. The handler must call `resolvePaste` exactly once,
33
+ * or the paste is dropped.
34
+ */
35
+ export interface OnPasteEvent {
36
+ /** Plain text from the clipboard, verbatim, before the text view sees it. */
37
+ text: string;
38
+ /**
39
+ * Markdown flavor, set only when the copy source was an input of this
40
+ * component. iOS-only; Android always reports `''`.
41
+ */
42
+ markdown: string;
43
+ }
29
44
  //# sourceMappingURL=events.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../src/types/events.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;CACtB"}
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../src/types/events.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-enriched-markdown-scaffold",
3
- "version": "0.7.4-scaffold.10",
3
+ "version": "0.7.4-scaffold.12",
4
4
  "description": "Markdown Text component for React Native",
5
5
  "main": "./lib/module/index",
6
6
  "module": "./lib/module/index",
@@ -425,6 +425,10 @@ export interface NativeProps extends ViewProps {
425
425
  */
426
426
  spoilerOverlay?: CodegenTypes.WithDefault<string, 'particles'>;
427
427
 
428
+ /**
429
+ * Hides the text selection context menu while keeping text selectable.
430
+ */
431
+ contextMenuHidden?: CodegenTypes.WithDefault<boolean, false>;
428
432
  /**
429
433
  * Custom items to show in the text selection context menu.
430
434
  */
@@ -37,6 +37,7 @@ import type {
37
37
  TextStyle,
38
38
  ColorValue,
39
39
  } from 'react-native';
40
+ import type { OnPasteEvent } from './types/events';
40
41
  import { normalizeMarkdownTextInputStyle } from './normalizeMarkdownTextInputStyle';
41
42
  import { normalizeMenuItem } from './normalizeMenuItem';
42
43
  import { toNativeRegexConfig } from './utils/regexParser';
@@ -152,6 +153,13 @@ export interface EnrichedMarkdownTextInputInstance {
152
153
  ) => void;
153
154
  removeMath: (start: number) => void;
154
155
  copyToClipboard: () => void;
156
+ /**
157
+ * Completes a paste reported through `onPaste`. Call it exactly once per
158
+ * event: `resolvePaste('', '')` drops the clipboard content (replacing any
159
+ * selection), a non-empty `markdown` re-applies the copied formatting, and
160
+ * plain `text` inserts verbatim.
161
+ */
162
+ resolvePaste: (text: string, markdown?: string) => void;
155
163
  getMarkdown: () => Promise<string>;
156
164
  getCaretRect: () => Promise<CaretRect>;
157
165
  }
@@ -206,6 +214,15 @@ export interface EnrichedMarkdownTextInputProps extends Omit<
206
214
  scrollEnabled?: boolean;
207
215
  blockSyntax?: boolean;
208
216
  autoCapitalize?: string;
217
+ /**
218
+ * Report pastes through `onPaste` instead of inserting them. Only takes
219
+ * effect when `onPaste` is also set — otherwise native would swallow every
220
+ * paste with nobody left to resolve it.
221
+ *
222
+ * macOS ignores this prop and always pastes inline.
223
+ * @default false
224
+ */
225
+ interceptPaste?: boolean;
209
226
  multiline?: boolean;
210
227
  cursorColor?: ColorValue;
211
228
  selectionColor?: ColorValue;
@@ -218,6 +235,12 @@ export interface EnrichedMarkdownTextInputProps extends Omit<
218
235
  onCaretRectChange?: (rect: CaretRect) => void;
219
236
  onLinkDetected?: (event: OnLinkDetected) => void;
220
237
  onMathPress?: (event: OnMathPressEvent) => void;
238
+ /**
239
+ * Fires instead of the insert when `interceptPaste` is on. The handler owns
240
+ * the paste from here: it must call `resolvePaste` exactly once, on every
241
+ * path including failures, or the paste is silently dropped.
242
+ */
243
+ onPaste?: (event: OnPasteEvent) => void;
221
244
  mentionIndicators?: string[];
222
245
  onStartMention?: (event: OnStartMentionEvent) => void;
223
246
  onChangeMention?: (event: OnChangeMentionEvent) => void;
@@ -287,6 +310,7 @@ export const EnrichedMarkdownTextInput = ({
287
310
  scrollEnabled = true,
288
311
  blockSyntax = true,
289
312
  autoCapitalize = 'sentences',
313
+ interceptPaste = false,
290
314
  multiline = true,
291
315
  cursorColor,
292
316
  selectionColor,
@@ -297,6 +321,7 @@ export const EnrichedMarkdownTextInput = ({
297
321
  onCaretRectChange,
298
322
  onLinkDetected,
299
323
  onMathPress,
324
+ onPaste,
300
325
  mentionIndicators,
301
326
  onStartMention,
302
327
  onChangeMention,
@@ -438,6 +463,14 @@ export const EnrichedMarkdownTextInput = ({
438
463
  [onMathPress]
439
464
  );
440
465
 
466
+ const handlePaste = useCallback(
467
+ (e: NativeSyntheticEvent<OnPasteEvent>) => {
468
+ const { text, markdown } = e.nativeEvent;
469
+ onPaste?.({ text, markdown });
470
+ },
471
+ [onPaste]
472
+ );
473
+
441
474
  const handleChangeText = useCallback(
442
475
  (e: NativeSyntheticEvent<OnChangeTextEvent>) => {
443
476
  onChangeText?.(e.nativeEvent.value);
@@ -593,6 +626,8 @@ export const EnrichedMarkdownTextInput = ({
593
626
  ),
594
627
  removeMath: (start) => Commands.removeMath(commandRef, start),
595
628
  copyToClipboard: () => Commands.copyToClipboard(commandRef),
629
+ resolvePaste: (text, markdown = '') =>
630
+ Commands.resolvePaste(commandRef, text, markdown),
596
631
  getMarkdown: () =>
597
632
  new Promise<string>((resolve, reject) => {
598
633
  const requestId = nextRequestId.current++;
@@ -624,6 +659,7 @@ export const EnrichedMarkdownTextInput = ({
624
659
  scrollEnabled={scrollEnabled}
625
660
  blockSyntax={blockSyntax}
626
661
  autoCapitalize={autoCapitalize}
662
+ interceptPaste={interceptPaste === true && onPaste != null}
627
663
  multiline={multiline}
628
664
  cursorColor={cursorColor}
629
665
  selectionColor={selectionColor}
@@ -636,6 +672,7 @@ export const EnrichedMarkdownTextInput = ({
636
672
  onChangeState={handleChangeState as NativeProps['onChangeState']}
637
673
  onLinkDetected={handleLinkDetected as NativeProps['onLinkDetected']}
638
674
  onMathPress={handleMathPress as NativeProps['onMathPress']}
675
+ onPaste={handlePaste as NativeProps['onPaste']}
639
676
  onInputFocus={handleFocus as NativeProps['onInputFocus']}
640
677
  onInputBlur={handleBlur as NativeProps['onInputBlur']}
641
678
  onRequestMarkdownResult={
@@ -141,6 +141,11 @@ export interface OnEndMentionEvent {
141
141
  indicator: string;
142
142
  }
143
143
 
144
+ export interface OnPasteEvent {
145
+ text: string;
146
+ markdown: string;
147
+ }
148
+
144
149
  export interface ContextMenuItemConfig {
145
150
  text: string;
146
151
  icon?: string;
@@ -226,6 +231,16 @@ export interface NativeProps extends ViewProps {
226
231
  * Auto-capitalization behavior.
227
232
  */
228
233
  autoCapitalize?: string;
234
+ /**
235
+ * When `true`, a paste is reported through `onPaste` instead of being
236
+ * inserted. Native reads the clipboard and leaves the buffer untouched — the
237
+ * JS handler decides what happens and must call the `resolvePaste` command
238
+ * exactly once, or the paste is dropped.
239
+ *
240
+ * macOS ignores this prop and always pastes inline.
241
+ * @default false
242
+ */
243
+ interceptPaste?: boolean;
229
244
  /**
230
245
  * Whether the input supports multiple lines.
231
246
  * @default true
@@ -312,6 +327,7 @@ export interface NativeProps extends ViewProps {
312
327
  onContextMenuItemPress?: CodegenTypes.DirectEventHandler<OnContextMenuItemPressEvent>;
313
328
  onLinkDetected?: CodegenTypes.DirectEventHandler<OnLinkDetected>;
314
329
  onMathPress?: CodegenTypes.DirectEventHandler<OnMathPressNativeEvent>;
330
+ onPaste?: CodegenTypes.DirectEventHandler<OnPasteEvent>;
315
331
  onStartMention?: CodegenTypes.DirectEventHandler<OnStartMentionEvent>;
316
332
  onChangeMention?: CodegenTypes.DirectEventHandler<OnChangeMentionEvent>;
317
333
  onEndMention?: CodegenTypes.DirectEventHandler<OnEndMentionEvent>;
@@ -368,6 +384,11 @@ interface NativeCommands {
368
384
  start: CodegenTypes.Int32
369
385
  ) => void;
370
386
  copyToClipboard: (viewRef: React.ElementRef<ComponentType>) => void;
387
+ resolvePaste: (
388
+ viewRef: React.ElementRef<ComponentType>,
389
+ text: string,
390
+ markdown: string
391
+ ) => void;
371
392
  requestMarkdown: (
372
393
  viewRef: React.ElementRef<ComponentType>,
373
394
  requestId: CodegenTypes.Int32
@@ -398,6 +419,7 @@ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
398
419
  'updateMath',
399
420
  'removeMath',
400
421
  'copyToClipboard',
422
+ 'resolvePaste',
401
423
  'requestMarkdown',
402
424
  'requestCaretRect',
403
425
  ],
@@ -424,6 +424,10 @@ export interface NativeProps extends ViewProps {
424
424
  * @default 'particles'
425
425
  */
426
426
  spoilerOverlay?: CodegenTypes.WithDefault<string, 'particles'>;
427
+ /**
428
+ * Hides the text selection context menu while keeping text selectable.
429
+ */
430
+ contextMenuHidden?: CodegenTypes.WithDefault<boolean, false>;
427
431
  /**
428
432
  * Custom items to show in the text selection context menu.
429
433
  */
package/src/index.tsx CHANGED
@@ -12,6 +12,7 @@ export type {
12
12
  LinkPressEvent,
13
13
  LinkLongPressEvent,
14
14
  TaskListItemPressEvent,
15
+ OnPasteEvent,
15
16
  } from './types/events';
16
17
  export type {
17
18
  AccessibilityLabels,
@@ -121,6 +121,7 @@ export const EnrichedMarkdownText = ({
121
121
  streamingConfig,
122
122
  spoilerOverlay = 'particles',
123
123
  contextMenuItems,
124
+ contextMenuHidden = false,
124
125
  selectionMenuConfig,
125
126
  accessibilityLabels,
126
127
  selectionColor,
@@ -280,6 +281,7 @@ export const EnrichedMarkdownText = ({
280
281
  spoilerOverlay,
281
282
  style: containerStyle,
282
283
  contextMenuItems: nativeContextMenuItems,
284
+ contextMenuHidden,
283
285
  selectionMenuConfig: normalizedSelectionMenuConfig,
284
286
  accessibilityLabels: resolvedAccessibilityLabels,
285
287
  onContextMenuItemPress: handleContextMenuItemPress,
@@ -254,6 +254,22 @@ export interface EnrichedMarkdownTextProps extends Omit<ViewProps, 'style'> {
254
254
  * @platform ios, android
255
255
  */
256
256
  contextMenuItems?: ContextMenuItem[];
257
+ /**
258
+ * Hides the text selection context menu. Text stays selectable (and stays
259
+ * reachable by TalkBack / VoiceOver) — only the menu is suppressed. Use
260
+ * `selectable={false}` instead if you want to disable selection itself.
261
+ *
262
+ * This hides the whole menu, including the custom items from
263
+ * `contextMenuItems` and the built-in items from `selectionMenuConfig`,
264
+ * since they all share one menu. It also covers the copy menus on table
265
+ * and math blocks.
266
+ *
267
+ * It does not suppress the system "Save to Camera Roll / Copy" sheet that
268
+ * UIKit shows when long-pressing an image.
269
+ * @default false
270
+ * @platform ios, android, macos
271
+ */
272
+ contextMenuHidden?: boolean;
257
273
  /**
258
274
  * Controls the built-in items added to the native text selection menu and
259
275
  * lets you localize their labels. Custom app-provided actions are controlled
@@ -30,3 +30,19 @@ export interface OnContextMenuItemPressEvent {
30
30
  selectionStart: number;
31
31
  selectionEnd: number;
32
32
  }
33
+
34
+ /**
35
+ * Event payload fired by the native component when the user pastes while
36
+ * `interceptPaste` is on. Native does not touch the buffer — it only reports
37
+ * what the clipboard held. The handler must call `resolvePaste` exactly once,
38
+ * or the paste is dropped.
39
+ */
40
+ export interface OnPasteEvent {
41
+ /** Plain text from the clipboard, verbatim, before the text view sees it. */
42
+ text: string;
43
+ /**
44
+ * Markdown flavor, set only when the copy source was an input of this
45
+ * component. iOS-only; Android always reports `''`.
46
+ */
47
+ markdown: string;
48
+ }