react-native-enriched-markdown-scaffold 1.0.2-scaffold.6 → 1.0.2-scaffold.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.
Files changed (64) hide show
  1. package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/EventEmitters.cpp +2 -0
  2. package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/EventEmitters.h +2 -0
  3. package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/Props.h +24 -0
  4. package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownInternalText.kt +12 -0
  5. package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownText.kt +12 -0
  6. package/android/src/main/java/com/swmansion/enriched/markdown/MeasurementStore.kt +8 -4
  7. package/android/src/main/java/com/swmansion/enriched/markdown/events/SelectionChangeEvent.kt +1 -0
  8. package/android/src/main/java/com/swmansion/enriched/markdown/styles/InlineMathStyle.kt +16 -1
  9. package/android/src/main/java/com/swmansion/enriched/markdown/styles/MathStyle.kt +3 -0
  10. package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/view/HeadlessActionMode.kt +76 -0
  11. package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/view/SelectionChangeReporter.kt +2 -0
  12. package/android/src/main/java/com/swmansion/enriched/markdown/views/TableContainerView.kt +1 -1
  13. package/android/src/math/java/com/swmansion/enriched/markdown/renderer/MathInlineRenderer.kt +1 -0
  14. package/android/src/math/java/com/swmansion/enriched/markdown/spans/MathInlineSpan.kt +13 -6
  15. package/android/src/math/java/com/swmansion/enriched/markdown/spans/MathMeasureHelper.kt +2 -1
  16. package/android/src/math/java/com/swmansion/enriched/markdown/views/MathContainerView.kt +11 -4
  17. package/docs/API_REFERENCE.md +4 -2
  18. package/ios/EnrichedMarkdown.mm +23 -0
  19. package/ios/EnrichedMarkdownText.mm +21 -0
  20. package/ios/attachments/ENRMMathInlineAttachment+macOS.m +2 -1
  21. package/ios/attachments/ENRMMathInlineAttachment.h +3 -0
  22. package/ios/attachments/ENRMMathInlineAttachment.m +2 -1
  23. package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/EventEmitters.cpp +2 -0
  24. package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/EventEmitters.h +2 -0
  25. package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/Props.h +24 -0
  26. package/ios/internals/MeasurementCache.h +3 -2
  27. package/ios/math/ENRMRaTeXBridge.swift +23 -5
  28. package/ios/renderer/ENRMMathInlineRenderer.m +1 -0
  29. package/ios/styles/StyleConfig.h +4 -0
  30. package/ios/styles/StyleConfig.mm +24 -0
  31. package/ios/utils/ENRMLinkChip.m +2 -1
  32. package/ios/utils/ENRMSelectionChange.h +24 -0
  33. package/ios/utils/ENRMSelectionChange.m +78 -0
  34. package/ios/utils/StylePropsUtils.h +10 -0
  35. package/ios/views/ENRMMathContainerView.m +4 -2
  36. package/lib/module/EnrichedMarkdownNativeComponent.ts +3 -0
  37. package/lib/module/EnrichedMarkdownTextNativeComponent.ts +3 -0
  38. package/lib/module/normalizeMarkdownStyle.js +4 -2
  39. package/lib/module/normalizeMarkdownStyle.js.map +1 -1
  40. package/lib/module/normalizeMarkdownStyle.web.js +4 -2
  41. package/lib/module/normalizeMarkdownStyle.web.js.map +1 -1
  42. package/lib/typescript/src/EnrichedMarkdownNativeComponent.d.ts +3 -0
  43. package/lib/typescript/src/EnrichedMarkdownNativeComponent.d.ts.map +1 -1
  44. package/lib/typescript/src/EnrichedMarkdownTextNativeComponent.d.ts +3 -0
  45. package/lib/typescript/src/EnrichedMarkdownTextNativeComponent.d.ts.map +1 -1
  46. package/lib/typescript/src/normalizeMarkdownStyle.d.ts.map +1 -1
  47. package/lib/typescript/src/normalizeMarkdownStyle.web.d.ts.map +1 -1
  48. package/lib/typescript/src/types/MarkdownStyle.d.ts +22 -0
  49. package/lib/typescript/src/types/MarkdownStyle.d.ts.map +1 -1
  50. package/lib/typescript/src/types/MarkdownStyleInternal.d.ts +2 -0
  51. package/lib/typescript/src/types/MarkdownStyleInternal.d.ts.map +1 -1
  52. package/lib/typescript/src/types/MarkdownTextProps.d.ts +8 -2
  53. package/lib/typescript/src/types/MarkdownTextProps.d.ts.map +1 -1
  54. package/lib/typescript/src/types/events.d.ts +8 -0
  55. package/lib/typescript/src/types/events.d.ts.map +1 -1
  56. package/package.json +1 -1
  57. package/src/EnrichedMarkdownNativeComponent.ts +3 -0
  58. package/src/EnrichedMarkdownTextNativeComponent.ts +3 -0
  59. package/src/normalizeMarkdownStyle.ts +2 -0
  60. package/src/normalizeMarkdownStyle.web.ts +2 -0
  61. package/src/types/MarkdownStyle.ts +22 -0
  62. package/src/types/MarkdownStyleInternal.ts +2 -0
  63. package/src/types/MarkdownTextProps.ts +8 -2
  64. package/src/types/events.ts +8 -0
@@ -256,6 +256,17 @@ interface MathStyle {
256
256
  * @default 'normal'
257
257
  */
258
258
  fontWeight?: 'bold' | 'normal';
259
+ /**
260
+ * Headroom kept above and below the rendered formula, in points (dp on
261
+ * Android), inside the box the formula reports. The math engine sizes a
262
+ * formula by its TeX metric box, and digit and capital outlines — plus the
263
+ * synthetic-bold stroke — rise a little past it; without this headroom that
264
+ * ink is clipped at the top of the box. About `0.06 × fontSize` covers the
265
+ * KaTeX faces; add `0.02 × fontSize` when `fontWeight` is `'bold'`.
266
+ * Android rounds it up to whole pixels.
267
+ * @default 0
268
+ */
269
+ glyphOverflow?: number;
259
270
  }
260
271
 
261
272
  interface InlineMathStyle {
@@ -280,6 +291,17 @@ interface InlineMathStyle {
280
291
  * @default 'normal'
281
292
  */
282
293
  fontWeight?: 'bold' | 'normal';
294
+ /**
295
+ * Headroom kept above and below the rendered formula, in points (dp on
296
+ * Android), inside the box the formula reports. The math engine sizes a
297
+ * formula by its TeX metric box, and digit and capital outlines — plus the
298
+ * synthetic-bold stroke — rise a little past it; without this headroom that
299
+ * ink is clipped at the top of the box. About `0.06 × fontSize` covers the
300
+ * KaTeX faces; add `0.02 × fontSize` when `fontWeight` is `'bold'`.
301
+ * Android rounds it up to whole pixels.
302
+ * @default 0
303
+ */
304
+ glyphOverflow?: number;
283
305
  }
284
306
 
285
307
  interface SpoilerParticlesStyle {
@@ -190,12 +190,14 @@ interface MathStyleInternal {
190
190
  marginBottom: number;
191
191
  textAlign: BlockTextAlign;
192
192
  fontWeight: string;
193
+ glyphOverflow: number;
193
194
  }
194
195
 
195
196
  interface InlineMathStyleInternal {
196
197
  color: string;
197
198
  paddingVertical: number;
198
199
  fontWeight: string;
200
+ glyphOverflow: number;
199
201
  }
200
202
 
201
203
  interface SpoilerParticlesStyleInternal {
@@ -305,8 +305,10 @@ export interface EnrichedMarkdownTextProps extends Omit<ViewProps, 'style'> {
305
305
  * the app (`ref.current.clearSelection()`).
306
306
  *
307
307
  * Rects are relative to the view that `ref.current.measureInWindow`
308
- * measures — add that origin to position UI on screen. There is no
309
- * "dragging" flag: debounce before showing a menu.
308
+ * measures — add that origin to position UI on screen. On iOS, `adjusting`
309
+ * is `true` while a selection handle is dragged: hide the menu until it is
310
+ * `false` again. Android reports every step of the drag instead (with
311
+ * `adjusting: false`), so debounce before showing a menu there.
310
312
  * @platform ios, android
311
313
  */
312
314
  onSelectionChange?: (event: SelectionChangeEvent) => void;
@@ -449,6 +451,10 @@ export interface EnrichedMarkdownTextProps extends Omit<ViewProps, 'style'> {
449
451
  *
450
452
  * It does not suppress the system "Save to Camera Roll / Copy" sheet that
451
453
  * UIKit shows when long-pressing an image.
454
+ *
455
+ * On Android no selection toolbar is created at all, so ROMs that draw
456
+ * their own (MIUI) stay hidden too. A selection made while this is on
457
+ * keeps no menu if it is turned off mid-selection; the next one gets it.
452
458
  * @default false
453
459
  * @platform ios, android, macos
454
460
  */
@@ -76,6 +76,14 @@ export interface SelectionChangeEvent {
76
76
  startRect: SelectionRect;
77
77
  /** Selected part of the last line (block: same as `rect`). */
78
78
  endRect: SelectionRect;
79
+ /**
80
+ * `true` while a selection handle is dragged (or the loupe is held), with the
81
+ * selection as it was when the drag began; `false` again, with the new
82
+ * selection, once the finger lifts. Hide your menu while it is `true`.
83
+ * Always `false` on Android, which reports the selection continuously
84
+ * during the drag.
85
+ */
86
+ adjusting: boolean;
79
87
  }
80
88
 
81
89
  /**