@mathers101/react-native-render-rich-text 0.0.0-stage → 0.1.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/LICENSE +20 -0
- package/README.md +140 -3
- package/ReactNativeRenderRichText.podspec +23 -0
- package/android/build.gradle +86 -0
- package/android/consumer-rules.pro +3 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/jni-adapter.cpp +191 -0
- package/android/src/main/java/com/renderrichtext/EnrichedTiptapText.kt +673 -0
- package/android/src/main/java/com/renderrichtext/EnrichedTiptapTextLayoutManager.kt +24 -0
- package/android/src/main/java/com/renderrichtext/EnrichedTiptapTextManager.kt +405 -0
- package/android/src/main/java/com/renderrichtext/EnrichedTiptapTextPackage.kt +13 -0
- package/android/src/main/java/com/renderrichtext/MeasurementStore.kt +644 -0
- package/android/src/main/java/com/renderrichtext/accessibility/AccessibilityLabels.kt +17 -0
- package/android/src/main/java/com/renderrichtext/accessibility/AccessibleTiptapTextView.kt +112 -0
- package/android/src/main/java/com/renderrichtext/accessibility/TiptapAccessibilityHelper.kt +576 -0
- package/android/src/main/java/com/renderrichtext/events/CodeBlockPressEvent.kt +24 -0
- package/android/src/main/java/com/renderrichtext/events/ContextMenuItemPressEvent.kt +28 -0
- package/android/src/main/java/com/renderrichtext/events/CopyPressEvent.kt +24 -0
- package/android/src/main/java/com/renderrichtext/events/FactoidPressEvent.kt +23 -0
- package/android/src/main/java/com/renderrichtext/events/ImagePressEvent.kt +25 -0
- package/android/src/main/java/com/renderrichtext/events/LatexErrorEvent.kt +29 -0
- package/android/src/main/java/com/renderrichtext/events/LinkLongPressEvent.kt +23 -0
- package/android/src/main/java/com/renderrichtext/events/LinkPressEvent.kt +23 -0
- package/android/src/main/java/com/renderrichtext/events/MentionLongPressEvent.kt +25 -0
- package/android/src/main/java/com/renderrichtext/events/MentionPressEvent.kt +25 -0
- package/android/src/main/java/com/renderrichtext/events/TaskListItemPressEvent.kt +26 -0
- package/android/src/main/java/com/renderrichtext/math/LatexErrorReporter.kt +9 -0
- package/android/src/main/java/com/renderrichtext/parser/Parser.kt +59 -0
- package/android/src/main/java/com/renderrichtext/parser/TextLinkMatching.kt +35 -0
- package/android/src/main/java/com/renderrichtext/parser/TiptapASTNode.kt +69 -0
- package/android/src/main/java/com/renderrichtext/renderer/BaselineShiftRenderer.kt +45 -0
- package/android/src/main/java/com/renderrichtext/renderer/BlankLineRenderer.kt +39 -0
- package/android/src/main/java/com/renderrichtext/renderer/BlockStyleContext.kt +181 -0
- package/android/src/main/java/com/renderrichtext/renderer/BlockquoteRenderer.kt +243 -0
- package/android/src/main/java/com/renderrichtext/renderer/BlockquoteTextRenderer.kt +56 -0
- package/android/src/main/java/com/renderrichtext/renderer/CodeBlockRenderer.kt +135 -0
- package/android/src/main/java/com/renderrichtext/renderer/CodeRenderer.kt +37 -0
- package/android/src/main/java/com/renderrichtext/renderer/EmphasisRenderer.kt +28 -0
- package/android/src/main/java/com/renderrichtext/renderer/FactoidRenderer.kt +97 -0
- package/android/src/main/java/com/renderrichtext/renderer/HeadingRenderer.kt +81 -0
- package/android/src/main/java/com/renderrichtext/renderer/HighlightRenderer.kt +26 -0
- package/android/src/main/java/com/renderrichtext/renderer/LineBreakRenderer.kt +17 -0
- package/android/src/main/java/com/renderrichtext/renderer/LinkRenderer.kt +90 -0
- package/android/src/main/java/com/renderrichtext/renderer/ListContextManager.kt +109 -0
- package/android/src/main/java/com/renderrichtext/renderer/ListItemRenderer.kt +211 -0
- package/android/src/main/java/com/renderrichtext/renderer/ListRenderer.kt +133 -0
- package/android/src/main/java/com/renderrichtext/renderer/MentionRenderer.kt +85 -0
- package/android/src/main/java/com/renderrichtext/renderer/NodeRenderer.kt +207 -0
- package/android/src/main/java/com/renderrichtext/renderer/ParagraphRenderer.kt +91 -0
- package/android/src/main/java/com/renderrichtext/renderer/Renderer.kt +148 -0
- package/android/src/main/java/com/renderrichtext/renderer/SoftBreakRenderer.kt +17 -0
- package/android/src/main/java/com/renderrichtext/renderer/SpanStyleCache.kt +143 -0
- package/android/src/main/java/com/renderrichtext/renderer/StrikethroughRenderer.kt +28 -0
- package/android/src/main/java/com/renderrichtext/renderer/StrongRenderer.kt +28 -0
- package/android/src/main/java/com/renderrichtext/renderer/TextRenderer.kt +31 -0
- package/android/src/main/java/com/renderrichtext/renderer/ThematicBreakRenderer.kt +46 -0
- package/android/src/main/java/com/renderrichtext/renderer/UnderlineRenderer.kt +28 -0
- package/android/src/main/java/com/renderrichtext/spans/BaseListSpan.kt +164 -0
- package/android/src/main/java/com/renderrichtext/spans/BaselineShiftSpan.kt +27 -0
- package/android/src/main/java/com/renderrichtext/spans/BlockquoteSpan.kt +302 -0
- package/android/src/main/java/com/renderrichtext/spans/CodeBackgroundSpan.kt +205 -0
- package/android/src/main/java/com/renderrichtext/spans/CodeBlockSpan.kt +216 -0
- package/android/src/main/java/com/renderrichtext/spans/CodeSpan.kt +32 -0
- package/android/src/main/java/com/renderrichtext/spans/EmphasisSpan.kt +42 -0
- package/android/src/main/java/com/renderrichtext/spans/FactoidBackgroundSpan.kt +265 -0
- package/android/src/main/java/com/renderrichtext/spans/FactoidPaddingSpan.kt +258 -0
- package/android/src/main/java/com/renderrichtext/spans/FactoidSpan.kt +32 -0
- package/android/src/main/java/com/renderrichtext/spans/FadeInSpan.kt +29 -0
- package/android/src/main/java/com/renderrichtext/spans/HeadingSpan.kt +38 -0
- package/android/src/main/java/com/renderrichtext/spans/HighlightSpan.kt +80 -0
- package/android/src/main/java/com/renderrichtext/spans/ImageSpan.kt +481 -0
- package/android/src/main/java/com/renderrichtext/spans/InlineBackgroundGeometry.kt +42 -0
- package/android/src/main/java/com/renderrichtext/spans/LineHeightSpan.kt +39 -0
- package/android/src/main/java/com/renderrichtext/spans/LinkPillIconCache.kt +154 -0
- package/android/src/main/java/com/renderrichtext/spans/LinkPillSpan.kt +381 -0
- package/android/src/main/java/com/renderrichtext/spans/LinkSpan.kt +68 -0
- package/android/src/main/java/com/renderrichtext/spans/ListItemSpacingSpan.kt +33 -0
- package/android/src/main/java/com/renderrichtext/spans/ListMarkerAnchorSpan.kt +38 -0
- package/android/src/main/java/com/renderrichtext/spans/MarginBottomSpan.kt +76 -0
- package/android/src/main/java/com/renderrichtext/spans/MentionChipSpan.kt +132 -0
- package/android/src/main/java/com/renderrichtext/spans/MentionSpan.kt +46 -0
- package/android/src/main/java/com/renderrichtext/spans/OrderedListSpan.kt +127 -0
- package/android/src/main/java/com/renderrichtext/spans/SpoilerSpan.kt +33 -0
- package/android/src/main/java/com/renderrichtext/spans/StrikethroughSpan.kt +12 -0
- package/android/src/main/java/com/renderrichtext/spans/StrongSpan.kt +39 -0
- package/android/src/main/java/com/renderrichtext/spans/TaskListSpan.kt +143 -0
- package/android/src/main/java/com/renderrichtext/spans/TextSpan.kt +26 -0
- package/android/src/main/java/com/renderrichtext/spans/ThematicBreakSpan.kt +69 -0
- package/android/src/main/java/com/renderrichtext/spans/UnorderedListSpan.kt +96 -0
- package/android/src/main/java/com/renderrichtext/spoiler/SpoilerStubs.kt +46 -0
- package/android/src/main/java/com/renderrichtext/styles/BaseBlockStyle.kt +11 -0
- package/android/src/main/java/com/renderrichtext/styles/BlockquoteStyle.kt +83 -0
- package/android/src/main/java/com/renderrichtext/styles/CodeBlockStyle.kt +80 -0
- package/android/src/main/java/com/renderrichtext/styles/CodeStyle.kt +26 -0
- package/android/src/main/java/com/renderrichtext/styles/EmphasisStyle.kt +21 -0
- package/android/src/main/java/com/renderrichtext/styles/FactoidStyle.kt +21 -0
- package/android/src/main/java/com/renderrichtext/styles/HeadingStyle.kt +33 -0
- package/android/src/main/java/com/renderrichtext/styles/HighlightStyle.kt +19 -0
- package/android/src/main/java/com/renderrichtext/styles/ImageStyle.kt +29 -0
- package/android/src/main/java/com/renderrichtext/styles/InlineImageStyle.kt +17 -0
- package/android/src/main/java/com/renderrichtext/styles/InlineMathStyle.kt +17 -0
- package/android/src/main/java/com/renderrichtext/styles/LinkPillContent.kt +36 -0
- package/android/src/main/java/com/renderrichtext/styles/LinkPillStyle.kt +44 -0
- package/android/src/main/java/com/renderrichtext/styles/LinkStyle.kt +23 -0
- package/android/src/main/java/com/renderrichtext/styles/LinkVariantEntry.kt +34 -0
- package/android/src/main/java/com/renderrichtext/styles/ListStyle.kt +65 -0
- package/android/src/main/java/com/renderrichtext/styles/MathStyle.kt +29 -0
- package/android/src/main/java/com/renderrichtext/styles/MentionStyle.kt +19 -0
- package/android/src/main/java/com/renderrichtext/styles/ParagraphStyle.kt +33 -0
- package/android/src/main/java/com/renderrichtext/styles/SpoilerStyle.kt +27 -0
- package/android/src/main/java/com/renderrichtext/styles/StrikethroughStyle.kt +17 -0
- package/android/src/main/java/com/renderrichtext/styles/StrongStyle.kt +21 -0
- package/android/src/main/java/com/renderrichtext/styles/StyleConfig.kt +411 -0
- package/android/src/main/java/com/renderrichtext/styles/StyleParser.kt +92 -0
- package/android/src/main/java/com/renderrichtext/styles/SubscriptStyle.kt +16 -0
- package/android/src/main/java/com/renderrichtext/styles/SuperscriptStyle.kt +16 -0
- package/android/src/main/java/com/renderrichtext/styles/TableStyle.kt +75 -0
- package/android/src/main/java/com/renderrichtext/styles/TaskListStyle.kt +29 -0
- package/android/src/main/java/com/renderrichtext/styles/TextAlignment.kt +32 -0
- package/android/src/main/java/com/renderrichtext/styles/ThematicBreakStyle.kt +23 -0
- package/android/src/main/java/com/renderrichtext/styles/UnderlineStyle.kt +17 -0
- package/android/src/main/java/com/renderrichtext/styles/VideoStyle.kt +31 -0
- package/android/src/main/java/com/renderrichtext/utils/common/BorderStyleUtils.kt +86 -0
- package/android/src/main/java/com/renderrichtext/utils/common/BreakStrategyUtils.kt +32 -0
- package/android/src/main/java/com/renderrichtext/utils/common/CodeBlockHighlighter.kt +36 -0
- package/android/src/main/java/com/renderrichtext/utils/common/CodeBlockNode.kt +42 -0
- package/android/src/main/java/com/renderrichtext/utils/common/EllipsizeUtils.kt +27 -0
- package/android/src/main/java/com/renderrichtext/utils/common/EnrichedTiptapAncestorUtils.kt +10 -0
- package/android/src/main/java/com/renderrichtext/utils/common/FeatureFlags.kt +9 -0
- package/android/src/main/java/com/renderrichtext/utils/common/LinkRecognitionProps.kt +31 -0
- package/android/src/main/java/com/renderrichtext/utils/common/LinkRegexConfig.kt +56 -0
- package/android/src/main/java/com/renderrichtext/utils/common/MotionPreferences.kt +18 -0
- package/android/src/main/java/com/renderrichtext/utils/common/ReadableMapExtensions.kt +28 -0
- package/android/src/main/java/com/renderrichtext/utils/common/TiptapViewManagerUtils.kt +242 -0
- package/android/src/main/java/com/renderrichtext/utils/common/layout/RTLUtils.kt +6 -0
- package/android/src/main/java/com/renderrichtext/utils/common/serialization/TiptapASTSerializer.kt +368 -0
- package/android/src/main/java/com/renderrichtext/utils/text/ImageCache.kt +88 -0
- package/android/src/main/java/com/renderrichtext/utils/text/ImageDownloader.kt +203 -0
- package/android/src/main/java/com/renderrichtext/utils/text/LocalImageLoader.kt +167 -0
- package/android/src/main/java/com/renderrichtext/utils/text/TailFadeInAnimator.kt +84 -0
- package/android/src/main/java/com/renderrichtext/utils/text/conversion/HTMLGenerator.kt +1105 -0
- package/android/src/main/java/com/renderrichtext/utils/text/conversion/TiptapExtractor.kt +423 -0
- package/android/src/main/java/com/renderrichtext/utils/text/extensions/ParagraphUtils.kt +9 -0
- package/android/src/main/java/com/renderrichtext/utils/text/extensions/SpannableExtensions.kt +9 -0
- package/android/src/main/java/com/renderrichtext/utils/text/extensions/TextPaintExtensions.kt +76 -0
- package/android/src/main/java/com/renderrichtext/utils/text/interaction/CheckboxTouchHelper.kt +61 -0
- package/android/src/main/java/com/renderrichtext/utils/text/interaction/TaskListTapUtils.kt +286 -0
- package/android/src/main/java/com/renderrichtext/utils/text/span/ApplyLineHeight.kt +39 -0
- package/android/src/main/java/com/renderrichtext/utils/text/span/BlockSpacing.kt +142 -0
- package/android/src/main/java/com/renderrichtext/utils/text/span/SpanFlags.kt +43 -0
- package/android/src/main/java/com/renderrichtext/utils/text/span/WidthAwareSpans.kt +30 -0
- package/android/src/main/java/com/renderrichtext/utils/text/view/CodeBlockPressHost.kt +15 -0
- package/android/src/main/java/com/renderrichtext/utils/text/view/ImagePressHost.kt +19 -0
- package/android/src/main/java/com/renderrichtext/utils/text/view/LinkEvents.kt +88 -0
- package/android/src/main/java/com/renderrichtext/utils/text/view/LinkLongPressMovementMethod.kt +449 -0
- package/android/src/main/java/com/renderrichtext/utils/text/view/SelectionActionMode.kt +235 -0
- package/android/src/main/java/com/renderrichtext/utils/text/view/TextSelectionColors.kt +48 -0
- package/android/src/main/java/com/renderrichtext/utils/text/view/TextViewSetup.kt +119 -0
- package/android/src/main/java/com/renderrichtext/views/ContextMenuPopup.kt +217 -0
- package/android/src/main/java/com/renderrichtext/views/CopyGlyph.kt +101 -0
- package/android/src/main/java/com/renderrichtext/views/WrapGlyph.kt +40 -0
- package/android/src/main/jni/CMakeLists.txt +52 -0
- package/android/src/main/jni/react/renderer/components/RichTextSpec/ComponentDescriptors.h +30 -0
- package/android/src/main/jni/react/renderer/components/RichTextSpec/TiptapTextComponentDescriptor.h +29 -0
- package/android/src/main/jni/react/renderer/components/RichTextSpec/TiptapTextMeasurementManager.cpp +45 -0
- package/android/src/main/jni/react/renderer/components/RichTextSpec/TiptapTextMeasurementManager.h +21 -0
- package/android/src/main/jni/react/renderer/components/RichTextSpec/TiptapTextShadowNode.cpp +38 -0
- package/android/src/main/jni/react/renderer/components/RichTextSpec/TiptapTextShadowNode.h +53 -0
- package/android/src/main/jni/react/renderer/components/RichTextSpec/TiptapTextState.cpp +9 -0
- package/android/src/main/jni/react/renderer/components/RichTextSpec/TiptapTextState.h +24 -0
- package/android/src/main/jni/react/renderer/components/RichTextSpec/conversions.h +40 -0
- package/cpp/parser/TiptapASTNode.hpp +68 -0
- package/cpp/parser/TiptapParser.cpp +233 -0
- package/cpp/parser/TiptapParser.hpp +13 -0
- package/cpp/vendor/nlohmann/json.hpp +24765 -0
- package/ios/EnrichedTiptapText.h +27 -0
- package/ios/EnrichedTiptapText.mm +1222 -0
- package/ios/attachments/ENRMImageAttachment.h +51 -0
- package/ios/attachments/ENRMImageAttachment.m +398 -0
- package/ios/attachments/ENRMLinkPillAttachment.h +47 -0
- package/ios/attachments/ENRMLinkPillAttachment.m +324 -0
- package/ios/attachments/ENRMLinkPillIconCache.h +28 -0
- package/ios/attachments/ENRMLinkPillIconCache.m +181 -0
- package/ios/attachments/ENRMLinkPillText.h +27 -0
- package/ios/attachments/ENRMLinkPillText.m +118 -0
- package/ios/attachments/ENRMMathInlineAttachment.h +7 -0
- package/ios/attachments/ENRMMathInlineAttachment.m +4 -0
- package/ios/attachments/ThematicBreakAttachment.h +15 -0
- package/ios/attachments/ThematicBreakAttachment.m +33 -0
- package/ios/internals/ENRMViewFreeMeasurement.h +208 -0
- package/ios/internals/EnrichedTiptapTextComponentDescriptor.h +19 -0
- package/ios/internals/EnrichedTiptapTextShadowNode.h +43 -0
- package/ios/internals/EnrichedTiptapTextShadowNode.mm +69 -0
- package/ios/internals/EnrichedTiptapTextState.h +24 -0
- package/ios/internals/MeasurementCache.h +308 -0
- package/ios/internals/ShadowMeasurementUtils.h +145 -0
- package/ios/parser/ENRMTextLinkAttributes.h +7 -0
- package/ios/parser/ENRMTiptapParser.h +33 -0
- package/ios/parser/ENRMTiptapParser.mm +73 -0
- package/ios/parser/TiptapASTNode.h +57 -0
- package/ios/parser/TiptapASTNode.m +52 -0
- package/ios/parser/TiptapParserBridge.mm +179 -0
- package/ios/renderer/AttributedRenderer.h +23 -0
- package/ios/renderer/AttributedRenderer.m +229 -0
- package/ios/renderer/BaseRenderer.h +33 -0
- package/ios/renderer/BaseRenderer.m +46 -0
- package/ios/renderer/BaselineShiftTextAttributes.h +10 -0
- package/ios/renderer/BaselineShiftTextAttributes.m +26 -0
- package/ios/renderer/BlankLineRenderer.h +4 -0
- package/ios/renderer/BlankLineRenderer.m +51 -0
- package/ios/renderer/BlockquoteRenderer.h +6 -0
- package/ios/renderer/BlockquoteRenderer.m +258 -0
- package/ios/renderer/CodeBlockRenderer.h +9 -0
- package/ios/renderer/CodeBlockRenderer.m +99 -0
- package/ios/renderer/CodeRenderer.h +9 -0
- package/ios/renderer/CodeRenderer.m +69 -0
- package/ios/renderer/ENRMBlockquoteTextRenderer.h +25 -0
- package/ios/renderer/ENRMBlockquoteTextRenderer.m +48 -0
- package/ios/renderer/EmphasisRenderer.h +5 -0
- package/ios/renderer/EmphasisRenderer.m +100 -0
- package/ios/renderer/FactoidRenderer.h +9 -0
- package/ios/renderer/FactoidRenderer.m +130 -0
- package/ios/renderer/HeadingRenderer.h +6 -0
- package/ios/renderer/HeadingRenderer.m +103 -0
- package/ios/renderer/HighlightRenderer.h +7 -0
- package/ios/renderer/HighlightRenderer.m +33 -0
- package/ios/renderer/LinkRenderer.h +6 -0
- package/ios/renderer/LinkRenderer.m +158 -0
- package/ios/renderer/ListItemRenderer.h +24 -0
- package/ios/renderer/ListItemRenderer.m +283 -0
- package/ios/renderer/ListRenderer.h +13 -0
- package/ios/renderer/ListRenderer.m +126 -0
- package/ios/renderer/MentionRenderer.h +9 -0
- package/ios/renderer/MentionRenderer.m +96 -0
- package/ios/renderer/NodeRenderer.h +8 -0
- package/ios/renderer/ParagraphRenderer.h +6 -0
- package/ios/renderer/ParagraphRenderer.m +85 -0
- package/ios/renderer/RenderContext.h +145 -0
- package/ios/renderer/RenderContext.m +403 -0
- package/ios/renderer/RendererFactory.h +12 -0
- package/ios/renderer/RendererFactory.m +158 -0
- package/ios/renderer/StrikethroughRenderer.h +5 -0
- package/ios/renderer/StrikethroughRenderer.m +30 -0
- package/ios/renderer/StrongRenderer.h +5 -0
- package/ios/renderer/StrongRenderer.m +88 -0
- package/ios/renderer/TextRenderer.h +6 -0
- package/ios/renderer/TextRenderer.m +18 -0
- package/ios/renderer/ThematicBreakRenderer.h +4 -0
- package/ios/renderer/ThematicBreakRenderer.m +42 -0
- package/ios/renderer/UnderlineRenderer.h +4 -0
- package/ios/renderer/UnderlineRenderer.m +41 -0
- package/ios/styles/ENRMFontSlot.h +12 -0
- package/ios/styles/ENRMFontSlot.m +24 -0
- package/ios/styles/StyleConfig.h +488 -0
- package/ios/styles/StyleConfig.mm +2820 -0
- package/ios/utils/AccessibilityInfo.h +35 -0
- package/ios/utils/AccessibilityInfo.m +24 -0
- package/ios/utils/BlockquoteBorder.h +26 -0
- package/ios/utils/BlockquoteBorder.m +294 -0
- package/ios/utils/CodeBackground.h +19 -0
- package/ios/utils/CodeBackground.m +197 -0
- package/ios/utils/CodeBlockBackground.h +17 -0
- package/ios/utils/CodeBlockBackground.m +103 -0
- package/ios/utils/ContextMenuUtils.h +76 -0
- package/ios/utils/ContextMenuUtils.mm +75 -0
- package/ios/utils/ENRMAccessibilityLabels.h +40 -0
- package/ios/utils/ENRMAccessibilityLabels.m +5 -0
- package/ios/utils/ENRMAsyncRenderCoordinator.h +24 -0
- package/ios/utils/ENRMAsyncRenderCoordinator.m +37 -0
- package/ios/utils/ENRMAtomicSize.h +65 -0
- package/ios/utils/ENRMCodeBlockContent.h +37 -0
- package/ios/utils/ENRMCodeBlockContent.mm +89 -0
- package/ios/utils/ENRMFeatureFlags.h +25 -0
- package/ios/utils/ENRMImageDownloader.h +30 -0
- package/ios/utils/ENRMImageDownloader.m +168 -0
- package/ios/utils/ENRMLatexErrorCoordinator.h +27 -0
- package/ios/utils/ENRMLatexErrorCoordinator.mm +75 -0
- package/ios/utils/ENRMLatexErrorReporting.h +13 -0
- package/ios/utils/ENRMLinkContextMenus.h +93 -0
- package/ios/utils/ENRMLinkContextMenus.m +178 -0
- package/ios/utils/ENRMLinkRegexConfig.h +30 -0
- package/ios/utils/ENRMLinkRegexConfig.mm +104 -0
- package/ios/utils/ENRMLinkRegexProps.h +23 -0
- package/ios/utils/ENRMLocalImageLoader.h +35 -0
- package/ios/utils/ENRMLocalImageLoader.m +111 -0
- package/ios/utils/ENRMMenuAction.h +27 -0
- package/ios/utils/ENRMMenuAction.m +33 -0
- package/ios/utils/ENRMSpoilerOverlayManager.h +15 -0
- package/ios/utils/ENRMSpoilerOverlayManager.m +19 -0
- package/ios/utils/ENRMSpoilerTapUtils.h +6 -0
- package/ios/utils/ENRMSpoilerTapUtils.m +11 -0
- package/ios/utils/ENRMTailFadeInAnimator.h +16 -0
- package/ios/utils/ENRMTailFadeInAnimator.m +161 -0
- package/ios/utils/ENRMTextHitTest.h +23 -0
- package/ios/utils/ENRMTextHitTest.m +20 -0
- package/ios/utils/ENRMTextInteractionUtils.h +20 -0
- package/ios/utils/ENRMTextInteractionUtils.m +15 -0
- package/ios/utils/ENRMTextRenderer.h +38 -0
- package/ios/utils/ENRMTextRenderer.m +54 -0
- package/ios/utils/ENRMTextViewSetup.h +132 -0
- package/ios/utils/ENRMUIKit.h +429 -0
- package/ios/utils/EditMenuUtils.h +105 -0
- package/ios/utils/EditMenuUtils.m +143 -0
- package/ios/utils/FactoidBackground.h +20 -0
- package/ios/utils/FactoidBackground.m +161 -0
- package/ios/utils/FontScaleObserver.h +10 -0
- package/ios/utils/FontScaleObserver.m +55 -0
- package/ios/utils/FontUtils.h +31 -0
- package/ios/utils/FontUtils.m +63 -0
- package/ios/utils/HTMLGenerator.h +25 -0
- package/ios/utils/HTMLGenerator.m +1041 -0
- package/ios/utils/HeightUpdateUtils.h +25 -0
- package/ios/utils/ImageRequestHeaderUtils.h +35 -0
- package/ios/utils/LastElementUtils.h +97 -0
- package/ios/utils/LinkContextMenuUtils.h +55 -0
- package/ios/utils/LinkPillContentUtils.h +46 -0
- package/ios/utils/LinkTapUtils.h +56 -0
- package/ios/utils/LinkTapUtils.m +139 -0
- package/ios/utils/ListMarkerDrawer.h +15 -0
- package/ios/utils/ListMarkerDrawer.m +239 -0
- package/ios/utils/MentionBackground.h +26 -0
- package/ios/utils/MentionBackground.m +86 -0
- package/ios/utils/ParagraphStyleUtils.h +87 -0
- package/ios/utils/ParagraphStyleUtils.m +484 -0
- package/ios/utils/PasteboardUtils.h +48 -0
- package/ios/utils/PasteboardUtils.m +166 -0
- package/ios/utils/RTFExportUtils.h +24 -0
- package/ios/utils/RTFExportUtils.m +299 -0
- package/ios/utils/RuntimeKeys.h +44 -0
- package/ios/utils/RuntimeKeys.m +13 -0
- package/ios/utils/SelectionColorUtils.h +14 -0
- package/ios/utils/StylePropsUtils.h +1340 -0
- package/ios/utils/TaskListTapUtils.h +6 -0
- package/ios/utils/TaskListTapUtils.m +14 -0
- package/ios/utils/TextViewLayoutManager.h +14 -0
- package/ios/utils/TextViewLayoutManager.mm +198 -0
- package/ios/utils/TiptapAccessibilityElementBuilder.h +43 -0
- package/ios/utils/TiptapAccessibilityElementBuilder.m +432 -0
- package/ios/utils/TiptapExtractor.h +17 -0
- package/ios/utils/TiptapExtractor.m +367 -0
- package/ios/views/ENRMTiptapTextView.h +25 -0
- package/ios/views/ENRMTiptapTextView.m +247 -0
- package/package.json +70 -6
- package/react-native.config.js +10 -0
- package/src/EnrichedTiptapTextNativeComponent.ts +739 -0
- package/src/RichText.tsx +164 -0
- package/src/admonitionDefaults.ts +58 -0
- package/src/darkModeTextStyle.ts +99 -0
- package/src/headingDefaults.ts +21 -0
- package/src/index.tsx +4 -0
- package/src/linkVariantUtils.ts +120 -0
- package/src/normalizeTiptapStyle.ts +397 -0
- package/src/rn-globals.d.ts +1 -0
- package/src/styleUtils.ts +107 -0
- package/src/types/TiptapStyle.ts +532 -0
- package/src/types/TiptapStyleInternal.ts +299 -0
- package/src/types/linkPill.ts +9 -0
- package/src/utils/isDev.ts +4 -0
|
@@ -0,0 +1,739 @@
|
|
|
1
|
+
import {
|
|
2
|
+
codegenNativeComponent,
|
|
3
|
+
type ViewProps,
|
|
4
|
+
type CodegenTypes,
|
|
5
|
+
type ColorValue,
|
|
6
|
+
} from 'react-native';
|
|
7
|
+
|
|
8
|
+
// All block styles extend this interface
|
|
9
|
+
interface BaseBlockStyleInternal {
|
|
10
|
+
fontSize: CodegenTypes.Float;
|
|
11
|
+
fontFamily: string;
|
|
12
|
+
fontWeight: string;
|
|
13
|
+
color: ColorValue;
|
|
14
|
+
marginTop: CodegenTypes.Float;
|
|
15
|
+
marginBottom: CodegenTypes.Float;
|
|
16
|
+
lineHeight: CodegenTypes.Float;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface ParagraphStyleInternal extends BaseBlockStyleInternal {
|
|
20
|
+
textAlign: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface HeadingStyleInternal extends BaseBlockStyleInternal {
|
|
24
|
+
textAlign: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface AdmonitionColorsInternal {
|
|
28
|
+
color: ColorValue;
|
|
29
|
+
backgroundColor: ColorValue;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface AdmonitionsStyleInternal {
|
|
33
|
+
note: AdmonitionColorsInternal;
|
|
34
|
+
tip: AdmonitionColorsInternal;
|
|
35
|
+
important: AdmonitionColorsInternal;
|
|
36
|
+
warning: AdmonitionColorsInternal;
|
|
37
|
+
caution: AdmonitionColorsInternal;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface BlockquoteStyleInternal extends BaseBlockStyleInternal {
|
|
41
|
+
borderColor: ColorValue;
|
|
42
|
+
borderWidth: CodegenTypes.Float;
|
|
43
|
+
gapWidth: CodegenTypes.Float;
|
|
44
|
+
backgroundColor: ColorValue;
|
|
45
|
+
borderRadius: CodegenTypes.Float;
|
|
46
|
+
padding: CodegenTypes.Float;
|
|
47
|
+
admonitions: AdmonitionsStyleInternal;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface ListStyleInternal extends BaseBlockStyleInternal {
|
|
51
|
+
bulletColor: ColorValue;
|
|
52
|
+
bulletSize: CodegenTypes.Float;
|
|
53
|
+
markerMinWidth: CodegenTypes.Float;
|
|
54
|
+
markerColor: ColorValue;
|
|
55
|
+
markerFontWeight: string;
|
|
56
|
+
gapWidth: CodegenTypes.Float;
|
|
57
|
+
marginLeft: CodegenTypes.Float;
|
|
58
|
+
itemSpacing: CodegenTypes.Float;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
interface CodeBlockSyntaxColorsInternal {
|
|
62
|
+
keyword: ColorValue;
|
|
63
|
+
operatorColor: ColorValue;
|
|
64
|
+
punctuation: ColorValue;
|
|
65
|
+
string: ColorValue;
|
|
66
|
+
number: ColorValue;
|
|
67
|
+
constant: ColorValue;
|
|
68
|
+
comment: ColorValue;
|
|
69
|
+
function: ColorValue;
|
|
70
|
+
type: ColorValue;
|
|
71
|
+
variable: ColorValue;
|
|
72
|
+
property: ColorValue;
|
|
73
|
+
tag: ColorValue;
|
|
74
|
+
attribute: ColorValue;
|
|
75
|
+
embedded: ColorValue;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
interface CodeBlockStyleInternal extends BaseBlockStyleInternal {
|
|
79
|
+
backgroundColor: ColorValue;
|
|
80
|
+
borderColor: ColorValue;
|
|
81
|
+
borderRadius: CodegenTypes.Float;
|
|
82
|
+
borderWidth: CodegenTypes.Float;
|
|
83
|
+
padding: CodegenTypes.Float;
|
|
84
|
+
syntaxColors: CodeBlockSyntaxColorsInternal;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
interface LinkStyleInternal {
|
|
88
|
+
fontFamily: string;
|
|
89
|
+
color: ColorValue;
|
|
90
|
+
underline: boolean;
|
|
91
|
+
backgroundColor: ColorValue;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
interface LinkPillInternal {
|
|
95
|
+
enabled: boolean;
|
|
96
|
+
label: string;
|
|
97
|
+
iconUri: string;
|
|
98
|
+
iconTintColor?: ColorValue;
|
|
99
|
+
borderRadius: CodegenTypes.Float;
|
|
100
|
+
paddingHorizontal: CodegenTypes.Float;
|
|
101
|
+
paddingVertical: CodegenTypes.Float;
|
|
102
|
+
lineHeight: CodegenTypes.Float;
|
|
103
|
+
borderWidth: CodegenTypes.Float;
|
|
104
|
+
borderColor: ColorValue;
|
|
105
|
+
maxWidth: CodegenTypes.Float;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Codegen spec for the native Tiptap view. This file must stay self-contained.
|
|
109
|
+
interface LinkVariantEntryInternal {
|
|
110
|
+
pattern: string;
|
|
111
|
+
color: ColorValue;
|
|
112
|
+
underline: boolean;
|
|
113
|
+
backgroundColor: ColorValue;
|
|
114
|
+
fontFamily: string;
|
|
115
|
+
pill: LinkPillInternal;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
interface StrongStyleInternal {
|
|
119
|
+
fontFamily: string;
|
|
120
|
+
fontWeight: string;
|
|
121
|
+
color?: ColorValue;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
interface EmphasisStyleInternal {
|
|
125
|
+
fontFamily: string;
|
|
126
|
+
fontStyle: string;
|
|
127
|
+
color?: ColorValue;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
interface StrikethroughStyleInternal {
|
|
131
|
+
color: ColorValue;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
interface UnderlineStyleInternal {
|
|
135
|
+
color: ColorValue;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
interface CodeStyleInternal {
|
|
139
|
+
fontFamily: string;
|
|
140
|
+
fontSize: CodegenTypes.Float;
|
|
141
|
+
color: ColorValue;
|
|
142
|
+
backgroundColor: ColorValue;
|
|
143
|
+
borderColor: ColorValue;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
interface MentionStyleInternal {
|
|
147
|
+
color: ColorValue;
|
|
148
|
+
backgroundColor: ColorValue;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
interface FactoidStyleInternal {
|
|
152
|
+
color: ColorValue;
|
|
153
|
+
backgroundColor: ColorValue;
|
|
154
|
+
borderColor: ColorValue;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
interface ImageStyleInternal {
|
|
158
|
+
height: CodegenTypes.Float;
|
|
159
|
+
maxHeight: CodegenTypes.Float;
|
|
160
|
+
aspectRatio: CodegenTypes.Float;
|
|
161
|
+
// Nested struct fields cannot use WithDefault; default is applied in JS normalization.
|
|
162
|
+
resizeMode: string;
|
|
163
|
+
borderRadius: CodegenTypes.Float;
|
|
164
|
+
marginTop: CodegenTypes.Float;
|
|
165
|
+
marginBottom: CodegenTypes.Float;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
interface VideoStyleInternal {
|
|
169
|
+
marginTop: CodegenTypes.Float;
|
|
170
|
+
marginBottom: CodegenTypes.Float;
|
|
171
|
+
borderRadius: CodegenTypes.Float;
|
|
172
|
+
aspectRatio: CodegenTypes.Float;
|
|
173
|
+
backgroundColor: ColorValue;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
interface InlineImageStyleInternal {
|
|
177
|
+
size: CodegenTypes.Float;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
interface ThematicBreakStyleInternal {
|
|
181
|
+
color: ColorValue;
|
|
182
|
+
height: CodegenTypes.Float;
|
|
183
|
+
marginTop: CodegenTypes.Float;
|
|
184
|
+
marginBottom: CodegenTypes.Float;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
interface TableStyleInternal extends BaseBlockStyleInternal {
|
|
188
|
+
headerFontFamily: string;
|
|
189
|
+
headerBackgroundColor: ColorValue;
|
|
190
|
+
headerTextColor: ColorValue;
|
|
191
|
+
rowEvenBackgroundColor: ColorValue;
|
|
192
|
+
rowOddBackgroundColor: ColorValue;
|
|
193
|
+
borderColor: ColorValue;
|
|
194
|
+
borderWidth: CodegenTypes.Float;
|
|
195
|
+
borderRadius: CodegenTypes.Float;
|
|
196
|
+
cellPaddingHorizontal: CodegenTypes.Float;
|
|
197
|
+
cellPaddingVertical: CodegenTypes.Float;
|
|
198
|
+
horizontalOverflow: CodegenTypes.Float;
|
|
199
|
+
align: string;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
interface TaskListStyleInternal {
|
|
203
|
+
checkedColor: ColorValue;
|
|
204
|
+
borderColor: ColorValue;
|
|
205
|
+
checkboxSize: CodegenTypes.Float;
|
|
206
|
+
checkboxBorderRadius: CodegenTypes.Float;
|
|
207
|
+
checkmarkColor: ColorValue;
|
|
208
|
+
checkedTextColor: ColorValue;
|
|
209
|
+
checkedStrikethrough: boolean;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
interface MathStyleInternal {
|
|
213
|
+
fontSize: CodegenTypes.Float;
|
|
214
|
+
color: ColorValue;
|
|
215
|
+
backgroundColor: ColorValue;
|
|
216
|
+
padding: CodegenTypes.Float;
|
|
217
|
+
marginTop: CodegenTypes.Float;
|
|
218
|
+
marginBottom: CodegenTypes.Float;
|
|
219
|
+
textAlign: string;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
interface InlineMathStyleInternal {
|
|
223
|
+
color: ColorValue;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
interface SpoilerParticlesStyleInternal {
|
|
227
|
+
density: CodegenTypes.Float;
|
|
228
|
+
speed: CodegenTypes.Float;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
interface SpoilerSolidStyleInternal {
|
|
232
|
+
borderRadius: CodegenTypes.Float;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
interface SpoilerStyleInternal {
|
|
236
|
+
color: ColorValue;
|
|
237
|
+
particles: SpoilerParticlesStyleInternal;
|
|
238
|
+
solid: SpoilerSolidStyleInternal;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
interface SuperscriptStyleInternal {
|
|
242
|
+
fontScale: CodegenTypes.Float;
|
|
243
|
+
baselineOffsetScale: CodegenTypes.Float;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
interface SubscriptStyleInternal {
|
|
247
|
+
fontScale: CodegenTypes.Float;
|
|
248
|
+
baselineOffsetScale: CodegenTypes.Float;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
interface HighlightStyleInternal {
|
|
252
|
+
color: ColorValue;
|
|
253
|
+
backgroundColor: ColorValue;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export interface TiptapStyleInternal {
|
|
257
|
+
paragraph: ParagraphStyleInternal;
|
|
258
|
+
h1: HeadingStyleInternal;
|
|
259
|
+
h2: HeadingStyleInternal;
|
|
260
|
+
h3: HeadingStyleInternal;
|
|
261
|
+
h4: HeadingStyleInternal;
|
|
262
|
+
h5: HeadingStyleInternal;
|
|
263
|
+
h6: HeadingStyleInternal;
|
|
264
|
+
blockquote: BlockquoteStyleInternal;
|
|
265
|
+
list: ListStyleInternal;
|
|
266
|
+
codeBlock: CodeBlockStyleInternal;
|
|
267
|
+
link: LinkStyleInternal;
|
|
268
|
+
linkVariants: ReadonlyArray<Readonly<LinkVariantEntryInternal>>;
|
|
269
|
+
strong: StrongStyleInternal;
|
|
270
|
+
em: EmphasisStyleInternal;
|
|
271
|
+
strikethrough: StrikethroughStyleInternal;
|
|
272
|
+
underline: UnderlineStyleInternal;
|
|
273
|
+
code: CodeStyleInternal;
|
|
274
|
+
mention: MentionStyleInternal;
|
|
275
|
+
factoid: FactoidStyleInternal;
|
|
276
|
+
image: ImageStyleInternal;
|
|
277
|
+
video: VideoStyleInternal;
|
|
278
|
+
inlineImage: InlineImageStyleInternal;
|
|
279
|
+
thematicBreak: ThematicBreakStyleInternal;
|
|
280
|
+
table: TableStyleInternal;
|
|
281
|
+
taskList: TaskListStyleInternal;
|
|
282
|
+
math: MathStyleInternal;
|
|
283
|
+
inlineMath: InlineMathStyleInternal;
|
|
284
|
+
spoiler: SpoilerStyleInternal;
|
|
285
|
+
superscript: SuperscriptStyleInternal;
|
|
286
|
+
subscript: SubscriptStyleInternal;
|
|
287
|
+
highlight: HighlightStyleInternal;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export interface LinkPressEvent {
|
|
291
|
+
url: string;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export interface FactoidPressEvent {
|
|
295
|
+
factoidId: string;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
export interface MentionPressEvent {
|
|
299
|
+
mentionId: string;
|
|
300
|
+
label: string;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
export interface LinkLongPressEvent {
|
|
304
|
+
url: string;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export interface ImagePressEvent {
|
|
308
|
+
url: string;
|
|
309
|
+
altText: string;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
export interface TaskListItemPressEvent {
|
|
313
|
+
index: CodegenTypes.Int32;
|
|
314
|
+
checked: boolean;
|
|
315
|
+
text: string;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
export interface CopyPressEvent {
|
|
319
|
+
code: string;
|
|
320
|
+
language: string;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
export interface LatexErrorEvent {
|
|
324
|
+
source: string;
|
|
325
|
+
message: string;
|
|
326
|
+
displayMode: boolean;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
export interface CodeBlockPressEvent {
|
|
330
|
+
code: string;
|
|
331
|
+
language: string;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
export interface ContextMenuItemConfig {
|
|
335
|
+
text: string;
|
|
336
|
+
icon?: string;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
export interface ImageRequestHeaderInternal {
|
|
340
|
+
name: string;
|
|
341
|
+
value: string;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
export interface LinkPillContentInternal {
|
|
345
|
+
url: string;
|
|
346
|
+
label: string;
|
|
347
|
+
iconUri: string;
|
|
348
|
+
iconTintColor?: ColorValue;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
export interface SelectionMenuConfig {
|
|
352
|
+
copyAsTiptap: boolean;
|
|
353
|
+
copyImageUrl: boolean;
|
|
354
|
+
copyLabel: string;
|
|
355
|
+
copyAsTiptapLabel: string;
|
|
356
|
+
copyImageUrlLabel: string;
|
|
357
|
+
copyImageUrlsLabel: string;
|
|
358
|
+
// Precomputed plural templates indexed by image count (0..100). Empty when no
|
|
359
|
+
// pluralLabels are set; native then uses copyImageUrlLabel/copyImageUrlsLabel.
|
|
360
|
+
copyImageUrlPluralTemplates: ReadonlyArray<string>;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
export interface OnContextMenuItemPressEvent {
|
|
364
|
+
itemText: string;
|
|
365
|
+
selectedText: string;
|
|
366
|
+
selectionStart: CodegenTypes.Int32;
|
|
367
|
+
selectionEnd: CodegenTypes.Int32;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
export interface AccessibilityLabelsListProps {
|
|
371
|
+
bulletPoint: string;
|
|
372
|
+
nestedBulletPoint: string;
|
|
373
|
+
orderedItem: string;
|
|
374
|
+
nestedOrderedItem: string;
|
|
375
|
+
}
|
|
376
|
+
export interface AccessibilityLabelsBlockquoteProps {
|
|
377
|
+
quote: string;
|
|
378
|
+
nestedQuote: string;
|
|
379
|
+
}
|
|
380
|
+
export interface AccessibilityLabelsTableProps {
|
|
381
|
+
row: string;
|
|
382
|
+
}
|
|
383
|
+
export interface AccessibilityLabelsMathProps {
|
|
384
|
+
equation: string;
|
|
385
|
+
}
|
|
386
|
+
export interface AccessibilityLabelsCodeBlockProps {
|
|
387
|
+
wrap: string;
|
|
388
|
+
unwrap: string;
|
|
389
|
+
}
|
|
390
|
+
export interface AccessibilityLabelsRotorProps {
|
|
391
|
+
headings: string;
|
|
392
|
+
links: string;
|
|
393
|
+
images: string;
|
|
394
|
+
}
|
|
395
|
+
export interface AccessibilityLabelsProps {
|
|
396
|
+
list: Readonly<AccessibilityLabelsListProps>;
|
|
397
|
+
blockquote: Readonly<AccessibilityLabelsBlockquoteProps>;
|
|
398
|
+
table: Readonly<AccessibilityLabelsTableProps>;
|
|
399
|
+
math: Readonly<AccessibilityLabelsMathProps>;
|
|
400
|
+
codeBlock: Readonly<AccessibilityLabelsCodeBlockProps>;
|
|
401
|
+
rotor: Readonly<AccessibilityLabelsRotorProps>;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* MD4C parser flags configuration.
|
|
406
|
+
* Controls how the Tiptap parser interprets certain syntax.
|
|
407
|
+
*/
|
|
408
|
+
export interface Md4cFlagsInternal {
|
|
409
|
+
/**
|
|
410
|
+
* Enable underline syntax support (__text__).
|
|
411
|
+
* When enabled, underscores are treated as underline markers.
|
|
412
|
+
* When disabled, underscores are treated as emphasis markers (same as asterisks).
|
|
413
|
+
* @default false
|
|
414
|
+
*/
|
|
415
|
+
underline: boolean;
|
|
416
|
+
/**
|
|
417
|
+
* Enable superscript span parsing (^text^).
|
|
418
|
+
* @default false
|
|
419
|
+
*/
|
|
420
|
+
superscript: boolean;
|
|
421
|
+
/**
|
|
422
|
+
* Enable subscript span parsing (~text~).
|
|
423
|
+
* @default false
|
|
424
|
+
*/
|
|
425
|
+
subscript: boolean;
|
|
426
|
+
/**
|
|
427
|
+
* Enable LaTeX math span parsing ($..$ and $$..$$).
|
|
428
|
+
* When disabled, dollar signs are treated as plain text.
|
|
429
|
+
* @default true
|
|
430
|
+
*/
|
|
431
|
+
latexMath: boolean;
|
|
432
|
+
/**
|
|
433
|
+
* Enable highlight span parsing (==text==).
|
|
434
|
+
* @default false
|
|
435
|
+
*/
|
|
436
|
+
highlight: boolean;
|
|
437
|
+
/**
|
|
438
|
+
* Treat soft breaks (single newlines) as hard breaks (visible line breaks).
|
|
439
|
+
* @default false
|
|
440
|
+
*/
|
|
441
|
+
hardSoftBreaks: boolean;
|
|
442
|
+
/**
|
|
443
|
+
* Preserve runs of consecutive blank lines as extra empty lines.
|
|
444
|
+
* @default false
|
|
445
|
+
*/
|
|
446
|
+
preserveBlankLines: boolean;
|
|
447
|
+
/**
|
|
448
|
+
* Enable GitHub-style admonitions/alerts extension.
|
|
449
|
+
* Forced off for `flavor="commonmark"`.
|
|
450
|
+
* @default true
|
|
451
|
+
*/
|
|
452
|
+
admonitions: boolean;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
interface StreamingConfigInternal {
|
|
456
|
+
tableMode: string;
|
|
457
|
+
codeBlockMode: string;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
interface LinkContextMenuItemConfig {
|
|
461
|
+
text: string;
|
|
462
|
+
icon: string;
|
|
463
|
+
disabled: boolean;
|
|
464
|
+
destructive: boolean;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
interface LinkContextMenuItemsConfig {
|
|
468
|
+
pattern: string;
|
|
469
|
+
items: ReadonlyArray<Readonly<LinkContextMenuItemConfig>>;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
interface OnLinkContextMenuItemPressEvent {
|
|
473
|
+
url: string;
|
|
474
|
+
pattern: string;
|
|
475
|
+
itemText: string;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
interface TextLinkNativeRegex {
|
|
479
|
+
pattern: string;
|
|
480
|
+
caseInsensitive: boolean;
|
|
481
|
+
dotAll: boolean;
|
|
482
|
+
isDisabled: boolean;
|
|
483
|
+
isDefault: boolean;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
export interface NativeProps extends ViewProps {
|
|
487
|
+
/**
|
|
488
|
+
* Tiptap document JSON.
|
|
489
|
+
*/
|
|
490
|
+
document: string;
|
|
491
|
+
/**
|
|
492
|
+
* Internal style configuration for Tiptap elements.
|
|
493
|
+
* Always provided with complete defaults via normalizeTiptapStyle.
|
|
494
|
+
* Block styles (paragraph, headings) contain fontSize, fontFamily, fontWeight, and color.
|
|
495
|
+
*/
|
|
496
|
+
tiptapStyle: TiptapStyleInternal;
|
|
497
|
+
/**
|
|
498
|
+
* Callback fired when a link is pressed.
|
|
499
|
+
* Receives the URL that was tapped.
|
|
500
|
+
*/
|
|
501
|
+
onLinkPress?: CodegenTypes.BubblingEventHandler<LinkPressEvent>;
|
|
502
|
+
/**
|
|
503
|
+
* Callback fired when a factoid is pressed.
|
|
504
|
+
* Receives the factoid's `id`. A factoid that contains a link emits
|
|
505
|
+
* `onLinkPress` instead, so a single tap never fires both.
|
|
506
|
+
*/
|
|
507
|
+
onFactoidPress?: CodegenTypes.BubblingEventHandler<FactoidPressEvent>;
|
|
508
|
+
/**
|
|
509
|
+
* Callback fired when a mention is pressed.
|
|
510
|
+
* Receives the mention node's `id` and `label`.
|
|
511
|
+
*/
|
|
512
|
+
onMentionPress?: CodegenTypes.BubblingEventHandler<MentionPressEvent>;
|
|
513
|
+
/**
|
|
514
|
+
* Callback fired when a mention is long pressed.
|
|
515
|
+
* Receives the mention node's `id` and `label`.
|
|
516
|
+
* - iOS: A long press on a mention. Text selection still starts everywhere else.
|
|
517
|
+
* - Android: Handles the long-press gesture on the mention chip.
|
|
518
|
+
*/
|
|
519
|
+
onMentionLongPress?: CodegenTypes.BubblingEventHandler<MentionPressEvent>;
|
|
520
|
+
/**
|
|
521
|
+
* Callback fired when a link is long pressed.
|
|
522
|
+
* Receives the URL that was long pressed.
|
|
523
|
+
* - iOS: When provided, overrides the system link preview behavior.
|
|
524
|
+
* - Android: Handles long press gestures on links.
|
|
525
|
+
*/
|
|
526
|
+
onLinkLongPress?: CodegenTypes.BubblingEventHandler<LinkLongPressEvent>;
|
|
527
|
+
/**
|
|
528
|
+
* Callback fired when a rendered image is tapped.
|
|
529
|
+
* Receives the image URL and its alt text (empty string when the image has
|
|
530
|
+
* no alt text). Images that are also links keep link behavior and emit
|
|
531
|
+
* `onLinkPress` instead, so a single tap never fires both.
|
|
532
|
+
*/
|
|
533
|
+
onImagePress?: CodegenTypes.BubblingEventHandler<ImagePressEvent>;
|
|
534
|
+
/**
|
|
535
|
+
* Gates native image tap handling. Set automatically to `true` by the JS
|
|
536
|
+
* wrapper when `onImagePress` is provided. When `false` (default), images are
|
|
537
|
+
* inert: taps fall through to text selection and the iOS Copy/Save menu
|
|
538
|
+
* exactly as before, and no image span becomes interactive on Android.
|
|
539
|
+
*
|
|
540
|
+
* @default false
|
|
541
|
+
*/
|
|
542
|
+
enableImagePress?: CodegenTypes.WithDefault<boolean, false>;
|
|
543
|
+
/**
|
|
544
|
+
* Callback fired when a task list checkbox is tapped.
|
|
545
|
+
* Receives the 0-based task index, current checked state, and the item's plain text.
|
|
546
|
+
*/
|
|
547
|
+
onTaskListItemPress?: CodegenTypes.BubblingEventHandler<TaskListItemPressEvent>;
|
|
548
|
+
/**
|
|
549
|
+
* Controls whether tapping a task list checkbox toggles its checked state.
|
|
550
|
+
*
|
|
551
|
+
* When `false`, the tap is fully inert: no visual toggle and no
|
|
552
|
+
* `onTaskListItemPress` emission. Text selection and links are unaffected.
|
|
553
|
+
*
|
|
554
|
+
* @default true
|
|
555
|
+
*/
|
|
556
|
+
enableTaskListItemToggle?: CodegenTypes.WithDefault<boolean, true>;
|
|
557
|
+
/**
|
|
558
|
+
* Callback fired when code is copied from a fenced code block's header copy
|
|
559
|
+
* button, its long-press context-menu "Copy" action, or the VoiceOver copy
|
|
560
|
+
* action. Receives the copied code and its language.
|
|
561
|
+
*/
|
|
562
|
+
onCopyPress?: CodegenTypes.BubblingEventHandler<CopyPressEvent>;
|
|
563
|
+
/** Fired when a fenced code block is tapped. Receives its code and language. */
|
|
564
|
+
onCodeBlockPress?: CodegenTypes.BubblingEventHandler<CodeBlockPressEvent>;
|
|
565
|
+
/**
|
|
566
|
+
* Gates native code block tap handling; set to `true` by the JS wrapper when
|
|
567
|
+
* `onCodeBlockPress` is provided.
|
|
568
|
+
* @default false
|
|
569
|
+
*/
|
|
570
|
+
enableCodeBlockPress?: CodegenTypes.WithDefault<boolean, false>;
|
|
571
|
+
/**
|
|
572
|
+
* Callback fired when a math expression cannot be parsed or rendered by the
|
|
573
|
+
* LaTeX engine. Receives the raw LaTeX `source` of the failing inline span or
|
|
574
|
+
* block (no delimiters), the engine's error `message` (empty when none), and
|
|
575
|
+
* `displayMode` (false = inline `$...$`, true = block `$$...$$`). The whole
|
|
576
|
+
* expression is the unit of failure; the engine does not report a single
|
|
577
|
+
* offending command.
|
|
578
|
+
*/
|
|
579
|
+
onLatexError?: CodegenTypes.BubblingEventHandler<LatexErrorEvent>;
|
|
580
|
+
/**
|
|
581
|
+
* Controls the long-press copy menu on code blocks, tables, block math, and blockquotes/admonitions.
|
|
582
|
+
* @default true
|
|
583
|
+
*/
|
|
584
|
+
enableBlockContextMenu?: CodegenTypes.WithDefault<boolean, true>;
|
|
585
|
+
/**
|
|
586
|
+
* Controls whether the system link preview is shown on long press (iOS only).
|
|
587
|
+
*
|
|
588
|
+
* When `true` (default), long-pressing a link shows the native iOS link preview.
|
|
589
|
+
* When `false`, the system preview is suppressed.
|
|
590
|
+
*
|
|
591
|
+
* Automatically set to `false` when `onLinkLongPress` is provided (unless explicitly overridden).
|
|
592
|
+
*
|
|
593
|
+
* Android: No-op (Android doesn't have a system link preview).
|
|
594
|
+
*
|
|
595
|
+
* @default true
|
|
596
|
+
*/
|
|
597
|
+
enableLinkPreview?: CodegenTypes.WithDefault<boolean, true>;
|
|
598
|
+
/**
|
|
599
|
+
* - iOS: Controls text selection and link previews on long press.
|
|
600
|
+
* - Android: Controls text selection.
|
|
601
|
+
* @default true
|
|
602
|
+
*/
|
|
603
|
+
selectable?: boolean;
|
|
604
|
+
/**
|
|
605
|
+
* Color of the text selection highlight.
|
|
606
|
+
*
|
|
607
|
+
* On iOS, this also affects the caret and selection handle colors
|
|
608
|
+
* (they share a single tint). On macOS, only the selection background
|
|
609
|
+
* is affected.
|
|
610
|
+
*
|
|
611
|
+
* @platform ios, android, macos, web
|
|
612
|
+
*/
|
|
613
|
+
selectionColor?: ColorValue;
|
|
614
|
+
/**
|
|
615
|
+
* Color of the selection handles (drag anchors).
|
|
616
|
+
* No-op on API levels below 29.
|
|
617
|
+
*
|
|
618
|
+
* @platform android
|
|
619
|
+
*/
|
|
620
|
+
selectionHandleColor?: ColorValue;
|
|
621
|
+
/**
|
|
622
|
+
* MD4C parser flags configuration.
|
|
623
|
+
* Controls how the Tiptap parser interprets certain syntax.
|
|
624
|
+
*/
|
|
625
|
+
md4cFlags: Md4cFlagsInternal;
|
|
626
|
+
/** Enables the GFM table, strikethrough, and task-list extensions. */
|
|
627
|
+
isGFM?: CodegenTypes.WithDefault<boolean, false>;
|
|
628
|
+
/**
|
|
629
|
+
* Specifies whether fonts should scale to respect Text Size accessibility settings.
|
|
630
|
+
* When false, text will not scale with the user's accessibility settings.
|
|
631
|
+
* @default true
|
|
632
|
+
*/
|
|
633
|
+
allowFontScaling?: CodegenTypes.WithDefault<boolean, true>;
|
|
634
|
+
/**
|
|
635
|
+
* Specifies the largest possible scale a font can reach when allowFontScaling is enabled.
|
|
636
|
+
* Possible values:
|
|
637
|
+
* - undefined/null (default): inherit from parent or global default (no limit)
|
|
638
|
+
* - 0: no limit, ignore parent/global default
|
|
639
|
+
* - >= 1: sets the maxFontSizeMultiplier of this node to this value
|
|
640
|
+
* @default undefined
|
|
641
|
+
*/
|
|
642
|
+
maxFontSizeMultiplier?: CodegenTypes.Float;
|
|
643
|
+
/**
|
|
644
|
+
* When false (default), removes trailing margin from the last element to eliminate bottom spacing.
|
|
645
|
+
* When true, keeps the trailing margin from the last element's marginBottom style.
|
|
646
|
+
* @default false
|
|
647
|
+
*/
|
|
648
|
+
allowTrailingMargin?: CodegenTypes.WithDefault<boolean, false>;
|
|
649
|
+
/**
|
|
650
|
+
* When true, newly appended content fades in during streaming updates.
|
|
651
|
+
* Only the tail (new characters beyond the previous content) is animated.
|
|
652
|
+
* @default false
|
|
653
|
+
*/
|
|
654
|
+
streamingAnimation?: CodegenTypes.WithDefault<boolean, false>;
|
|
655
|
+
/**
|
|
656
|
+
* Fine-grained control over streaming behavior for block-level elements.
|
|
657
|
+
*/
|
|
658
|
+
streamingConfig?: StreamingConfigInternal;
|
|
659
|
+
/**
|
|
660
|
+
* Controls how spoiler text is displayed before being revealed.
|
|
661
|
+
* - 'particles' (default): animated particle overlay.
|
|
662
|
+
* - 'solid': opaque rectangle covering the text.
|
|
663
|
+
* @default 'particles'
|
|
664
|
+
*/
|
|
665
|
+
spoilerOverlay?: CodegenTypes.WithDefault<string, 'particles'>;
|
|
666
|
+
/**
|
|
667
|
+
* Custom items to show in the text selection context menu.
|
|
668
|
+
*/
|
|
669
|
+
contextMenuItems?: ReadonlyArray<Readonly<ContextMenuItemConfig>>;
|
|
670
|
+
/**
|
|
671
|
+
* HTTP headers attached to remote image requests, as name/value pairs.
|
|
672
|
+
*/
|
|
673
|
+
imageRequestHeaders?: ReadonlyArray<Readonly<ImageRequestHeaderInternal>>;
|
|
674
|
+
/** Per-link pill content (label, icon), one entry per exact link URL. */
|
|
675
|
+
linkPillContent?: ReadonlyArray<Readonly<LinkPillContentInternal>>;
|
|
676
|
+
/** Opt-in text link recognition; see `linkRecognition`. */
|
|
677
|
+
linkRecognition?: Readonly<{
|
|
678
|
+
text: Readonly<TextLinkNativeRegex>;
|
|
679
|
+
inlineCode: Readonly<TextLinkNativeRegex>;
|
|
680
|
+
}>;
|
|
681
|
+
/** Link long-press menus (iOS 17+): item lists by URL pattern, in matching order. */
|
|
682
|
+
linkContextMenuItems?: ReadonlyArray<Readonly<LinkContextMenuItemsConfig>>;
|
|
683
|
+
onLinkContextMenuItemPress?: CodegenTypes.BubblingEventHandler<OnLinkContextMenuItemPressEvent>;
|
|
684
|
+
/**
|
|
685
|
+
* Built-in items to show in the text selection context menu.
|
|
686
|
+
*/
|
|
687
|
+
selectionMenuConfig: Readonly<SelectionMenuConfig>;
|
|
688
|
+
accessibilityLabels: Readonly<AccessibilityLabelsProps>;
|
|
689
|
+
/**
|
|
690
|
+
* Fired when a custom context menu item is pressed.
|
|
691
|
+
* Receives the item label, the currently selected text, and the selection range.
|
|
692
|
+
*/
|
|
693
|
+
onContextMenuItemPress?: CodegenTypes.BubblingEventHandler<OnContextMenuItemPressEvent>;
|
|
694
|
+
/**
|
|
695
|
+
* Sets the text break strategy on Android (API 23+).
|
|
696
|
+
* @default 'highQuality'
|
|
697
|
+
* @platform android
|
|
698
|
+
*/
|
|
699
|
+
textBreakStrategy?: CodegenTypes.WithDefault<string, 'highQuality'>;
|
|
700
|
+
/**
|
|
701
|
+
* Sets the line break strategy on iOS 14+.
|
|
702
|
+
* @default 'none'
|
|
703
|
+
* @platform ios
|
|
704
|
+
*/
|
|
705
|
+
lineBreakStrategyIOS?: CodegenTypes.WithDefault<string, 'none'>;
|
|
706
|
+
/**
|
|
707
|
+
* Paragraph writing direction.
|
|
708
|
+
* - 'first-strong' (default): resolves each paragraph from its first strong directional character;
|
|
709
|
+
* neutral-only paragraphs fall back to the view's resolved layout direction. Library extension —
|
|
710
|
+
* matches Android's TEXT_DIRECTION_FIRST_STRONG.
|
|
711
|
+
* - 'auto': React Native parity; iOS TextKit follows the app's userInterfaceLayoutDirection.
|
|
712
|
+
* - 'ltr' / 'rtl': force base direction on every paragraph. Code blocks always stay LTR.
|
|
713
|
+
* @default 'first-strong'
|
|
714
|
+
* @platform ios
|
|
715
|
+
*/
|
|
716
|
+
writingDirection?: CodegenTypes.WithDefault<string, 'first-strong'>;
|
|
717
|
+
/**
|
|
718
|
+
* Maximum number of lines to display before the text is truncated. 0 (the
|
|
719
|
+
* default) means unlimited. Matches React Native Text's `numberOfLines`.
|
|
720
|
+
* Only applies to CommonMark; ignored when the flavor is 'github'.
|
|
721
|
+
* Android: while clamped the view is not selectable and links are not tappable
|
|
722
|
+
* (DynamicLayout has no maxLines support, so selection/links would drop the
|
|
723
|
+
* ellipsis); both are restored once the clamp is removed. iOS is unaffected.
|
|
724
|
+
* @default 0
|
|
725
|
+
*/
|
|
726
|
+
numberOfLines?: CodegenTypes.WithDefault<CodegenTypes.Int32, 0>;
|
|
727
|
+
/**
|
|
728
|
+
* Where to place the ellipsis when text is truncated by `numberOfLines`:
|
|
729
|
+
* 'head' | 'middle' | 'tail' | 'clip' ('clip' cuts with no ellipsis). Only
|
|
730
|
+
* takes effect when `numberOfLines` is set. Matches React Native Text's
|
|
731
|
+
* `ellipsizeMode`. Ignored when the flavor is 'github'.
|
|
732
|
+
* @default 'tail'
|
|
733
|
+
*/
|
|
734
|
+
ellipsizeMode?: CodegenTypes.WithDefault<string, 'tail'>;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
export default codegenNativeComponent<NativeProps>('EnrichedTiptapText', {
|
|
738
|
+
interfaceOnly: true,
|
|
739
|
+
});
|