react-native-enriched-markdown-scaffold 1.0.2-scaffold.1 → 1.0.2-scaffold.10

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 (163) hide show
  1. package/android/build.gradle +2 -0
  2. package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownManagerDelegate.java +18 -0
  3. package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownManagerInterface.java +4 -0
  4. package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownTextManagerDelegate.java +18 -0
  5. package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownTextManagerInterface.java +4 -0
  6. package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/EventEmitters.cpp +148 -0
  7. package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/EventEmitters.h +120 -0
  8. package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/Props.cpp +30 -0
  9. package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/Props.h +210 -0
  10. package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdown.kt +176 -2
  11. package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownInternalText.kt +45 -0
  12. package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownManager.kt +35 -0
  13. package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownText.kt +112 -0
  14. package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownTextManager.kt +34 -0
  15. package/android/src/main/java/com/swmansion/enriched/markdown/MeasurementStore.kt +46 -8
  16. package/android/src/main/java/com/swmansion/enriched/markdown/events/CopyRequestEvent.kt +28 -0
  17. package/android/src/main/java/com/swmansion/enriched/markdown/events/LinkLayoutEvent.kt +36 -0
  18. package/android/src/main/java/com/swmansion/enriched/markdown/events/SelectionChangeEvent.kt +43 -0
  19. package/android/src/main/java/com/swmansion/enriched/markdown/input/EnrichedMarkdownTextInputView.kt +25 -3
  20. package/android/src/main/java/com/swmansion/enriched/markdown/input/editing/InputConnectionWrapper.kt +7 -0
  21. package/android/src/main/java/com/swmansion/enriched/markdown/renderer/LinkRenderer.kt +37 -7
  22. package/android/src/main/java/com/swmansion/enriched/markdown/renderer/SpanStyleCache.kt +5 -1
  23. package/android/src/main/java/com/swmansion/enriched/markdown/spans/CodeBackgroundSpan.kt +13 -99
  24. package/android/src/main/java/com/swmansion/enriched/markdown/spans/InlineChipPainter.kt +140 -0
  25. package/android/src/main/java/com/swmansion/enriched/markdown/spans/LinkChipSpans.kt +177 -0
  26. package/android/src/main/java/com/swmansion/enriched/markdown/spans/LinkSpan.kt +1 -6
  27. package/android/src/main/java/com/swmansion/enriched/markdown/styles/InlineMathStyle.kt +16 -1
  28. package/android/src/main/java/com/swmansion/enriched/markdown/styles/LinkStyle.kt +36 -1
  29. package/android/src/main/java/com/swmansion/enriched/markdown/styles/LinkVariantEntry.kt +7 -3
  30. package/android/src/main/java/com/swmansion/enriched/markdown/styles/MathStyle.kt +3 -0
  31. package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/MarkdownViewManagerUtils.kt +51 -0
  32. package/android/src/main/java/com/swmansion/enriched/markdown/utils/input/PasteTextUtils.kt +34 -2
  33. package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/conversion/HTMLGenerator.kt +2 -1
  34. package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/conversion/MarkdownExtractor.kt +6 -0
  35. package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/view/HeadlessActionMode.kt +88 -0
  36. package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/view/LinkLayoutCollector.kt +100 -0
  37. package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/view/SelectionActionMode.kt +53 -14
  38. package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/view/SelectionChangeReporter.kt +232 -0
  39. package/android/src/main/java/com/swmansion/enriched/markdown/views/BlockMenuOptions.kt +64 -0
  40. package/android/src/main/java/com/swmansion/enriched/markdown/views/CodeBlockContainerView.kt +29 -3
  41. package/android/src/main/java/com/swmansion/enriched/markdown/views/TableContainerView.kt +30 -7
  42. package/android/src/math/java/com/swmansion/enriched/markdown/renderer/MathInlineRenderer.kt +1 -0
  43. package/android/src/math/java/com/swmansion/enriched/markdown/spans/MathInlineSpan.kt +13 -6
  44. package/android/src/math/java/com/swmansion/enriched/markdown/spans/MathMeasureHelper.kt +2 -1
  45. package/android/src/math/java/com/swmansion/enriched/markdown/views/MathContainerView.kt +25 -9
  46. package/docs/API_REFERENCE.md +183 -4
  47. package/docs/COPY_OPTIONS.md +40 -0
  48. package/docs/INPUT.md +3 -1
  49. package/docs/MENTIONS.md +8 -1
  50. package/docs/STYLES.md +27 -0
  51. package/docs/TEXT.md +2 -0
  52. package/docs/WEB.md +1 -0
  53. package/ios/EnrichedMarkdown.mm +321 -9
  54. package/ios/EnrichedMarkdownText.mm +203 -6
  55. package/ios/attachments/ENRMMathInlineAttachment+macOS.m +2 -1
  56. package/ios/attachments/ENRMMathInlineAttachment.h +3 -0
  57. package/ios/attachments/ENRMMathInlineAttachment.m +2 -1
  58. package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/EventEmitters.cpp +148 -0
  59. package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/EventEmitters.h +120 -0
  60. package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/Props.cpp +30 -0
  61. package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/Props.h +210 -0
  62. package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/RCTComponentViewHelpers.h +50 -2
  63. package/ios/internals/MeasurementCache.h +8 -2
  64. package/ios/math/ENRMRaTeXBridge.swift +23 -5
  65. package/ios/renderer/ENRMMathInlineRenderer.m +1 -0
  66. package/ios/renderer/LinkRenderer.m +47 -15
  67. package/ios/styles/StyleConfig.h +20 -0
  68. package/ios/styles/StyleConfig.mm +84 -0
  69. package/ios/utils/CodeBackground.m +3 -65
  70. package/ios/utils/ENRMBlockMenu.h +66 -0
  71. package/ios/utils/ENRMChipDrawing.h +24 -0
  72. package/ios/utils/ENRMChipDrawing.m +83 -0
  73. package/ios/utils/ENRMLinkChip.h +70 -0
  74. package/ios/utils/ENRMLinkChip.m +213 -0
  75. package/ios/utils/ENRMLinkLayout.h +50 -0
  76. package/ios/utils/ENRMLinkLayout.m +45 -0
  77. package/ios/utils/ENRMSelectionChange.h +120 -0
  78. package/ios/utils/ENRMSelectionChange.m +282 -0
  79. package/ios/utils/EditMenuUtils+macOS.m +4 -1
  80. package/ios/utils/EditMenuUtils.h +35 -6
  81. package/ios/utils/EditMenuUtils.m +171 -15
  82. package/ios/utils/HTMLGenerator.m +2 -1
  83. package/ios/utils/MarkdownAccessibilityElementBuilder.m +3 -1
  84. package/ios/utils/MarkdownExtractor.m +2 -1
  85. package/ios/utils/RTFExportUtils.m +2 -0
  86. package/ios/utils/StylePropsUtils.h +47 -1
  87. package/ios/utils/TextViewLayoutManager.mm +3 -0
  88. package/ios/views/ENRMCodeBlockContainerView.h +16 -2
  89. package/ios/views/ENRMCodeBlockContainerView.m +22 -19
  90. package/ios/views/ENRMMathContainerView.h +11 -0
  91. package/ios/views/ENRMMathContainerView.m +17 -20
  92. package/ios/views/TableContainerView.h +14 -0
  93. package/ios/views/TableContainerView.m +34 -18
  94. package/lib/module/EnrichedMarkdownNativeComponent.ts +138 -1
  95. package/lib/module/EnrichedMarkdownTextNativeComponent.ts +138 -1
  96. package/lib/module/index.js.map +1 -1
  97. package/lib/module/jest/index.js +14 -0
  98. package/lib/module/jest/index.js.map +1 -1
  99. package/lib/module/native/EnrichedMarkdownText.js +169 -11
  100. package/lib/module/native/EnrichedMarkdownText.js.map +1 -1
  101. package/lib/module/normalizeMarkdownStyle.js +17 -4
  102. package/lib/module/normalizeMarkdownStyle.js.map +1 -1
  103. package/lib/module/normalizeMarkdownStyle.web.js +17 -4
  104. package/lib/module/normalizeMarkdownStyle.web.js.map +1 -1
  105. package/lib/module/web/EnrichedMarkdownText.js +6 -3
  106. package/lib/module/web/EnrichedMarkdownText.js.map +1 -1
  107. package/lib/module/web/renderers/InlineRenderers.js +96 -3
  108. package/lib/module/web/renderers/InlineRenderers.js.map +1 -1
  109. package/lib/module/web/styles.js +18 -0
  110. package/lib/module/web/styles.js.map +1 -1
  111. package/lib/module/web/utils.js +13 -0
  112. package/lib/module/web/utils.js.map +1 -1
  113. package/lib/typescript/src/EnrichedMarkdownNativeComponent.d.ts +123 -2
  114. package/lib/typescript/src/EnrichedMarkdownNativeComponent.d.ts.map +1 -1
  115. package/lib/typescript/src/EnrichedMarkdownTextNativeComponent.d.ts +123 -2
  116. package/lib/typescript/src/EnrichedMarkdownTextNativeComponent.d.ts.map +1 -1
  117. package/lib/typescript/src/index.d.ts +2 -2
  118. package/lib/typescript/src/index.d.ts.map +1 -1
  119. package/lib/typescript/src/index.web.d.ts +1 -1
  120. package/lib/typescript/src/index.web.d.ts.map +1 -1
  121. package/lib/typescript/src/jest/index.d.ts +1 -1
  122. package/lib/typescript/src/jest/index.d.ts.map +1 -1
  123. package/lib/typescript/src/native/EnrichedMarkdownText.d.ts +5 -5
  124. package/lib/typescript/src/native/EnrichedMarkdownText.d.ts.map +1 -1
  125. package/lib/typescript/src/normalizeMarkdownStyle.d.ts.map +1 -1
  126. package/lib/typescript/src/normalizeMarkdownStyle.web.d.ts.map +1 -1
  127. package/lib/typescript/src/types/MarkdownStyle.d.ts +50 -5
  128. package/lib/typescript/src/types/MarkdownStyle.d.ts.map +1 -1
  129. package/lib/typescript/src/types/MarkdownStyleInternal.d.ts +12 -0
  130. package/lib/typescript/src/types/MarkdownStyleInternal.d.ts.map +1 -1
  131. package/lib/typescript/src/types/MarkdownTextProps.d.ts +144 -11
  132. package/lib/typescript/src/types/MarkdownTextProps.d.ts.map +1 -1
  133. package/lib/typescript/src/types/MarkdownTextProps.web.d.ts +41 -1
  134. package/lib/typescript/src/types/MarkdownTextProps.web.d.ts.map +1 -1
  135. package/lib/typescript/src/types/events.d.ts +66 -0
  136. package/lib/typescript/src/types/events.d.ts.map +1 -1
  137. package/lib/typescript/src/web/EnrichedMarkdownText.d.ts +1 -1
  138. package/lib/typescript/src/web/EnrichedMarkdownText.d.ts.map +1 -1
  139. package/lib/typescript/src/web/renderers/InlineRenderers.d.ts.map +1 -1
  140. package/lib/typescript/src/web/styles.d.ts.map +1 -1
  141. package/lib/typescript/src/web/types.d.ts +4 -0
  142. package/lib/typescript/src/web/types.d.ts.map +1 -1
  143. package/lib/typescript/src/web/utils.d.ts +4 -0
  144. package/lib/typescript/src/web/utils.d.ts.map +1 -1
  145. package/package.json +1 -1
  146. package/src/EnrichedMarkdownNativeComponent.ts +138 -1
  147. package/src/EnrichedMarkdownTextNativeComponent.ts +138 -1
  148. package/src/index.tsx +6 -0
  149. package/src/index.web.tsx +5 -1
  150. package/src/jest/index.tsx +22 -1
  151. package/src/native/EnrichedMarkdownText.tsx +220 -9
  152. package/src/normalizeMarkdownStyle.ts +15 -0
  153. package/src/normalizeMarkdownStyle.web.ts +13 -0
  154. package/src/types/MarkdownStyle.ts +51 -5
  155. package/src/types/MarkdownStyleInternal.ts +12 -0
  156. package/src/types/MarkdownTextProps.ts +151 -11
  157. package/src/types/MarkdownTextProps.web.ts +43 -1
  158. package/src/types/events.ts +69 -0
  159. package/src/web/EnrichedMarkdownText.tsx +10 -3
  160. package/src/web/renderers/InlineRenderers.tsx +111 -3
  161. package/src/web/styles.ts +25 -0
  162. package/src/web/types.ts +4 -0
  163. package/src/web/utils.ts +8 -0
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/web/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAA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,CAAC;IAC5B,qFAAqF;IACrF,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IAC9C,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACtD,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,IAAI,CAAC;IAC9D,oBAAoB,CAAC,EAAE,CAAC,IAAI,EAAE,kBAAkB,KAAK,SAAS,GAAG,IAAI,CAAC;CACvE;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IAC5B,2EAA2E;IAC3E,wBAAwB,EAAE,OAAO,CAAC;CACnC;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,qBAAqB,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,QAAQ,CAAC;IACtB,iDAAiD;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,iBAAiB,CAAC;IAC7B,YAAY,EAAE,kBAAkB,CAAC;IACjC,cAAc,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,SAAS,CAAC;CAC9C;AAED,MAAM,MAAM,WAAW,GAAG,OAAO,CAC/B,MAAM,CAAC,QAAQ,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC,CAC/C,CAAC"}
@@ -11,6 +11,10 @@ export declare function filenameFromUrl(url: string): string;
11
11
  export declare function indexTaskItems(node: ASTNode, counter?: {
12
12
  value: number;
13
13
  }): void;
14
+ /** Stamps Link nodes with their document-order index (the `renderLinkDecoration` key). */
15
+ export declare function indexLinks(node: ASTNode, counter?: {
16
+ value: number;
17
+ }): void;
14
18
  /**
15
19
  * Stamps Image nodes with `isInline` when they appear inside a paragraph
16
20
  * that also contains other content (text, links, etc.).
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/web/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,0EAA0E;AAC1E,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAIrD;AAED,gEAAgE;AAChE,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAQnD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO;;CAAe,GAAG,IAAI,CAK1E;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAcpD"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/web/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,0EAA0E;AAC1E,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAIrD;AAED,gEAAgE;AAChE,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAQnD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO;;CAAe,GAAG,IAAI,CAK1E;AAED,0FAA0F;AAC1F,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO;;CAAe,GAAG,IAAI,CAKtE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAcpD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-enriched-markdown-scaffold",
3
- "version": "1.0.2-scaffold.1",
3
+ "version": "1.0.2-scaffold.10",
4
4
  "description": "Markdown-based Rich Text solution for React Native",
5
5
  "main": "./lib/module/index",
6
6
  "module": "./lib/module/index",
@@ -1,9 +1,12 @@
1
1
  import {
2
2
  codegenNativeComponent,
3
+ codegenNativeCommands,
3
4
  type ViewProps,
4
5
  type CodegenTypes,
5
6
  type ColorValue,
7
+ type HostComponent,
6
8
  } from 'react-native';
9
+ import type React from 'react';
7
10
 
8
11
  // All block styles extend this interface
9
12
  interface BaseBlockStyleInternal {
@@ -75,6 +78,11 @@ interface LinkStyleInternal {
75
78
  color: ColorValue;
76
79
  underline: boolean;
77
80
  backgroundColor: ColorValue;
81
+ borderRadius: CodegenTypes.Float;
82
+ paddingHorizontal: CodegenTypes.Float;
83
+ paddingVertical: CodegenTypes.Float;
84
+ borderColor: ColorValue;
85
+ borderWidth: CodegenTypes.Float;
78
86
  }
79
87
 
80
88
  // Mirrors EnrichedMarkdownTextNativeComponent.ts — kept in sync manually (codegen spec files must be self-contained).
@@ -83,6 +91,11 @@ interface LinkVariantEntryInternal {
83
91
  color: ColorValue;
84
92
  underline: boolean;
85
93
  backgroundColor: ColorValue;
94
+ borderRadius: CodegenTypes.Float;
95
+ paddingHorizontal: CodegenTypes.Float;
96
+ paddingVertical: CodegenTypes.Float;
97
+ borderColor: ColorValue;
98
+ borderWidth: CodegenTypes.Float;
86
99
  }
87
100
 
88
101
  interface StrongStyleInternal {
@@ -168,12 +181,14 @@ interface MathStyleInternal {
168
181
  marginBottom: CodegenTypes.Float;
169
182
  textAlign: string;
170
183
  fontWeight: string;
184
+ glyphOverflow: CodegenTypes.Float;
171
185
  }
172
186
 
173
187
  interface InlineMathStyleInternal {
174
188
  color: ColorValue;
175
189
  paddingVertical: CodegenTypes.Float;
176
190
  fontWeight: string;
191
+ glyphOverflow: CodegenTypes.Float;
177
192
  }
178
193
 
179
194
  interface SpoilerParticlesStyleInternal {
@@ -245,6 +260,59 @@ export interface LinkLongPressEvent {
245
260
  url: string;
246
261
  }
247
262
 
263
+ /**
264
+ * `fragments` holds one entry per laid-out line of a link (a wrapping link
265
+ * yields several). Rects are in dp, relative to the native view's origin, and
266
+ * cover the drawn chip (glyphs + padding). Flattened rather than nested per
267
+ * link, and written inline, because codegen only accepts inline object
268
+ * literals as event array elements.
269
+ */
270
+ export interface LinkLayoutEvent {
271
+ fragments: {
272
+ linkIndex: CodegenTypes.Int32;
273
+ url: string;
274
+ text: string;
275
+ x: CodegenTypes.Double;
276
+ y: CodegenTypes.Double;
277
+ width: CodegenTypes.Double;
278
+ height: CodegenTypes.Double;
279
+ }[];
280
+ }
281
+
282
+ /**
283
+ * Current text selection, or a long-pressed table / math / code block while
284
+ * `contextMenuHidden` is on. `active: false` means the selection was cleared
285
+ * (every other field is then empty / zero). Rects are in dp / pt, relative to
286
+ * the native view's origin; rect objects are written inline because codegen
287
+ * only accepts inline object literals in event payloads.
288
+ */
289
+ export interface SelectionChangeEvent {
290
+ active: boolean;
291
+ source: string;
292
+ text: string;
293
+ markdown: string;
294
+ whole: boolean;
295
+ rect: {
296
+ x: CodegenTypes.Double;
297
+ y: CodegenTypes.Double;
298
+ width: CodegenTypes.Double;
299
+ height: CodegenTypes.Double;
300
+ };
301
+ startRect: {
302
+ x: CodegenTypes.Double;
303
+ y: CodegenTypes.Double;
304
+ width: CodegenTypes.Double;
305
+ height: CodegenTypes.Double;
306
+ };
307
+ endRect: {
308
+ x: CodegenTypes.Double;
309
+ y: CodegenTypes.Double;
310
+ width: CodegenTypes.Double;
311
+ height: CodegenTypes.Double;
312
+ };
313
+ adjusting: boolean;
314
+ }
315
+
248
316
  export interface TaskListItemPressEvent {
249
317
  index: CodegenTypes.Int32;
250
318
  checked: boolean;
@@ -256,6 +324,14 @@ export interface CopyPressEvent {
256
324
  language: string;
257
325
  }
258
326
 
327
+ export interface CopyRequestEvent {
328
+ // 'selection' | 'math' | 'table' | 'code'
329
+ source: string;
330
+ markdown: string;
331
+ text: string;
332
+ whole: boolean;
333
+ }
334
+
259
335
  export interface ContextMenuItemConfig {
260
336
  text: string;
261
337
  icon?: string;
@@ -276,6 +352,16 @@ export interface SelectionMenuConfig {
276
352
  // Precomputed plural templates indexed by image count (0..100). Empty when no
277
353
  // pluralLabels are set; native then uses copyImageUrlLabel/copyImageUrlsLabel.
278
354
  copyImageUrlPluralTemplates: ReadonlyArray<string>;
355
+ // false removes the Copy item from the text and block menus.
356
+ copyEnabled: boolean;
357
+ // true: Copy writes Markdown (plain text) instead of rich text / raw block content.
358
+ copyFormatMarkdown: boolean;
359
+ // true: the text selection menu drops every system-provided item.
360
+ systemItemsNone: boolean;
361
+ // false hides the copy button in the code block header.
362
+ codeBlockCopyButton: boolean;
363
+ // true: the Copy item emits onCopyRequest instead of writing the clipboard.
364
+ interceptCopy: boolean;
279
365
  }
280
366
 
281
367
  export interface OnContextMenuItemPressEvent {
@@ -382,6 +468,30 @@ export interface NativeProps extends ViewProps {
382
468
  * - Android: Handles long press gestures on links.
383
469
  */
384
470
  onLinkLongPress?: CodegenTypes.BubblingEventHandler<LinkLongPressEvent>;
471
+ /**
472
+ * When true, the view reports the laid-out rects of every link through
473
+ * `onLinkLayout` (after each render and whenever its size changes).
474
+ * Set by the JS wrapper only when `renderLinkDecoration` is provided.
475
+ * @default false
476
+ */
477
+ emitLinkLayout?: CodegenTypes.WithDefault<boolean, false>;
478
+ /**
479
+ * Fired with the rects of every link fragment while `emitLinkLayout` is on.
480
+ * Deduplicated: not re-fired when the payload is unchanged.
481
+ */
482
+ onLinkLayout?: CodegenTypes.DirectEventHandler<LinkLayoutEvent>;
483
+ /**
484
+ * When true, the view reports selection changes (and, with
485
+ * `contextMenuHidden`, block long-presses) through `onSelectionChange`.
486
+ * Set by the JS wrapper only when `onSelectionChange` is provided.
487
+ * @default false
488
+ */
489
+ emitSelectionChange?: CodegenTypes.WithDefault<boolean, false>;
490
+ /**
491
+ * Fired while `emitSelectionChange` is on: coalesced to one event per frame,
492
+ * deduplicated, and `active: false` once the selection is gone.
493
+ */
494
+ onSelectionChange?: CodegenTypes.DirectEventHandler<SelectionChangeEvent>;
385
495
  /**
386
496
  * Callback fired when a task list checkbox is tapped.
387
497
  * Receives the 0-based task index, current checked state, and the item's plain text.
@@ -402,6 +512,12 @@ export interface NativeProps extends ViewProps {
402
512
  * action. Receives the copied code and its language.
403
513
  */
404
514
  onCopyPress?: CodegenTypes.BubblingEventHandler<CopyPressEvent>;
515
+ /**
516
+ * Fired instead of writing the clipboard when the Copy item of the text
517
+ * selection menu or a table / math / code block menu is pressed while
518
+ * `selectionMenuConfig.interceptCopy` is set.
519
+ */
520
+ onCopyRequest?: CodegenTypes.BubblingEventHandler<CopyRequestEvent>;
405
521
  /**
406
522
  * Controls whether the system link preview is shown on long press (iOS only).
407
523
  *
@@ -415,6 +531,16 @@ export interface NativeProps extends ViewProps {
415
531
  * @default true
416
532
  */
417
533
  enableLinkPreview?: CodegenTypes.WithDefault<boolean, true>;
534
+ /**
535
+ * When `true`, long-pressing a link selects its label and shows the
536
+ * selection edit menu instead of the system link preview (iOS only).
537
+ * Takes precedence over `enableLinkPreview` and `onLinkLongPress`.
538
+ *
539
+ * Android: No-op.
540
+ *
541
+ * @default false
542
+ */
543
+ linkLongPressSelects?: CodegenTypes.WithDefault<boolean, false>;
418
544
  /**
419
545
  * - iOS: Controls text selection and link previews on long press.
420
546
  * - Android: Controls text selection.
@@ -529,6 +655,17 @@ export interface NativeProps extends ViewProps {
529
655
  writingDirection?: CodegenTypes.WithDefault<string, 'first-strong'>;
530
656
  }
531
657
 
658
+ type ComponentType = HostComponent<NativeProps>;
659
+
660
+ interface NativeCommands {
661
+ /** Clears the text selection (and any active block) and fires `onSelectionChange` with `active: false`. */
662
+ clearSelection: (viewRef: React.ElementRef<ComponentType>) => void;
663
+ }
664
+
665
+ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
666
+ supportedCommands: ['clearSelection'],
667
+ });
668
+
532
669
  export default codegenNativeComponent<NativeProps>('EnrichedMarkdown', {
533
670
  interfaceOnly: true,
534
- });
671
+ }) as HostComponent<NativeProps>;
@@ -1,9 +1,12 @@
1
1
  import {
2
2
  codegenNativeComponent,
3
+ codegenNativeCommands,
3
4
  type ViewProps,
4
5
  type CodegenTypes,
5
6
  type ColorValue,
7
+ type HostComponent,
6
8
  } from 'react-native';
9
+ import type React from 'react';
7
10
 
8
11
  // All block styles extend this interface
9
12
  interface BaseBlockStyleInternal {
@@ -75,6 +78,11 @@ interface LinkStyleInternal {
75
78
  color: ColorValue;
76
79
  underline: boolean;
77
80
  backgroundColor: ColorValue;
81
+ borderRadius: CodegenTypes.Float;
82
+ paddingHorizontal: CodegenTypes.Float;
83
+ paddingVertical: CodegenTypes.Float;
84
+ borderColor: ColorValue;
85
+ borderWidth: CodegenTypes.Float;
78
86
  }
79
87
 
80
88
  // Mirrors EnrichedMarkdownNativeComponent.ts — kept in sync manually (codegen spec files must be self-contained).
@@ -83,6 +91,11 @@ interface LinkVariantEntryInternal {
83
91
  color: ColorValue;
84
92
  underline: boolean;
85
93
  backgroundColor: ColorValue;
94
+ borderRadius: CodegenTypes.Float;
95
+ paddingHorizontal: CodegenTypes.Float;
96
+ paddingVertical: CodegenTypes.Float;
97
+ borderColor: ColorValue;
98
+ borderWidth: CodegenTypes.Float;
86
99
  }
87
100
 
88
101
  interface StrongStyleInternal {
@@ -169,12 +182,14 @@ interface MathStyleInternal {
169
182
  marginBottom: CodegenTypes.Float;
170
183
  textAlign: string;
171
184
  fontWeight: string;
185
+ glyphOverflow: CodegenTypes.Float;
172
186
  }
173
187
 
174
188
  interface InlineMathStyleInternal {
175
189
  color: ColorValue;
176
190
  paddingVertical: CodegenTypes.Float;
177
191
  fontWeight: string;
192
+ glyphOverflow: CodegenTypes.Float;
178
193
  }
179
194
 
180
195
  interface SpoilerParticlesStyleInternal {
@@ -246,6 +261,59 @@ export interface LinkLongPressEvent {
246
261
  url: string;
247
262
  }
248
263
 
264
+ /**
265
+ * `fragments` holds one entry per laid-out line of a link (a wrapping link
266
+ * yields several). Rects are in dp, relative to the native view's origin, and
267
+ * cover the drawn chip (glyphs + padding). Flattened rather than nested per
268
+ * link, and written inline, because codegen only accepts inline object
269
+ * literals as event array elements.
270
+ */
271
+ export interface LinkLayoutEvent {
272
+ fragments: {
273
+ linkIndex: CodegenTypes.Int32;
274
+ url: string;
275
+ text: string;
276
+ x: CodegenTypes.Double;
277
+ y: CodegenTypes.Double;
278
+ width: CodegenTypes.Double;
279
+ height: CodegenTypes.Double;
280
+ }[];
281
+ }
282
+
283
+ /**
284
+ * Current text selection, or a long-pressed table / math / code block while
285
+ * `contextMenuHidden` is on. `active: false` means the selection was cleared
286
+ * (every other field is then empty / zero). Rects are in dp / pt, relative to
287
+ * the native view's origin; rect objects are written inline because codegen
288
+ * only accepts inline object literals in event payloads.
289
+ */
290
+ export interface SelectionChangeEvent {
291
+ active: boolean;
292
+ source: string;
293
+ text: string;
294
+ markdown: string;
295
+ whole: boolean;
296
+ rect: {
297
+ x: CodegenTypes.Double;
298
+ y: CodegenTypes.Double;
299
+ width: CodegenTypes.Double;
300
+ height: CodegenTypes.Double;
301
+ };
302
+ startRect: {
303
+ x: CodegenTypes.Double;
304
+ y: CodegenTypes.Double;
305
+ width: CodegenTypes.Double;
306
+ height: CodegenTypes.Double;
307
+ };
308
+ endRect: {
309
+ x: CodegenTypes.Double;
310
+ y: CodegenTypes.Double;
311
+ width: CodegenTypes.Double;
312
+ height: CodegenTypes.Double;
313
+ };
314
+ adjusting: boolean;
315
+ }
316
+
249
317
  export interface TaskListItemPressEvent {
250
318
  index: CodegenTypes.Int32;
251
319
  checked: boolean;
@@ -257,6 +325,14 @@ export interface CopyPressEvent {
257
325
  language: string;
258
326
  }
259
327
 
328
+ export interface CopyRequestEvent {
329
+ // 'selection' | 'math' | 'table' | 'code'
330
+ source: string;
331
+ markdown: string;
332
+ text: string;
333
+ whole: boolean;
334
+ }
335
+
260
336
  export interface ContextMenuItemConfig {
261
337
  text: string;
262
338
  icon?: string;
@@ -277,6 +353,16 @@ export interface SelectionMenuConfig {
277
353
  // Precomputed plural templates indexed by image count (0..100). Empty when no
278
354
  // pluralLabels are set; native then uses copyImageUrlLabel/copyImageUrlsLabel.
279
355
  copyImageUrlPluralTemplates: ReadonlyArray<string>;
356
+ // false removes the Copy item from the text and block menus.
357
+ copyEnabled: boolean;
358
+ // true: Copy writes Markdown (plain text) instead of rich text / raw block content.
359
+ copyFormatMarkdown: boolean;
360
+ // true: the text selection menu drops every system-provided item.
361
+ systemItemsNone: boolean;
362
+ // false hides the copy button in the code block header.
363
+ codeBlockCopyButton: boolean;
364
+ // true: the Copy item emits onCopyRequest instead of writing the clipboard.
365
+ interceptCopy: boolean;
280
366
  }
281
367
 
282
368
  export interface OnContextMenuItemPressEvent {
@@ -383,6 +469,30 @@ export interface NativeProps extends ViewProps {
383
469
  * - Android: Handles long press gestures on links.
384
470
  */
385
471
  onLinkLongPress?: CodegenTypes.BubblingEventHandler<LinkLongPressEvent>;
472
+ /**
473
+ * When true, the view reports the laid-out rects of every link through
474
+ * `onLinkLayout` (after each render and whenever its size changes).
475
+ * Set by the JS wrapper only when `renderLinkDecoration` is provided.
476
+ * @default false
477
+ */
478
+ emitLinkLayout?: CodegenTypes.WithDefault<boolean, false>;
479
+ /**
480
+ * Fired with the rects of every link fragment while `emitLinkLayout` is on.
481
+ * Deduplicated: not re-fired when the payload is unchanged.
482
+ */
483
+ onLinkLayout?: CodegenTypes.DirectEventHandler<LinkLayoutEvent>;
484
+ /**
485
+ * When true, the view reports selection changes (and, with
486
+ * `contextMenuHidden`, block long-presses) through `onSelectionChange`.
487
+ * Set by the JS wrapper only when `onSelectionChange` is provided.
488
+ * @default false
489
+ */
490
+ emitSelectionChange?: CodegenTypes.WithDefault<boolean, false>;
491
+ /**
492
+ * Fired while `emitSelectionChange` is on: coalesced to one event per frame,
493
+ * deduplicated, and `active: false` once the selection is gone.
494
+ */
495
+ onSelectionChange?: CodegenTypes.DirectEventHandler<SelectionChangeEvent>;
386
496
  /**
387
497
  * Callback fired when a task list checkbox is tapped.
388
498
  * Receives the 0-based task index, current checked state, and the item's plain text.
@@ -403,6 +513,12 @@ export interface NativeProps extends ViewProps {
403
513
  * action. Receives the copied code and its language.
404
514
  */
405
515
  onCopyPress?: CodegenTypes.BubblingEventHandler<CopyPressEvent>;
516
+ /**
517
+ * Fired instead of writing the clipboard when the Copy item of the text
518
+ * selection menu or a table / math / code block menu is pressed while
519
+ * `selectionMenuConfig.interceptCopy` is set.
520
+ */
521
+ onCopyRequest?: CodegenTypes.BubblingEventHandler<CopyRequestEvent>;
406
522
  /**
407
523
  * Controls whether the system link preview is shown on long press (iOS only).
408
524
  *
@@ -416,6 +532,16 @@ export interface NativeProps extends ViewProps {
416
532
  * @default true
417
533
  */
418
534
  enableLinkPreview?: CodegenTypes.WithDefault<boolean, true>;
535
+ /**
536
+ * When `true`, long-pressing a link selects its label and shows the
537
+ * selection edit menu instead of the system link preview (iOS only).
538
+ * Takes precedence over `enableLinkPreview` and `onLinkLongPress`.
539
+ *
540
+ * Android: No-op.
541
+ *
542
+ * @default false
543
+ */
544
+ linkLongPressSelects?: CodegenTypes.WithDefault<boolean, false>;
419
545
  /**
420
546
  * - iOS: Controls text selection and link previews on long press.
421
547
  * - Android: Controls text selection.
@@ -529,6 +655,17 @@ export interface NativeProps extends ViewProps {
529
655
  writingDirection?: CodegenTypes.WithDefault<string, 'first-strong'>;
530
656
  }
531
657
 
658
+ type ComponentType = HostComponent<NativeProps>;
659
+
660
+ interface NativeCommands {
661
+ /** Clears the text selection (and any active block) and fires `onSelectionChange` with `active: false`. */
662
+ clearSelection: (viewRef: React.ElementRef<ComponentType>) => void;
663
+ }
664
+
665
+ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
666
+ supportedCommands: ['clearSelection'],
667
+ });
668
+
532
669
  export default codegenNativeComponent<NativeProps>('EnrichedMarkdownText', {
533
670
  interfaceOnly: true,
534
- });
671
+ }) as HostComponent<NativeProps>;
package/src/index.tsx CHANGED
@@ -1,19 +1,25 @@
1
1
  export { default as EnrichedMarkdownText } from './native/EnrichedMarkdownText';
2
2
  export type {
3
3
  EnrichedMarkdownTextProps,
4
+ EnrichedMarkdownTextInstance,
4
5
  StreamingConfig,
5
6
  MarkdownStyle,
6
7
  Md4cFlags,
7
8
  ContextMenuItem as TextContextMenuItem,
8
9
  SelectionMenuConfig as TextSelectionMenuConfig,
9
10
  SelectionMenuPluralLabels as TextSelectionMenuPluralLabels,
11
+ LinkDecorationInfo,
12
+ LinkRect,
10
13
  } from './native/EnrichedMarkdownText';
11
14
  export type {
12
15
  LinkPressEvent,
13
16
  LinkLongPressEvent,
14
17
  TaskListItemPressEvent,
15
18
  CopyPressEvent,
19
+ CopyEvent,
16
20
  OnPasteEvent,
21
+ SelectionChangeEvent,
22
+ SelectionRect,
17
23
  } from './types/events';
18
24
  export type {
19
25
  AccessibilityLabels,
package/src/index.web.tsx CHANGED
@@ -1,5 +1,9 @@
1
1
  export { EnrichedMarkdownText, default } from './web/EnrichedMarkdownText';
2
- export type { EnrichedMarkdownTextProps } from './types/MarkdownTextProps.web';
2
+ export type {
3
+ EnrichedMarkdownTextProps,
4
+ LinkDecorationInfo,
5
+ LinkRect,
6
+ } from './types/MarkdownTextProps.web';
3
7
  export type { MarkdownStyle, Md4cFlags } from './types/MarkdownStyle';
4
8
  export type {
5
9
  LinkPressEvent,
@@ -26,7 +26,10 @@ import type {
26
26
  EnrichedMarkdownTextInputProps,
27
27
  InsertMathOptions,
28
28
  } from '../EnrichedMarkdownTextInput';
29
- import type { EnrichedMarkdownTextProps } from '../native/EnrichedMarkdownText';
29
+ import type {
30
+ EnrichedMarkdownTextInstance,
31
+ EnrichedMarkdownTextProps,
32
+ } from '../native/EnrichedMarkdownText';
30
33
 
31
34
  export {
32
35
  DEFAULT_ACCESSIBILITY_LABELS,
@@ -165,6 +168,7 @@ export const EnrichedMarkdownTextInput = ({
165
168
  };
166
169
 
167
170
  export const EnrichedMarkdownText = ({
171
+ ref,
168
172
  markdown,
169
173
  containerStyle,
170
174
  testID,
@@ -178,7 +182,9 @@ export const EnrichedMarkdownText = ({
178
182
  onLinkPress: _onLinkPress,
179
183
  onLinkLongPress: _onLinkLongPress,
180
184
  onTaskListItemPress: _onTaskListItemPress,
185
+ onSelectionChange: _onSelectionChange,
181
186
  enableLinkPreview: _enableLinkPreview,
187
+ linkLongPressSelects: _linkLongPressSelects,
182
188
  selectable: _selectable,
183
189
  md4cFlags: _md4cFlags,
184
190
  allowFontScaling: _allowFontScaling,
@@ -198,6 +204,21 @@ export const EnrichedMarkdownText = ({
198
204
  lineBreakStrategyIOS: _lineBreakStrategyIOS,
199
205
  writingDirection: _writingDirection,
200
206
  }: EnrichedMarkdownTextProps) => {
207
+ const instanceRef = useRef<EnrichedMarkdownTextInstance | null>(null);
208
+ if (instanceRef.current === null) {
209
+ instanceRef.current = {
210
+ // No native selection under Jest; the mock records the call.
211
+ clearSelection: spy(() => {}),
212
+ measure: spy((callback) => callback(0, 0, 0, 0, 0, 0)),
213
+ measureInWindow: spy((callback) => callback(0, 0, 0, 0)),
214
+ measureLayout: spy((_relativeToNativeNode, onSuccess) =>
215
+ onSuccess(0, 0, 0, 0)
216
+ ),
217
+ };
218
+ }
219
+
220
+ useImperativeHandle(ref, () => instanceRef.current!);
221
+
201
222
  return (
202
223
  <Text
203
224
  style={containerStyle}