react-native-enriched-markdown-scaffold 0.7.4-scaffold.9 → 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.
- package/README.md +54 -8
- package/ReactNativeEnrichedMarkdown.podspec +82 -73
- package/android/build.gradle +188 -1
- package/android/consumer-rules.pro +1 -1
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownManagerDelegate.java +27 -0
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownManagerInterface.java +7 -0
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownTextInputManagerDelegate.java +24 -0
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownTextInputManagerInterface.java +8 -0
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownTextManagerDelegate.java +27 -0
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownTextManagerInterface.java +7 -0
- package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/EventEmitters.cpp +223 -0
- package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/EventEmitters.h +183 -0
- package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/Props.cpp +65 -0
- package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/Props.h +1086 -61
- package/android/src/main/baseline-prof.txt +1 -1
- package/android/src/main/cpp/jni-adapter.cpp +74 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdown.kt +351 -13
- package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownInternalText.kt +62 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownManager.kt +85 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownText.kt +160 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownTextLayoutManager.kt +10 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownTextManager.kt +76 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/MeasurementStore.kt +126 -10
- package/android/src/main/java/com/swmansion/enriched/markdown/events/CopyPressEvent.kt +24 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/events/CopyRequestEvent.kt +28 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/events/LinkLayoutEvent.kt +36 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/events/SelectionChangeEvent.kt +43 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/EnrichedMarkdownTextInputManager.kt +54 -4
- package/android/src/main/java/com/swmansion/enriched/markdown/input/EnrichedMarkdownTextInputView.kt +923 -462
- package/android/src/main/java/com/swmansion/enriched/markdown/input/MarkdownClipboard.kt +42 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/editing/BlockEditCoordinator.kt +196 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/editing/ClipboardCoordinator.kt +73 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/editing/EditContext.kt +19 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/editing/EditPipeline.kt +248 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/editing/EditSession.kt +52 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/editing/InputConnectionWrapper.kt +108 -7
- package/android/src/main/java/com/swmansion/enriched/markdown/input/editing/LinkCoordinator.kt +69 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/editing/MarkdownTextWatcher.kt +3 -3
- package/android/src/main/java/com/swmansion/enriched/markdown/input/editing/MentionCoordinator.kt +118 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/events/OnChangeStateEvent.kt +26 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/events/OnContextMenuItemPressEvent.kt +26 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/events/OnInputKeyPressEvent.kt +24 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/events/OnPasteEvent.kt +24 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/formatting/BlockStore.kt +254 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/formatting/FormattingStore.kt +80 -87
- package/android/src/main/java/com/swmansion/enriched/markdown/input/formatting/InputFormatter.kt +109 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/input/formatting/InputParser.kt +116 -22
- package/android/src/main/java/com/swmansion/enriched/markdown/input/formatting/MarkdownSerializer.kt +167 -38
- package/android/src/main/java/com/swmansion/enriched/markdown/input/formatting/RangeEditAdjustment.kt +149 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/layout/InputEventEmitter.kt +66 -5
- package/android/src/main/java/com/swmansion/enriched/markdown/input/layout/InputMeasurementStore.kt +4 -2
- package/android/src/main/java/com/swmansion/enriched/markdown/input/model/BlockRange.kt +27 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/model/BlockType.kt +48 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/model/FormattingRange.kt +9 -4
- package/android/src/main/java/com/swmansion/enriched/markdown/input/model/InputFormatterStyle.kt +39 -2
- package/android/src/main/java/com/swmansion/enriched/markdown/input/model/MathAtom.kt +20 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/model/MathChipStyle.kt +1 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/input/model/MutableRangeBounds.kt +11 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/spans/InputBulletSpan.kt +82 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/spans/InputHeadingSpan.kt +58 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/spans/InputListItemSpacingSpan.kt +37 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/spans/InputOrderedListMarkerSpan.kt +63 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/styles/BlockHandler.kt +54 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/styles/HeadingBlockHandler.kt +27 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/styles/OrderedListBlockHandler.kt +38 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/styles/UnorderedListBlockHandler.kt +37 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/toolbar/InputContextMenu.kt +8 -26
- package/android/src/main/java/com/swmansion/enriched/markdown/parser/MarkdownASTNode.kt +1 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/parser/Parser.kt +1 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/BlockStyleContext.kt +9 -2
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/BlockquoteRenderer.kt +100 -12
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/CodeBlockRenderer.kt +16 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/HeadingRenderer.kt +4 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/LinkRenderer.kt +37 -7
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/ListContextManager.kt +2 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/ListItemRenderer.kt +74 -18
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/ListRenderer.kt +43 -4
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/NodeRenderer.kt +9 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/SoftBreakRenderer.kt +16 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/SpanStyleCache.kt +35 -28
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/BaseListSpan.kt +24 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/BlockquoteSpan.kt +174 -24
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/CodeBackgroundSpan.kt +20 -82
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/CodeBlockSpan.kt +13 -16
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/CodeSpan.kt +1 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/EmphasisSpan.kt +1 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/ImageSpan.kt +182 -46
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/InlineChipPainter.kt +140 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/LinkChipSpans.kt +177 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/LinkSpan.kt +1 -6
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/ListItemSpacingSpan.kt +33 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/ListMarkerAnchorSpan.kt +38 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/OrderedListSpan.kt +2 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/StrongSpan.kt +1 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/TaskListSpan.kt +3 -2
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/UnorderedListSpan.kt +3 -2
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/BlockquoteStyle.kt +6 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/CodeBlockStyle.kt +26 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/ImageStyle.kt +7 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/InlineMathStyle.kt +16 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/LinkStyle.kt +36 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/LinkVariantEntry.kt +7 -3
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/ListStyle.kt +4 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/MathStyle.kt +3 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/StyleConfig.kt +13 -4
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/TableStyle.kt +6 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/CodeBlockHighlighter.kt +90 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/CodeBlockNode.kt +57 -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/MarkdownSegment.kt +9 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/MarkdownViewManagerUtils.kt +84 -7
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/ReadableMapExtensions.kt +3 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/RenderedSegment.kt +10 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/SegmentSignature.kt +1 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/StreamingMarkdownFilter.kt +83 -5
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/serialization/MarkdownASTSerializer.kt +4 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/input/MarkdownStyleParser.kt +74 -44
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/input/PasteTextUtils.kt +52 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/ImageCache.kt +26 -3
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/ImageDownloader.kt +22 -9
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/LocalImageLoader.kt +161 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/conversion/HTMLGenerator.kt +2 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/conversion/MarkdownExtractor.kt +6 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/extensions/TextPaintExtensions.kt +23 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/interaction/CheckboxTouchHelper.kt +7 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/interaction/TaskListTapUtils.kt +41 -21
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/span/BlockSpacing.kt +15 -8
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/view/HeadlessActionMode.kt +88 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/view/LinkLayoutCollector.kt +100 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/view/LinkLongPressMovementMethod.kt +58 -27
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/view/SelectionActionMode.kt +72 -16
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/view/SelectionChangeReporter.kt +232 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/views/BlockMenuOptions.kt +64 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/views/CodeBlockContainerView.kt +414 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/views/ContextMenuPopup.kt +9 -6
- package/android/src/main/java/com/swmansion/enriched/markdown/views/CopyGlyph.kt +101 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/views/TableContainerView.kt +61 -11
- package/android/src/main/jni/CMakeLists.txt +53 -0
- package/android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownContainerShadowNode.cpp +10 -0
- package/android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownContainerShadowNode.h +11 -2
- package/android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownTextShadowNode.cpp +10 -0
- package/android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownTextShadowNode.h +12 -2
- package/android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownTextState.cpp +9 -0
- package/android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownTextState.h +24 -0
- package/android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/conversions.h +16 -0
- package/android/src/math/java/com/swmansion/enriched/markdown/input/math/MathChipControllerImpl.kt +21 -4
- package/android/src/math/java/com/swmansion/enriched/markdown/renderer/MathInlineRenderer.kt +8 -2
- package/android/src/math/java/com/swmansion/enriched/markdown/spans/MathChipSpan.kt +1 -1
- package/android/src/math/java/com/swmansion/enriched/markdown/spans/MathInlineSpan.kt +13 -6
- package/android/src/math/java/com/swmansion/enriched/markdown/spans/MathMeasureHelper.kt +2 -1
- package/android/src/math/java/com/swmansion/enriched/markdown/views/MathContainerView.kt +26 -8
- package/cpp/highlight/CodeBlockHighlighter.cpp +284 -0
- package/cpp/highlight/CodeBlockHighlighter.hpp +66 -0
- package/cpp/highlight/CodeBlockLanguages.cpp +138 -0
- package/cpp/highlight/CodeBlockLanguages.hpp +25 -0
- package/cpp/highlight/HighlightGrammars.hpp +28 -0
- package/cpp/highlight/code_highlight_podspec.rb +211 -0
- package/cpp/highlight/gen-registry.mjs +155 -0
- package/cpp/highlight/grammar-versions.json +159 -0
- package/cpp/highlight/vendor/generated/generated_queries.h +1665 -0
- package/cpp/highlight/vendor/generated/generated_registry.cpp +59 -0
- package/cpp/parser/MD4CParser.cpp +173 -61
- package/cpp/parser/MD4CParser.hpp +1 -0
- package/cpp/parser/MarkdownASTNode.hpp +2 -1
- package/cpp/wasm/ASTSerializer.cpp +2 -0
- package/cpp/wasm/build.sh +1 -0
- package/cpp/wasm/md4c_wasm.cpp +3 -1
- package/docs/ACCESSIBILITY.md +14 -2
- package/docs/API_REFERENCE.md +405 -12
- package/docs/BREAKING_CHANGES.md +129 -0
- package/docs/CODE_HIGHLIGHT.md +133 -0
- package/docs/COPY_OPTIONS.md +61 -3
- package/docs/ELEMENTS_STRUCTURE.md +52 -4
- package/docs/IMAGE_CACHING.md +30 -0
- package/docs/INPUT.md +110 -11
- package/docs/LATEX_MATH.md +87 -45
- package/docs/MACOS.md +1 -1
- package/docs/MARKDOWN_STREAMING.md +27 -1
- package/docs/MENTIONS.md +8 -1
- package/docs/NATIVE_ASSETS.md +127 -0
- package/docs/RTL.md +1 -1
- package/docs/STYLES.md +73 -6
- package/docs/TESTING.md +112 -0
- package/docs/TEXT.md +18 -6
- package/docs/WEB.md +4 -1
- package/ios/EnrichedMarkdown.h +7 -0
- package/ios/EnrichedMarkdown.mm +583 -76
- package/ios/EnrichedMarkdownText.h +7 -0
- package/ios/EnrichedMarkdownText.mm +299 -73
- package/ios/attachments/ENRMImageAttachment.h +9 -0
- package/ios/attachments/ENRMImageAttachment.m +143 -40
- package/ios/attachments/ENRMMathInlineAttachment+macOS.m +2 -1
- package/ios/attachments/ENRMMathInlineAttachment.h +5 -0
- package/ios/attachments/ENRMMathInlineAttachment.m +50 -82
- package/ios/attachments/ENRMMathInlineAttachmentShared.h +2 -0
- package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/EventEmitters.cpp +223 -0
- package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/EventEmitters.h +183 -0
- package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/Props.cpp +65 -0
- package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/Props.h +1086 -61
- package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/RCTComponentViewHelpers.h +181 -2
- package/ios/input/ENRMAutoLinkDetector.h +2 -1
- package/ios/input/ENRMAutoLinkDetector.mm +79 -41
- package/ios/input/ENRMBlockEditCoordinator.h +71 -0
- package/ios/input/ENRMBlockEditCoordinator.mm +195 -0
- package/ios/input/ENRMBlockRange.h +28 -0
- package/ios/input/ENRMBlockRange.mm +30 -0
- package/ios/input/ENRMBlockStore.h +56 -0
- package/ios/input/ENRMBlockStore.mm +275 -0
- package/ios/input/ENRMClipboardCoordinator.h +45 -0
- package/ios/input/ENRMClipboardCoordinator.mm +120 -0
- package/ios/input/ENRMDetectorPipeline.h +2 -1
- package/ios/input/ENRMEditPipeline.h +76 -0
- package/ios/input/ENRMEditPipeline.mm +228 -0
- package/ios/input/ENRMEditSession.h +36 -0
- package/ios/input/ENRMEditSession.mm +63 -0
- package/ios/input/ENRMFormattingStore.h +17 -0
- package/ios/input/ENRMFormattingStore.mm +95 -105
- package/ios/input/ENRMInputBlockType.h +91 -0
- package/ios/input/ENRMInputBlockType.mm +5 -0
- package/ios/input/ENRMInputDecorationDrawer.h +18 -0
- package/ios/input/ENRMInputEventEmitter.h +56 -0
- package/ios/input/ENRMInputEventEmitter.mm +308 -0
- package/ios/input/ENRMInputFormatter.h +29 -69
- package/ios/input/ENRMInputFormatter.mm +216 -124
- package/ios/input/ENRMInputFormatterStyle.h +99 -0
- package/ios/input/ENRMInputFormatterStyle.mm +188 -0
- package/ios/input/ENRMInputLayoutManager.h +9 -0
- package/ios/input/ENRMInputLayoutManager.mm +30 -0
- package/ios/input/ENRMInputListMarkerDrawer.h +32 -0
- package/ios/input/ENRMInputListMarkerDrawer.mm +426 -0
- package/ios/input/ENRMInputParser.h +5 -6
- package/ios/input/ENRMInputParser.mm +461 -178
- package/ios/input/ENRMInputRemend.mm +2 -2
- package/ios/input/ENRMInputStyleStateBuilder.h +40 -0
- package/ios/input/ENRMInputStyleStateBuilder.mm +60 -0
- package/ios/input/ENRMInputTextView.mm +103 -8
- package/ios/input/ENRMInputTypingAttributesController.h +42 -0
- package/ios/input/ENRMInputTypingAttributesController.mm +203 -0
- package/ios/input/ENRMLinkCoordinator.h +41 -0
- package/ios/input/ENRMLinkCoordinator.mm +89 -0
- package/ios/input/ENRMMarkdownSerializer.h +29 -5
- package/ios/input/ENRMMarkdownSerializer.mm +170 -48
- package/ios/input/ENRMMathAtom.h +26 -0
- package/ios/input/ENRMMathAtom.mm +12 -0
- package/ios/input/ENRMMentionCoordinator.h +45 -0
- package/ios/input/ENRMMentionCoordinator.mm +167 -0
- package/ios/input/ENRMRangeEditAdjustment.h +38 -0
- package/ios/input/ENRMRangeEditAdjustment.mm +91 -0
- package/ios/input/ENRMRangeStoreUtils.h +39 -0
- package/ios/input/EnrichedMarkdownTextInput+ContextMenu.mm +6 -6
- package/ios/input/EnrichedMarkdownTextInput+Internal.h +11 -3
- package/ios/input/EnrichedMarkdownTextInput.h +7 -1
- package/ios/input/EnrichedMarkdownTextInput.mm +1089 -1023
- package/ios/input/InputStylePropsUtils.h +109 -68
- package/ios/input/internals/EnrichedMarkdownTextInputShadowNode.mm +2 -1
- package/ios/input/styles/ENRMBlockHandler.h +46 -0
- package/ios/input/styles/ENRMHeadingBlockHandler.h +15 -0
- package/ios/input/styles/ENRMHeadingBlockHandler.mm +38 -0
- package/ios/input/styles/ENRMOrderedListBlockHandler.h +14 -0
- package/ios/input/styles/ENRMOrderedListBlockHandler.mm +48 -0
- package/ios/input/styles/ENRMUnorderedListBlockHandler.h +15 -0
- package/ios/input/styles/ENRMUnorderedListBlockHandler.mm +51 -0
- package/ios/internals/ENRMViewFreeMeasurement.h +331 -0
- package/ios/internals/EnrichedMarkdownShadowNode.h +1 -3
- package/ios/internals/EnrichedMarkdownShadowNode.mm +16 -20
- package/ios/internals/EnrichedMarkdownTextShadowNode.h +1 -3
- package/ios/internals/EnrichedMarkdownTextShadowNode.mm +15 -20
- package/ios/internals/MeasurementCache.h +41 -9
- package/ios/internals/ShadowMeasurementUtils.h +63 -58
- package/ios/math/ENRMMathChipController.h +74 -0
- package/ios/math/ENRMMathChipController.mm +476 -0
- package/ios/math/ENRMRaTeXBridge.swift +27 -6
- package/ios/parser/ENRMMarkdownParser.h +1 -8
- package/ios/parser/ENRMMarkdownParser.mm +2 -11
- package/ios/parser/MarkdownASTNode.h +2 -1
- package/ios/parser/MarkdownParserBridge.mm +4 -0
- package/ios/renderer/AttributedRenderer.m +20 -2
- package/ios/renderer/BaseRenderer.h +17 -2
- package/ios/renderer/BaseRenderer.m +30 -0
- package/ios/renderer/BlockquoteRenderer.h +1 -1
- package/ios/renderer/BlockquoteRenderer.m +144 -35
- package/ios/renderer/CodeBlockRenderer.h +1 -1
- package/ios/renderer/CodeBlockRenderer.m +27 -23
- package/ios/renderer/CodeRenderer.h +1 -1
- package/ios/renderer/CodeRenderer.m +3 -1
- package/ios/renderer/ENRMImageRenderer.h +1 -1
- package/ios/renderer/ENRMImageRenderer.m +5 -1
- package/ios/renderer/ENRMMathInlineRenderer.h +1 -1
- package/ios/renderer/ENRMMathInlineRenderer.m +6 -1
- package/ios/renderer/ENRMSpoilerRenderer.h +1 -1
- package/ios/renderer/ENRMSpoilerRenderer.m +3 -1
- package/ios/renderer/EmphasisRenderer.h +1 -1
- package/ios/renderer/EmphasisRenderer.m +3 -1
- package/ios/renderer/HeadingRenderer.h +1 -1
- package/ios/renderer/HeadingRenderer.m +13 -6
- package/ios/renderer/HighlightRenderer.h +1 -1
- package/ios/renderer/HighlightRenderer.m +3 -1
- package/ios/renderer/LinkRenderer.h +1 -1
- package/ios/renderer/LinkRenderer.m +50 -16
- package/ios/renderer/ListItemRenderer.h +13 -1
- package/ios/renderer/ListItemRenderer.m +102 -44
- package/ios/renderer/ListRenderer.h +2 -2
- package/ios/renderer/ListRenderer.m +63 -25
- package/ios/renderer/ParagraphRenderer.h +1 -1
- package/ios/renderer/ParagraphRenderer.m +16 -8
- package/ios/renderer/RenderContext.h +10 -0
- package/ios/renderer/RenderContext.m +44 -0
- package/ios/renderer/RendererFactory.m +14 -0
- package/ios/renderer/StrikethroughRenderer.h +1 -1
- package/ios/renderer/StrikethroughRenderer.m +3 -1
- package/ios/renderer/StrongRenderer.h +1 -1
- package/ios/renderer/StrongRenderer.m +3 -1
- package/ios/renderer/SubscriptRenderer.h +1 -1
- package/ios/renderer/SubscriptRenderer.m +3 -1
- package/ios/renderer/SuperscriptRenderer.h +1 -1
- package/ios/renderer/SuperscriptRenderer.m +3 -1
- package/ios/renderer/TextRenderer.h +2 -2
- package/ios/renderer/TextRenderer.m +3 -1
- package/ios/renderer/ThematicBreakRenderer.h +1 -1
- package/ios/renderer/ThematicBreakRenderer.m +3 -1
- package/ios/renderer/UnderlineRenderer.h +1 -1
- package/ios/renderer/UnderlineRenderer.m +3 -1
- package/ios/styles/StyleConfig.h +42 -0
- package/ios/styles/StyleConfig.mm +216 -0
- package/ios/utils/BlockquoteBorder.h +6 -0
- package/ios/utils/BlockquoteBorder.m +249 -52
- package/ios/utils/CodeBackground.m +3 -65
- package/ios/utils/CodeBlockBackground.m +16 -2
- package/ios/utils/ENRMAtomicSize.h +65 -0
- package/ios/utils/ENRMBlockMenu.h +66 -0
- package/ios/utils/ENRMChipDrawing.h +24 -0
- package/ios/utils/ENRMChipDrawing.m +83 -0
- package/ios/utils/ENRMCodeBlockContent.h +37 -0
- package/ios/utils/ENRMCodeBlockContent.mm +79 -0
- package/ios/utils/ENRMCodeBlockHighlighter.h +37 -0
- package/ios/utils/ENRMCodeBlockHighlighter.mm +51 -0
- package/ios/utils/ENRMFeatureFlags.h +7 -0
- package/ios/utils/ENRMImageDownloader.h +11 -1
- package/ios/utils/ENRMImageDownloader.m +60 -16
- package/ios/utils/ENRMLinkChip.h +70 -0
- package/ios/utils/ENRMLinkChip.m +213 -0
- package/ios/utils/ENRMLinkLayout.h +50 -0
- package/ios/utils/ENRMLinkLayout.m +45 -0
- package/ios/utils/ENRMLocalImageLoader.h +31 -0
- package/ios/utils/ENRMLocalImageLoader.m +68 -0
- package/ios/utils/ENRMMathFallback.h +26 -0
- package/ios/utils/ENRMMathFallback.m +18 -0
- package/ios/utils/ENRMSelectionChange.h +120 -0
- package/ios/utils/ENRMSelectionChange.m +282 -0
- package/ios/utils/ENRMTextViewSetup.h +35 -17
- package/ios/utils/EditMenuUtils+macOS.m +4 -1
- package/ios/utils/EditMenuUtils.h +35 -6
- package/ios/utils/EditMenuUtils.m +188 -11
- package/ios/utils/HTMLGenerator.m +2 -1
- package/ios/utils/ImageRequestHeaderUtils.h +35 -0
- package/ios/utils/LastElementUtils.h +1 -0
- package/ios/utils/ListMarkerDrawer.m +29 -42
- package/ios/utils/MarkdownASTSerializer.m +4 -0
- package/ios/utils/MarkdownAccessibilityElementBuilder.m +3 -1
- package/ios/utils/MarkdownExtractor.m +2 -1
- package/ios/utils/ParagraphStyleUtils.h +5 -0
- package/ios/utils/ParagraphStyleUtils.m +77 -17
- package/ios/utils/RTFExportUtils.m +2 -0
- package/ios/utils/RenderedMarkdownSegment.h +13 -1
- package/ios/utils/RenderedMarkdownSegment.m +20 -0
- package/ios/utils/SegmentRenderer.m +17 -4
- package/ios/utils/StreamingMarkdownFilter.h +11 -1
- package/ios/utils/StreamingMarkdownFilter.m +98 -2
- package/ios/utils/StylePropsUtils.h +110 -1
- package/ios/utils/TaskListTapUtils.m +24 -0
- package/ios/utils/TextViewLayoutManager.mm +3 -0
- package/ios/views/ENRMCodeBlockContainerView.h +60 -0
- package/ios/views/ENRMCodeBlockContainerView.m +569 -0
- package/ios/views/ENRMMathContainerView.h +23 -0
- package/ios/views/ENRMMathContainerView.m +87 -20
- package/ios/views/TableContainerView.h +32 -0
- package/ios/views/TableContainerView.m +291 -175
- package/jest.d.ts +1 -0
- package/jest.js +5 -0
- package/lib/module/EnrichedMarkdownNativeComponent.ts +203 -1
- package/lib/module/EnrichedMarkdownTextInput.js +84 -5
- package/lib/module/EnrichedMarkdownTextInput.js.map +1 -1
- package/lib/module/EnrichedMarkdownTextInputNativeComponent.ts +78 -5
- package/lib/module/EnrichedMarkdownTextNativeComponent.ts +204 -1
- package/lib/module/headingDefaults.js +34 -0
- package/lib/module/headingDefaults.js.map +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/jest/index.js +205 -0
- package/lib/module/jest/index.js.map +1 -0
- package/lib/module/native/EnrichedMarkdownText.js +199 -15
- package/lib/module/native/EnrichedMarkdownText.js.map +1 -1
- package/lib/module/normalizeMarkdownStyle.js +98 -23
- package/lib/module/normalizeMarkdownStyle.js.map +1 -1
- package/lib/module/normalizeMarkdownStyle.web.js +73 -22
- package/lib/module/normalizeMarkdownStyle.web.js.map +1 -1
- package/lib/module/normalizeMarkdownTextInputStyle.js +62 -15
- package/lib/module/normalizeMarkdownTextInputStyle.js.map +1 -1
- package/lib/module/normalizeMenuItem.js +1 -1
- package/lib/module/utils/textInputState.js +26 -0
- package/lib/module/utils/textInputState.js.map +1 -0
- package/lib/module/web/EnrichedMarkdownText.js +15 -8
- package/lib/module/web/EnrichedMarkdownText.js.map +1 -1
- package/lib/module/web/parseMarkdown.js +4 -3
- package/lib/module/web/parseMarkdown.js.map +1 -1
- package/lib/module/web/renderers/InlineRenderers.js +102 -3
- package/lib/module/web/renderers/InlineRenderers.js.map +1 -1
- package/lib/module/web/renderers/ListRenderers.js +7 -2
- package/lib/module/web/renderers/ListRenderers.js.map +1 -1
- package/lib/module/web/renderers/index.js +7 -4
- package/lib/module/web/renderers/index.js.map +1 -1
- package/lib/module/web/styles.js +101 -6
- package/lib/module/web/styles.js.map +1 -1
- package/lib/module/web/utils.js +14 -0
- package/lib/module/web/utils.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 +185 -2
- package/lib/typescript/src/EnrichedMarkdownNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/EnrichedMarkdownTextInput.d.ts +94 -9
- package/lib/typescript/src/EnrichedMarkdownTextInput.d.ts.map +1 -1
- package/lib/typescript/src/EnrichedMarkdownTextInputNativeComponent.d.ts +69 -5
- package/lib/typescript/src/EnrichedMarkdownTextInputNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/EnrichedMarkdownTextNativeComponent.d.ts +185 -2
- package/lib/typescript/src/EnrichedMarkdownTextNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/headingDefaults.d.ts +9 -0
- package/lib/typescript/src/headingDefaults.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +3 -3
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/index.web.d.ts +2 -2
- package/lib/typescript/src/index.web.d.ts.map +1 -1
- package/lib/typescript/src/jest/index.d.ts +6 -0
- package/lib/typescript/src/jest/index.d.ts.map +1 -0
- package/lib/typescript/src/native/EnrichedMarkdownText.d.ts +5 -5
- package/lib/typescript/src/native/EnrichedMarkdownText.d.ts.map +1 -1
- 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/normalizeMarkdownTextInputStyle.d.ts +19 -5
- package/lib/typescript/src/normalizeMarkdownTextInputStyle.d.ts.map +1 -1
- package/lib/typescript/src/types/MarkdownStyle.d.ts +122 -5
- package/lib/typescript/src/types/MarkdownStyle.d.ts.map +1 -1
- package/lib/typescript/src/types/MarkdownStyleInternal.d.ts +39 -0
- package/lib/typescript/src/types/MarkdownStyleInternal.d.ts.map +1 -1
- package/lib/typescript/src/types/MarkdownTextProps.d.ts +207 -10
- package/lib/typescript/src/types/MarkdownTextProps.d.ts.map +1 -1
- package/lib/typescript/src/types/MarkdownTextProps.web.d.ts +60 -1
- package/lib/typescript/src/types/MarkdownTextProps.web.d.ts.map +1 -1
- package/lib/typescript/src/types/events.d.ts +85 -0
- package/lib/typescript/src/types/events.d.ts.map +1 -1
- package/lib/typescript/src/utils/textInputState.d.ts +24 -0
- package/lib/typescript/src/utils/textInputState.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/parseMarkdown.d.ts +1 -1
- package/lib/typescript/src/web/parseMarkdown.d.ts.map +1 -1
- package/lib/typescript/src/web/renderers/InlineRenderers.d.ts.map +1 -1
- package/lib/typescript/src/web/renderers/ListRenderers.d.ts.map +1 -1
- package/lib/typescript/src/web/renderers/index.d.ts +2 -1
- package/lib/typescript/src/web/renderers/index.d.ts.map +1 -1
- package/lib/typescript/src/web/styles.d.ts +2 -1
- package/lib/typescript/src/web/styles.d.ts.map +1 -1
- package/lib/typescript/src/web/types.d.ts +10 -2
- package/lib/typescript/src/web/types.d.ts.map +1 -1
- package/lib/typescript/src/web/utils.d.ts +4 -0
- package/lib/typescript/src/web/utils.d.ts.map +1 -1
- package/package.json +36 -9
- package/postinstall.mjs +131 -0
- package/ratex-version.json +21 -0
- package/src/EnrichedMarkdownNativeComponent.ts +203 -1
- package/src/EnrichedMarkdownTextInput.tsx +159 -8
- package/src/EnrichedMarkdownTextInputNativeComponent.ts +78 -5
- package/src/EnrichedMarkdownTextNativeComponent.ts +204 -1
- package/src/headingDefaults.ts +21 -0
- package/src/index.tsx +15 -0
- package/src/index.web.tsx +6 -1
- package/src/jest/index.tsx +236 -0
- package/src/native/EnrichedMarkdownText.tsx +260 -11
- package/src/normalizeMarkdownStyle.ts +117 -16
- package/src/normalizeMarkdownStyle.web.ts +76 -15
- package/src/normalizeMarkdownTextInputStyle.ts +110 -35
- package/src/normalizeMenuItem.ts +1 -1
- package/src/types/MarkdownStyle.ts +125 -5
- package/src/types/MarkdownStyleInternal.ts +51 -0
- package/src/types/MarkdownTextProps.ts +215 -10
- package/src/types/MarkdownTextProps.web.ts +62 -1
- package/src/types/events.ts +90 -0
- package/src/utils/textInputState.ts +35 -0
- package/src/web/EnrichedMarkdownText.tsx +26 -5
- package/src/web/parseMarkdown.ts +6 -2
- package/src/web/renderers/InlineRenderers.tsx +116 -3
- package/src/web/renderers/ListRenderers.tsx +14 -2
- package/src/web/renderers/index.tsx +6 -2
- package/src/web/styles.ts +114 -5
- package/src/web/types.ts +10 -1
- package/src/web/utils.ts +9 -0
- package/src/web/wasm/md4c.js +0 -0
- package/vendor-grammars.mjs +511 -0
- package/vendor-ratex.mjs +173 -0
- package/app.plugin.js +0 -2
- package/plugin/build/withAndroidMath.js +0 -19
- package/plugin/build/withIosMath.js +0 -28
- package/plugin/build/withReactNativeEnrichedMarkdown.js +0 -11
- package/plugin/src/withAndroidMath.ts +0 -24
- package/plugin/src/withIosMath.ts +0 -35
- package/plugin/src/withReactNativeEnrichedMarkdown.ts +0 -17
- package/plugin/tsconfig.build.json +0 -16
|
@@ -6,6 +6,19 @@ export type BlockTextAlign = 'auto' | 'left' | 'right' | 'center' | 'justify';
|
|
|
6
6
|
// Mirrors the public fontStyle values; empty string means "inherit / no override".
|
|
7
7
|
export type EmphasisFontStyle = 'normal' | 'italic' | 'oblique' | '';
|
|
8
8
|
|
|
9
|
+
// empty string means "no table alignment set" (legacy start-aligned placement).
|
|
10
|
+
export type TableAlign = 'left' | 'center' | 'right' | '';
|
|
11
|
+
|
|
12
|
+
// empty string means "legacy sizing" (fill width, no resize-mode handling).
|
|
13
|
+
// resolves to 'cover' when maxHeight/aspectRatio is present.
|
|
14
|
+
export type ImageResizeMode =
|
|
15
|
+
| 'contain'
|
|
16
|
+
| 'cover'
|
|
17
|
+
| 'stretch'
|
|
18
|
+
| 'center'
|
|
19
|
+
| 'none'
|
|
20
|
+
| '';
|
|
21
|
+
|
|
9
22
|
interface BaseBlockStyleInternal {
|
|
10
23
|
fontSize: number;
|
|
11
24
|
fontFamily: string;
|
|
@@ -29,6 +42,8 @@ interface BlockquoteStyleInternal extends BaseBlockStyleInternal {
|
|
|
29
42
|
borderWidth: number;
|
|
30
43
|
gapWidth: number;
|
|
31
44
|
backgroundColor: string;
|
|
45
|
+
borderRadius: number;
|
|
46
|
+
padding: number;
|
|
32
47
|
}
|
|
33
48
|
|
|
34
49
|
interface ListStyleInternal extends BaseBlockStyleInternal {
|
|
@@ -39,6 +54,24 @@ interface ListStyleInternal extends BaseBlockStyleInternal {
|
|
|
39
54
|
markerFontWeight: string;
|
|
40
55
|
gapWidth: number;
|
|
41
56
|
marginLeft: number;
|
|
57
|
+
itemSpacing: number;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface CodeBlockSyntaxColorsInternal {
|
|
61
|
+
keyword: string;
|
|
62
|
+
operatorColor: string;
|
|
63
|
+
punctuation: string;
|
|
64
|
+
string: string;
|
|
65
|
+
number: string;
|
|
66
|
+
constant: string;
|
|
67
|
+
comment: string;
|
|
68
|
+
function: string;
|
|
69
|
+
type: string;
|
|
70
|
+
variable: string;
|
|
71
|
+
property: string;
|
|
72
|
+
tag: string;
|
|
73
|
+
attribute: string;
|
|
74
|
+
embedded: string;
|
|
42
75
|
}
|
|
43
76
|
|
|
44
77
|
interface CodeBlockStyleInternal extends BaseBlockStyleInternal {
|
|
@@ -47,6 +80,7 @@ interface CodeBlockStyleInternal extends BaseBlockStyleInternal {
|
|
|
47
80
|
borderRadius: number;
|
|
48
81
|
borderWidth: number;
|
|
49
82
|
padding: number;
|
|
83
|
+
syntaxColors: CodeBlockSyntaxColorsInternal;
|
|
50
84
|
}
|
|
51
85
|
|
|
52
86
|
interface LinkStyleInternal {
|
|
@@ -54,6 +88,11 @@ interface LinkStyleInternal {
|
|
|
54
88
|
color: string;
|
|
55
89
|
underline: boolean;
|
|
56
90
|
backgroundColor: string;
|
|
91
|
+
borderRadius: number;
|
|
92
|
+
paddingHorizontal: number;
|
|
93
|
+
paddingVertical: number;
|
|
94
|
+
borderColor: string;
|
|
95
|
+
borderWidth: number;
|
|
57
96
|
}
|
|
58
97
|
|
|
59
98
|
export interface LinkVariantEntryInternal {
|
|
@@ -61,6 +100,11 @@ export interface LinkVariantEntryInternal {
|
|
|
61
100
|
color: string;
|
|
62
101
|
underline: boolean;
|
|
63
102
|
backgroundColor: string;
|
|
103
|
+
borderRadius: number;
|
|
104
|
+
paddingHorizontal: number;
|
|
105
|
+
paddingVertical: number;
|
|
106
|
+
borderColor: string;
|
|
107
|
+
borderWidth: number;
|
|
64
108
|
}
|
|
65
109
|
|
|
66
110
|
interface StrongStyleInternal {
|
|
@@ -93,6 +137,9 @@ interface CodeStyleInternal {
|
|
|
93
137
|
|
|
94
138
|
interface ImageStyleInternal {
|
|
95
139
|
height: number;
|
|
140
|
+
maxHeight: number;
|
|
141
|
+
aspectRatio: number;
|
|
142
|
+
resizeMode: ImageResizeMode;
|
|
96
143
|
borderRadius: number;
|
|
97
144
|
marginTop: number;
|
|
98
145
|
marginBottom: number;
|
|
@@ -120,6 +167,8 @@ interface TableStyleInternal extends BaseBlockStyleInternal {
|
|
|
120
167
|
borderRadius: number;
|
|
121
168
|
cellPaddingHorizontal: number;
|
|
122
169
|
cellPaddingVertical: number;
|
|
170
|
+
horizontalOverflow: number;
|
|
171
|
+
align: TableAlign;
|
|
123
172
|
}
|
|
124
173
|
|
|
125
174
|
interface TaskListStyleInternal {
|
|
@@ -141,12 +190,14 @@ interface MathStyleInternal {
|
|
|
141
190
|
marginBottom: number;
|
|
142
191
|
textAlign: BlockTextAlign;
|
|
143
192
|
fontWeight: string;
|
|
193
|
+
glyphOverflow: number;
|
|
144
194
|
}
|
|
145
195
|
|
|
146
196
|
interface InlineMathStyleInternal {
|
|
147
197
|
color: string;
|
|
148
198
|
paddingVertical: number;
|
|
149
199
|
fontWeight: string;
|
|
200
|
+
glyphOverflow: number;
|
|
150
201
|
}
|
|
151
202
|
|
|
152
203
|
interface SpoilerParticlesStyleInternal {
|
|
@@ -1,12 +1,62 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ReactNode, RefObject } from 'react';
|
|
2
|
+
import type {
|
|
3
|
+
ColorValue,
|
|
4
|
+
HostInstance,
|
|
5
|
+
ViewProps,
|
|
6
|
+
ViewStyle,
|
|
7
|
+
TextStyle,
|
|
8
|
+
} from 'react-native';
|
|
2
9
|
import type { MarkdownStyle, Md4cFlags } from './MarkdownStyle';
|
|
3
10
|
import type { AccessibilityLabels } from './AccessibilityLabels';
|
|
4
11
|
import type {
|
|
5
12
|
LinkPressEvent,
|
|
6
13
|
LinkLongPressEvent,
|
|
7
14
|
TaskListItemPressEvent,
|
|
15
|
+
CopyPressEvent,
|
|
16
|
+
CopyEvent,
|
|
17
|
+
SelectionChangeEvent,
|
|
8
18
|
} from './events';
|
|
9
19
|
|
|
20
|
+
/** Imperative handle of `EnrichedMarkdownText`, reached through its `ref`. */
|
|
21
|
+
export interface EnrichedMarkdownTextInstance {
|
|
22
|
+
/**
|
|
23
|
+
* Clears the text selection (and any long-pressed block) and fires
|
|
24
|
+
* `onSelectionChange` with `active: false`.
|
|
25
|
+
* @platform ios, android
|
|
26
|
+
*/
|
|
27
|
+
clearSelection: () => void;
|
|
28
|
+
measure: HostInstance['measure'];
|
|
29
|
+
measureInWindow: HostInstance['measureInWindow'];
|
|
30
|
+
measureLayout: HostInstance['measureLayout'];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A rect in dp, relative to the component's content box (inside any
|
|
35
|
+
* `containerStyle` padding).
|
|
36
|
+
*/
|
|
37
|
+
export interface LinkRect {
|
|
38
|
+
x: number;
|
|
39
|
+
y: number;
|
|
40
|
+
width: number;
|
|
41
|
+
height: number;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Layout of one rendered link, passed to `renderLinkDecoration`. */
|
|
45
|
+
export interface LinkDecorationInfo {
|
|
46
|
+
/** Position of the link in the document (0-based) — stable key for a link. */
|
|
47
|
+
index: number;
|
|
48
|
+
url: string;
|
|
49
|
+
/** The link's visible text. */
|
|
50
|
+
text: string;
|
|
51
|
+
/**
|
|
52
|
+
* Anchor rect. Native: the drawn chip (glyphs + padding) of the link's last
|
|
53
|
+
* line fragment. Web: the link's inline box.
|
|
54
|
+
*/
|
|
55
|
+
rect: LinkRect;
|
|
56
|
+
/** Every line fragment of the link (several when it wraps). Web: `[rect]`. */
|
|
57
|
+
rects: LinkRect[];
|
|
58
|
+
}
|
|
59
|
+
|
|
10
60
|
/**
|
|
11
61
|
* Public context menu item. Each item includes a JS-side `onPress` callback
|
|
12
62
|
* that is called when the user taps the item in the selection context menu.
|
|
@@ -56,22 +106,31 @@ export interface SelectionMenuPluralLabels {
|
|
|
56
106
|
* Controls the built-in items added to the native text selection menu and
|
|
57
107
|
* lets you localize their labels.
|
|
58
108
|
*
|
|
59
|
-
* Each item accepts an object: `{ enabled }` toggles visibility
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
109
|
+
* Each item accepts an object: `{ enabled }` toggles visibility and `label`
|
|
110
|
+
* overrides the English default. Wire `label` to your i18n library to match
|
|
111
|
+
* the rest of your app's UI. Items and labels apply to the main text selection
|
|
112
|
+
* menu as well as the table, math and code block copy menus.
|
|
113
|
+
*
|
|
114
|
+
* `copy.enabled`, `copy.format` and `systemItems` are ignored on macOS.
|
|
64
115
|
*
|
|
65
116
|
* @platform ios, android, macos
|
|
66
117
|
*/
|
|
67
118
|
export interface SelectionMenuConfig {
|
|
68
119
|
/**
|
|
69
|
-
* The
|
|
70
|
-
*
|
|
120
|
+
* The "Copy" item.
|
|
121
|
+
* - `enabled`: `false` removes it from the text selection menu, the table /
|
|
122
|
+
* math / code block menus and the code block VoiceOver copy action.
|
|
123
|
+
* - `format`: `'rich'` copies rich text (plain + HTML, plus RTF on iOS) from
|
|
124
|
+
* text selections and the raw content from blocks; `'markdown'` copies
|
|
125
|
+
* Markdown as plain text everywhere the item appears (inline math becomes
|
|
126
|
+
* `$…$`, math blocks `$$…$$`, code blocks are fenced). The code block header
|
|
127
|
+
* button and VoiceOver action always copy the raw code.
|
|
128
|
+
* @default { enabled: true, label: "Copy", format: "rich" }
|
|
71
129
|
*/
|
|
72
|
-
copy?: { label?: string };
|
|
130
|
+
copy?: { enabled?: boolean; label?: string; format?: 'rich' | 'markdown' };
|
|
73
131
|
/**
|
|
74
|
-
* The built-in "Copy as Markdown" action
|
|
132
|
+
* The built-in "Copy as Markdown" action, in the text selection menu and in
|
|
133
|
+
* the table / math / code block menus.
|
|
75
134
|
* @default { enabled: true, label: "Copy as Markdown" }
|
|
76
135
|
*/
|
|
77
136
|
copyAsMarkdown?: { enabled?: boolean; label?: string };
|
|
@@ -86,6 +145,23 @@ export interface SelectionMenuConfig {
|
|
|
86
145
|
label?: string;
|
|
87
146
|
pluralLabels?: SelectionMenuPluralLabels;
|
|
88
147
|
};
|
|
148
|
+
/**
|
|
149
|
+
* Which system items the text selection menu keeps.
|
|
150
|
+
* - `'default'`: keep everything the OS adds (Select All, Look Up, Share,
|
|
151
|
+
* Translate, app text actions…), with Copy replaced by the built-in one.
|
|
152
|
+
* - `'none'`: drop every system item; the menu only holds the built-in items
|
|
153
|
+
* above and `contextMenuItems`.
|
|
154
|
+
* @default 'default'
|
|
155
|
+
* @platform ios, android
|
|
156
|
+
*/
|
|
157
|
+
systemItems?: 'default' | 'none';
|
|
158
|
+
/**
|
|
159
|
+
* The copy button in the code block header. `false` hides the button; the
|
|
160
|
+
* header and language label stay.
|
|
161
|
+
* @default { enabled: true }
|
|
162
|
+
* @platform ios, android, macos
|
|
163
|
+
*/
|
|
164
|
+
codeBlockCopyButton?: { enabled?: boolean };
|
|
89
165
|
}
|
|
90
166
|
|
|
91
167
|
export interface StreamingConfig {
|
|
@@ -98,9 +174,26 @@ export interface StreamingConfig {
|
|
|
98
174
|
* @platform ios, android
|
|
99
175
|
*/
|
|
100
176
|
tableMode?: 'hidden' | 'progressive';
|
|
177
|
+
/**
|
|
178
|
+
* Controls how a fenced code block whose closing fence has not arrived yet
|
|
179
|
+
* is handled during streaming.
|
|
180
|
+
* - `'hidden'`: hide the entire code block until its closing fence arrives.
|
|
181
|
+
* - `'progressive'` (default): show the code as it streams in with its header
|
|
182
|
+
* visible but non-interactive (copying is disabled); syntax highlighting is
|
|
183
|
+
* deferred until the closing fence arrives, so it appears once atomically.
|
|
184
|
+
* Only effective when `streamingAnimation` is `true`.
|
|
185
|
+
* @default 'progressive'
|
|
186
|
+
* @platform ios, android
|
|
187
|
+
*/
|
|
188
|
+
codeBlockMode?: 'hidden' | 'progressive';
|
|
101
189
|
}
|
|
102
190
|
|
|
103
191
|
export interface EnrichedMarkdownTextProps extends Omit<ViewProps, 'style'> {
|
|
192
|
+
/**
|
|
193
|
+
* Imperative handle: `clearSelection()` plus the host `measure*` methods.
|
|
194
|
+
* @platform ios, android
|
|
195
|
+
*/
|
|
196
|
+
ref?: RefObject<EnrichedMarkdownTextInstance | null>;
|
|
104
197
|
/**
|
|
105
198
|
* Markdown content to render.
|
|
106
199
|
* @platform ios, android, web
|
|
@@ -138,6 +231,21 @@ export interface EnrichedMarkdownTextProps extends Omit<ViewProps, 'style'> {
|
|
|
138
231
|
* @platform ios, android, web
|
|
139
232
|
*/
|
|
140
233
|
onLinkLongPress?: (event: LinkLongPressEvent) => void;
|
|
234
|
+
/**
|
|
235
|
+
* Renders a decoration (e.g. a badge or icon) over each link. The returned
|
|
236
|
+
* node is placed in an absolutely positioned box matching `info.rect` (the
|
|
237
|
+
* link's last line fragment, including chip padding) with
|
|
238
|
+
* `pointerEvents="box-none"`; position content relative to it (negative
|
|
239
|
+
* offsets overflow the box). Return `null` to leave a link undecorated.
|
|
240
|
+
*
|
|
241
|
+
* Native caveats: rects arrive from native after layout, so decorations
|
|
242
|
+
* appear one frame after the text; links inside tables (`flavor="github"`)
|
|
243
|
+
* are not reported; content overflowing the component bounds does not
|
|
244
|
+
* receive touches on Android. Toggling this prop between set and unset
|
|
245
|
+
* remounts the native view.
|
|
246
|
+
* @platform ios, android, web
|
|
247
|
+
*/
|
|
248
|
+
renderLinkDecoration?: (info: LinkDecorationInfo) => ReactNode | null;
|
|
141
249
|
/**
|
|
142
250
|
* Callback fired when a task list checkbox is tapped.
|
|
143
251
|
*
|
|
@@ -149,6 +257,61 @@ export interface EnrichedMarkdownTextProps extends Omit<ViewProps, 'style'> {
|
|
|
149
257
|
* @platform ios, android, web
|
|
150
258
|
*/
|
|
151
259
|
onTaskListItemPress?: (event: TaskListItemPressEvent) => void;
|
|
260
|
+
/**
|
|
261
|
+
* Controls whether tapping a task list checkbox toggles its checked state.
|
|
262
|
+
*
|
|
263
|
+
* When `true` (default), tapping the checkbox toggles it and fires
|
|
264
|
+
* `onTaskListItemPress`. When `false`, the checkbox renders its markdown
|
|
265
|
+
* state read-only: the tap is fully inert — no visual toggle and no
|
|
266
|
+
* `onTaskListItemPress` emission. Text selection and links in the same row
|
|
267
|
+
* are unaffected.
|
|
268
|
+
*
|
|
269
|
+
* @default true
|
|
270
|
+
* @platform ios, android, web
|
|
271
|
+
*/
|
|
272
|
+
enableTaskListItemToggle?: boolean;
|
|
273
|
+
/**
|
|
274
|
+
* Callback fired when code is copied from a fenced code block, via the header
|
|
275
|
+
* copy button, the long-press context-menu "Copy" action, or the VoiceOver
|
|
276
|
+
* copy action. Receives the copied code and its language. Does not fire for
|
|
277
|
+
* "Copy as Markdown", nor for the context-menu "Copy" when
|
|
278
|
+
* `selectionMenuConfig.copy.format` is `'markdown'`.
|
|
279
|
+
*
|
|
280
|
+
* Only fires when `flavor="github"` (the copy button is part of the GitHub
|
|
281
|
+
* flavor's container-based code block renderer).
|
|
282
|
+
* @platform ios, android, macos
|
|
283
|
+
*/
|
|
284
|
+
onCopyPress?: (event: CopyPressEvent) => void;
|
|
285
|
+
/**
|
|
286
|
+
* Takes over the "Copy" item of the text selection menu and of the table /
|
|
287
|
+
* math / code block menus. When set, native does **not** write the
|
|
288
|
+
* clipboard: it calls this with the copied content and the handler writes
|
|
289
|
+
* whatever it wants (e.g. with `expo-clipboard`). Overrides
|
|
290
|
+
* `selectionMenuConfig.copy.format`; `copy.enabled: false` still hides the
|
|
291
|
+
* item. "Copy as Markdown", the code block header button and the VoiceOver
|
|
292
|
+
* copy action are unaffected, and `onCopyPress` does not fire for an
|
|
293
|
+
* intercepted Copy.
|
|
294
|
+
* @platform ios, android
|
|
295
|
+
*/
|
|
296
|
+
onCopy?: (event: CopyEvent) => void;
|
|
297
|
+
/**
|
|
298
|
+
* Reports the text selection so the app can draw its own menu (pair it with
|
|
299
|
+
* `contextMenuHidden`). Fires at most once per frame while the selection
|
|
300
|
+
* changes, and with `active: false` once it is gone. With
|
|
301
|
+
* `contextMenuHidden`, a long press on a table / math / code block fires it
|
|
302
|
+
* too (`source` is the block kind, `whole: true`), since those blocks have no
|
|
303
|
+
* text selection of their own. Only one part of a component holds a
|
|
304
|
+
* selection at a time; clearing the selection of *other* components is up to
|
|
305
|
+
* the app (`ref.current.clearSelection()`).
|
|
306
|
+
*
|
|
307
|
+
* Rects are relative to the view that `ref.current.measureInWindow`
|
|
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.
|
|
312
|
+
* @platform ios, android
|
|
313
|
+
*/
|
|
314
|
+
onSelectionChange?: (event: SelectionChangeEvent) => void;
|
|
152
315
|
/**
|
|
153
316
|
* Controls whether the system link preview is shown on long press (iOS only).
|
|
154
317
|
*
|
|
@@ -162,6 +325,16 @@ export interface EnrichedMarkdownTextProps extends Omit<ViewProps, 'style'> {
|
|
|
162
325
|
* @platform ios
|
|
163
326
|
*/
|
|
164
327
|
enableLinkPreview?: boolean;
|
|
328
|
+
/**
|
|
329
|
+
* When `true`, long-pressing a link selects its label and shows the
|
|
330
|
+
* selection edit menu, like a manual text selection, instead of the system
|
|
331
|
+
* link preview. Takes precedence over `enableLinkPreview` and
|
|
332
|
+
* `onLinkLongPress`.
|
|
333
|
+
*
|
|
334
|
+
* @default false
|
|
335
|
+
* @platform ios
|
|
336
|
+
*/
|
|
337
|
+
linkLongPressSelects?: boolean;
|
|
165
338
|
/**
|
|
166
339
|
* Controls text selection.
|
|
167
340
|
* - iOS: Controls text selection and link previews on long press.
|
|
@@ -254,6 +427,38 @@ export interface EnrichedMarkdownTextProps extends Omit<ViewProps, 'style'> {
|
|
|
254
427
|
* @platform ios, android
|
|
255
428
|
*/
|
|
256
429
|
contextMenuItems?: ContextMenuItem[];
|
|
430
|
+
/**
|
|
431
|
+
* HTTP headers to attach to remote image requests, e.g. a `Referer`
|
|
432
|
+
* required by CDN hotlink protection or an `Authorization` token.
|
|
433
|
+
*
|
|
434
|
+
* Headers participate in image cache identity, so the same URL requested
|
|
435
|
+
* with different headers is fetched and cached separately.
|
|
436
|
+
*
|
|
437
|
+
* Not supported on web — browsers don't allow custom headers on `<img>`
|
|
438
|
+
* requests.
|
|
439
|
+
* @platform ios, android
|
|
440
|
+
*/
|
|
441
|
+
imageRequestHeaders?: Record<string, string>;
|
|
442
|
+
/**
|
|
443
|
+
* Hides the text selection context menu. Text stays selectable (and stays
|
|
444
|
+
* reachable by TalkBack / VoiceOver) — only the menu is suppressed. Use
|
|
445
|
+
* `selectable={false}` instead if you want to disable selection itself.
|
|
446
|
+
*
|
|
447
|
+
* This hides the whole menu, including the custom items from
|
|
448
|
+
* `contextMenuItems` and the built-in items from `selectionMenuConfig`,
|
|
449
|
+
* since they all share one menu. It also covers the copy menus on table,
|
|
450
|
+
* math and code blocks.
|
|
451
|
+
*
|
|
452
|
+
* It does not suppress the system "Save to Camera Roll / Copy" sheet that
|
|
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.
|
|
458
|
+
* @default false
|
|
459
|
+
* @platform ios, android, macos
|
|
460
|
+
*/
|
|
461
|
+
contextMenuHidden?: boolean;
|
|
257
462
|
/**
|
|
258
463
|
* Controls the built-in items added to the native text selection menu and
|
|
259
464
|
* lets you localize their labels. Custom app-provided actions are controlled
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CSSProperties, HTMLAttributes } from 'react';
|
|
1
|
+
import type { CSSProperties, HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import type { MarkdownStyle, Md4cFlags } from './MarkdownStyle';
|
|
3
3
|
import type {
|
|
4
4
|
LinkPressEvent,
|
|
@@ -6,6 +6,33 @@ import type {
|
|
|
6
6
|
TaskListItemPressEvent,
|
|
7
7
|
} from './events';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* A rect in dp, relative to the component's content box (inside any
|
|
11
|
+
* `containerStyle` padding).
|
|
12
|
+
*/
|
|
13
|
+
export interface LinkRect {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Layout of one rendered link, passed to `renderLinkDecoration`. */
|
|
21
|
+
export interface LinkDecorationInfo {
|
|
22
|
+
/** Position of the link in the document (0-based) — stable key for a link. */
|
|
23
|
+
index: number;
|
|
24
|
+
url: string;
|
|
25
|
+
/** The link's visible text. */
|
|
26
|
+
text: string;
|
|
27
|
+
/**
|
|
28
|
+
* Anchor rect. Native: the drawn chip (glyphs + padding) of the link's last
|
|
29
|
+
* line fragment. Web: the link's inline box.
|
|
30
|
+
*/
|
|
31
|
+
rect: LinkRect;
|
|
32
|
+
/** Every line fragment of the link (several when it wraps). Web: `[rect]`. */
|
|
33
|
+
rects: LinkRect[];
|
|
34
|
+
}
|
|
35
|
+
|
|
9
36
|
export interface EnrichedMarkdownTextProps extends Omit<
|
|
10
37
|
HTMLAttributes<HTMLDivElement>,
|
|
11
38
|
'style' | 'dir'
|
|
@@ -47,6 +74,21 @@ export interface EnrichedMarkdownTextProps extends Omit<
|
|
|
47
74
|
* @platform ios, android, web
|
|
48
75
|
*/
|
|
49
76
|
onLinkLongPress?: (event: LinkLongPressEvent) => void;
|
|
77
|
+
/**
|
|
78
|
+
* Renders a decoration (e.g. a badge or icon) over each link. The returned
|
|
79
|
+
* node is placed in an absolutely positioned box matching `info.rect` (the
|
|
80
|
+
* link's last line fragment, including chip padding) with
|
|
81
|
+
* `pointerEvents="box-none"`; position content relative to it (negative
|
|
82
|
+
* offsets overflow the box). Return `null` to leave a link undecorated.
|
|
83
|
+
*
|
|
84
|
+
* Native caveats: rects arrive from native after layout, so decorations
|
|
85
|
+
* appear one frame after the text; links inside tables (`flavor="github"`)
|
|
86
|
+
* are not reported; content overflowing the component bounds does not
|
|
87
|
+
* receive touches on Android. Toggling this prop between set and unset
|
|
88
|
+
* remounts the native view.
|
|
89
|
+
* @platform ios, android, web
|
|
90
|
+
*/
|
|
91
|
+
renderLinkDecoration?: (info: LinkDecorationInfo) => ReactNode | null;
|
|
50
92
|
/**
|
|
51
93
|
* Callback fired when a task list checkbox is tapped.
|
|
52
94
|
*
|
|
@@ -58,6 +100,25 @@ export interface EnrichedMarkdownTextProps extends Omit<
|
|
|
58
100
|
* @platform ios, android, web
|
|
59
101
|
*/
|
|
60
102
|
onTaskListItemPress?: (event: TaskListItemPressEvent) => void;
|
|
103
|
+
/**
|
|
104
|
+
* Controls whether tapping a task list checkbox toggles its checked state.
|
|
105
|
+
*
|
|
106
|
+
* When `true` (default), tapping the checkbox toggles it and fires
|
|
107
|
+
* `onTaskListItemPress`. When `false`, the checkbox renders its markdown
|
|
108
|
+
* state read-only: the tap is fully inert — no visual toggle and no
|
|
109
|
+
* `onTaskListItemPress` emission. Text selection and links in the same row
|
|
110
|
+
* are unaffected.
|
|
111
|
+
*
|
|
112
|
+
* On web the checkbox keeps its normal appearance and is marked
|
|
113
|
+
* `readOnly` / `aria-disabled` rather than `disabled`, so it stays visually
|
|
114
|
+
* consistent with iOS and Android. It is also made pointer-inert
|
|
115
|
+
* (`pointer-events: none`) so the browser cannot paint hover or active
|
|
116
|
+
* states on a checkbox that cannot be toggled.
|
|
117
|
+
*
|
|
118
|
+
* @default true
|
|
119
|
+
* @platform ios, android, web
|
|
120
|
+
*/
|
|
121
|
+
enableTaskListItemToggle?: boolean;
|
|
61
122
|
/**
|
|
62
123
|
* Controls text selection.
|
|
63
124
|
* - iOS: Controls text selection and link previews on long press.
|
package/src/types/events.ts
CHANGED
|
@@ -12,6 +12,80 @@ export interface TaskListItemPressEvent {
|
|
|
12
12
|
text: string;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
export interface CopyPressEvent {
|
|
16
|
+
code: string;
|
|
17
|
+
language: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Payload of `onCopy`: what the Copy item would have copied. With `onCopy`
|
|
22
|
+
* set, native writes nothing to the clipboard — the handler owns the write.
|
|
23
|
+
*/
|
|
24
|
+
export interface CopyEvent {
|
|
25
|
+
/** Which menu the Copy item belongs to. */
|
|
26
|
+
source: 'selection' | 'math' | 'table' | 'code';
|
|
27
|
+
/**
|
|
28
|
+
* Markdown of the copied content — what `copy.format: 'markdown'` writes.
|
|
29
|
+
* Text selections: the original source when `whole`, otherwise rebuilt from
|
|
30
|
+
* the rendered styles (falls back to `text`). Blocks: `$$…$$`, the table as
|
|
31
|
+
* Markdown, or the fenced code block.
|
|
32
|
+
*/
|
|
33
|
+
markdown: string;
|
|
34
|
+
/** Rendered text of the selection, or the block's raw content. */
|
|
35
|
+
text: string;
|
|
36
|
+
/**
|
|
37
|
+
* `true` when the selection covers the whole component, so `markdown` is the
|
|
38
|
+
* original source. Always `true` for blocks.
|
|
39
|
+
*/
|
|
40
|
+
whole: boolean;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* A rect in dp, relative to the component's native view: add the origin from
|
|
45
|
+
* the component ref's `measureInWindow` to get window coordinates.
|
|
46
|
+
*/
|
|
47
|
+
export interface SelectionRect {
|
|
48
|
+
x: number;
|
|
49
|
+
y: number;
|
|
50
|
+
width: number;
|
|
51
|
+
height: number;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Payload of `onSelectionChange`: the current text selection, or a table /
|
|
56
|
+
* math / code block long-pressed while `contextMenuHidden` is on. Content
|
|
57
|
+
* fields carry what `onCopy` would receive for the same selection.
|
|
58
|
+
*/
|
|
59
|
+
export interface SelectionChangeEvent {
|
|
60
|
+
/** `false` once the selection is gone; every other field is then empty / zero. */
|
|
61
|
+
active: boolean;
|
|
62
|
+
/** `'selection'` for text; the block kind for a long-pressed block. */
|
|
63
|
+
source: CopyEvent['source'];
|
|
64
|
+
/** Rendered text of the selection, or the block's raw content. */
|
|
65
|
+
text: string;
|
|
66
|
+
/** Same as `CopyEvent.markdown` for this selection. */
|
|
67
|
+
markdown: string;
|
|
68
|
+
/** Same as `CopyEvent.whole`. Always `true` for blocks. */
|
|
69
|
+
whole: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Bounding box of the selection (full content width when it spans several
|
|
72
|
+
* lines); the block's frame for blocks.
|
|
73
|
+
*/
|
|
74
|
+
rect: SelectionRect;
|
|
75
|
+
/** Selected part of the first line (block: same as `rect`). */
|
|
76
|
+
startRect: SelectionRect;
|
|
77
|
+
/** Selected part of the last line (block: same as `rect`). */
|
|
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;
|
|
87
|
+
}
|
|
88
|
+
|
|
15
89
|
/**
|
|
16
90
|
* Native-level context menu item config sent to the native component.
|
|
17
91
|
* Does not include the `onPress` callback — callbacks are managed on the JS side.
|
|
@@ -30,3 +104,19 @@ export interface OnContextMenuItemPressEvent {
|
|
|
30
104
|
selectionStart: number;
|
|
31
105
|
selectionEnd: number;
|
|
32
106
|
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Event payload fired by the native component when the user pastes while
|
|
110
|
+
* `interceptPaste` is on. Native does not touch the buffer — it only reports
|
|
111
|
+
* what the clipboard held. The handler must call `resolvePaste` exactly once,
|
|
112
|
+
* or the paste is dropped.
|
|
113
|
+
*/
|
|
114
|
+
export interface OnPasteEvent {
|
|
115
|
+
/** Plain text from the clipboard, verbatim, before the text view sees it. */
|
|
116
|
+
text: string;
|
|
117
|
+
/**
|
|
118
|
+
* Markdown flavor, set only when the copy source was an input of this
|
|
119
|
+
* component. iOS-only; Android always reports `''`.
|
|
120
|
+
*/
|
|
121
|
+
markdown: string;
|
|
122
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bridges EnrichedMarkdownTextInput into React Native's TextInputState focus
|
|
3
|
+
* registry so it participates in RN's keyboard-dismiss behavior (issue #577).
|
|
4
|
+
*
|
|
5
|
+
* Registering a non-TextInput host component is safe: TextInputState's
|
|
6
|
+
* blurTextInput dispatches the built-in TextInput's "blur" command at the
|
|
7
|
+
* registered instance, and Fabric command dispatch is name-based — it works
|
|
8
|
+
* as long as the component ships a command with that name, which ours does.
|
|
9
|
+
*
|
|
10
|
+
* A deep import is required because the public TextInput.State API lacks the
|
|
11
|
+
* registerInput/focusInput/blurInput bookkeeping functions.
|
|
12
|
+
*/
|
|
13
|
+
import type { HostInstance } from 'react-native';
|
|
14
|
+
|
|
15
|
+
interface TextInputStateModule {
|
|
16
|
+
registerInput(input: HostInstance): void;
|
|
17
|
+
unregisterInput(input: HostInstance): void;
|
|
18
|
+
focusInput(input: HostInstance | null): void;
|
|
19
|
+
blurInput(input: HostInstance | null): void;
|
|
20
|
+
blurTextInput(input: HostInstance | null): void;
|
|
21
|
+
currentlyFocusedInput(): HostInstance | null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The internal module's export shape has changed across RN versions: newer
|
|
26
|
+
* versions use `export default` (surfacing as `.default` after Metro's CJS
|
|
27
|
+
* transform) while older ones assigned `module.exports` directly. A raw
|
|
28
|
+
* require bypasses Babel's import interop, so both shapes are handled here.
|
|
29
|
+
*/
|
|
30
|
+
const TextInputStateModuleImpl =
|
|
31
|
+
// eslint-disable-next-line @react-native/no-deep-imports
|
|
32
|
+
require('react-native/Libraries/Components/TextInput/TextInputState');
|
|
33
|
+
|
|
34
|
+
export const TextInputState = (TextInputStateModuleImpl.default ??
|
|
35
|
+
TextInputStateModuleImpl) as TextInputStateModule;
|