react-native-enriched-html 0.0.0 → 1.0.0
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 +402 -0
- package/ReactNativeEnrichedHtml.podspec +31 -0
- package/android/build.gradle +106 -0
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedTextInputViewManagerDelegate.java +203 -0
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedTextInputViewManagerInterface.java +74 -0
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedTextViewManagerDelegate.java +70 -0
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedTextViewManagerInterface.java +31 -0
- package/android/generated/jni/react/renderer/components/ReactNativeEnrichedSpec/ComponentDescriptors.cpp +22 -0
- package/android/generated/jni/react/renderer/components/ReactNativeEnrichedSpec/ComponentDescriptors.h +24 -0
- package/android/generated/jni/react/renderer/components/ReactNativeEnrichedSpec/EventEmitters.cpp +456 -0
- package/android/generated/jni/react/renderer/components/ReactNativeEnrichedSpec/EventEmitters.h +410 -0
- package/android/generated/jni/react/renderer/components/ReactNativeEnrichedSpec/Props.cpp +272 -0
- package/android/generated/jni/react/renderer/components/ReactNativeEnrichedSpec/Props.h +1595 -0
- package/android/generated/jni/react/renderer/components/ReactNativeEnrichedSpec/ShadowNodes.cpp +17 -0
- package/android/generated/jni/react/renderer/components/ReactNativeEnrichedSpec/ShadowNodes.h +23 -0
- package/android/generated/jni/react/renderer/components/ReactNativeEnrichedSpec/States.cpp +16 -0
- package/android/generated/jni/react/renderer/components/ReactNativeEnrichedSpec/States.h +20 -0
- package/android/gradle.properties +5 -0
- package/android/lint.gradle +70 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/swmansion/enriched/ReactNativeEnrichedPackage.kt +22 -0
- package/android/src/main/java/com/swmansion/enriched/common/AllowFontScaling.kt +36 -0
- package/android/src/main/java/com/swmansion/enriched/common/AsyncDrawable.kt +126 -0
- package/android/src/main/java/com/swmansion/enriched/common/CheckboxDrawable.kt +81 -0
- package/android/src/main/java/com/swmansion/enriched/common/EnrichedConstants.kt +16 -0
- package/android/src/main/java/com/swmansion/enriched/common/EnrichedStyle.kt +57 -0
- package/android/src/main/java/com/swmansion/enriched/common/ForceRedrawSpan.kt +14 -0
- package/android/src/main/java/com/swmansion/enriched/common/GumboNormalizer.kt +5 -0
- package/android/src/main/java/com/swmansion/enriched/common/MentionStyle.kt +9 -0
- package/android/src/main/java/com/swmansion/enriched/common/ResourceManager.kt +26 -0
- package/android/src/main/java/com/swmansion/enriched/common/parser/EnrichedParser.java +1034 -0
- package/android/src/main/java/com/swmansion/enriched/common/parser/EnrichedSpanFactory.kt +82 -0
- package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedAlignmentSpan.kt +19 -0
- package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedBlockQuoteSpan.kt +53 -0
- package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedBoldSpan.kt +12 -0
- package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedCheckboxListSpan.kt +92 -0
- package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedCodeBlockSpan.kt +81 -0
- package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedH1Span.kt +20 -0
- package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedH2Span.kt +20 -0
- package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedH3Span.kt +20 -0
- package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedH4Span.kt +21 -0
- package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedH5Span.kt +20 -0
- package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedH6Span.kt +20 -0
- package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedImageSpan.kt +185 -0
- package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedInlineCodeSpan.kt +24 -0
- package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedItalicSpan.kt +12 -0
- package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedLinkSpan.kt +29 -0
- package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedMentionSpan.kt +35 -0
- package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedOrderedListSpan.kt +79 -0
- package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedStrikeThroughSpan.kt +11 -0
- package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedUnderlineSpan.kt +11 -0
- package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedUnorderedListSpan.kt +62 -0
- package/android/src/main/java/com/swmansion/enriched/common/spans/interfaces/EnrichedBlockSpan.kt +5 -0
- package/android/src/main/java/com/swmansion/enriched/common/spans/interfaces/EnrichedHeadingSpan.kt +3 -0
- package/android/src/main/java/com/swmansion/enriched/common/spans/interfaces/EnrichedInlineSpan.kt +3 -0
- package/android/src/main/java/com/swmansion/enriched/common/spans/interfaces/EnrichedParagraphSpan.kt +5 -0
- package/android/src/main/java/com/swmansion/enriched/common/spans/interfaces/EnrichedSpan.kt +3 -0
- package/android/src/main/java/com/swmansion/enriched/common/spans/interfaces/EnrichedZeroWidthSpaceSpan.kt +4 -0
- package/android/src/main/java/com/swmansion/enriched/text/EnrichedTextMovementMethod.kt +75 -0
- package/android/src/main/java/com/swmansion/enriched/text/EnrichedTextSpanFactory.kt +83 -0
- package/android/src/main/java/com/swmansion/enriched/text/EnrichedTextStyle.kt +202 -0
- package/android/src/main/java/com/swmansion/enriched/text/EnrichedTextView.kt +361 -0
- package/android/src/main/java/com/swmansion/enriched/text/EnrichedTextViewManager.kt +157 -0
- package/android/src/main/java/com/swmansion/enriched/text/MeasurementStore.kt +170 -0
- package/android/src/main/java/com/swmansion/enriched/text/events/OnLinkPressEvent.kt +23 -0
- package/android/src/main/java/com/swmansion/enriched/text/events/OnMentionPressEvent.kt +32 -0
- package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextAlignmentSpan.kt +14 -0
- package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextBlockQuoteSpan.kt +14 -0
- package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextBoldSpan.kt +14 -0
- package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextCheckboxListSpan.kt +15 -0
- package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextCodeBlockSpan.kt +14 -0
- package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextH1Span.kt +14 -0
- package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextH2Span.kt +14 -0
- package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextH3Span.kt +15 -0
- package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextH4Span.kt +15 -0
- package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextH5Span.kt +14 -0
- package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextH6Span.kt +14 -0
- package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextImageSpan.kt +57 -0
- package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextInlineCodeSpan.kt +14 -0
- package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextItalicSpan.kt +14 -0
- package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextLinkSpan.kt +41 -0
- package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextMentionSpan.kt +63 -0
- package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextOrderedListSpan.kt +16 -0
- package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextStrikeThroughSpan.kt +15 -0
- package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextUnderlineSpan.kt +15 -0
- package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextUnorderedListSpan.kt +15 -0
- package/android/src/main/java/com/swmansion/enriched/text/spans/interfaces/EnrichedTextClickableSpan.kt +9 -0
- package/android/src/main/java/com/swmansion/enriched/text/spans/interfaces/EnrichedTextSpan.kt +10 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/EnrichedTextInputConnectionWrapper.kt +140 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/EnrichedTextInputSpannableFactory.kt +85 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/EnrichedTextInputView.kt +1141 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/EnrichedTextInputViewLayoutManager.kt +27 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/EnrichedTextInputViewManager.kt +500 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/MeasurementStore.kt +230 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/events/MentionHandler.kt +55 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/events/OnChangeHtmlEvent.kt +27 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/events/OnChangeSelectionEvent.kt +30 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/events/OnChangeStateEvent.kt +21 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/events/OnChangeTextEvent.kt +30 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/events/OnContextMenuItemPressEvent.kt +35 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/events/OnInputBlurEvent.kt +25 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/events/OnInputFocusEvent.kt +25 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/events/OnInputKeyPressEvent.kt +27 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/events/OnLinkDetectedEvent.kt +32 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/events/OnMentionDetectedEvent.kt +30 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/events/OnMentionEvent.kt +34 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/events/OnPasteImagesEvent.kt +47 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/events/OnRequestHtmlResultEvent.kt +32 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/events/OnSubmitEditingEvent.kt +29 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputAlignmentSpan.kt +14 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputBlockQuoteSpan.kt +14 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputBoldSpan.kt +14 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputCheckboxListSpan.kt +15 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputCodeBlockSpan.kt +14 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputH1Span.kt +14 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputH2Span.kt +14 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputH3Span.kt +14 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputH4Span.kt +14 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputH5Span.kt +14 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputH6Span.kt +14 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputImageSpan.kt +36 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputInlineCodeSpan.kt +14 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputItalicSpan.kt +14 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputLinkSpan.kt +16 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputMentionSpan.kt +18 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputOrderedListSpan.kt +21 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputStrikeThroughSpan.kt +14 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputUnderlineSpan.kt +14 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputUnorderedListSpan.kt +14 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedLineHeightSpan.kt +45 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedSpans.kt +240 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/spans/interfaces/EnrichedInputSpan.kt +10 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/styles/AlignmentStyles.kt +367 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/styles/HtmlStyle.kt +371 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/styles/InlineStyles.kt +232 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/styles/ListStyles.kt +260 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/styles/ParagraphStyles.kt +439 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/styles/ParametrizedStyles.kt +408 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/utils/EnrichedEditableFactory.kt +17 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/utils/EnrichedSelection.kt +340 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/utils/EnrichedSpanState.kt +318 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/utils/EnrichedSpannable.kt +156 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/utils/EnrichedSpannableStringBuilder.kt +59 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/utils/RichContentReceiver.kt +127 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/utils/ShortcutsHandler.kt +150 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/utils/StyleUtils.kt +51 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/utils/Utils.kt +106 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/watchers/EnrichedSpanWatcher.kt +109 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/watchers/EnrichedTextWatcher.kt +106 -0
- package/android/src/main/new_arch/CMakeLists.txt +62 -0
- package/android/src/main/new_arch/GumboNormalizerJni.cpp +14 -0
- package/android/src/main/new_arch/ReactNativeEnrichedSpec.cpp +11 -0
- package/android/src/main/new_arch/ReactNativeEnrichedSpec.h +16 -0
- package/android/src/main/new_arch/react/renderer/components/ReactNativeEnrichedSpec/EnrichedTextComponentDescriptor.h +32 -0
- package/android/src/main/new_arch/react/renderer/components/ReactNativeEnrichedSpec/EnrichedTextInputComponentDescriptor.h +35 -0
- package/android/src/main/new_arch/react/renderer/components/ReactNativeEnrichedSpec/EnrichedTextInputMeasurementManager.cpp +53 -0
- package/android/src/main/new_arch/react/renderer/components/ReactNativeEnrichedSpec/EnrichedTextInputMeasurementManager.h +25 -0
- package/android/src/main/new_arch/react/renderer/components/ReactNativeEnrichedSpec/EnrichedTextInputShadowNode.cpp +35 -0
- package/android/src/main/new_arch/react/renderer/components/ReactNativeEnrichedSpec/EnrichedTextInputShadowNode.h +53 -0
- package/android/src/main/new_arch/react/renderer/components/ReactNativeEnrichedSpec/EnrichedTextInputState.cpp +9 -0
- package/android/src/main/new_arch/react/renderer/components/ReactNativeEnrichedSpec/EnrichedTextInputState.h +24 -0
- package/android/src/main/new_arch/react/renderer/components/ReactNativeEnrichedSpec/EnrichedTextMeasurementManager.cpp +45 -0
- package/android/src/main/new_arch/react/renderer/components/ReactNativeEnrichedSpec/EnrichedTextMeasurementManager.h +25 -0
- package/android/src/main/new_arch/react/renderer/components/ReactNativeEnrichedSpec/EnrichedTextShadowNode.cpp +21 -0
- package/android/src/main/new_arch/react/renderer/components/ReactNativeEnrichedSpec/EnrichedTextShadowNode.h +39 -0
- package/android/src/main/new_arch/react/renderer/components/ReactNativeEnrichedSpec/conversions.h +44 -0
- package/android/src/main/res/drawable/broken_image.xml +10 -0
- package/cpp/CMakeLists.txt +50 -0
- package/cpp/GumboParser/GumboParser.h +34043 -0
- package/cpp/README.md +59 -0
- package/cpp/parser/GumboNormalizer.c +915 -0
- package/cpp/parser/GumboParser.cpp +16 -0
- package/cpp/parser/GumboParser.hpp +23 -0
- package/cpp/tests/GumboParserTest.cpp +457 -0
- package/ios/EnrichedTextInputView.h +54 -0
- package/ios/EnrichedTextInputView.mm +2170 -0
- package/ios/EnrichedTextInputViewManager.mm +13 -0
- package/ios/EnrichedTextView.h +35 -0
- package/ios/EnrichedTextView.mm +806 -0
- package/ios/EnrichedTextViewManager.mm +13 -0
- package/ios/config/EnrichedConfig.h +114 -0
- package/ios/config/EnrichedConfig.mm +727 -0
- package/ios/enrichedInputTextView/EnrichedInputTextView.h +6 -0
- package/ios/enrichedInputTextView/EnrichedInputTextView.mm +334 -0
- package/ios/enrichedTextTextView/EnrichedTextTextView.h +16 -0
- package/ios/enrichedTextTextView/EnrichedTextTextView.mm +71 -0
- package/ios/extensions/ColorExtension.h +8 -0
- package/ios/extensions/ColorExtension.mm +48 -0
- package/ios/extensions/FontExtension.h +11 -0
- package/ios/extensions/FontExtension.mm +72 -0
- package/ios/extensions/ImageExtension.h +33 -0
- package/ios/extensions/ImageExtension.mm +176 -0
- package/ios/extensions/LayoutManagerExtension.h +6 -0
- package/ios/extensions/LayoutManagerExtension.mm +454 -0
- package/ios/extensions/StringExtension.h +15 -0
- package/ios/extensions/StringExtension.mm +69 -0
- package/ios/generated/ReactNativeEnrichedSpec/ComponentDescriptors.cpp +22 -0
- package/ios/generated/ReactNativeEnrichedSpec/ComponentDescriptors.h +24 -0
- package/ios/generated/ReactNativeEnrichedSpec/EventEmitters.cpp +456 -0
- package/ios/generated/ReactNativeEnrichedSpec/EventEmitters.h +410 -0
- package/ios/generated/ReactNativeEnrichedSpec/Props.cpp +272 -0
- package/ios/generated/ReactNativeEnrichedSpec/Props.h +1595 -0
- package/ios/generated/ReactNativeEnrichedSpec/RCTComponentViewHelpers.h +570 -0
- package/ios/generated/ReactNativeEnrichedSpec/ShadowNodes.cpp +17 -0
- package/ios/generated/ReactNativeEnrichedSpec/ShadowNodes.h +23 -0
- package/ios/generated/ReactNativeEnrichedSpec/States.cpp +16 -0
- package/ios/generated/ReactNativeEnrichedSpec/States.h +20 -0
- package/ios/htmlParser/HtmlParser.h +11 -0
- package/ios/htmlParser/HtmlParser.mm +1468 -0
- package/ios/inputAttributesManager/InputAttributesManager.h +18 -0
- package/ios/inputAttributesManager/InputAttributesManager.mm +222 -0
- package/ios/inputHtmlParser/InputHtmlParser.h +10 -0
- package/ios/inputHtmlParser/InputHtmlParser.mm +225 -0
- package/ios/interfaces/AlignmentEntry.h +9 -0
- package/ios/interfaces/AlignmentEntry.mm +4 -0
- package/ios/interfaces/AttributeEntry.h +9 -0
- package/ios/interfaces/AttributeEntry.mm +4 -0
- package/ios/interfaces/BaseStyleProtocol.h +17 -0
- package/ios/interfaces/EnrichedTextStyleHeaders.h +62 -0
- package/ios/interfaces/EnrichedViewHost.h +26 -0
- package/ios/interfaces/ImageAttachment.h +11 -0
- package/ios/interfaces/ImageAttachment.mm +107 -0
- package/ios/interfaces/ImageData.h +10 -0
- package/ios/interfaces/ImageData.mm +4 -0
- package/ios/interfaces/LinkData.h +11 -0
- package/ios/interfaces/LinkData.mm +43 -0
- package/ios/interfaces/LinkRegexConfig.h +19 -0
- package/ios/interfaces/LinkRegexConfig.mm +37 -0
- package/ios/interfaces/MediaAttachment.h +23 -0
- package/ios/interfaces/MediaAttachment.mm +31 -0
- package/ios/interfaces/MentionParams.h +8 -0
- package/ios/interfaces/MentionParams.mm +4 -0
- package/ios/interfaces/MentionStyleProps.h +17 -0
- package/ios/interfaces/MentionStyleProps.mm +80 -0
- package/ios/interfaces/StyleBase.h +38 -0
- package/ios/interfaces/StyleBase.mm +279 -0
- package/ios/interfaces/StyleHeaders.h +110 -0
- package/ios/interfaces/StylePair.h +9 -0
- package/ios/interfaces/StylePair.mm +4 -0
- package/ios/interfaces/StyleTypeEnum.h +27 -0
- package/ios/interfaces/TextDecorationLineEnum.h +6 -0
- package/ios/interfaces/TextDecorationLineEnum.mm +4 -0
- package/ios/internals/EnrichedTextComponentDescriptor.h +19 -0
- package/ios/internals/EnrichedTextInputViewComponentDescriptor.h +19 -0
- package/ios/internals/EnrichedTextInputViewShadowNode.h +44 -0
- package/ios/internals/EnrichedTextInputViewShadowNode.mm +103 -0
- package/ios/internals/EnrichedTextInputViewState.cpp +10 -0
- package/ios/internals/EnrichedTextInputViewState.h +22 -0
- package/ios/internals/EnrichedTextViewShadowNode.h +34 -0
- package/ios/internals/EnrichedTextViewShadowNode.mm +72 -0
- package/ios/internals/EnrichedTextViewState.cpp +7 -0
- package/ios/internals/EnrichedTextViewState.h +18 -0
- package/ios/styles/AlignmentStyle.mm +203 -0
- package/ios/styles/BlockQuoteStyle.mm +54 -0
- package/ios/styles/BoldStyle.mm +37 -0
- package/ios/styles/CheckboxListStyle.mm +154 -0
- package/ios/styles/CodeBlockStyle.mm +49 -0
- package/ios/styles/EnrichedTextStyles.mm +61 -0
- package/ios/styles/H1Style.mm +20 -0
- package/ios/styles/H2Style.mm +20 -0
- package/ios/styles/H3Style.mm +20 -0
- package/ios/styles/H4Style.mm +20 -0
- package/ios/styles/H5Style.mm +20 -0
- package/ios/styles/H6Style.mm +20 -0
- package/ios/styles/HeadingStyleBase.mm +96 -0
- package/ios/styles/ImageStyle.mm +150 -0
- package/ios/styles/InlineCodeStyle.mm +65 -0
- package/ios/styles/ItalicStyle.mm +37 -0
- package/ios/styles/LinkStyle.mm +532 -0
- package/ios/styles/MentionStyle.mm +541 -0
- package/ios/styles/OrderedListStyle.mm +48 -0
- package/ios/styles/StrikethroughStyle.mm +25 -0
- package/ios/styles/UnderlineStyle.mm +24 -0
- package/ios/styles/UnorderedListStyle.mm +48 -0
- package/ios/textHtmlParser/TextHtmlParser.h +10 -0
- package/ios/textHtmlParser/TextHtmlParser.mm +181 -0
- package/ios/utils/AlignmentUtils.h +20 -0
- package/ios/utils/AlignmentUtils.mm +111 -0
- package/ios/utils/AttachmentLayoutUtils.h +24 -0
- package/ios/utils/AttachmentLayoutUtils.mm +144 -0
- package/ios/utils/CheckboxHitTestUtils.h +10 -0
- package/ios/utils/CheckboxHitTestUtils.mm +122 -0
- package/ios/utils/DotReplacementUtils.h +10 -0
- package/ios/utils/DotReplacementUtils.mm +68 -0
- package/ios/utils/EnrichedTextTouchHandler.h +14 -0
- package/ios/utils/EnrichedTextTouchHandler.mm +152 -0
- package/ios/utils/KeyboardUtils.h +7 -0
- package/ios/utils/KeyboardUtils.mm +30 -0
- package/ios/utils/OccurenceUtils.h +44 -0
- package/ios/utils/OccurenceUtils.mm +185 -0
- package/ios/utils/ParagraphAttributesUtils.h +18 -0
- package/ios/utils/ParagraphAttributesUtils.mm +289 -0
- package/ios/utils/RangeUtils.h +12 -0
- package/ios/utils/RangeUtils.mm +183 -0
- package/ios/utils/ShortcutsUtils.h +21 -0
- package/ios/utils/ShortcutsUtils.mm +486 -0
- package/ios/utils/StyleUtils.h +33 -0
- package/ios/utils/StyleUtils.mm +290 -0
- package/ios/utils/TextBlockTapGestureRecognizer.h +17 -0
- package/ios/utils/TextBlockTapGestureRecognizer.mm +56 -0
- package/ios/utils/TextInsertionUtils.h +17 -0
- package/ios/utils/TextInsertionUtils.mm +60 -0
- package/ios/utils/TextListsUtils.h +40 -0
- package/ios/utils/TextListsUtils.mm +93 -0
- package/ios/utils/WeakBox.h +3 -0
- package/ios/utils/WeakBox.m +4 -0
- package/ios/utils/WordsUtils.h +7 -0
- package/ios/utils/WordsUtils.mm +98 -0
- package/ios/utils/ZeroWidthSpaceUtils.h +14 -0
- package/ios/utils/ZeroWidthSpaceUtils.mm +310 -0
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/index.native.js +7 -0
- package/lib/module/index.native.js.map +1 -0
- package/lib/module/native/EnrichedText.js +76 -0
- package/lib/module/native/EnrichedText.js.map +1 -0
- package/lib/module/native/EnrichedTextInput.js +306 -0
- package/lib/module/native/EnrichedTextInput.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/spec/EnrichedTextInputNativeComponent.ts +524 -0
- package/lib/module/spec/EnrichedTextNativeComponent.ts +110 -0
- package/lib/module/types.js +4 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utils/EnrichedTextInputDefaultProps.js +20 -0
- package/lib/module/utils/EnrichedTextInputDefaultProps.js.map +1 -0
- package/lib/module/utils/defaultHtmlStyle.js +83 -0
- package/lib/module/utils/defaultHtmlStyle.js.map +1 -0
- package/lib/module/utils/expandMentionStylesForIndicators.js +15 -0
- package/lib/module/utils/expandMentionStylesForIndicators.js.map +1 -0
- package/lib/module/utils/isMentionStyleRecord.js +10 -0
- package/lib/module/utils/isMentionStyleRecord.js.map +1 -0
- package/lib/module/utils/normalizeHtmlStyle.js +126 -0
- package/lib/module/utils/normalizeHtmlStyle.js.map +1 -0
- package/lib/module/utils/nullthrows.js +9 -0
- package/lib/module/utils/nullthrows.js.map +1 -0
- package/lib/module/utils/regexParser.js +46 -0
- package/lib/module/utils/regexParser.js.map +1 -0
- package/lib/module/web/EnrichedTextInput.css +201 -0
- package/lib/module/web/EnrichedTextInput.js +314 -0
- package/lib/module/web/EnrichedTextInput.js.map +1 -0
- package/lib/module/web/adaptWebToNativeEvent.js +34 -0
- package/lib/module/web/adaptWebToNativeEvent.js.map +1 -0
- package/lib/module/web/checkboxHtmlNormalizer.js +54 -0
- package/lib/module/web/checkboxHtmlNormalizer.js.map +1 -0
- package/lib/module/web/formats/EnrichedBlockquote.js +32 -0
- package/lib/module/web/formats/EnrichedBlockquote.js.map +1 -0
- package/lib/module/web/formats/EnrichedBold.js +22 -0
- package/lib/module/web/formats/EnrichedBold.js.map +1 -0
- package/lib/module/web/formats/EnrichedCheckboxItem.js +32 -0
- package/lib/module/web/formats/EnrichedCheckboxItem.js.map +1 -0
- package/lib/module/web/formats/EnrichedCheckboxList.js +35 -0
- package/lib/module/web/formats/EnrichedCheckboxList.js.map +1 -0
- package/lib/module/web/formats/EnrichedCode.js +15 -0
- package/lib/module/web/formats/EnrichedCode.js.map +1 -0
- package/lib/module/web/formats/EnrichedCodeBlock.js +43 -0
- package/lib/module/web/formats/EnrichedCodeBlock.js.map +1 -0
- package/lib/module/web/formats/EnrichedHeading.js +27 -0
- package/lib/module/web/formats/EnrichedHeading.js.map +1 -0
- package/lib/module/web/formats/EnrichedImage.js +57 -0
- package/lib/module/web/formats/EnrichedImage.js.map +1 -0
- package/lib/module/web/formats/EnrichedImageNodeView.js +90 -0
- package/lib/module/web/formats/EnrichedImageNodeView.js.map +1 -0
- package/lib/module/web/formats/EnrichedItalic.js +22 -0
- package/lib/module/web/formats/EnrichedItalic.js.map +1 -0
- package/lib/module/web/formats/EnrichedLink.js +140 -0
- package/lib/module/web/formats/EnrichedLink.js.map +1 -0
- package/lib/module/web/formats/EnrichedListItem.js +19 -0
- package/lib/module/web/formats/EnrichedListItem.js.map +1 -0
- package/lib/module/web/formats/EnrichedMention.js +50 -0
- package/lib/module/web/formats/EnrichedMention.js.map +1 -0
- package/lib/module/web/formats/EnrichedOrderedList.js +32 -0
- package/lib/module/web/formats/EnrichedOrderedList.js.map +1 -0
- package/lib/module/web/formats/EnrichedStrike.js +22 -0
- package/lib/module/web/formats/EnrichedStrike.js.map +1 -0
- package/lib/module/web/formats/EnrichedUnderline.js +22 -0
- package/lib/module/web/formats/EnrichedUnderline.js.map +1 -0
- package/lib/module/web/formats/EnrichedUnorderedList.js +33 -0
- package/lib/module/web/formats/EnrichedUnorderedList.js.map +1 -0
- package/lib/module/web/formats/applyWrappingListToSelection.js +63 -0
- package/lib/module/web/formats/applyWrappingListToSelection.js.map +1 -0
- package/lib/module/web/formats/formatRules.js +48 -0
- package/lib/module/web/formats/formatRules.js.map +1 -0
- package/lib/module/web/formats/listKeyboard.js +50 -0
- package/lib/module/web/formats/listKeyboard.js.map +1 -0
- package/lib/module/web/formats/wrappedBlockKeyboard.js +58 -0
- package/lib/module/web/formats/wrappedBlockKeyboard.js.map +1 -0
- package/lib/module/web/pasteImages.js +78 -0
- package/lib/module/web/pasteImages.js.map +1 -0
- package/lib/module/web/pastedImageDimensions.js +49 -0
- package/lib/module/web/pastedImageDimensions.js.map +1 -0
- package/lib/module/web/pmPlugins/MentionPlugin/index.js +36 -0
- package/lib/module/web/pmPlugins/MentionPlugin/index.js.map +1 -0
- package/lib/module/web/pmPlugins/MentionPlugin/isCaretInBlockedContext.js +11 -0
- package/lib/module/web/pmPlugins/MentionPlugin/isCaretInBlockedContext.js.map +1 -0
- package/lib/module/web/pmPlugins/MentionPlugin/makeMentionPluginState.js +67 -0
- package/lib/module/web/pmPlugins/MentionPlugin/makeMentionPluginState.js.map +1 -0
- package/lib/module/web/pmPlugins/MentionPlugin/mentionPluginKey.js +5 -0
- package/lib/module/web/pmPlugins/MentionPlugin/mentionPluginKey.js.map +1 -0
- package/lib/module/web/pmPlugins/MentionPlugin/removeMentionMarksIfSpansResized.js +56 -0
- package/lib/module/web/pmPlugins/MentionPlugin/removeMentionMarksIfSpansResized.js.map +1 -0
- package/lib/module/web/pmPlugins/MentionPlugin/setMention.js +58 -0
- package/lib/module/web/pmPlugins/MentionPlugin/setMention.js.map +1 -0
- package/lib/module/web/pmPlugins/MentionPlugin/startMention.js +9 -0
- package/lib/module/web/pmPlugins/MentionPlugin/startMention.js.map +1 -0
- package/lib/module/web/pmPlugins/MentionPlugin/stripPartialMentionMarks.js +9 -0
- package/lib/module/web/pmPlugins/MentionPlugin/stripPartialMentionMarks.js.map +1 -0
- package/lib/module/web/pmPlugins/MentionPlugin/subscribeMentionEvents.js +100 -0
- package/lib/module/web/pmPlugins/MentionPlugin/subscribeMentionEvents.js.map +1 -0
- package/lib/module/web/pmPlugins/MentionPlugin/types.js +4 -0
- package/lib/module/web/pmPlugins/MentionPlugin/types.js.map +1 -0
- package/lib/module/web/pmPlugins/MergeAdjacentSameKindBlocksPlugin.js +42 -0
- package/lib/module/web/pmPlugins/MergeAdjacentSameKindBlocksPlugin.js.map +1 -0
- package/lib/module/web/pmPlugins/ShortcutPlugin.js +123 -0
- package/lib/module/web/pmPlugins/ShortcutPlugin.js.map +1 -0
- package/lib/module/web/pmPlugins/StrictMarksPlugin.js +98 -0
- package/lib/module/web/pmPlugins/StrictMarksPlugin.js.map +1 -0
- package/lib/module/web/pmPlugins/StripBoldInStyledHeadingsPlugin.js +56 -0
- package/lib/module/web/pmPlugins/StripBoldInStyledHeadingsPlugin.js.map +1 -0
- package/lib/module/web/pmPlugins/StripMarksInCodeBlockPlugin.js +28 -0
- package/lib/module/web/pmPlugins/StripMarksInCodeBlockPlugin.js.map +1 -0
- package/lib/module/web/pmPlugins/StripMarksOnImagePlugin.js +29 -0
- package/lib/module/web/pmPlugins/StripMarksOnImagePlugin.js.map +1 -0
- package/lib/module/web/positionMapping.js +76 -0
- package/lib/module/web/positionMapping.js.map +1 -0
- package/lib/module/web/returnKeyTypeToEnterKeyHint.js +20 -0
- package/lib/module/web/returnKeyTypeToEnterKeyHint.js.map +1 -0
- package/lib/module/web/styleConversion/buildMentionRulesCSS.js +33 -0
- package/lib/module/web/styleConversion/buildMentionRulesCSS.js.map +1 -0
- package/lib/module/web/styleConversion/enrichedInputStyleToCSSProperties.js +159 -0
- package/lib/module/web/styleConversion/enrichedInputStyleToCSSProperties.js.map +1 -0
- package/lib/module/web/styleConversion/enrichedInputThemingToCSSProperties.js +18 -0
- package/lib/module/web/styleConversion/enrichedInputThemingToCSSProperties.js.map +1 -0
- package/lib/module/web/styleConversion/htmlStyleToCSSVariables.js +145 -0
- package/lib/module/web/styleConversion/htmlStyleToCSSVariables.js.map +1 -0
- package/lib/module/web/styleConversion/mentionIndicatorCssKey.js +15 -0
- package/lib/module/web/styleConversion/mentionIndicatorCssKey.js.map +1 -0
- package/lib/module/web/styleConversion/toColor.js +18 -0
- package/lib/module/web/styleConversion/toColor.js.map +1 -0
- package/lib/module/web/tiptapHtmlNormalizer.js +30 -0
- package/lib/module/web/tiptapHtmlNormalizer.js.map +1 -0
- package/lib/module/web/useOnChangeHtml.js +8 -0
- package/lib/module/web/useOnChangeHtml.js.map +1 -0
- package/lib/module/web/useOnChangeState.js +88 -0
- package/lib/module/web/useOnChangeState.js.map +1 -0
- package/lib/module/web/useOnChangeText.js +11 -0
- package/lib/module/web/useOnChangeText.js.map +1 -0
- package/lib/module/web/useOnEditorChange.js +25 -0
- package/lib/module/web/useOnEditorChange.js.map +1 -0
- package/lib/module/web/useOnLinkDetected.js +68 -0
- package/lib/module/web/useOnLinkDetected.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/index.d.ts +3 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/index.native.d.ts +5 -0
- package/lib/typescript/src/index.native.d.ts.map +1 -0
- package/lib/typescript/src/native/EnrichedText.d.ts +3 -0
- package/lib/typescript/src/native/EnrichedText.d.ts.map +1 -0
- package/lib/typescript/src/native/EnrichedTextInput.d.ts +3 -0
- package/lib/typescript/src/native/EnrichedTextInput.d.ts.map +1 -0
- package/lib/typescript/src/spec/EnrichedTextInputNativeComponent.d.ts +405 -0
- package/lib/typescript/src/spec/EnrichedTextInputNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/spec/EnrichedTextNativeComponent.d.ts +88 -0
- package/lib/typescript/src/spec/EnrichedTextNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +721 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/lib/typescript/src/utils/EnrichedTextInputDefaultProps.d.ts +13 -0
- package/lib/typescript/src/utils/EnrichedTextInputDefaultProps.d.ts.map +1 -0
- package/lib/typescript/src/utils/defaultHtmlStyle.d.ts +4 -0
- package/lib/typescript/src/utils/defaultHtmlStyle.d.ts.map +1 -0
- package/lib/typescript/src/utils/expandMentionStylesForIndicators.d.ts +3 -0
- package/lib/typescript/src/utils/expandMentionStylesForIndicators.d.ts.map +1 -0
- package/lib/typescript/src/utils/isMentionStyleRecord.d.ts +3 -0
- package/lib/typescript/src/utils/isMentionStyleRecord.d.ts.map +1 -0
- package/lib/typescript/src/utils/normalizeHtmlStyle.d.ts +6 -0
- package/lib/typescript/src/utils/normalizeHtmlStyle.d.ts.map +1 -0
- package/lib/typescript/src/utils/nullthrows.d.ts +2 -0
- package/lib/typescript/src/utils/nullthrows.d.ts.map +1 -0
- package/lib/typescript/src/utils/regexParser.d.ts +3 -0
- package/lib/typescript/src/utils/regexParser.d.ts.map +1 -0
- package/lib/typescript/src/web/EnrichedTextInput.d.ts +4 -0
- package/lib/typescript/src/web/EnrichedTextInput.d.ts.map +1 -0
- package/lib/typescript/src/web/adaptWebToNativeEvent.d.ts +3 -0
- package/lib/typescript/src/web/adaptWebToNativeEvent.d.ts.map +1 -0
- package/lib/typescript/src/web/checkboxHtmlNormalizer.d.ts +3 -0
- package/lib/typescript/src/web/checkboxHtmlNormalizer.d.ts.map +1 -0
- package/lib/typescript/src/web/formats/EnrichedBlockquote.d.ts +2 -0
- package/lib/typescript/src/web/formats/EnrichedBlockquote.d.ts.map +1 -0
- package/lib/typescript/src/web/formats/EnrichedBold.d.ts +2 -0
- package/lib/typescript/src/web/formats/EnrichedBold.d.ts.map +1 -0
- package/lib/typescript/src/web/formats/EnrichedCheckboxItem.d.ts +2 -0
- package/lib/typescript/src/web/formats/EnrichedCheckboxItem.d.ts.map +1 -0
- package/lib/typescript/src/web/formats/EnrichedCheckboxList.d.ts +9 -0
- package/lib/typescript/src/web/formats/EnrichedCheckboxList.d.ts.map +1 -0
- package/lib/typescript/src/web/formats/EnrichedCode.d.ts +2 -0
- package/lib/typescript/src/web/formats/EnrichedCode.d.ts.map +1 -0
- package/lib/typescript/src/web/formats/EnrichedCodeBlock.d.ts +9 -0
- package/lib/typescript/src/web/formats/EnrichedCodeBlock.d.ts.map +1 -0
- package/lib/typescript/src/web/formats/EnrichedHeading.d.ts +5 -0
- package/lib/typescript/src/web/formats/EnrichedHeading.d.ts.map +1 -0
- package/lib/typescript/src/web/formats/EnrichedImage.d.ts +2 -0
- package/lib/typescript/src/web/formats/EnrichedImage.d.ts.map +1 -0
- package/lib/typescript/src/web/formats/EnrichedImageNodeView.d.ts +3 -0
- package/lib/typescript/src/web/formats/EnrichedImageNodeView.d.ts.map +1 -0
- package/lib/typescript/src/web/formats/EnrichedItalic.d.ts +2 -0
- package/lib/typescript/src/web/formats/EnrichedItalic.d.ts.map +1 -0
- package/lib/typescript/src/web/formats/EnrichedLink.d.ts +5 -0
- package/lib/typescript/src/web/formats/EnrichedLink.d.ts.map +1 -0
- package/lib/typescript/src/web/formats/EnrichedListItem.d.ts +2 -0
- package/lib/typescript/src/web/formats/EnrichedListItem.d.ts.map +1 -0
- package/lib/typescript/src/web/formats/EnrichedMention.d.ts +4 -0
- package/lib/typescript/src/web/formats/EnrichedMention.d.ts.map +1 -0
- package/lib/typescript/src/web/formats/EnrichedOrderedList.d.ts +2 -0
- package/lib/typescript/src/web/formats/EnrichedOrderedList.d.ts.map +1 -0
- package/lib/typescript/src/web/formats/EnrichedStrike.d.ts +2 -0
- package/lib/typescript/src/web/formats/EnrichedStrike.d.ts.map +1 -0
- package/lib/typescript/src/web/formats/EnrichedUnderline.d.ts +2 -0
- package/lib/typescript/src/web/formats/EnrichedUnderline.d.ts.map +1 -0
- package/lib/typescript/src/web/formats/EnrichedUnorderedList.d.ts +9 -0
- package/lib/typescript/src/web/formats/EnrichedUnorderedList.d.ts.map +1 -0
- package/lib/typescript/src/web/formats/applyWrappingListToSelection.d.ts +18 -0
- package/lib/typescript/src/web/formats/applyWrappingListToSelection.d.ts.map +1 -0
- package/lib/typescript/src/web/formats/formatRules.d.ts +10 -0
- package/lib/typescript/src/web/formats/formatRules.d.ts.map +1 -0
- package/lib/typescript/src/web/formats/listKeyboard.d.ts +4 -0
- package/lib/typescript/src/web/formats/listKeyboard.d.ts.map +1 -0
- package/lib/typescript/src/web/formats/wrappedBlockKeyboard.d.ts +12 -0
- package/lib/typescript/src/web/formats/wrappedBlockKeyboard.d.ts.map +1 -0
- package/lib/typescript/src/web/pasteImages.d.ts +10 -0
- package/lib/typescript/src/web/pasteImages.d.ts.map +1 -0
- package/lib/typescript/src/web/pastedImageDimensions.d.ts +9 -0
- package/lib/typescript/src/web/pastedImageDimensions.d.ts.map +1 -0
- package/lib/typescript/src/web/pmPlugins/MentionPlugin/index.d.ts +9 -0
- package/lib/typescript/src/web/pmPlugins/MentionPlugin/index.d.ts.map +1 -0
- package/lib/typescript/src/web/pmPlugins/MentionPlugin/isCaretInBlockedContext.d.ts +3 -0
- package/lib/typescript/src/web/pmPlugins/MentionPlugin/isCaretInBlockedContext.d.ts.map +1 -0
- package/lib/typescript/src/web/pmPlugins/MentionPlugin/makeMentionPluginState.d.ts +4 -0
- package/lib/typescript/src/web/pmPlugins/MentionPlugin/makeMentionPluginState.d.ts.map +1 -0
- package/lib/typescript/src/web/pmPlugins/MentionPlugin/mentionPluginKey.d.ts +4 -0
- package/lib/typescript/src/web/pmPlugins/MentionPlugin/mentionPluginKey.d.ts.map +1 -0
- package/lib/typescript/src/web/pmPlugins/MentionPlugin/removeMentionMarksIfSpansResized.d.ts +9 -0
- package/lib/typescript/src/web/pmPlugins/MentionPlugin/removeMentionMarksIfSpansResized.d.ts.map +1 -0
- package/lib/typescript/src/web/pmPlugins/MentionPlugin/setMention.d.ts +3 -0
- package/lib/typescript/src/web/pmPlugins/MentionPlugin/setMention.d.ts.map +1 -0
- package/lib/typescript/src/web/pmPlugins/MentionPlugin/startMention.d.ts +3 -0
- package/lib/typescript/src/web/pmPlugins/MentionPlugin/startMention.d.ts.map +1 -0
- package/lib/typescript/src/web/pmPlugins/MentionPlugin/stripPartialMentionMarks.d.ts +3 -0
- package/lib/typescript/src/web/pmPlugins/MentionPlugin/stripPartialMentionMarks.d.ts.map +1 -0
- package/lib/typescript/src/web/pmPlugins/MentionPlugin/subscribeMentionEvents.d.ts +4 -0
- package/lib/typescript/src/web/pmPlugins/MentionPlugin/subscribeMentionEvents.d.ts.map +1 -0
- package/lib/typescript/src/web/pmPlugins/MentionPlugin/types.d.ts +20 -0
- package/lib/typescript/src/web/pmPlugins/MentionPlugin/types.d.ts.map +1 -0
- package/lib/typescript/src/web/pmPlugins/MergeAdjacentSameKindBlocksPlugin.d.ts +3 -0
- package/lib/typescript/src/web/pmPlugins/MergeAdjacentSameKindBlocksPlugin.d.ts.map +1 -0
- package/lib/typescript/src/web/pmPlugins/ShortcutPlugin.d.ts +7 -0
- package/lib/typescript/src/web/pmPlugins/ShortcutPlugin.d.ts.map +1 -0
- package/lib/typescript/src/web/pmPlugins/StrictMarksPlugin.d.ts +3 -0
- package/lib/typescript/src/web/pmPlugins/StrictMarksPlugin.d.ts.map +1 -0
- package/lib/typescript/src/web/pmPlugins/StripBoldInStyledHeadingsPlugin.d.ts +10 -0
- package/lib/typescript/src/web/pmPlugins/StripBoldInStyledHeadingsPlugin.d.ts.map +1 -0
- package/lib/typescript/src/web/pmPlugins/StripMarksInCodeBlockPlugin.d.ts +3 -0
- package/lib/typescript/src/web/pmPlugins/StripMarksInCodeBlockPlugin.d.ts.map +1 -0
- package/lib/typescript/src/web/pmPlugins/StripMarksOnImagePlugin.d.ts +3 -0
- package/lib/typescript/src/web/pmPlugins/StripMarksOnImagePlugin.d.ts.map +1 -0
- package/lib/typescript/src/web/positionMapping.d.ts +39 -0
- package/lib/typescript/src/web/positionMapping.d.ts.map +1 -0
- package/lib/typescript/src/web/returnKeyTypeToEnterKeyHint.d.ts +4 -0
- package/lib/typescript/src/web/returnKeyTypeToEnterKeyHint.d.ts.map +1 -0
- package/lib/typescript/src/web/styleConversion/buildMentionRulesCSS.d.ts +3 -0
- package/lib/typescript/src/web/styleConversion/buildMentionRulesCSS.d.ts.map +1 -0
- package/lib/typescript/src/web/styleConversion/enrichedInputStyleToCSSProperties.d.ts +8 -0
- package/lib/typescript/src/web/styleConversion/enrichedInputStyleToCSSProperties.d.ts.map +1 -0
- package/lib/typescript/src/web/styleConversion/enrichedInputThemingToCSSProperties.d.ts +9 -0
- package/lib/typescript/src/web/styleConversion/enrichedInputThemingToCSSProperties.d.ts.map +1 -0
- package/lib/typescript/src/web/styleConversion/htmlStyleToCSSVariables.d.ts +10 -0
- package/lib/typescript/src/web/styleConversion/htmlStyleToCSSVariables.d.ts.map +1 -0
- package/lib/typescript/src/web/styleConversion/mentionIndicatorCssKey.d.ts +3 -0
- package/lib/typescript/src/web/styleConversion/mentionIndicatorCssKey.d.ts.map +1 -0
- package/lib/typescript/src/web/styleConversion/toColor.d.ts +3 -0
- package/lib/typescript/src/web/styleConversion/toColor.d.ts.map +1 -0
- package/lib/typescript/src/web/tiptapHtmlNormalizer.d.ts +3 -0
- package/lib/typescript/src/web/tiptapHtmlNormalizer.d.ts.map +1 -0
- package/lib/typescript/src/web/useOnChangeHtml.d.ts +5 -0
- package/lib/typescript/src/web/useOnChangeHtml.d.ts.map +1 -0
- package/lib/typescript/src/web/useOnChangeState.d.ts +6 -0
- package/lib/typescript/src/web/useOnChangeState.d.ts.map +1 -0
- package/lib/typescript/src/web/useOnChangeText.d.ts +5 -0
- package/lib/typescript/src/web/useOnChangeText.d.ts.map +1 -0
- package/lib/typescript/src/web/useOnEditorChange.d.ts +6 -0
- package/lib/typescript/src/web/useOnEditorChange.d.ts.map +1 -0
- package/lib/typescript/src/web/useOnLinkDetected.d.ts +4 -0
- package/lib/typescript/src/web/useOnLinkDetected.d.ts.map +1 -0
- package/package.json +232 -1
- package/react-native.config.js +16 -0
- package/src/index.native.tsx +34 -0
- package/src/index.tsx +24 -0
- package/src/native/EnrichedText.tsx +115 -0
- package/src/native/EnrichedTextInput.tsx +374 -0
- package/src/spec/EnrichedTextInputNativeComponent.ts +524 -0
- package/src/spec/EnrichedTextNativeComponent.ts +110 -0
- package/src/types.ts +864 -0
- package/src/utils/EnrichedTextInputDefaultProps.ts +16 -0
- package/src/utils/defaultHtmlStyle.ts +83 -0
- package/src/utils/expandMentionStylesForIndicators.ts +19 -0
- package/src/utils/isMentionStyleRecord.ts +22 -0
- package/src/utils/normalizeHtmlStyle.ts +181 -0
- package/src/utils/nullthrows.ts +7 -0
- package/src/utils/regexParser.ts +56 -0
- package/src/web/EnrichedTextInput.css +201 -0
- package/src/web/EnrichedTextInput.tsx +403 -0
- package/src/web/adaptWebToNativeEvent.ts +37 -0
- package/src/web/checkboxHtmlNormalizer.ts +62 -0
- package/src/web/formats/EnrichedBlockquote.ts +36 -0
- package/src/web/formats/EnrichedBold.ts +16 -0
- package/src/web/formats/EnrichedCheckboxItem.ts +35 -0
- package/src/web/formats/EnrichedCheckboxList.ts +47 -0
- package/src/web/formats/EnrichedCode.ts +13 -0
- package/src/web/formats/EnrichedCodeBlock.ts +53 -0
- package/src/web/formats/EnrichedHeading.ts +36 -0
- package/src/web/formats/EnrichedImage.ts +59 -0
- package/src/web/formats/EnrichedImageNodeView.tsx +89 -0
- package/src/web/formats/EnrichedItalic.ts +16 -0
- package/src/web/formats/EnrichedLink.ts +149 -0
- package/src/web/formats/EnrichedListItem.ts +17 -0
- package/src/web/formats/EnrichedMention.ts +55 -0
- package/src/web/formats/EnrichedOrderedList.ts +40 -0
- package/src/web/formats/EnrichedStrike.ts +16 -0
- package/src/web/formats/EnrichedUnderline.ts +16 -0
- package/src/web/formats/EnrichedUnorderedList.ts +50 -0
- package/src/web/formats/applyWrappingListToSelection.ts +76 -0
- package/src/web/formats/formatRules.ts +84 -0
- package/src/web/formats/listKeyboard.ts +58 -0
- package/src/web/formats/wrappedBlockKeyboard.ts +76 -0
- package/src/web/pasteImages.ts +96 -0
- package/src/web/pastedImageDimensions.ts +40 -0
- package/src/web/pmPlugins/MentionPlugin/index.ts +45 -0
- package/src/web/pmPlugins/MentionPlugin/isCaretInBlockedContext.ts +17 -0
- package/src/web/pmPlugins/MentionPlugin/makeMentionPluginState.ts +75 -0
- package/src/web/pmPlugins/MentionPlugin/mentionPluginKey.ts +4 -0
- package/src/web/pmPlugins/MentionPlugin/removeMentionMarksIfSpansResized.ts +68 -0
- package/src/web/pmPlugins/MentionPlugin/setMention.ts +83 -0
- package/src/web/pmPlugins/MentionPlugin/startMention.ts +14 -0
- package/src/web/pmPlugins/MentionPlugin/stripPartialMentionMarks.ts +20 -0
- package/src/web/pmPlugins/MentionPlugin/subscribeMentionEvents.ts +105 -0
- package/src/web/pmPlugins/MentionPlugin/types.ts +22 -0
- package/src/web/pmPlugins/MergeAdjacentSameKindBlocksPlugin.ts +57 -0
- package/src/web/pmPlugins/ShortcutPlugin.ts +98 -0
- package/src/web/pmPlugins/StrictMarksPlugin.ts +131 -0
- package/src/web/pmPlugins/StripBoldInStyledHeadingsPlugin.ts +79 -0
- package/src/web/pmPlugins/StripMarksInCodeBlockPlugin.ts +34 -0
- package/src/web/pmPlugins/StripMarksOnImagePlugin.ts +33 -0
- package/src/web/positionMapping.ts +81 -0
- package/src/web/returnKeyTypeToEnterKeyHint.ts +29 -0
- package/src/web/styleConversion/buildMentionRulesCSS.ts +42 -0
- package/src/web/styleConversion/enrichedInputStyleToCSSProperties.ts +224 -0
- package/src/web/styleConversion/enrichedInputThemingToCSSProperties.ts +34 -0
- package/src/web/styleConversion/htmlStyleToCSSVariables.ts +226 -0
- package/src/web/styleConversion/mentionIndicatorCssKey.ts +14 -0
- package/src/web/styleConversion/toColor.ts +17 -0
- package/src/web/tiptapHtmlNormalizer.ts +33 -0
- package/src/web/useOnChangeHtml.ts +14 -0
- package/src/web/useOnChangeState.ts +125 -0
- package/src/web/useOnChangeText.ts +15 -0
- package/src/web/useOnEditorChange.ts +33 -0
- package/src/web/useOnLinkDetected.ts +82 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { HtmlStyle, MentionStyleProperties } from '../../types';
|
|
2
|
+
import { isMentionStyleRecord } from '../../utils/isMentionStyleRecord';
|
|
3
|
+
import { ETI_MENTION_CSS_VARS } from './htmlStyleToCSSVariables';
|
|
4
|
+
import { MENTION_STYLE_DEFAULT_KEY } from './mentionIndicatorCssKey';
|
|
5
|
+
|
|
6
|
+
function escapeIndicatorForCssAttributeSelector(indicator: string): string {
|
|
7
|
+
if (typeof CSS !== 'undefined' && typeof CSS.escape === 'function') {
|
|
8
|
+
return CSS.escape(indicator);
|
|
9
|
+
}
|
|
10
|
+
return indicator.replace(/["\\]/g, '\\$&');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function buildMentionRulesCSS(htmlStyle?: HtmlStyle): string {
|
|
14
|
+
const mapRaw = htmlStyle?.mention;
|
|
15
|
+
if (!mapRaw || typeof mapRaw !== 'object' || !isMentionStyleRecord(mapRaw)) {
|
|
16
|
+
return '';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const map: Record<string, MentionStyleProperties> = mapRaw;
|
|
20
|
+
const keys = Object.keys(map);
|
|
21
|
+
if (keys.length === 0) {
|
|
22
|
+
return '';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const lines: string[] = [];
|
|
26
|
+
for (const indicator of keys) {
|
|
27
|
+
const selector =
|
|
28
|
+
indicator === MENTION_STYLE_DEFAULT_KEY
|
|
29
|
+
? '.eti-editor mention'
|
|
30
|
+
: `.eti-editor mention[indicator="${escapeIndicatorForCssAttributeSelector(indicator)}"]`;
|
|
31
|
+
|
|
32
|
+
lines.push(
|
|
33
|
+
`${selector} {
|
|
34
|
+
color: var(${ETI_MENTION_CSS_VARS.color(indicator)});
|
|
35
|
+
background-color: var(${ETI_MENTION_CSS_VARS.backgroundColor(indicator)});
|
|
36
|
+
text-decoration-line: var(${ETI_MENTION_CSS_VARS.textDecorationLine(indicator)});
|
|
37
|
+
}`.trim()
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return lines.join('\n');
|
|
42
|
+
}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import type { EnrichedInputStyle } from '../../types';
|
|
3
|
+
import type { AnimatableNumericValue, DimensionValue } from 'react-native';
|
|
4
|
+
import { toColor } from './toColor';
|
|
5
|
+
|
|
6
|
+
interface ExtraOptions {
|
|
7
|
+
scrollEnabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function enrichedInputStyleToCSSProperties(
|
|
11
|
+
style: EnrichedInputStyle,
|
|
12
|
+
extraOptions: ExtraOptions = {}
|
|
13
|
+
): CSSProperties {
|
|
14
|
+
const css: CSSProperties = {
|
|
15
|
+
// Dimensions
|
|
16
|
+
width: toPx(style.width),
|
|
17
|
+
height: toPx(style.height),
|
|
18
|
+
minWidth: toPx(style.minWidth),
|
|
19
|
+
maxWidth: toPx(style.maxWidth),
|
|
20
|
+
minHeight: toPx(style.minHeight),
|
|
21
|
+
maxHeight: toPx(style.maxHeight),
|
|
22
|
+
top: toPx(style.top),
|
|
23
|
+
bottom: toPx(style.bottom),
|
|
24
|
+
left: toPx(style.left),
|
|
25
|
+
right: toPx(style.right),
|
|
26
|
+
inset: toPx(style.inset),
|
|
27
|
+
insetBlock: toPx(style.insetBlock),
|
|
28
|
+
insetBlockEnd: toPx(style.insetBlockEnd),
|
|
29
|
+
insetBlockStart: toPx(style.insetBlockStart),
|
|
30
|
+
insetInline: toPx(style.insetInline),
|
|
31
|
+
insetInlineEnd: toPx(style.insetInlineEnd ?? style.end),
|
|
32
|
+
insetInlineStart: toPx(style.insetInlineStart ?? style.start),
|
|
33
|
+
|
|
34
|
+
// Margin - specific properties take precedence over shorthands (RN behavior)
|
|
35
|
+
margin: toPx(style.margin),
|
|
36
|
+
marginTop: toPx(style.marginTop ?? style.marginVertical),
|
|
37
|
+
marginBottom: toPx(style.marginBottom ?? style.marginVertical),
|
|
38
|
+
marginLeft: toPx(style.marginLeft ?? style.marginHorizontal),
|
|
39
|
+
marginRight: toPx(style.marginRight ?? style.marginHorizontal),
|
|
40
|
+
marginBlock: toPx(style.marginBlock),
|
|
41
|
+
marginBlockEnd: toPx(style.marginBlockEnd),
|
|
42
|
+
marginBlockStart: toPx(style.marginBlockStart),
|
|
43
|
+
marginInline: toPx(style.marginInline),
|
|
44
|
+
marginInlineEnd: toPx(style.marginInlineEnd ?? style.marginEnd),
|
|
45
|
+
marginInlineStart: toPx(style.marginInlineStart ?? style.marginStart),
|
|
46
|
+
|
|
47
|
+
// Padding - specific properties take precedence over shorthands (RN behavior)
|
|
48
|
+
padding: toPx(style.padding),
|
|
49
|
+
paddingTop: toPx(style.paddingTop ?? style.paddingVertical),
|
|
50
|
+
paddingBottom: toPx(style.paddingBottom ?? style.paddingVertical),
|
|
51
|
+
paddingLeft: toPx(style.paddingLeft ?? style.paddingHorizontal),
|
|
52
|
+
paddingRight: toPx(style.paddingRight ?? style.paddingHorizontal),
|
|
53
|
+
paddingBlock: toPx(style.paddingBlock),
|
|
54
|
+
paddingBlockEnd: toPx(style.paddingBlockEnd),
|
|
55
|
+
paddingBlockStart: toPx(style.paddingBlockStart),
|
|
56
|
+
paddingInline: toPx(style.paddingInline),
|
|
57
|
+
paddingInlineEnd: toPx(style.paddingInlineEnd ?? style.paddingEnd),
|
|
58
|
+
paddingInlineStart: toPx(style.paddingInlineStart ?? style.paddingStart),
|
|
59
|
+
|
|
60
|
+
// Border widths
|
|
61
|
+
borderInlineStartWidth: toPx(style.borderStartWidth),
|
|
62
|
+
borderInlineEndWidth: toPx(style.borderEndWidth),
|
|
63
|
+
borderWidth: toPx(style.borderWidth),
|
|
64
|
+
borderTopWidth: toPx(style.borderTopWidth),
|
|
65
|
+
borderBottomWidth: toPx(style.borderBottomWidth),
|
|
66
|
+
borderLeftWidth: toPx(style.borderLeftWidth),
|
|
67
|
+
borderRightWidth: toPx(style.borderRightWidth),
|
|
68
|
+
|
|
69
|
+
// Border radius (physical)
|
|
70
|
+
borderRadius: toPx(style.borderRadius),
|
|
71
|
+
borderTopLeftRadius: toPx(style.borderTopLeftRadius),
|
|
72
|
+
borderTopRightRadius: toPx(style.borderTopRightRadius),
|
|
73
|
+
borderBottomLeftRadius: toPx(style.borderBottomLeftRadius),
|
|
74
|
+
borderBottomRightRadius: toPx(style.borderBottomRightRadius),
|
|
75
|
+
|
|
76
|
+
// Border radius (logical)
|
|
77
|
+
borderStartStartRadius: toPx(
|
|
78
|
+
style.borderStartStartRadius ?? style.borderTopStartRadius
|
|
79
|
+
),
|
|
80
|
+
borderStartEndRadius: toPx(
|
|
81
|
+
style.borderStartEndRadius ?? style.borderTopEndRadius
|
|
82
|
+
),
|
|
83
|
+
borderEndStartRadius: toPx(
|
|
84
|
+
style.borderEndStartRadius ?? style.borderBottomStartRadius
|
|
85
|
+
),
|
|
86
|
+
borderEndEndRadius: toPx(
|
|
87
|
+
style.borderEndEndRadius ?? style.borderBottomEndRadius
|
|
88
|
+
),
|
|
89
|
+
|
|
90
|
+
// Border colors
|
|
91
|
+
borderColor: toColor(style.borderColor),
|
|
92
|
+
borderBlockColor: toColor(style.borderBlockColor),
|
|
93
|
+
borderBlockEndColor: toColor(style.borderBlockEndColor),
|
|
94
|
+
borderBlockStartColor: toColor(style.borderBlockStartColor),
|
|
95
|
+
borderBottomColor: toColor(style.borderBottomColor),
|
|
96
|
+
borderInlineEndColor: toColor(style.borderEndColor),
|
|
97
|
+
borderLeftColor: toColor(style.borderLeftColor),
|
|
98
|
+
borderRightColor: toColor(style.borderRightColor),
|
|
99
|
+
borderInlineStartColor: toColor(style.borderStartColor),
|
|
100
|
+
borderTopColor: toColor(style.borderTopColor),
|
|
101
|
+
borderStyle:
|
|
102
|
+
style.borderStyle ??
|
|
103
|
+
(style.borderWidth != null ||
|
|
104
|
+
style.borderTopWidth != null ||
|
|
105
|
+
style.borderBottomWidth != null ||
|
|
106
|
+
style.borderLeftWidth != null ||
|
|
107
|
+
style.borderRightWidth != null ||
|
|
108
|
+
style.borderStartWidth != null ||
|
|
109
|
+
style.borderEndWidth != null ||
|
|
110
|
+
style.borderColor != null
|
|
111
|
+
? 'solid'
|
|
112
|
+
: undefined),
|
|
113
|
+
|
|
114
|
+
// Typography
|
|
115
|
+
color: toColor(style.color),
|
|
116
|
+
fontFamily: style.fontFamily,
|
|
117
|
+
fontSize: toPx(style.fontSize),
|
|
118
|
+
fontStyle: style.fontStyle,
|
|
119
|
+
fontWeight: style.fontWeight,
|
|
120
|
+
lineHeight: toPx(style.lineHeight),
|
|
121
|
+
letterSpacing: toPx(style.letterSpacing),
|
|
122
|
+
|
|
123
|
+
// View appearance
|
|
124
|
+
backgroundColor: toColor(style.backgroundColor),
|
|
125
|
+
// boxShadow/filter: RN accepts arrays, CSS only strings
|
|
126
|
+
boxShadow:
|
|
127
|
+
typeof style.boxShadow === 'string' ? style.boxShadow : undefined,
|
|
128
|
+
display: style.display,
|
|
129
|
+
position: style.position,
|
|
130
|
+
alignSelf: style.alignSelf,
|
|
131
|
+
backfaceVisibility: style.backfaceVisibility,
|
|
132
|
+
cursor: style.cursor,
|
|
133
|
+
filter: typeof style.filter === 'string' ? style.filter : undefined,
|
|
134
|
+
mixBlendMode: style.mixBlendMode,
|
|
135
|
+
boxSizing: style.boxSizing,
|
|
136
|
+
// pointerEvents: RN 'box-none'/'box-only' have no CSS equivalent
|
|
137
|
+
pointerEvents:
|
|
138
|
+
style.pointerEvents === 'auto' || style.pointerEvents === 'none'
|
|
139
|
+
? style.pointerEvents
|
|
140
|
+
: undefined,
|
|
141
|
+
|
|
142
|
+
// Outline
|
|
143
|
+
outlineColor: toColor(style.outlineColor),
|
|
144
|
+
outlineStyle:
|
|
145
|
+
style.outlineStyle ?? (style.outlineWidth != null ? 'solid' : undefined),
|
|
146
|
+
outlineOffset: toPx(style.outlineOffset),
|
|
147
|
+
outlineWidth: toPx(style.outlineWidth),
|
|
148
|
+
|
|
149
|
+
// Transforms
|
|
150
|
+
transform: resolveTransform(style.transform),
|
|
151
|
+
// transformOrigin: RN accepts strings or arrays, CSS only strings
|
|
152
|
+
transformOrigin:
|
|
153
|
+
typeof style.transformOrigin === 'string'
|
|
154
|
+
? style.transformOrigin
|
|
155
|
+
: undefined,
|
|
156
|
+
|
|
157
|
+
// Flex
|
|
158
|
+
flex: style.flex,
|
|
159
|
+
flexGrow: style.flexGrow,
|
|
160
|
+
flexShrink: style.flexShrink,
|
|
161
|
+
flexBasis: toPx(style.flexBasis),
|
|
162
|
+
|
|
163
|
+
// Misc
|
|
164
|
+
zIndex: style.zIndex,
|
|
165
|
+
// opacity: RN AnimatableNumericValue includes AnimatedNode; CSS only number
|
|
166
|
+
opacity: typeof style.opacity === 'number' ? style.opacity : undefined,
|
|
167
|
+
aspectRatio: style.aspectRatio,
|
|
168
|
+
|
|
169
|
+
// Extra options
|
|
170
|
+
overflowY:
|
|
171
|
+
extraOptions.scrollEnabled != null
|
|
172
|
+
? extraOptions.scrollEnabled
|
|
173
|
+
? 'auto'
|
|
174
|
+
: 'hidden'
|
|
175
|
+
: undefined,
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
// Clean undefined values
|
|
179
|
+
return Object.fromEntries(
|
|
180
|
+
Object.entries(css).filter(([, v]) => v !== undefined)
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function toPx(
|
|
185
|
+
value?: DimensionValue | AnimatableNumericValue | string
|
|
186
|
+
): string | undefined {
|
|
187
|
+
if (value == null) return undefined;
|
|
188
|
+
if (typeof value === 'number') return `${value}px`;
|
|
189
|
+
if (typeof value === 'string') return value;
|
|
190
|
+
return undefined;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function resolveTransform(
|
|
194
|
+
transform: EnrichedInputStyle['transform']
|
|
195
|
+
): string | undefined {
|
|
196
|
+
if (typeof transform === 'string') return transform;
|
|
197
|
+
if (!Array.isArray(transform)) return undefined;
|
|
198
|
+
|
|
199
|
+
const parts = transform.map((item) => {
|
|
200
|
+
if ('translateX' in item) return `translateX(${item.translateX}px)`;
|
|
201
|
+
if ('translateY' in item) return `translateY(${item.translateY}px)`;
|
|
202
|
+
if ('translateZ' in item) return `translateZ(${item.translateZ}px)`;
|
|
203
|
+
if ('scale' in item) return `scale(${item.scale})`;
|
|
204
|
+
if ('scaleX' in item) return `scaleX(${item.scaleX})`;
|
|
205
|
+
if ('scaleY' in item) return `scaleY(${item.scaleY})`;
|
|
206
|
+
if ('scaleZ' in item) return `scaleZ(${item.scaleZ})`;
|
|
207
|
+
if ('rotate' in item) return `rotate(${item.rotate})`;
|
|
208
|
+
if ('rotateX' in item) return `rotateX(${item.rotateX})`;
|
|
209
|
+
if ('rotateY' in item) return `rotateY(${item.rotateY})`;
|
|
210
|
+
if ('rotateZ' in item) return `rotateZ(${item.rotateZ})`;
|
|
211
|
+
if ('skewX' in item) return `skewX(${item.skewX})`;
|
|
212
|
+
if ('skewY' in item) return `skewY(${item.skewY})`;
|
|
213
|
+
if ('perspective' in item) return `perspective(${item.perspective}px)`;
|
|
214
|
+
if ('matrix' in item) {
|
|
215
|
+
return item.matrix.length === 16
|
|
216
|
+
? `matrix3d(${item.matrix.join(', ')})`
|
|
217
|
+
: `matrix(${item.matrix.join(', ')})`;
|
|
218
|
+
}
|
|
219
|
+
return null;
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
const css = parts.filter(Boolean).join(' ');
|
|
223
|
+
return css || undefined;
|
|
224
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import type { ColorValue } from 'react-native';
|
|
3
|
+
import { toColor } from './toColor';
|
|
4
|
+
|
|
5
|
+
type EnrichedInputThemingStyle = Partial<
|
|
6
|
+
Pick<CSSProperties, 'caretColor'> & {
|
|
7
|
+
'--eti-placeholder-text-color': string;
|
|
8
|
+
'--eti-selection-color': string;
|
|
9
|
+
}
|
|
10
|
+
>;
|
|
11
|
+
|
|
12
|
+
export interface EnrichedInputThemingColors {
|
|
13
|
+
cursorColor?: ColorValue;
|
|
14
|
+
placeholderTextColor?: ColorValue;
|
|
15
|
+
selectionColor?: ColorValue;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function enrichedInputThemingToCSSProperties({
|
|
19
|
+
cursorColor,
|
|
20
|
+
placeholderTextColor,
|
|
21
|
+
selectionColor,
|
|
22
|
+
}: EnrichedInputThemingColors): CSSProperties {
|
|
23
|
+
const extra: EnrichedInputThemingStyle = {};
|
|
24
|
+
const caret = toColor(cursorColor);
|
|
25
|
+
if (caret) extra.caretColor = caret;
|
|
26
|
+
|
|
27
|
+
const placeholderCss = toColor(placeholderTextColor);
|
|
28
|
+
if (placeholderCss) extra['--eti-placeholder-text-color'] = placeholderCss;
|
|
29
|
+
|
|
30
|
+
const selectionCss = toColor(selectionColor);
|
|
31
|
+
if (selectionCss) extra['--eti-selection-color'] = selectionCss;
|
|
32
|
+
|
|
33
|
+
return extra;
|
|
34
|
+
}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import type { ColorValue } from 'react-native';
|
|
3
|
+
import type { HtmlStyle, MentionStyleProperties } from '../../types';
|
|
4
|
+
import { DEFAULT_HTML_STYLE } from '../../utils/defaultHtmlStyle';
|
|
5
|
+
import { expandMentionStylesForIndicators } from '../../utils/expandMentionStylesForIndicators';
|
|
6
|
+
import { HEADING_TAGS } from '../formats/EnrichedHeading';
|
|
7
|
+
import {
|
|
8
|
+
indicatorToMentionCssKey,
|
|
9
|
+
MENTION_STYLE_DEFAULT_KEY,
|
|
10
|
+
} from './mentionIndicatorCssKey';
|
|
11
|
+
import { toColor } from './toColor';
|
|
12
|
+
import { isMentionStyleRecord } from '../../utils/isMentionStyleRecord';
|
|
13
|
+
|
|
14
|
+
export function mergeWithDefaultHtmlStyle(
|
|
15
|
+
htmlStyle?: HtmlStyle
|
|
16
|
+
): Required<HtmlStyle> {
|
|
17
|
+
const style = htmlStyle ?? {};
|
|
18
|
+
|
|
19
|
+
const mentionMap = expandMentionStylesForIndicatorsIncludeDefault(style);
|
|
20
|
+
const converted: HtmlStyle = {
|
|
21
|
+
...style,
|
|
22
|
+
mention: mentionMap,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const merged: Record<string, unknown> = { ...DEFAULT_HTML_STYLE };
|
|
26
|
+
|
|
27
|
+
for (const key in converted) {
|
|
28
|
+
if (key === 'mention') {
|
|
29
|
+
merged[key] = { ...(converted.mention as object) };
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
merged[key] = {
|
|
33
|
+
...DEFAULT_HTML_STYLE[key as keyof HtmlStyle],
|
|
34
|
+
...(converted[key as keyof HtmlStyle] as object),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return merged as Required<HtmlStyle>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const ETI_CSS_VARS = {
|
|
42
|
+
codeColor: '--eti-code-color',
|
|
43
|
+
codeBgColor: '--eti-code-bg-color',
|
|
44
|
+
blockquoteBorderColor: '--eti-blockquote-border-color',
|
|
45
|
+
blockquoteBorderWidth: '--eti-blockquote-border-width',
|
|
46
|
+
blockquoteGapWidth: '--eti-blockquote-gap-width',
|
|
47
|
+
blockquoteColor: '--eti-blockquote-color',
|
|
48
|
+
codeblockBgColor: '--eti-codeblock-bg-color',
|
|
49
|
+
codeblockColor: '--eti-codeblock-color',
|
|
50
|
+
codeblockBorderRadius: '--eti-codeblock-border-radius',
|
|
51
|
+
linkColor: '--eti-link-color',
|
|
52
|
+
linkTextDecorationLine: '--eti-link-text-decoration-line',
|
|
53
|
+
ulBulletColor: '--eti-ul-bullet-color',
|
|
54
|
+
ulBulletSize: '--eti-ul-bullet-size',
|
|
55
|
+
ulMarginLeft: '--eti-ul-margin-left',
|
|
56
|
+
ulGapWidth: '--eti-ul-gap-width',
|
|
57
|
+
olMarginLeft: '--eti-ol-margin-left',
|
|
58
|
+
olGapWidth: '--eti-ol-gap-width',
|
|
59
|
+
olMarkerColor: '--eti-ol-marker-color',
|
|
60
|
+
olMarkerFontWeight: '--eti-ol-marker-font-weight',
|
|
61
|
+
checkboxBoxSize: '--eti-checkbox-box-size',
|
|
62
|
+
checkboxGapWidth: '--eti-checkbox-gap-width',
|
|
63
|
+
checkboxMarginLeft: '--eti-checkbox-margin-left',
|
|
64
|
+
checkboxBoxColor: '--eti-checkbox-box-color',
|
|
65
|
+
} as const;
|
|
66
|
+
|
|
67
|
+
export const ETI_MENTION_CSS_VARS = {
|
|
68
|
+
color: (indicator: string) =>
|
|
69
|
+
`--eti-mention-${indicatorToMentionCssKey(indicator)}-color`,
|
|
70
|
+
backgroundColor: (indicator: string) =>
|
|
71
|
+
`--eti-mention-${indicatorToMentionCssKey(indicator)}-background-color`,
|
|
72
|
+
textDecorationLine: (indicator: string) =>
|
|
73
|
+
`--eti-mention-${indicatorToMentionCssKey(indicator)}-text-decoration-line`,
|
|
74
|
+
} as const;
|
|
75
|
+
|
|
76
|
+
function setColorVar(
|
|
77
|
+
vars: Record<string, string>,
|
|
78
|
+
name: string,
|
|
79
|
+
value?: ColorValue
|
|
80
|
+
): void {
|
|
81
|
+
const c = toColor(value);
|
|
82
|
+
if (c) vars[name] = c;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function setPxVar(
|
|
86
|
+
vars: Record<string, string>,
|
|
87
|
+
name: string,
|
|
88
|
+
n?: number | null
|
|
89
|
+
): void {
|
|
90
|
+
if (n != null) vars[name] = `${n}px`;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function applyCodeVars(
|
|
94
|
+
vars: Record<string, string>,
|
|
95
|
+
code?: HtmlStyle['code']
|
|
96
|
+
): void {
|
|
97
|
+
setColorVar(vars, ETI_CSS_VARS.codeColor, code?.color);
|
|
98
|
+
setColorVar(vars, ETI_CSS_VARS.codeBgColor, code?.backgroundColor);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function applyHeadingVars(
|
|
102
|
+
vars: Record<string, string>,
|
|
103
|
+
htmlStyle?: HtmlStyle
|
|
104
|
+
): void {
|
|
105
|
+
for (const level of HEADING_TAGS) {
|
|
106
|
+
const h = htmlStyle?.[level];
|
|
107
|
+
if (h?.fontSize != null)
|
|
108
|
+
vars[`--eti-${level}-font-size`] = `${h.fontSize}px`;
|
|
109
|
+
if (h?.bold != null)
|
|
110
|
+
vars[`--eti-${level}-font-weight`] = h.bold ? 'bold' : 'normal';
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function applyBlockquoteVars(
|
|
115
|
+
vars: Record<string, string>,
|
|
116
|
+
bq?: HtmlStyle['blockquote']
|
|
117
|
+
): void {
|
|
118
|
+
setColorVar(vars, ETI_CSS_VARS.blockquoteBorderColor, bq?.borderColor);
|
|
119
|
+
setPxVar(vars, ETI_CSS_VARS.blockquoteBorderWidth, bq?.borderWidth);
|
|
120
|
+
setPxVar(vars, ETI_CSS_VARS.blockquoteGapWidth, bq?.gapWidth);
|
|
121
|
+
setColorVar(vars, ETI_CSS_VARS.blockquoteColor, bq?.color);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function applyCodeblockVars(
|
|
125
|
+
vars: Record<string, string>,
|
|
126
|
+
cb?: HtmlStyle['codeblock']
|
|
127
|
+
): void {
|
|
128
|
+
setColorVar(vars, ETI_CSS_VARS.codeblockBgColor, cb?.backgroundColor);
|
|
129
|
+
setColorVar(vars, ETI_CSS_VARS.codeblockColor, cb?.color);
|
|
130
|
+
setPxVar(vars, ETI_CSS_VARS.codeblockBorderRadius, cb?.borderRadius);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function applyLinkVars(
|
|
134
|
+
vars: Record<string, string>,
|
|
135
|
+
anchor?: HtmlStyle['a']
|
|
136
|
+
): void {
|
|
137
|
+
setColorVar(vars, ETI_CSS_VARS.linkColor, anchor?.color);
|
|
138
|
+
if (anchor?.textDecorationLine != null) {
|
|
139
|
+
vars[ETI_CSS_VARS.linkTextDecorationLine] = anchor.textDecorationLine;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function applyUnorderedListVars(
|
|
144
|
+
vars: Record<string, string>,
|
|
145
|
+
ul?: HtmlStyle['ul']
|
|
146
|
+
): void {
|
|
147
|
+
setColorVar(vars, ETI_CSS_VARS.ulBulletColor, ul?.bulletColor);
|
|
148
|
+
setPxVar(vars, ETI_CSS_VARS.ulBulletSize, ul?.bulletSize);
|
|
149
|
+
setPxVar(vars, ETI_CSS_VARS.ulMarginLeft, ul?.marginLeft);
|
|
150
|
+
setPxVar(vars, ETI_CSS_VARS.ulGapWidth, ul?.gapWidth);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function applyOrderedListVars(
|
|
154
|
+
vars: Record<string, string>,
|
|
155
|
+
ol?: HtmlStyle['ol']
|
|
156
|
+
): void {
|
|
157
|
+
setPxVar(vars, ETI_CSS_VARS.olMarginLeft, ol?.marginLeft);
|
|
158
|
+
setPxVar(vars, ETI_CSS_VARS.olGapWidth, ol?.gapWidth);
|
|
159
|
+
setColorVar(vars, ETI_CSS_VARS.olMarkerColor, ol?.markerColor);
|
|
160
|
+
if (ol?.markerFontWeight != null) {
|
|
161
|
+
vars[ETI_CSS_VARS.olMarkerFontWeight] = String(ol.markerFontWeight);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function applyCheckboxListVars(
|
|
166
|
+
vars: Record<string, string>,
|
|
167
|
+
ulCheckbox?: HtmlStyle['ulCheckbox']
|
|
168
|
+
): void {
|
|
169
|
+
setPxVar(vars, ETI_CSS_VARS.checkboxBoxSize, ulCheckbox?.boxSize);
|
|
170
|
+
setPxVar(vars, ETI_CSS_VARS.checkboxGapWidth, ulCheckbox?.gapWidth);
|
|
171
|
+
setPxVar(vars, ETI_CSS_VARS.checkboxMarginLeft, ulCheckbox?.marginLeft);
|
|
172
|
+
setColorVar(vars, ETI_CSS_VARS.checkboxBoxColor, ulCheckbox?.boxColor);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function applyMentionVars(
|
|
176
|
+
vars: Record<string, string>,
|
|
177
|
+
mention: Record<string, MentionStyleProperties>
|
|
178
|
+
): void {
|
|
179
|
+
for (const [indicator, mentionStyle] of Object.entries(mention)) {
|
|
180
|
+
setColorVar(
|
|
181
|
+
vars,
|
|
182
|
+
ETI_MENTION_CSS_VARS.color(indicator),
|
|
183
|
+
mentionStyle.color
|
|
184
|
+
);
|
|
185
|
+
setColorVar(
|
|
186
|
+
vars,
|
|
187
|
+
ETI_MENTION_CSS_VARS.backgroundColor(indicator),
|
|
188
|
+
mentionStyle.backgroundColor
|
|
189
|
+
);
|
|
190
|
+
if (mentionStyle.textDecorationLine != null) {
|
|
191
|
+
vars[ETI_MENTION_CSS_VARS.textDecorationLine(indicator)] =
|
|
192
|
+
mentionStyle.textDecorationLine;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function expandMentionStylesForIndicatorsIncludeDefault(htmlStyle?: HtmlStyle) {
|
|
198
|
+
const mentionIndicators = isMentionStyleRecord(htmlStyle?.mention)
|
|
199
|
+
? Object.keys(htmlStyle?.mention)
|
|
200
|
+
: [];
|
|
201
|
+
|
|
202
|
+
if (!mentionIndicators.includes(MENTION_STYLE_DEFAULT_KEY))
|
|
203
|
+
mentionIndicators.push(MENTION_STYLE_DEFAULT_KEY);
|
|
204
|
+
|
|
205
|
+
return expandMentionStylesForIndicators(
|
|
206
|
+
htmlStyle?.mention,
|
|
207
|
+
mentionIndicators
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export function htmlStyleToCSSVariables(htmlStyle?: HtmlStyle): CSSProperties {
|
|
212
|
+
const vars: Record<string, string> = {};
|
|
213
|
+
applyCodeVars(vars, htmlStyle?.code);
|
|
214
|
+
applyHeadingVars(vars, htmlStyle);
|
|
215
|
+
applyBlockquoteVars(vars, htmlStyle?.blockquote);
|
|
216
|
+
applyCodeblockVars(vars, htmlStyle?.codeblock);
|
|
217
|
+
applyLinkVars(vars, htmlStyle?.a);
|
|
218
|
+
applyUnorderedListVars(vars, htmlStyle?.ul);
|
|
219
|
+
applyOrderedListVars(vars, htmlStyle?.ol);
|
|
220
|
+
applyCheckboxListVars(vars, htmlStyle?.ulCheckbox);
|
|
221
|
+
applyMentionVars(
|
|
222
|
+
vars,
|
|
223
|
+
expandMentionStylesForIndicatorsIncludeDefault(htmlStyle)
|
|
224
|
+
);
|
|
225
|
+
return vars as CSSProperties;
|
|
226
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const MENTION_STYLE_DEFAULT_KEY = 'default';
|
|
2
|
+
|
|
3
|
+
export function indicatorToMentionCssKey(indicator: string): string {
|
|
4
|
+
if (indicator === MENTION_STYLE_DEFAULT_KEY) {
|
|
5
|
+
return MENTION_STYLE_DEFAULT_KEY;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const cp = indicator.codePointAt(0);
|
|
9
|
+
if (cp === undefined) {
|
|
10
|
+
return 'u0000';
|
|
11
|
+
}
|
|
12
|
+
const hex = cp.toString(16).toUpperCase();
|
|
13
|
+
return 'u' + hex.padStart(Math.max(4, hex.length), '0');
|
|
14
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ColorValue } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export function toColor(value?: ColorValue): string | undefined {
|
|
4
|
+
if (typeof value === 'string') return value;
|
|
5
|
+
if (typeof value === 'number') {
|
|
6
|
+
// eslint-disable-next-line no-bitwise
|
|
7
|
+
const r = (value >>> 24) & 0xff;
|
|
8
|
+
// eslint-disable-next-line no-bitwise
|
|
9
|
+
const g = (value >>> 16) & 0xff;
|
|
10
|
+
// eslint-disable-next-line no-bitwise
|
|
11
|
+
const b = (value >>> 8) & 0xff;
|
|
12
|
+
// eslint-disable-next-line no-bitwise
|
|
13
|
+
const a = (value & 0xff) / 255;
|
|
14
|
+
return `rgba(${r}, ${g}, ${b}, ${a})`;
|
|
15
|
+
}
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
checkboxHtmlForTiptap,
|
|
3
|
+
checkboxHtmlFromTiptap,
|
|
4
|
+
} from './checkboxHtmlNormalizer';
|
|
5
|
+
|
|
6
|
+
export function prepareHtmlForTiptap(html: string): string {
|
|
7
|
+
html = checkboxHtmlForTiptap(html);
|
|
8
|
+
html = html.replace(/<br\s*\/?>/gi, '<p></p>');
|
|
9
|
+
return html;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function normalizeHtmlFromTiptap(html: string): string {
|
|
13
|
+
html = checkboxHtmlFromTiptap(html);
|
|
14
|
+
|
|
15
|
+
// Strip <p> wrappers inside <li> elements.
|
|
16
|
+
// TipTap renders <li><p>text</p></li> but native expects <li>text</li>.
|
|
17
|
+
// This regex is safe because EnrichedListItem.content is 'paragraph', which
|
|
18
|
+
// prevents TipTap from ever emitting nested lists
|
|
19
|
+
html = html.replace(/<li([^>]*)><p>(.*?)<\/p><\/li>/gs, '<li$1>$2</li>');
|
|
20
|
+
|
|
21
|
+
// Convert remaining empty <p></p> to <br> (outside of lists)
|
|
22
|
+
html = html.replace(/<p><\/p>/g, '<br>');
|
|
23
|
+
|
|
24
|
+
// Convert <img> tags to self-closing tags
|
|
25
|
+
html = html.replace(/<img\b([^>]*)>/gi, (_, attrs: string) => {
|
|
26
|
+
if (attrs.trimEnd().endsWith('/')) {
|
|
27
|
+
return `<img${attrs}>`;
|
|
28
|
+
}
|
|
29
|
+
return `<img${attrs}/>`;
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
return `<html>${html}</html>`;
|
|
33
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Editor } from '@tiptap/react';
|
|
2
|
+
import type { OnChangeHtmlEvent } from '../types';
|
|
3
|
+
import type { NativeSyntheticEvent } from 'react-native';
|
|
4
|
+
import { useOnEditorChange } from './useOnEditorChange';
|
|
5
|
+
import { normalizeHtmlFromTiptap } from './tiptapHtmlNormalizer';
|
|
6
|
+
|
|
7
|
+
export const useOnChangeHtml = (
|
|
8
|
+
editor: Editor,
|
|
9
|
+
onChangeHtml?: (e: NativeSyntheticEvent<OnChangeHtmlEvent>) => void
|
|
10
|
+
) => {
|
|
11
|
+
useOnEditorChange(editor, onChangeHtml, (e) =>
|
|
12
|
+
normalizeHtmlFromTiptap(e.getHTML())
|
|
13
|
+
);
|
|
14
|
+
};
|