react-native-enriched-markdown-scaffold 1.0.2-scaffold.9 → 1.2.0-scaffold.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/ReactNativeEnrichedMarkdown.podspec +31 -10
- package/android/build.gradle +49 -12
- package/android/consumer-rules.pro +3 -0
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownManagerDelegate.java +18 -0
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownManagerInterface.java +6 -0
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownTextInputManagerDelegate.java +3 -0
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownTextInputManagerInterface.java +1 -0
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownTextManagerDelegate.java +18 -0
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownTextManagerInterface.java +6 -0
- package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/EventEmitters.cpp +62 -0
- package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/EventEmitters.h +44 -0
- package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/Props.cpp +67 -2
- package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/Props.h +929 -178
- package/android/src/main/baseline-prof.txt +21 -22
- package/android/src/main/cpp/jni-adapter.cpp +17 -5
- package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdown.kt +729 -768
- package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownInternalText.kt +1 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownManager.kt +72 -3
- package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownText.kt +222 -8
- package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownTextManager.kt +65 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/MeasurementStore.kt +191 -26
- package/android/src/main/java/com/swmansion/enriched/markdown/accessibility/AccessibleMarkdownTextView.kt +10 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/accessibility/MarkdownAccessibilityHelper.kt +54 -6
- package/android/src/main/java/com/swmansion/enriched/markdown/events/CodeBlockPressEvent.kt +24 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/events/ImagePressEvent.kt +25 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/events/LatexErrorEvent.kt +29 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/EnrichedMarkdownTextInputManager.kt +21 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/EnrichedMarkdownTextInputView.kt +101 -9
- package/android/src/main/java/com/swmansion/enriched/markdown/input/editing/EditPipeline.kt +48 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/editing/InputConnectionWrapper.kt +7 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/editing/MarkdownShortcutMatcher.kt +64 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/formatting/InputRemend.kt +44 -6
- package/android/src/main/java/com/swmansion/enriched/markdown/input/layout/InputEventEmitter.kt +9 -8
- package/android/src/main/java/com/swmansion/enriched/markdown/math/LatexErrorReporter.kt +9 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/parser/MarkdownASTNode.kt +6 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/parser/Parser.kt +5 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/BlankLineRenderer.kt +38 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/BlockStyleContext.kt +2 -2
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/BlockquoteRenderer.kt +3 -2
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/BlockquoteTextRenderer.kt +55 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/CodeBlockRenderer.kt +8 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/HighlightRenderer.kt +10 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/NodeRenderer.kt +31 -3
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/ParagraphRenderer.kt +17 -2
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/Renderer.kt +40 -21
- package/android/src/main/java/com/swmansion/enriched/markdown/segments/AdmonitionIcons.kt +62 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/{views → segments}/BlockSegmentView.kt +1 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/segments/BlockquoteContainerView.kt +401 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/{views → segments}/CodeBlockContainerView.kt +55 -16
- package/android/src/main/java/com/swmansion/enriched/markdown/segments/ContainerNodeView.kt +164 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/{utils/common → segments}/MarkdownSegment.kt +21 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/segments/RenderedSegment.kt +137 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/segments/SegmentHeightMeasurer.kt +139 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/{utils/common → segments}/SegmentReconciler.kt +1 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/{utils/common → segments}/SegmentSignature.kt +3 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/segments/SegmentViewCreators.kt +262 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/segments/SegmentViewFactory.kt +29 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/{views → segments}/TableContainerView.kt +100 -36
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/CodeBackgroundSpan.kt +18 -17
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/CodeBlockSpan.kt +3 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/HighlightSpan.kt +60 -6
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/ImageSpan.kt +15 -5
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/InlineBackgroundGeometry.kt +42 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/InlineChipPainter.kt +4 -27
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/LineHeightSpan.kt +10 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/LinkSpan.kt +1 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/spoiler/SpoilerDrawUtils.kt +11 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/BlockquoteStyle.kt +27 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/LinkVariantEntry.kt +2 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/StyleConfig.kt +10 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/VideoStyle.kt +31 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/BorderStyleUtils.kt +86 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/EllipsizeUtils.kt +27 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/EnrichedMarkdownAncestorUtils.kt +10 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/FeatureFlags.kt +1 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/MarkdownViewManagerUtils.kt +36 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/ReadableMapExtensions.kt +5 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/serialization/MarkdownASTSerializer.kt +227 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/input/PasteTextUtils.kt +34 -2
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/conversion/HTMLGenerator.kt +50 -28
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/conversion/MarkdownExtractor.kt +16 -21
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/extensions/SpannableExtensions.kt +4 -3
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/span/BlockSpacing.kt +3 -2
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/span/SpanFlags.kt +13 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/view/CodeBlockPressHost.kt +15 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/view/ImagePressHost.kt +19 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/view/LinkEvents.kt +11 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/view/LinkLongPressMovementMethod.kt +87 -2
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/view/TextViewSetup.kt +79 -0
- package/android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/conversions.h +2 -0
- package/android/src/math/java/com/swmansion/enriched/markdown/renderer/MathInlineRenderer.kt +9 -3
- package/android/src/math/java/com/swmansion/enriched/markdown/{views → segments}/MathContainerView.kt +86 -29
- package/android/src/math/java/com/swmansion/enriched/markdown/spans/MathInlineSpan.kt +33 -7
- package/android/src/video/java/com/swmansion/enriched/markdown/segments/VideoContainerView.kt +115 -0
- package/cpp/md4c/md4c.c +343 -236
- package/cpp/md4c/md4c.h +28 -11
- package/cpp/parser/MD4CParser.cpp +266 -4
- package/cpp/parser/MD4CParser.hpp +6 -2
- package/cpp/parser/MarkdownASTNode.hpp +4 -1
- package/cpp/wasm/ASTSerializer.cpp +6 -0
- package/cpp/wasm/md4c_wasm.cpp +5 -1
- package/docs/API_REFERENCE.md +199 -12
- package/docs/BREAKING_CHANGES.md +75 -0
- package/docs/CODE_HIGHLIGHT.md +4 -0
- package/docs/COPY_OPTIONS.md +52 -9
- package/docs/ELEMENTS_STRUCTURE.md +48 -1
- package/docs/INPUT.md +60 -3
- package/docs/LATEX_MATH.md +30 -0
- package/docs/MACOS.md +1 -1
- package/docs/MENTIONS.md +2 -2
- package/docs/STYLES.md +27 -0
- package/docs/TEXT.md +8 -0
- package/docs/WEB.md +44 -10
- package/ios/EnrichedMarkdown.mm +285 -43
- package/ios/EnrichedMarkdownText.mm +185 -23
- package/ios/attachments/ENRMImageAttachment.h +17 -2
- package/ios/attachments/ENRMImageAttachment.m +26 -28
- package/ios/attachments/ENRMMathInlineAttachment+macOS.m +10 -2
- package/ios/attachments/ENRMMathInlineAttachment.h +3 -1
- package/ios/attachments/ENRMMathInlineAttachment.m +17 -1
- package/ios/attachments/ENRMMathInlineAttachmentShared.h +3 -0
- package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/EventEmitters.cpp +62 -0
- package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/EventEmitters.h +44 -0
- package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/Props.cpp +67 -2
- package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/Props.h +929 -178
- package/ios/input/ENRMInputFormatter.mm +68 -12
- package/ios/input/ENRMInputFormatterStyle.mm +9 -2
- package/ios/input/ENRMInputParser.mm +18 -0
- package/ios/input/ENRMInputRemend.mm +40 -3
- package/ios/input/ENRMMarkdownShortcutMatcher.h +39 -0
- package/ios/input/ENRMMarkdownShortcutMatcher.mm +66 -0
- package/ios/input/EnrichedMarkdownTextInput.mm +129 -1
- package/ios/internals/ENRMViewFreeMeasurement.h +45 -6
- package/ios/internals/MeasurementCache.h +20 -4
- package/ios/internals/ShadowMeasurementUtils.h +2 -0
- package/ios/math/ENRMLatexErrorCoordinator.h +27 -0
- package/ios/math/ENRMLatexErrorCoordinator.mm +75 -0
- package/ios/math/ENRMLatexErrorReporting.h +13 -0
- package/ios/math/ENRMRaTeXBridge.swift +46 -3
- package/ios/parser/ENRMMarkdownParser.h +3 -0
- package/ios/parser/ENRMMarkdownParser.mm +11 -2
- package/ios/parser/MarkdownASTNode.h +8 -1
- package/ios/parser/MarkdownASTNode.m +20 -0
- package/ios/parser/MarkdownParserBridge.mm +13 -2
- package/ios/renderer/AttributedRenderer.h +13 -1
- package/ios/renderer/AttributedRenderer.m +24 -13
- package/ios/renderer/BaselineShiftTextAttributes.h +4 -0
- package/ios/renderer/BaselineShiftTextAttributes.m +4 -0
- package/ios/renderer/BlankLineRenderer.h +4 -0
- package/ios/renderer/BlankLineRenderer.m +51 -0
- package/ios/renderer/BlockquoteRenderer.m +1 -0
- package/ios/renderer/CodeBlockRenderer.m +8 -0
- package/ios/renderer/CodeRenderer.m +5 -2
- package/ios/renderer/ENRMBlockquoteTextRenderer.h +25 -0
- package/ios/renderer/ENRMBlockquoteTextRenderer.m +48 -0
- package/ios/renderer/ENRMImageRenderer.m +1 -1
- package/ios/renderer/ENRMMathInlineRenderer.m +9 -1
- package/ios/renderer/HeadingRenderer.m +1 -0
- package/ios/renderer/HighlightRenderer.m +6 -0
- package/ios/renderer/LinkRenderer.m +1 -1
- package/ios/renderer/ListItemRenderer.m +51 -2
- package/ios/renderer/ParagraphRenderer.m +10 -3
- package/ios/renderer/RenderContext.h +16 -0
- package/ios/renderer/RenderContext.m +16 -0
- package/ios/renderer/RendererFactory.m +6 -0
- package/ios/renderer/SubscriptRenderer.m +1 -0
- package/ios/renderer/SuperscriptRenderer.m +1 -0
- package/ios/segments/ENRMAdmonitionIcons.h +31 -0
- package/ios/segments/ENRMAdmonitionIcons.m +93 -0
- package/ios/segments/ENRMBlockquoteContainerView.h +90 -0
- package/ios/segments/ENRMBlockquoteContainerView.mm +551 -0
- package/ios/{views → segments}/ENRMCodeBlockContainerView.h +9 -4
- package/ios/{views → segments}/ENRMCodeBlockContainerView.m +147 -36
- package/ios/segments/ENRMContainerNodeView.h +52 -0
- package/ios/segments/ENRMContainerNodeView.mm +201 -0
- package/ios/segments/ENRMDynamicBlockProps.h +32 -0
- package/ios/segments/ENRMDynamicBlockProps.m +15 -0
- package/ios/{views → segments}/ENRMMathContainerView.h +13 -5
- package/ios/{views → segments}/ENRMMathContainerView.m +60 -9
- package/ios/segments/ENRMSVGPath.h +21 -0
- package/ios/segments/ENRMSVGPath.m +409 -0
- package/ios/segments/ENRMSegmentHeightMeasurer.h +33 -0
- package/ios/segments/ENRMSegmentHeightMeasurer.mm +94 -0
- package/ios/segments/ENRMVideoContainerView.h +40 -0
- package/ios/segments/ENRMVideoContainerView.m +421 -0
- package/ios/{utils → segments}/RenderedMarkdownSegment.h +19 -2
- package/ios/{utils → segments}/RenderedMarkdownSegment.m +42 -1
- package/ios/segments/SegmentRenderer.h +26 -0
- package/ios/{utils → segments}/SegmentRenderer.m +46 -9
- package/ios/{views → segments}/TableContainerView.h +5 -4
- package/ios/{views → segments}/TableContainerView.m +96 -12
- package/ios/styles/StyleConfig.h +17 -0
- package/ios/styles/StyleConfig.mm +90 -0
- package/ios/utils/ENRMCodeBlockContent.mm +13 -0
- package/ios/utils/ENRMFeatureFlags.h +6 -0
- package/ios/utils/ENRMTextRenderer.h +8 -0
- package/ios/utils/ENRMTextRenderer.m +26 -10
- package/ios/utils/ENRMUIKit.h +1 -0
- package/ios/utils/FontUtils.h +2 -1
- package/ios/utils/FontUtils.m +22 -6
- package/ios/utils/LinkTapUtils.h +17 -2
- package/ios/utils/LinkTapUtils.m +44 -2
- package/ios/utils/ListMarkerDrawer.m +25 -1
- package/ios/utils/MarkdownASTSerializer.h +7 -0
- package/ios/utils/MarkdownASTSerializer.m +243 -0
- package/ios/utils/MarkdownAccessibilityElementBuilder.m +9 -67
- package/ios/utils/MarkdownExtractor.m +6 -3
- package/ios/utils/ParagraphStyleUtils.h +25 -1
- package/ios/utils/ParagraphStyleUtils.m +51 -7
- package/ios/utils/StylePropsUtils.h +60 -1
- package/ios/utils/TextViewLayoutManager.mm +57 -0
- package/lib/module/EnrichedMarkdownNativeComponent.ts +110 -4
- package/lib/module/EnrichedMarkdownTextInput.js +60 -2
- package/lib/module/EnrichedMarkdownTextInput.js.map +1 -1
- package/lib/module/EnrichedMarkdownTextInputNativeComponent.ts +12 -0
- package/lib/module/EnrichedMarkdownTextNativeComponent.ts +115 -4
- package/lib/module/admonitionDefaults.js +34 -0
- package/lib/module/admonitionDefaults.js.map +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/jest/index.js +84 -4
- package/lib/module/jest/index.js.map +1 -1
- package/lib/module/native/EnrichedMarkdownText.js +58 -5
- package/lib/module/native/EnrichedMarkdownText.js.map +1 -1
- package/lib/module/normalizeMarkdownShortcuts.js +31 -0
- package/lib/module/normalizeMarkdownShortcuts.js.map +1 -0
- package/lib/module/normalizeMarkdownStyle.js +15 -1
- package/lib/module/normalizeMarkdownStyle.js.map +1 -1
- package/lib/module/normalizeMarkdownStyle.web.js +15 -1
- package/lib/module/normalizeMarkdownStyle.web.js.map +1 -1
- package/lib/module/styleUtils.js +15 -3
- package/lib/module/styleUtils.js.map +1 -1
- package/lib/module/utils/textInputState.js +4 -3
- package/lib/module/utils/textInputState.js.map +1 -1
- package/lib/module/utils/usePressability.js +28 -0
- package/lib/module/utils/usePressability.js.map +1 -0
- package/lib/module/web/EnrichedMarkdownText.js +19 -6
- package/lib/module/web/EnrichedMarkdownText.js.map +1 -1
- package/lib/module/web/globalStyles.js +7 -1
- package/lib/module/web/globalStyles.js.map +1 -1
- package/lib/module/web/nativeProps.js +70 -0
- package/lib/module/web/nativeProps.js.map +1 -0
- package/lib/module/web/parseMarkdown.js +5 -3
- package/lib/module/web/parseMarkdown.js.map +1 -1
- package/lib/module/web/renderers/BlockRenderers.js +164 -8
- package/lib/module/web/renderers/BlockRenderers.js.map +1 -1
- package/lib/module/web/renderers/admonitionIcons.js +34 -0
- package/lib/module/web/renderers/admonitionIcons.js.map +1 -0
- package/lib/module/web/styles.js +30 -8
- package/lib/module/web/styles.js.map +1 -1
- package/lib/module/web/wasm/md4c.js +0 -0
- package/lib/module/web/wasm/md4c.js.map +1 -1
- package/lib/typescript/src/EnrichedMarkdownNativeComponent.d.ts +103 -3
- package/lib/typescript/src/EnrichedMarkdownNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/EnrichedMarkdownTextInput.d.ts +27 -3
- package/lib/typescript/src/EnrichedMarkdownTextInput.d.ts.map +1 -1
- package/lib/typescript/src/EnrichedMarkdownTextInputNativeComponent.d.ts +11 -0
- package/lib/typescript/src/EnrichedMarkdownTextInputNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/EnrichedMarkdownTextNativeComponent.d.ts +108 -3
- package/lib/typescript/src/EnrichedMarkdownTextNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/admonitionDefaults.d.ts +10 -0
- package/lib/typescript/src/admonitionDefaults.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +3 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/index.web.d.ts +1 -1
- package/lib/typescript/src/index.web.d.ts.map +1 -1
- package/lib/typescript/src/jest/index.d.ts +2 -2
- package/lib/typescript/src/jest/index.d.ts.map +1 -1
- package/lib/typescript/src/native/EnrichedMarkdownText.d.ts +3 -3
- package/lib/typescript/src/native/EnrichedMarkdownText.d.ts.map +1 -1
- package/lib/typescript/src/normalizeMarkdownShortcuts.d.ts +7 -0
- package/lib/typescript/src/normalizeMarkdownShortcuts.d.ts.map +1 -0
- package/lib/typescript/src/normalizeMarkdownStyle.d.ts.map +1 -1
- package/lib/typescript/src/normalizeMarkdownStyle.web.d.ts.map +1 -1
- package/lib/typescript/src/styleUtils.d.ts.map +1 -1
- package/lib/typescript/src/types/MarkdownStyle.d.ts +59 -1
- package/lib/typescript/src/types/MarkdownStyle.d.ts.map +1 -1
- package/lib/typescript/src/types/MarkdownStyleInternal.d.ts +21 -0
- package/lib/typescript/src/types/MarkdownStyleInternal.d.ts.map +1 -1
- package/lib/typescript/src/types/MarkdownTextProps.d.ts +93 -8
- package/lib/typescript/src/types/MarkdownTextProps.d.ts.map +1 -1
- package/lib/typescript/src/types/MarkdownTextProps.web.d.ts +25 -1
- package/lib/typescript/src/types/MarkdownTextProps.web.d.ts.map +1 -1
- package/lib/typescript/src/types/events.d.ts +33 -5
- package/lib/typescript/src/types/events.d.ts.map +1 -1
- package/lib/typescript/src/utils/textInputState.d.ts +5 -3
- package/lib/typescript/src/utils/textInputState.d.ts.map +1 -1
- package/lib/typescript/src/utils/usePressability.d.ts +24 -0
- package/lib/typescript/src/utils/usePressability.d.ts.map +1 -0
- package/lib/typescript/src/web/EnrichedMarkdownText.d.ts +1 -1
- package/lib/typescript/src/web/EnrichedMarkdownText.d.ts.map +1 -1
- package/lib/typescript/src/web/globalStyles.d.ts +1 -0
- package/lib/typescript/src/web/globalStyles.d.ts.map +1 -1
- package/lib/typescript/src/web/nativeProps.d.ts +34 -0
- package/lib/typescript/src/web/nativeProps.d.ts.map +1 -0
- package/lib/typescript/src/web/parseMarkdown.d.ts +1 -1
- package/lib/typescript/src/web/parseMarkdown.d.ts.map +1 -1
- package/lib/typescript/src/web/renderers/BlockRenderers.d.ts.map +1 -1
- package/lib/typescript/src/web/renderers/admonitionIcons.d.ts +5 -0
- package/lib/typescript/src/web/renderers/admonitionIcons.d.ts.map +1 -0
- package/lib/typescript/src/web/styles.d.ts +1 -0
- package/lib/typescript/src/web/styles.d.ts.map +1 -1
- package/lib/typescript/src/web/types.d.ts +8 -2
- package/lib/typescript/src/web/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/postinstall.mjs +7 -0
- package/src/EnrichedMarkdownNativeComponent.ts +110 -4
- package/src/EnrichedMarkdownTextInput.tsx +101 -4
- package/src/EnrichedMarkdownTextInputNativeComponent.ts +12 -0
- package/src/EnrichedMarkdownTextNativeComponent.ts +115 -4
- package/src/admonitionDefaults.ts +58 -0
- package/src/index.tsx +5 -0
- package/src/index.web.tsx +3 -0
- package/src/jest/index.tsx +138 -5
- package/src/native/EnrichedMarkdownText.tsx +55 -3
- package/src/normalizeMarkdownShortcuts.ts +38 -0
- package/src/normalizeMarkdownStyle.ts +17 -0
- package/src/normalizeMarkdownStyle.web.ts +17 -0
- package/src/styleUtils.ts +17 -6
- package/src/types/MarkdownStyle.ts +62 -1
- package/src/types/MarkdownStyleInternal.ts +24 -0
- package/src/types/MarkdownTextProps.ts +95 -7
- package/src/types/MarkdownTextProps.web.ts +26 -0
- package/src/types/events.ts +36 -5
- package/src/utils/textInputState.ts +5 -3
- package/src/utils/usePressability.ts +34 -0
- package/src/web/EnrichedMarkdownText.tsx +36 -3
- package/src/web/globalStyles.ts +10 -0
- package/src/web/nativeProps.ts +78 -0
- package/src/web/parseMarkdown.ts +10 -2
- package/src/web/renderers/BlockRenderers.tsx +175 -6
- package/src/web/renderers/admonitionIcons.ts +37 -0
- package/src/web/styles.ts +28 -3
- package/src/web/types.ts +12 -1
- package/src/web/wasm/md4c.js +0 -0
- package/vendor-ratex.mjs +86 -17
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/DocumentRenderer.kt +0 -16
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/RenderedSegment.kt +0 -88
- package/ios/utils/SegmentRenderer.h +0 -24
- /package/ios/{views → segments}/ENRMTableGridView.h +0 -0
- /package/ios/{views → segments}/ENRMTableGridView.m +0 -0
- /package/ios/{views → segments}/ENRMTableIOSGridView.h +0 -0
- /package/ios/{views → segments}/ENRMTableIOSGridView.m +0 -0
- /package/ios/{utils → segments}/SegmentReconciler.h +0 -0
- /package/ios/{utils → segments}/SegmentReconciler.m +0 -0
- /package/ios/{utils → segments}/SegmentViewRegistry.h +0 -0
- /package/ios/{utils → segments}/SegmentViewRegistry.m +0 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#import "ENRMCodeBlockContainerView.h"
|
|
4
|
+
#import "ENRMContainerNodeView.h"
|
|
5
|
+
#import "StyleConfig.h"
|
|
6
|
+
|
|
7
|
+
@class MarkdownASTNode;
|
|
8
|
+
@class ENRMAccessibilityLabels;
|
|
9
|
+
|
|
10
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
11
|
+
|
|
12
|
+
typedef void (^ENRMBlockquoteLinkBlock)(NSString *url);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* A GFM blockquote rendered as a recursive container (issue #608): it splits its
|
|
16
|
+
* own AST children into segments and lays them out through the shared
|
|
17
|
+
* ENRMContainerNodeView machinery, so a nested quote becomes another
|
|
18
|
+
* ENRMBlockquoteContainerView, a fenced code block becomes an
|
|
19
|
+
* ENRMCodeBlockContainerView, and prose collapses into a single inner text view.
|
|
20
|
+
* Nesting depth is automatic: each level is its own view, inset further by its
|
|
21
|
+
* padding, so drawRect: only ever renders one accent bar plus the background for
|
|
22
|
+
* this single level. This mirrors Android's BlockquoteContainerView.
|
|
23
|
+
*
|
|
24
|
+
* The content inset is applied via contentInsets (left = borderWidth + gapWidth
|
|
25
|
+
* + padding, other edges = padding), reusing the geometry the commonmark
|
|
26
|
+
* BlockquoteBorder draws for the in-text (list-nested) path, which stays
|
|
27
|
+
* untouched. The base measure/layout already honor contentInsets.
|
|
28
|
+
*
|
|
29
|
+
* Streaming is static inside a quote (no pending fence, no animation); a content
|
|
30
|
+
* change re-signs the whole subtree so the outer reconciler still reuses the
|
|
31
|
+
* quote view.
|
|
32
|
+
*/
|
|
33
|
+
@interface ENRMBlockquoteContainerView : ENRMContainerNodeView
|
|
34
|
+
|
|
35
|
+
- (instancetype)initWithConfig:(StyleConfig *)config;
|
|
36
|
+
|
|
37
|
+
// Splits the node's children into segments and applies them to this container.
|
|
38
|
+
- (void)applyBlockquoteNode:(MarkdownASTNode *)node;
|
|
39
|
+
|
|
40
|
+
// Laid-out height of this quote at the given outer width (the width the parent
|
|
41
|
+
// lays it out at, before this view's own inset).
|
|
42
|
+
- (CGFloat)measureHeight:(CGFloat)maxWidth;
|
|
43
|
+
|
|
44
|
+
// View-free height for the shadow-node measurement pass: the same height an
|
|
45
|
+
// instance's measureHeight: reports for the node, without building a view. It
|
|
46
|
+
// sums the child segments at the reduced inner width and adds the vertical
|
|
47
|
+
// inset, recursing into itself for nested quotes. pointScaleFactor is the layout
|
|
48
|
+
// context's scale (the visible instance path uses RCTScreenScale), threaded so
|
|
49
|
+
// the per-text-segment pixel rounding matches the laid-out height.
|
|
50
|
+
+ (CGFloat)measureHeightForBlockquoteNode:(MarkdownASTNode *)node
|
|
51
|
+
config:(StyleConfig *)config
|
|
52
|
+
maxWidth:(CGFloat)maxWidth
|
|
53
|
+
pointScaleFactor:(CGFloat)pointScaleFactor
|
|
54
|
+
allowFontScaling:(BOOL)allowFontScaling
|
|
55
|
+
lineBreakStrategy:(NSLineBreakStrategy)lineBreakStrategy;
|
|
56
|
+
|
|
57
|
+
// Consumer text props threaded into the quote's inner content so it honors them
|
|
58
|
+
// the same way the root document path does, instead of assuming defaults. Set by
|
|
59
|
+
// the host (root view or parent quote) at creation; propagated to nested quotes.
|
|
60
|
+
@property (nonatomic, assign) BOOL allowFontScaling;
|
|
61
|
+
@property (nonatomic, assign) NSLineBreakStrategy lineBreakStrategy;
|
|
62
|
+
|
|
63
|
+
// YES when this quote is nested directly inside another quote. A nested quote
|
|
64
|
+
// carries no vertical margin (only the outermost quote does, applied by the root
|
|
65
|
+
// host), matching the commonmark path which applies blockquote margins only at
|
|
66
|
+
// depth 0. Set by the parent quote's child registry.
|
|
67
|
+
@property (nonatomic, assign) BOOL nested;
|
|
68
|
+
|
|
69
|
+
// Bridged up to the JS onLinkPress/onLinkLongPress events; propagated to nested
|
|
70
|
+
// quotes so links at any depth fire.
|
|
71
|
+
@property (nonatomic, copy, nullable) ENRMBlockquoteLinkBlock onLinkPress;
|
|
72
|
+
@property (nonatomic, copy, nullable) ENRMBlockquoteLinkBlock onLinkLongPress;
|
|
73
|
+
|
|
74
|
+
@property (nonatomic, copy, nullable) ENRMCodeBlockCopyBlock onCopyPress;
|
|
75
|
+
@property (nonatomic, copy, nullable) ENRMCodeBlockPressBlock onCodeBlockPress;
|
|
76
|
+
|
|
77
|
+
// Shared, runtime-mutable block props (context-menu gate, code-block tap gate,
|
|
78
|
+
// copy labels) read live at use-time. Set to the root's shared instance at
|
|
79
|
+
// creation and handed unchanged to this quote's children, so a child added after
|
|
80
|
+
// a toggle is born current with no per-toggle push. See ENRMDynamicBlockProps.
|
|
81
|
+
@property (nonatomic, strong) ENRMDynamicBlockProps *dynamicProps;
|
|
82
|
+
|
|
83
|
+
// Resolved VoiceOver strings (list, quote, table and math announcements). Set by
|
|
84
|
+
// the host at creation and pushed to this quote's children, recursing into
|
|
85
|
+
// nested quotes, so they are labelled the same way top-level segments are.
|
|
86
|
+
@property (nonatomic, strong, nullable) ENRMAccessibilityLabels *accessibilityLabels;
|
|
87
|
+
|
|
88
|
+
@end
|
|
89
|
+
|
|
90
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,551 @@
|
|
|
1
|
+
#import "ENRMBlockquoteContainerView.h"
|
|
2
|
+
#import "ENRMAdmonitionIcons.h"
|
|
3
|
+
#import "ENRMCodeBlockContainerView.h"
|
|
4
|
+
#import "ENRMFeatureFlags.h"
|
|
5
|
+
#import "ENRMSegmentHeightMeasurer.h"
|
|
6
|
+
#import "ENRMTextInteractionUtils.h"
|
|
7
|
+
#import "ENRMTextRenderer.h"
|
|
8
|
+
#import "EnrichedMarkdownInternalText.h"
|
|
9
|
+
#import "MarkdownASTNode.h"
|
|
10
|
+
#import "MarkdownASTSerializer.h"
|
|
11
|
+
#import "PasteboardUtils.h"
|
|
12
|
+
#import "SegmentRenderer.h"
|
|
13
|
+
#import "TableContainerView.h"
|
|
14
|
+
#if ENRICHED_MARKDOWN_MATH
|
|
15
|
+
#import "ENRMMathContainerView.h"
|
|
16
|
+
#endif
|
|
17
|
+
#if ENRICHED_MARKDOWN_VIDEO
|
|
18
|
+
#import "ENRMVideoContainerView.h"
|
|
19
|
+
#endif
|
|
20
|
+
#if TARGET_OS_OSX
|
|
21
|
+
#import "ENRMMenuAction.h"
|
|
22
|
+
#endif
|
|
23
|
+
|
|
24
|
+
// Inner content is rendered with trailing margins disabled; the quote's own
|
|
25
|
+
// vertical inset provides the bottom gap, and per-segment margins between children
|
|
26
|
+
// still apply (allowTrailingMargin only gates the last child's bottom margin). The
|
|
27
|
+
// consumer's allowFontScaling / lineBreakStrategy are threaded through so the
|
|
28
|
+
// quote's content honors them the same way the root document path does.
|
|
29
|
+
static NSArray<ENRMRenderedSegment *> *ENRMRenderBlockquoteChildren(MarkdownASTNode *node, StyleConfig *config,
|
|
30
|
+
BOOL allowFontScaling,
|
|
31
|
+
NSLineBreakStrategy lineBreakStrategy)
|
|
32
|
+
{
|
|
33
|
+
return ENRMRenderSegmentsFromAST(node, config, /*allowTrailingMargin*/ NO, allowFontScaling,
|
|
34
|
+
config.maxFontSizeMultiplier, lineBreakStrategy, /*blockquoteContent*/ YES);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// The admonition type ("note"/"tip"/…) for a node, or nil for a plain quote.
|
|
38
|
+
static NSString *ENRMAdmonitionTypeForNode(MarkdownASTNode *node)
|
|
39
|
+
{
|
|
40
|
+
if (node.type != MarkdownNodeTypeAdmonition) {
|
|
41
|
+
return nil;
|
|
42
|
+
}
|
|
43
|
+
NSString *type = node.attributes[@"admonitionType"];
|
|
44
|
+
return type.length > 0 ? type : @"note";
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static CGFloat ENRMAdmonitionIconSize(StyleConfig *config)
|
|
48
|
+
{
|
|
49
|
+
return ceil(config.blockquoteFontSize);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Bold variant of the blockquote font for the header title, respecting the
|
|
53
|
+
// configured family where the platform supports trait derivation.
|
|
54
|
+
static UIFont *ENRMAdmonitionTitleFont(StyleConfig *config)
|
|
55
|
+
{
|
|
56
|
+
UIFont *base = config.blockquoteFont;
|
|
57
|
+
#if !TARGET_OS_OSX
|
|
58
|
+
UIFontDescriptor *descriptor = [base.fontDescriptor
|
|
59
|
+
fontDescriptorWithSymbolicTraits:(base.fontDescriptor.symbolicTraits | UIFontDescriptorTraitBold)];
|
|
60
|
+
UIFont *bold = descriptor ? [UIFont fontWithDescriptor:descriptor size:base.pointSize] : nil;
|
|
61
|
+
return bold ?: [UIFont boldSystemFontOfSize:base.pointSize];
|
|
62
|
+
#else
|
|
63
|
+
NSFontDescriptor *descriptor = [base.fontDescriptor fontDescriptorWithSymbolicTraits:NSFontDescriptorTraitBold];
|
|
64
|
+
NSFont *bold = descriptor ? [NSFont fontWithDescriptor:descriptor size:base.pointSize] : nil;
|
|
65
|
+
return bold ?: [NSFont boldSystemFontOfSize:base.pointSize];
|
|
66
|
+
#endif
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Height of the header band (icon + title row); body sits a gap below it.
|
|
70
|
+
static CGFloat ENRMAdmonitionHeaderContentHeight(StyleConfig *config)
|
|
71
|
+
{
|
|
72
|
+
return ceil(MAX(ENRMAdmonitionIconSize(config), config.blockquoteFontSize * 1.35));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
static CGFloat ENRMAdmonitionHeaderToBodyGap(StyleConfig *config)
|
|
76
|
+
{
|
|
77
|
+
return round(config.blockquoteFontSize * 0.4);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Vertical space reserved above the body for the header (0 for a plain quote).
|
|
81
|
+
static CGFloat ENRMAdmonitionHeaderReservedHeight(StyleConfig *config, BOOL isAdmonition)
|
|
82
|
+
{
|
|
83
|
+
if (!isAdmonition) {
|
|
84
|
+
return 0;
|
|
85
|
+
}
|
|
86
|
+
return ENRMAdmonitionHeaderContentHeight(config) + ENRMAdmonitionHeaderToBodyGap(config);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
static UIEdgeInsets ENRMBlockquoteContentInsetsForNode(StyleConfig *config, BOOL isAdmonition)
|
|
90
|
+
{
|
|
91
|
+
CGFloat padding = config.blockquotePadding;
|
|
92
|
+
CGFloat left = ceil(config.blockquoteBorderWidth + config.blockquoteGapWidth + padding);
|
|
93
|
+
CGFloat top = ceil(padding + ENRMAdmonitionHeaderReservedHeight(config, isAdmonition));
|
|
94
|
+
CGFloat vertical = ceil(padding);
|
|
95
|
+
CGFloat right = ceil(padding);
|
|
96
|
+
return UIEdgeInsetsMake(top, left, vertical, right);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
static UIEdgeInsets ENRMBlockquoteContentInsets(StyleConfig *config)
|
|
100
|
+
{
|
|
101
|
+
return ENRMBlockquoteContentInsetsForNode(config, NO);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@interface ENRMBlockquoteContainerView ()
|
|
105
|
+
#if !TARGET_OS_OSX
|
|
106
|
+
<UIContextMenuInteractionDelegate>
|
|
107
|
+
#endif
|
|
108
|
+
// nil for a plain blockquote; the admonition type string otherwise.
|
|
109
|
+
@property (nonatomic, copy, nullable) NSString *admonitionType;
|
|
110
|
+
@property (nonatomic, copy) NSString *cachedMarkdown;
|
|
111
|
+
@property (nonatomic, copy) NSString *cachedPlainText;
|
|
112
|
+
@end
|
|
113
|
+
|
|
114
|
+
@implementation ENRMBlockquoteContainerView
|
|
115
|
+
|
|
116
|
+
- (instancetype)initWithConfig:(StyleConfig *)config
|
|
117
|
+
{
|
|
118
|
+
self = [super initWithFrame:CGRectZero];
|
|
119
|
+
if (self) {
|
|
120
|
+
self.config = config;
|
|
121
|
+
self.contentInsets = ENRMBlockquoteContentInsets(config);
|
|
122
|
+
self.allowTrailingMargin = NO;
|
|
123
|
+
// Preserved prior defaults until the host overrides them at creation.
|
|
124
|
+
_allowFontScaling = YES;
|
|
125
|
+
_lineBreakStrategy = NSLineBreakStrategyNone;
|
|
126
|
+
_dynamicProps = [[ENRMDynamicBlockProps alloc] init];
|
|
127
|
+
_cachedMarkdown = @"";
|
|
128
|
+
_cachedPlainText = @"";
|
|
129
|
+
#if !TARGET_OS_OSX
|
|
130
|
+
self.contentMode = UIViewContentModeRedraw;
|
|
131
|
+
UIContextMenuInteraction *contextMenu = [[UIContextMenuInteraction alloc] initWithDelegate:self];
|
|
132
|
+
[self addInteraction:contextMenu];
|
|
133
|
+
#endif
|
|
134
|
+
self.segmentViewRegistry = [self buildChildRegistry];
|
|
135
|
+
}
|
|
136
|
+
return self;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
- (void)applyBlockquoteNode:(MarkdownASTNode *)node
|
|
140
|
+
{
|
|
141
|
+
self.admonitionType = ENRMAdmonitionTypeForNode(node);
|
|
142
|
+
self.contentInsets = ENRMBlockquoteContentInsetsForNode(self.config, self.admonitionType != nil);
|
|
143
|
+
self.cachedMarkdown = markdownFromBlockquoteNode(node);
|
|
144
|
+
self.cachedPlainText = plainTextFromASTNode(node);
|
|
145
|
+
NSArray<ENRMRenderedSegment *> *rendered =
|
|
146
|
+
ENRMRenderBlockquoteChildren(node, self.config, self.allowFontScaling, self.lineBreakStrategy);
|
|
147
|
+
[self applySegments:rendered reset:NO];
|
|
148
|
+
#if !TARGET_OS_OSX
|
|
149
|
+
[self setNeedsDisplay];
|
|
150
|
+
#else
|
|
151
|
+
self.needsDisplay = YES;
|
|
152
|
+
#endif
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
- (void)setAccessibilityLabels:(ENRMAccessibilityLabels *)accessibilityLabels
|
|
156
|
+
{
|
|
157
|
+
if (_accessibilityLabels == accessibilityLabels) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
_accessibilityLabels = accessibilityLabels;
|
|
161
|
+
// Children created before this point (or before a labels prop change) still
|
|
162
|
+
// hold the previous labels; nested quotes forward them to their own children.
|
|
163
|
+
for (RCTUIView *child in self.subviews) {
|
|
164
|
+
if ([child isKindOfClass:[EnrichedMarkdownInternalText class]]) {
|
|
165
|
+
((EnrichedMarkdownInternalText *)child).accessibilityLabels = accessibilityLabels;
|
|
166
|
+
} else if ([child isKindOfClass:[TableContainerView class]]) {
|
|
167
|
+
((TableContainerView *)child).accessibilityLabels = accessibilityLabels;
|
|
168
|
+
} else if ([child isKindOfClass:[ENRMBlockquoteContainerView class]]) {
|
|
169
|
+
((ENRMBlockquoteContainerView *)child).accessibilityLabels = accessibilityLabels;
|
|
170
|
+
}
|
|
171
|
+
#if ENRICHED_MARKDOWN_MATH
|
|
172
|
+
else if ([child isKindOfClass:[ENRMMathContainerView class]]) {
|
|
173
|
+
((ENRMMathContainerView *)child).accessibilityLabels = accessibilityLabels;
|
|
174
|
+
}
|
|
175
|
+
#endif
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// Child registry for this quote's own content. It reuses static creators for
|
|
180
|
+
// every kind and, for a nested Blockquote, creates another
|
|
181
|
+
// ENRMBlockquoteContainerView (the recursion). Streaming is static: no
|
|
182
|
+
// animation, no pending-fence sync.
|
|
183
|
+
- (ENRMSegmentViewRegistry *)buildChildRegistry
|
|
184
|
+
{
|
|
185
|
+
StyleConfig *config = self.config;
|
|
186
|
+
__weak ENRMBlockquoteContainerView *weakSelf = self;
|
|
187
|
+
NSMutableArray<ENRMSegmentViewHandler *> *handlers = [NSMutableArray array];
|
|
188
|
+
|
|
189
|
+
[handlers
|
|
190
|
+
addObject:[ENRMSegmentViewHandler handlerWithKind:ENRMSegmentKindText
|
|
191
|
+
matchesView:^BOOL(RCTUIView *view, ENRMRenderedSegment *segment) {
|
|
192
|
+
return [view isKindOfClass:[EnrichedMarkdownInternalText class]];
|
|
193
|
+
}
|
|
194
|
+
createView:^RCTUIView *(ENRMRenderedSegment *segment) {
|
|
195
|
+
ENRMBlockquoteContainerView *strongSelf = weakSelf;
|
|
196
|
+
EnrichedMarkdownInternalText *view = [[EnrichedMarkdownInternalText alloc] initWithConfig:config];
|
|
197
|
+
view.lastElementMarginBottom = segment.textResult.lastElementMarginBottom;
|
|
198
|
+
view.accessibilityInfo = segment.textResult.accessibilityInfo;
|
|
199
|
+
view.accessibilityLabels = strongSelf.accessibilityLabels;
|
|
200
|
+
[view applyAttributedText:segment.textResult.attributedText context:segment.textResult.context];
|
|
201
|
+
if (strongSelf) {
|
|
202
|
+
[strongSelf attachLinkTapToTextView:view];
|
|
203
|
+
}
|
|
204
|
+
return view;
|
|
205
|
+
}
|
|
206
|
+
updateView:^(RCTUIView *view, ENRMRenderedSegment *segment) {
|
|
207
|
+
EnrichedMarkdownInternalText *textView = (EnrichedMarkdownInternalText *)view;
|
|
208
|
+
textView.lastElementMarginBottom = segment.textResult.lastElementMarginBottom;
|
|
209
|
+
textView.accessibilityInfo = segment.textResult.accessibilityInfo;
|
|
210
|
+
[textView applyAttributedText:segment.textResult.attributedText
|
|
211
|
+
context:segment.textResult.context];
|
|
212
|
+
}]];
|
|
213
|
+
|
|
214
|
+
[handlers addObject:[ENRMSegmentViewHandler handlerWithKind:ENRMSegmentKindTable
|
|
215
|
+
matchesView:^BOOL(RCTUIView *view, ENRMRenderedSegment *segment) {
|
|
216
|
+
return [view isKindOfClass:[TableContainerView class]];
|
|
217
|
+
}
|
|
218
|
+
createView:^RCTUIView *(ENRMRenderedSegment *segment) {
|
|
219
|
+
TableContainerView *view = [[TableContainerView alloc] initWithConfig:config];
|
|
220
|
+
ENRMBlockquoteContainerView *strongSelf = weakSelf;
|
|
221
|
+
if (strongSelf) {
|
|
222
|
+
view.dynamicProps = strongSelf.dynamicProps;
|
|
223
|
+
view.accessibilityLabels = strongSelf.accessibilityLabels;
|
|
224
|
+
view.onLinkPress = ^(NSString *url) {
|
|
225
|
+
ENRMBlockquoteContainerView *s = weakSelf;
|
|
226
|
+
if (s.onLinkPress && url)
|
|
227
|
+
s.onLinkPress(url);
|
|
228
|
+
};
|
|
229
|
+
view.onLinkLongPress = ^(NSString *url) {
|
|
230
|
+
ENRMBlockquoteContainerView *s = weakSelf;
|
|
231
|
+
if (s.onLinkLongPress && url)
|
|
232
|
+
s.onLinkLongPress(url);
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
[view applyTableNode:segment.tableSegment.tableNode];
|
|
236
|
+
return view;
|
|
237
|
+
}
|
|
238
|
+
updateView:^(RCTUIView *view, ENRMRenderedSegment *segment) {
|
|
239
|
+
[(TableContainerView *)view applyTableNode:segment.tableSegment.tableNode];
|
|
240
|
+
}]];
|
|
241
|
+
|
|
242
|
+
[handlers
|
|
243
|
+
addObject:[ENRMSegmentViewHandler handlerWithKind:ENRMSegmentKindCodeBlock
|
|
244
|
+
matchesView:^BOOL(RCTUIView *view, ENRMRenderedSegment *segment) {
|
|
245
|
+
return [view isKindOfClass:[ENRMCodeBlockContainerView class]];
|
|
246
|
+
}
|
|
247
|
+
createView:^RCTUIView *(ENRMRenderedSegment *segment) {
|
|
248
|
+
ENRMCodeBlockContainerView *view = [[ENRMCodeBlockContainerView alloc] initWithConfig:config];
|
|
249
|
+
ENRMBlockquoteContainerView *strongSelf = weakSelf;
|
|
250
|
+
view.dynamicProps = strongSelf.dynamicProps;
|
|
251
|
+
view.onCopyPress = ^(NSString *code, NSString *language) {
|
|
252
|
+
ENRMBlockquoteContainerView *s = weakSelf;
|
|
253
|
+
if (s.onCopyPress)
|
|
254
|
+
s.onCopyPress(code, language);
|
|
255
|
+
};
|
|
256
|
+
view.onCodeBlockPress = ^(NSString *code, NSString *language) {
|
|
257
|
+
ENRMBlockquoteContainerView *s = weakSelf;
|
|
258
|
+
if (s.onCodeBlockPress)
|
|
259
|
+
s.onCodeBlockPress(code, language);
|
|
260
|
+
};
|
|
261
|
+
[view applyCodeBlockNode:segment.codeBlockSegment.codeBlockNode];
|
|
262
|
+
return view;
|
|
263
|
+
}
|
|
264
|
+
updateView:^(RCTUIView *view, ENRMRenderedSegment *segment) {
|
|
265
|
+
[(ENRMCodeBlockContainerView *)view applyCodeBlockNode:segment.codeBlockSegment.codeBlockNode];
|
|
266
|
+
}]];
|
|
267
|
+
|
|
268
|
+
[handlers addObject:[ENRMSegmentViewHandler handlerWithKind:ENRMSegmentKindBlockquote
|
|
269
|
+
matchesView:^BOOL(RCTUIView *view, ENRMRenderedSegment *segment) {
|
|
270
|
+
return [view isKindOfClass:[ENRMBlockquoteContainerView class]];
|
|
271
|
+
}
|
|
272
|
+
createView:^RCTUIView *(ENRMRenderedSegment *segment) {
|
|
273
|
+
ENRMBlockquoteContainerView *view =
|
|
274
|
+
[[ENRMBlockquoteContainerView alloc] initWithConfig:config];
|
|
275
|
+
view.nested = YES;
|
|
276
|
+
ENRMBlockquoteContainerView *strongSelf = weakSelf;
|
|
277
|
+
if (strongSelf) {
|
|
278
|
+
view.allowFontScaling = strongSelf.allowFontScaling;
|
|
279
|
+
view.lineBreakStrategy = strongSelf.lineBreakStrategy;
|
|
280
|
+
view.dynamicProps = strongSelf.dynamicProps;
|
|
281
|
+
view.accessibilityLabels = strongSelf.accessibilityLabels;
|
|
282
|
+
view.onCopyPress = strongSelf.onCopyPress;
|
|
283
|
+
view.onCodeBlockPress = strongSelf.onCodeBlockPress;
|
|
284
|
+
view.onLinkPress = ^(NSString *url) {
|
|
285
|
+
ENRMBlockquoteContainerView *s = weakSelf;
|
|
286
|
+
if (s.onLinkPress && url)
|
|
287
|
+
s.onLinkPress(url);
|
|
288
|
+
};
|
|
289
|
+
view.onLinkLongPress = ^(NSString *url) {
|
|
290
|
+
ENRMBlockquoteContainerView *s = weakSelf;
|
|
291
|
+
if (s.onLinkLongPress && url)
|
|
292
|
+
s.onLinkLongPress(url);
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
[view applyBlockquoteNode:segment.blockquoteSegment.blockquoteNode];
|
|
296
|
+
return view;
|
|
297
|
+
}
|
|
298
|
+
updateView:^(RCTUIView *view, ENRMRenderedSegment *segment) {
|
|
299
|
+
[(ENRMBlockquoteContainerView *)view
|
|
300
|
+
applyBlockquoteNode:segment.blockquoteSegment.blockquoteNode];
|
|
301
|
+
}]];
|
|
302
|
+
|
|
303
|
+
#if ENRICHED_MARKDOWN_MATH
|
|
304
|
+
#if !TARGET_OS_OSX
|
|
305
|
+
[handlers addObject:[ENRMSegmentViewHandler handlerWithKind:ENRMSegmentKindMath
|
|
306
|
+
matchesView:^BOOL(RCTUIView *view, ENRMRenderedSegment *segment) {
|
|
307
|
+
return [view isKindOfClass:[ENRMMathContainerView class]];
|
|
308
|
+
}
|
|
309
|
+
createView:^RCTUIView *(ENRMRenderedSegment *segment) {
|
|
310
|
+
ENRMMathContainerView *view = [[ENRMMathContainerView alloc] initWithConfig:config];
|
|
311
|
+
ENRMBlockquoteContainerView *strongSelf = weakSelf;
|
|
312
|
+
view.dynamicProps = strongSelf.dynamicProps;
|
|
313
|
+
view.accessibilityLabels = strongSelf.accessibilityLabels;
|
|
314
|
+
[view applyLatex:segment.mathSegment.latex];
|
|
315
|
+
return view;
|
|
316
|
+
}
|
|
317
|
+
updateView:^(RCTUIView *view, ENRMRenderedSegment *segment) {
|
|
318
|
+
[(ENRMMathContainerView *)view applyLatex:segment.mathSegment.latex];
|
|
319
|
+
}]];
|
|
320
|
+
#endif
|
|
321
|
+
#endif
|
|
322
|
+
|
|
323
|
+
#if ENRICHED_MARKDOWN_VIDEO
|
|
324
|
+
__weak ENRMBlockquoteContainerView *weakBQ = self;
|
|
325
|
+
[handlers addObject:[ENRMSegmentViewHandler handlerWithKind:ENRMSegmentKindVideo
|
|
326
|
+
matchesView:^BOOL(RCTUIView *view, ENRMRenderedSegment *segment) {
|
|
327
|
+
return [view isKindOfClass:[ENRMVideoContainerView class]];
|
|
328
|
+
}
|
|
329
|
+
createView:^RCTUIView *(ENRMRenderedSegment *segment) {
|
|
330
|
+
ENRMVideoContainerView *view = [[ENRMVideoContainerView alloc] initWithConfig:config];
|
|
331
|
+
ENRMBlockquoteContainerView *bq = weakBQ;
|
|
332
|
+
if (bq) {
|
|
333
|
+
view.dynamicProps = bq.dynamicProps;
|
|
334
|
+
}
|
|
335
|
+
[view applyVideoNode:segment.videoSegment.videoNode];
|
|
336
|
+
return view;
|
|
337
|
+
}
|
|
338
|
+
updateView:^(RCTUIView *view, ENRMRenderedSegment *segment) {
|
|
339
|
+
[(ENRMVideoContainerView *)view applyVideoNode:segment.videoSegment.videoNode];
|
|
340
|
+
}]];
|
|
341
|
+
#endif
|
|
342
|
+
|
|
343
|
+
return [[ENRMSegmentViewRegistry alloc] initWithHandlers:handlers];
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
- (void)attachLinkTapToTextView:(EnrichedMarkdownInternalText *)view
|
|
347
|
+
{
|
|
348
|
+
ENRMTapRecognizer *tap = [[ENRMTapRecognizer alloc] initWithTarget:self action:@selector(handleTextTap:)];
|
|
349
|
+
[view.textView addGestureRecognizer:tap];
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
- (void)handleTextTap:(ENRMTapRecognizer *)recognizer
|
|
353
|
+
{
|
|
354
|
+
ENRMPlatformTextView *textView = (ENRMPlatformTextView *)recognizer.view;
|
|
355
|
+
__weak ENRMBlockquoteContainerView *weakSelf = self;
|
|
356
|
+
ENRMHandleTapOnTextView(textView, recognizer, ^(NSString *url) {
|
|
357
|
+
ENRMBlockquoteContainerView *strongSelf = weakSelf;
|
|
358
|
+
if (strongSelf.onLinkPress && url)
|
|
359
|
+
strongSelf.onLinkPress(url);
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
- (CGFloat)measureHeight:(CGFloat)maxWidth
|
|
364
|
+
{
|
|
365
|
+
return [self computeContentHeightForWidth:MAX(maxWidth - self.contentInsets.left - self.contentInsets.right, 0)];
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
+ (CGFloat)measureHeightForBlockquoteNode:(MarkdownASTNode *)node
|
|
369
|
+
config:(StyleConfig *)config
|
|
370
|
+
maxWidth:(CGFloat)maxWidth
|
|
371
|
+
pointScaleFactor:(CGFloat)pointScaleFactor
|
|
372
|
+
allowFontScaling:(BOOL)allowFontScaling
|
|
373
|
+
lineBreakStrategy:(NSLineBreakStrategy)lineBreakStrategy
|
|
374
|
+
{
|
|
375
|
+
UIEdgeInsets insets = ENRMBlockquoteContentInsetsForNode(config, ENRMAdmonitionTypeForNode(node) != nil);
|
|
376
|
+
CGFloat innerWidth = MAX(maxWidth - insets.left - insets.right, 1);
|
|
377
|
+
|
|
378
|
+
NSArray<ENRMRenderedSegment *> *rendered =
|
|
379
|
+
ENRMRenderBlockquoteChildren(node, config, allowFontScaling, lineBreakStrategy);
|
|
380
|
+
CGFloat childrenHeight = ENRMMeasureSegmentsHeightViewFree(
|
|
381
|
+
rendered, config, innerWidth, /*allowTrailingMargin*/ NO, pointScaleFactor, ENRMWritingDirectionModeFirstStrong,
|
|
382
|
+
NSWritingDirectionNatural, allowFontScaling, lineBreakStrategy);
|
|
383
|
+
|
|
384
|
+
return childrenHeight + insets.top + insets.bottom;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
- (void)drawRect:(CGRect)rect
|
|
388
|
+
{
|
|
389
|
+
StyleConfig *config = self.config;
|
|
390
|
+
CGFloat borderWidth = config.blockquoteBorderWidth;
|
|
391
|
+
CGFloat radius = config.blockquoteBorderRadius;
|
|
392
|
+
CGRect bounds = self.bounds;
|
|
393
|
+
|
|
394
|
+
// The rounded (or plain) box outline, shared by the background fill and the accent
|
|
395
|
+
// bar's clip so the bar's left corners follow the border radius.
|
|
396
|
+
#if !TARGET_OS_OSX
|
|
397
|
+
UIBezierPath *boxPath = radius > 0 ? [UIBezierPath bezierPathWithRoundedRect:bounds cornerRadius:radius]
|
|
398
|
+
: [UIBezierPath bezierPathWithRect:bounds];
|
|
399
|
+
#else
|
|
400
|
+
NSBezierPath *boxPath = radius > 0 ? [NSBezierPath bezierPathWithRoundedRect:bounds xRadius:radius yRadius:radius]
|
|
401
|
+
: [NSBezierPath bezierPathWithRect:bounds];
|
|
402
|
+
#endif
|
|
403
|
+
|
|
404
|
+
// Admonitions theme the box with their per-type color; a plain quote keeps the
|
|
405
|
+
// base blockquote colors.
|
|
406
|
+
NSString *admonitionType = self.admonitionType;
|
|
407
|
+
RCTUIColor *backgroundColor =
|
|
408
|
+
admonitionType ? [config admonitionBackgroundColorForType:admonitionType] : config.blockquoteBackgroundColor;
|
|
409
|
+
if (backgroundColor && backgroundColor != [RCTUIColor clearColor]) {
|
|
410
|
+
[backgroundColor setFill];
|
|
411
|
+
[boxPath fill];
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
if (borderWidth > 0) {
|
|
415
|
+
RCTUIColor *borderColor =
|
|
416
|
+
admonitionType ? [config admonitionColorForType:admonitionType] : config.blockquoteBorderColor;
|
|
417
|
+
if (borderColor) {
|
|
418
|
+
CGRect barRect = CGRectMake(0, 0, borderWidth, bounds.size.height);
|
|
419
|
+
[borderColor setFill];
|
|
420
|
+
#if !TARGET_OS_OSX
|
|
421
|
+
CGContextRef ctx = UIGraphicsGetCurrentContext();
|
|
422
|
+
CGContextSaveGState(ctx);
|
|
423
|
+
[boxPath addClip];
|
|
424
|
+
[[UIBezierPath bezierPathWithRect:barRect] fill];
|
|
425
|
+
CGContextRestoreGState(ctx);
|
|
426
|
+
#else
|
|
427
|
+
[NSGraphicsContext saveGraphicsState];
|
|
428
|
+
[boxPath addClip];
|
|
429
|
+
[[NSBezierPath bezierPathWithRect:barRect] fill];
|
|
430
|
+
[NSGraphicsContext restoreGraphicsState];
|
|
431
|
+
#endif
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
if (admonitionType) {
|
|
436
|
+
[self drawAdmonitionHeaderForType:admonitionType config:config];
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
// Draws the admonition header (tinted octicon + capitalized title) in the band
|
|
441
|
+
// reserved at the top by the enlarged content inset. The view is flipped on
|
|
442
|
+
// macOS, so the y-down icon path and text draw identically on both platforms.
|
|
443
|
+
- (void)drawAdmonitionHeaderForType:(NSString *)type config:(StyleConfig *)config
|
|
444
|
+
{
|
|
445
|
+
RCTUIColor *tint = [config admonitionColorForType:type];
|
|
446
|
+
CGFloat padding = config.blockquotePadding;
|
|
447
|
+
CGFloat leftInset = ceil(config.blockquoteBorderWidth + config.blockquoteGapWidth + padding);
|
|
448
|
+
CGFloat iconSize = ENRMAdmonitionIconSize(config);
|
|
449
|
+
CGFloat headerHeight = ENRMAdmonitionHeaderContentHeight(config);
|
|
450
|
+
CGFloat headerTop = ceil(padding);
|
|
451
|
+
CGFloat titleX = leftInset;
|
|
452
|
+
|
|
453
|
+
CGPathRef iconPath = ENRMAdmonitionIconPath(type);
|
|
454
|
+
if (iconPath) {
|
|
455
|
+
#if !TARGET_OS_OSX
|
|
456
|
+
CGContextRef ctx = UIGraphicsGetCurrentContext();
|
|
457
|
+
#else
|
|
458
|
+
CGContextRef ctx = [[NSGraphicsContext currentContext] CGContext];
|
|
459
|
+
#endif
|
|
460
|
+
if (ctx) {
|
|
461
|
+
CGFloat scale = iconSize / ENRMAdmonitionIconViewBox;
|
|
462
|
+
CGFloat iconY = headerTop + (headerHeight - iconSize) / 2.0;
|
|
463
|
+
CGContextSaveGState(ctx);
|
|
464
|
+
CGContextTranslateCTM(ctx, leftInset, iconY);
|
|
465
|
+
CGContextScaleCTM(ctx, scale, scale);
|
|
466
|
+
CGContextAddPath(ctx, iconPath);
|
|
467
|
+
[tint setFill];
|
|
468
|
+
CGContextFillPath(ctx);
|
|
469
|
+
CGContextRestoreGState(ctx);
|
|
470
|
+
}
|
|
471
|
+
titleX = leftInset + iconSize + round(iconSize * 0.4);
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
NSString *title = ENRMAdmonitionTitle(type);
|
|
475
|
+
UIFont *titleFont = ENRMAdmonitionTitleFont(config);
|
|
476
|
+
NSDictionary<NSAttributedStringKey, id> *attributes =
|
|
477
|
+
@{NSFontAttributeName : titleFont, NSForegroundColorAttributeName : tint};
|
|
478
|
+
NSAttributedString *attributed = [[NSAttributedString alloc] initWithString:title attributes:attributes];
|
|
479
|
+
CGSize titleSize = [attributed size];
|
|
480
|
+
CGFloat titleY = headerTop + (headerHeight - titleSize.height) / 2.0;
|
|
481
|
+
[attributed drawAtPoint:CGPointMake(titleX, titleY)];
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
#pragma mark - Context menu
|
|
485
|
+
|
|
486
|
+
- (void)copyMarkdownToPasteboard
|
|
487
|
+
{
|
|
488
|
+
if (_cachedMarkdown.length > 0) {
|
|
489
|
+
copyStringToPasteboard(_cachedMarkdown);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
- (void)copyPlainTextToPasteboard
|
|
494
|
+
{
|
|
495
|
+
if (_cachedPlainText.length > 0) {
|
|
496
|
+
NSMutableDictionary *items = [NSMutableDictionary dictionary];
|
|
497
|
+
items[kUTIPlainText] = _cachedPlainText;
|
|
498
|
+
if (_cachedMarkdown.length > 0) {
|
|
499
|
+
items[kUTIMarkdown] = _cachedMarkdown;
|
|
500
|
+
}
|
|
501
|
+
copyItemsToPasteboard(items);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
#if !TARGET_OS_OSX
|
|
506
|
+
- (UIContextMenuConfiguration *)contextMenuInteraction:(UIContextMenuInteraction *)interaction
|
|
507
|
+
configurationForMenuAtLocation:(CGPoint)location
|
|
508
|
+
{
|
|
509
|
+
if (!self.dynamicProps.enableBlockContextMenu) {
|
|
510
|
+
return nil;
|
|
511
|
+
}
|
|
512
|
+
return [UIContextMenuConfiguration
|
|
513
|
+
configurationWithIdentifier:nil
|
|
514
|
+
previewProvider:nil
|
|
515
|
+
actionProvider:^UIMenu *(NSArray<UIMenuElement *> *suggestedActions) {
|
|
516
|
+
UIAction *copyPlainText =
|
|
517
|
+
[UIAction actionWithTitle:self.dynamicProps.menuCopyLabel
|
|
518
|
+
image:[RCTUIImage systemImageNamed:@"doc.on.doc"]
|
|
519
|
+
identifier:nil
|
|
520
|
+
handler:^(__kindof UIAction *action) { [self copyPlainTextToPasteboard]; }];
|
|
521
|
+
|
|
522
|
+
UIAction *copyMarkdown =
|
|
523
|
+
[UIAction actionWithTitle:self.dynamicProps.menuCopyAsMarkdownLabel
|
|
524
|
+
image:[RCTUIImage systemImageNamed:@"doc.text"]
|
|
525
|
+
identifier:nil
|
|
526
|
+
handler:^(__kindof UIAction *action) { [self copyMarkdownToPasteboard]; }];
|
|
527
|
+
|
|
528
|
+
return [UIMenu menuWithTitle:@"" children:@[ copyPlainText, copyMarkdown ]];
|
|
529
|
+
}];
|
|
530
|
+
}
|
|
531
|
+
#endif // !TARGET_OS_OSX
|
|
532
|
+
|
|
533
|
+
#if TARGET_OS_OSX
|
|
534
|
+
- (BOOL)isFlipped
|
|
535
|
+
{
|
|
536
|
+
return YES;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
- (NSMenu *)menuForEvent:(NSEvent *)event
|
|
540
|
+
{
|
|
541
|
+
if (!self.dynamicProps.enableBlockContextMenu) {
|
|
542
|
+
return [super menuForEvent:event];
|
|
543
|
+
}
|
|
544
|
+
NSMenu *menu = [[NSMenu alloc] initWithTitle:@""];
|
|
545
|
+
[menu addItem:ENRMCreateMenuItem(self.dynamicProps.menuCopyLabel, ^{ [self copyPlainTextToPasteboard]; })];
|
|
546
|
+
[menu addItem:ENRMCreateMenuItem(self.dynamicProps.menuCopyAsMarkdownLabel, ^{ [self copyMarkdownToPasteboard]; })];
|
|
547
|
+
return menu;
|
|
548
|
+
}
|
|
549
|
+
#endif
|
|
550
|
+
|
|
551
|
+
@end
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
#import "ENRMBlockMenu.h"
|
|
3
|
+
#import "ENRMDynamicBlockProps.h"
|
|
3
4
|
#import "ENRMUIKit.h"
|
|
4
5
|
#import "StyleConfig.h"
|
|
5
6
|
|
|
@@ -8,6 +9,7 @@
|
|
|
8
9
|
NS_ASSUME_NONNULL_BEGIN
|
|
9
10
|
|
|
10
11
|
typedef void (^ENRMCodeBlockCopyBlock)(NSString *code, NSString *language);
|
|
12
|
+
typedef void (^ENRMCodeBlockPressBlock)(NSString *code, NSString *language);
|
|
11
13
|
|
|
12
14
|
@interface ENRMCodeBlockContainerView : RCTUIView
|
|
13
15
|
|
|
@@ -27,10 +29,10 @@ typedef void (^ENRMCodeBlockCopyBlock)(NSString *code, NSString *language);
|
|
|
27
29
|
// disabled, while the header stays visible.
|
|
28
30
|
@property (nonatomic, assign) BOOL pending;
|
|
29
31
|
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
@property (nonatomic,
|
|
32
|
+
// Shared, runtime-mutable block props (context-menu gate, tap gate, copy labels)
|
|
33
|
+
// read live at use-time. Set to the root's shared instance at creation so a code
|
|
34
|
+
// block added after a toggle is born current. See ENRMDynamicBlockProps.
|
|
35
|
+
@property (nonatomic, strong) ENRMDynamicBlockProps *dynamicProps;
|
|
34
36
|
|
|
35
37
|
/// Suppresses the long-press copy menu on this block. Mirrors the
|
|
36
38
|
/// `contextMenuHidden` prop; the header copy button is a visible control, not a
|
|
@@ -55,6 +57,9 @@ typedef void (^ENRMCodeBlockCopyBlock)(NSString *code, NSString *language);
|
|
|
55
57
|
// `menuOptions.copyWritesMarkdown` is set.
|
|
56
58
|
@property (nonatomic, copy, nullable) ENRMCodeBlockCopyBlock onCopyPress;
|
|
57
59
|
|
|
60
|
+
// Bridges a whole-block tap (not the copy button) up to the JS onCodeBlockPress event.
|
|
61
|
+
@property (nonatomic, copy, nullable) ENRMCodeBlockPressBlock onCodeBlockPress;
|
|
62
|
+
|
|
58
63
|
@end
|
|
59
64
|
|
|
60
65
|
NS_ASSUME_NONNULL_END
|