react-native-enriched-html 0.0.0 → 1.1.0-nightly-20260617-3dfd09072
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,334 @@
|
|
|
1
|
+
#import "EnrichedInputTextView.h"
|
|
2
|
+
#import "AlignmentUtils.h"
|
|
3
|
+
#import "EnrichedTextInputView.h"
|
|
4
|
+
#import "HtmlParser.h"
|
|
5
|
+
#import "StringExtension.h"
|
|
6
|
+
#import "TextInsertionUtils.h"
|
|
7
|
+
#import "TextListsUtils.h"
|
|
8
|
+
#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h>
|
|
9
|
+
|
|
10
|
+
@implementation EnrichedInputTextView
|
|
11
|
+
|
|
12
|
+
- (void)layoutSubviews {
|
|
13
|
+
[super layoutSubviews];
|
|
14
|
+
// UITextView resets contentSize during its own layout pass (triggered when
|
|
15
|
+
// the frame is set on first mount). Re-schedule a relayout so our explicit
|
|
16
|
+
// contentSize is applied after UITextView finishes its internal layout.
|
|
17
|
+
EnrichedTextInputView *input = (EnrichedTextInputView *)_input;
|
|
18
|
+
if (input != nil) {
|
|
19
|
+
[input scheduleRelayoutIfNeeded];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// UITextView places the cursor at the leading edge when a paragraph contains
|
|
24
|
+
// zero (or invisible) glyphs because the layout engine has nothing to align.
|
|
25
|
+
// We fix this by reading the active alignment and repositioning the caret rect
|
|
26
|
+
- (CGRect)caretRectForPosition:(UITextPosition *)position {
|
|
27
|
+
CGRect rect = [super caretRectForPosition:position];
|
|
28
|
+
NSUInteger idx = [self offsetFromPosition:self.beginningOfDocument
|
|
29
|
+
toPosition:position];
|
|
30
|
+
NSString *text = self.textStorage.string;
|
|
31
|
+
NSRange paraRange = NSMakeRange(0, 0);
|
|
32
|
+
if (idx <= text.length) {
|
|
33
|
+
paraRange = [text paragraphRangeForRange:NSMakeRange(idx, 0)];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Non-empty paragraph gets its caret drawn the usual way.
|
|
37
|
+
if (paraRange.length != 0) {
|
|
38
|
+
return rect;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
NSParagraphStyle *pStyle =
|
|
42
|
+
self.typingAttributes[NSParagraphStyleAttributeName];
|
|
43
|
+
|
|
44
|
+
if (pStyle == nil) {
|
|
45
|
+
return rect;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
NSString *marker =
|
|
49
|
+
[TextListsUtils firstTextListWithPrefix:@"EnrichedAlignment"
|
|
50
|
+
inArray:pStyle.textLists]
|
|
51
|
+
.markerFormat;
|
|
52
|
+
NSTextAlignment alignment = [AlignmentUtils markerToAlignment:marker];
|
|
53
|
+
CGFloat containerWidth = self.textContainer.size.width;
|
|
54
|
+
|
|
55
|
+
if (alignment == NSTextAlignmentCenter) {
|
|
56
|
+
rect.origin.x = (containerWidth - rect.size.width) / 2.0;
|
|
57
|
+
} else if (alignment == NSTextAlignmentRight) {
|
|
58
|
+
rect.origin.x = containerWidth - rect.size.width;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return rect;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
- (void)copy:(id)sender {
|
|
65
|
+
EnrichedTextInputView *typedInput = (EnrichedTextInputView *)_input;
|
|
66
|
+
if (typedInput == nullptr) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// remove zero width spaces before copying the text
|
|
71
|
+
NSString *plainText = [typedInput->textView.textStorage.string
|
|
72
|
+
substringWithRange:typedInput->textView.selectedRange];
|
|
73
|
+
NSString *fixedPlainText =
|
|
74
|
+
[plainText stringByReplacingOccurrencesOfString:@"\u200B" withString:@""];
|
|
75
|
+
|
|
76
|
+
NSString *parsedHtml =
|
|
77
|
+
[HtmlParser parseToHtmlFromRange:typedInput->textView.selectedRange
|
|
78
|
+
host:typedInput];
|
|
79
|
+
|
|
80
|
+
NSMutableAttributedString *attrStr = [[typedInput->textView.textStorage
|
|
81
|
+
attributedSubstringFromRange:typedInput->textView.selectedRange]
|
|
82
|
+
mutableCopy];
|
|
83
|
+
NSRange fullAttrStrRange = NSMakeRange(0, attrStr.length);
|
|
84
|
+
[attrStr.mutableString replaceOccurrencesOfString:@"\u200B"
|
|
85
|
+
withString:@""
|
|
86
|
+
options:0
|
|
87
|
+
range:fullAttrStrRange];
|
|
88
|
+
|
|
89
|
+
NSData *rtfData =
|
|
90
|
+
[attrStr dataFromRange:NSMakeRange(0, attrStr.length)
|
|
91
|
+
documentAttributes:@{
|
|
92
|
+
NSDocumentTypeDocumentAttribute : NSRTFTextDocumentType
|
|
93
|
+
}
|
|
94
|
+
error:nullptr];
|
|
95
|
+
|
|
96
|
+
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
|
|
97
|
+
[pasteboard setItems:@[ @{
|
|
98
|
+
UTTypeUTF8PlainText.identifier : fixedPlainText,
|
|
99
|
+
UTTypeHTML.identifier : parsedHtml,
|
|
100
|
+
UTTypeRTF.identifier : rtfData
|
|
101
|
+
} ]];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
- (void)paste:(id)sender {
|
|
105
|
+
EnrichedTextInputView *typedInput = (EnrichedTextInputView *)_input;
|
|
106
|
+
if (typedInput == nullptr) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
|
|
111
|
+
NSArray<NSString *> *pasteboardTypes = pasteboard.pasteboardTypes;
|
|
112
|
+
NSRange currentRange = typedInput->textView.selectedRange;
|
|
113
|
+
|
|
114
|
+
// Check the pasteboard for supported image formats. If found, save them to
|
|
115
|
+
// temporary storage then emit the 'onPasteImages' event and stop processing
|
|
116
|
+
// further (ignoring any HTML/Text).
|
|
117
|
+
NSMutableArray<NSDictionary *> *foundImages = [NSMutableArray new];
|
|
118
|
+
|
|
119
|
+
for (NSDictionary<NSString *, id> *item in pasteboard.items) {
|
|
120
|
+
NSData *imageData = nil;
|
|
121
|
+
BOOL added = NO;
|
|
122
|
+
NSString *ext = nil;
|
|
123
|
+
NSString *mimeType = nil;
|
|
124
|
+
|
|
125
|
+
for (int j = 0; j < item.allKeys.count; j++) {
|
|
126
|
+
if (added) {
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
NSString *type = item.allKeys[j];
|
|
131
|
+
if ([type isEqual:UTTypeJPEG.identifier] ||
|
|
132
|
+
[type isEqual:UTTypePNG.identifier] ||
|
|
133
|
+
[type isEqual:UTTypeHEIC.identifier] ||
|
|
134
|
+
[type isEqual:UTTypeTIFF.identifier]) {
|
|
135
|
+
id value = item[type];
|
|
136
|
+
if ([value isKindOfClass:[NSData class]]) {
|
|
137
|
+
// raw bytes available — no re-encoding needed
|
|
138
|
+
imageData = (NSData *)value;
|
|
139
|
+
} else if ([value isKindOfClass:[UIImage class]]) {
|
|
140
|
+
imageData = [self getDataForImageItem:(UIImage *)value type:type];
|
|
141
|
+
}
|
|
142
|
+
} else if ([type isEqual:UTTypeWebP.identifier] ||
|
|
143
|
+
[type isEqual:UTTypeGIF.identifier]) {
|
|
144
|
+
// webp and gifs: read raw bytes directly — no re-encoding needed
|
|
145
|
+
imageData = [pasteboard dataForPasteboardType:type];
|
|
146
|
+
}
|
|
147
|
+
if (!imageData) {
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
NSDictionary *info = [self detectImageFormat:type];
|
|
152
|
+
if (!info) {
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
ext = info[@"ext"];
|
|
156
|
+
mimeType = info[@"mime"];
|
|
157
|
+
|
|
158
|
+
UIImage *imageInfo = [UIImage imageWithData:imageData];
|
|
159
|
+
|
|
160
|
+
if (imageInfo) {
|
|
161
|
+
NSString *path = [self saveToTempFile:imageData extension:ext];
|
|
162
|
+
|
|
163
|
+
if (path) {
|
|
164
|
+
added = YES;
|
|
165
|
+
[foundImages addObject:@{
|
|
166
|
+
@"uri" : path,
|
|
167
|
+
@"type" : mimeType,
|
|
168
|
+
@"width" : @(imageInfo.size.width),
|
|
169
|
+
@"height" : @(imageInfo.size.height)
|
|
170
|
+
}];
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (foundImages.count > 0) {
|
|
177
|
+
[typedInput emitOnPasteImagesEvent:foundImages];
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if ([pasteboardTypes containsObject:UTTypeHTML.identifier]) {
|
|
182
|
+
// we try processing the html contents
|
|
183
|
+
|
|
184
|
+
NSString *htmlString;
|
|
185
|
+
id htmlValue = [pasteboard valueForPasteboardType:UTTypeHTML.identifier];
|
|
186
|
+
|
|
187
|
+
if ([htmlValue isKindOfClass:[NSData class]]) {
|
|
188
|
+
htmlString = [[NSString alloc] initWithData:htmlValue
|
|
189
|
+
encoding:NSUTF8StringEncoding];
|
|
190
|
+
} else if ([htmlValue isKindOfClass:[NSString class]]) {
|
|
191
|
+
htmlString = htmlValue;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// validate the html
|
|
195
|
+
NSString *initiallyProcessedHtml =
|
|
196
|
+
[typedInput->parser initiallyProcessHtml:htmlString];
|
|
197
|
+
|
|
198
|
+
if (initiallyProcessedHtml != nullptr) {
|
|
199
|
+
// valid html, let's apply it
|
|
200
|
+
currentRange.length > 0
|
|
201
|
+
? [typedInput->parser replaceFromHtml:initiallyProcessedHtml
|
|
202
|
+
range:currentRange]
|
|
203
|
+
: [typedInput->parser insertFromHtml:initiallyProcessedHtml
|
|
204
|
+
location:currentRange.location];
|
|
205
|
+
} else {
|
|
206
|
+
// fall back to plain text, otherwise do nothing
|
|
207
|
+
[self tryHandlingPlainTextItemsIn:pasteboard
|
|
208
|
+
range:currentRange
|
|
209
|
+
input:typedInput];
|
|
210
|
+
}
|
|
211
|
+
} else {
|
|
212
|
+
[self tryHandlingPlainTextItemsIn:pasteboard
|
|
213
|
+
range:currentRange
|
|
214
|
+
input:typedInput];
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
[typedInput anyTextMayHaveBeenModified];
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
- (NSDictionary *)detectImageFormat:(NSString *)type {
|
|
221
|
+
if ([type isEqual:UTTypeJPEG.identifier]) {
|
|
222
|
+
return @{@"ext" : @"jpg", @"mime" : @"image/jpeg"};
|
|
223
|
+
} else if ([type isEqual:UTTypePNG.identifier]) {
|
|
224
|
+
return @{@"ext" : @"png", @"mime" : @"image/png"};
|
|
225
|
+
} else if ([type isEqual:UTTypeGIF.identifier]) {
|
|
226
|
+
return @{@"ext" : @"gif", @"mime" : @"image/gif"};
|
|
227
|
+
} else if ([type isEqual:UTTypeHEIC.identifier]) {
|
|
228
|
+
return @{@"ext" : @"heic", @"mime" : @"image/heic"};
|
|
229
|
+
} else if ([type isEqual:UTTypeWebP.identifier]) {
|
|
230
|
+
return @{@"ext" : @"webp", @"mime" : @"image/webp"};
|
|
231
|
+
} else if ([type isEqual:UTTypeTIFF.identifier]) {
|
|
232
|
+
return @{@"ext" : @"tiff", @"mime" : @"image/tiff"};
|
|
233
|
+
} else {
|
|
234
|
+
return nil;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
- (NSData *)getDataForImageItem:(UIImage *)image type:(NSString *)type {
|
|
239
|
+
if ([type isEqual:UTTypePNG.identifier]) {
|
|
240
|
+
return UIImagePNGRepresentation(image);
|
|
241
|
+
} else if ([type isEqual:UTTypeHEIC.identifier]) {
|
|
242
|
+
return UIImageHEICRepresentation(image);
|
|
243
|
+
} else {
|
|
244
|
+
return UIImageJPEGRepresentation(image, 1.0);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
- (NSString *)saveToTempFile:(NSData *)data extension:(NSString *)ext {
|
|
249
|
+
if (!data)
|
|
250
|
+
return nil;
|
|
251
|
+
NSString *fileName =
|
|
252
|
+
[NSString stringWithFormat:@"%@.%@", [NSUUID UUID].UUIDString, ext];
|
|
253
|
+
|
|
254
|
+
NSString *filePath =
|
|
255
|
+
[NSTemporaryDirectory() stringByAppendingPathComponent:fileName];
|
|
256
|
+
|
|
257
|
+
if ([data writeToFile:filePath atomically:YES]) {
|
|
258
|
+
return [NSURL fileURLWithPath:filePath].absoluteString;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
return nil;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
- (void)tryHandlingPlainTextItemsIn:(UIPasteboard *)pasteboard
|
|
265
|
+
range:(NSRange)range
|
|
266
|
+
input:(EnrichedTextInputView *)input {
|
|
267
|
+
NSArray *existingTypes = pasteboard.pasteboardTypes;
|
|
268
|
+
NSArray *handledTypes = @[
|
|
269
|
+
UTTypeUTF8PlainText.identifier, UTTypePlainText.identifier,
|
|
270
|
+
UTTypeURL.identifier
|
|
271
|
+
];
|
|
272
|
+
NSString *plainText;
|
|
273
|
+
|
|
274
|
+
for (NSString *type in handledTypes) {
|
|
275
|
+
if (![existingTypes containsObject:type]) {
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
id value = [pasteboard valueForPasteboardType:type];
|
|
280
|
+
|
|
281
|
+
if ([value isKindOfClass:[NSData class]]) {
|
|
282
|
+
plainText = [[NSString alloc] initWithData:value
|
|
283
|
+
encoding:NSUTF8StringEncoding];
|
|
284
|
+
} else if ([value isKindOfClass:[NSString class]]) {
|
|
285
|
+
plainText = (NSString *)value;
|
|
286
|
+
} else if ([value isKindOfClass:[NSURL class]]) {
|
|
287
|
+
plainText = [(NSURL *)value absoluteString];
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
if (!plainText) {
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
range.length > 0 ? [TextInsertionUtils replaceText:plainText
|
|
296
|
+
at:range
|
|
297
|
+
additionalAttributes:nullptr
|
|
298
|
+
host:input
|
|
299
|
+
withSelection:YES]
|
|
300
|
+
: [TextInsertionUtils insertText:plainText
|
|
301
|
+
at:range.location
|
|
302
|
+
additionalAttributes:nullptr
|
|
303
|
+
host:input
|
|
304
|
+
withSelection:YES];
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
- (void)cut:(id)sender {
|
|
308
|
+
EnrichedTextInputView *typedInput = (EnrichedTextInputView *)_input;
|
|
309
|
+
if (typedInput == nullptr) {
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
[self copy:sender];
|
|
314
|
+
[TextInsertionUtils replaceText:@""
|
|
315
|
+
at:typedInput->textView.selectedRange
|
|
316
|
+
additionalAttributes:nullptr
|
|
317
|
+
host:typedInput
|
|
318
|
+
withSelection:YES];
|
|
319
|
+
|
|
320
|
+
[typedInput anyTextMayHaveBeenModified];
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
|
|
324
|
+
if (action == @selector(paste:)) {
|
|
325
|
+
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
|
|
326
|
+
// Enable Paste if clipboard has Text OR Images
|
|
327
|
+
if (pasteboard.hasStrings || pasteboard.hasImages) {
|
|
328
|
+
return YES;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
return [super canPerformAction:action withSender:sender];
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
@end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#import <UIKit/UIKit.h>
|
|
4
|
+
|
|
5
|
+
@class EnrichedTextTouchHandler;
|
|
6
|
+
@class EnrichedTextView;
|
|
7
|
+
|
|
8
|
+
// Forwards single-finger touches to `EnrichedTextTouchHandler` before `super`
|
|
9
|
+
// so link/mention pressed styling is not delayed by `UITextView` gesture
|
|
10
|
+
// arbitration.
|
|
11
|
+
@interface EnrichedTextTextView : UITextView
|
|
12
|
+
|
|
13
|
+
@property(nonatomic, weak) EnrichedTextTouchHandler *touchHandler;
|
|
14
|
+
@property(nonatomic, weak) EnrichedTextView *host;
|
|
15
|
+
|
|
16
|
+
@end
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#import "EnrichedTextTextView.h"
|
|
2
|
+
#import "EnrichedTextTouchHandler.h"
|
|
3
|
+
#import "EnrichedTextView.h"
|
|
4
|
+
#import "HtmlParser.h"
|
|
5
|
+
#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h>
|
|
6
|
+
|
|
7
|
+
@implementation EnrichedTextTextView
|
|
8
|
+
|
|
9
|
+
- (void)copy:(id)sender {
|
|
10
|
+
EnrichedTextView *host = self.host;
|
|
11
|
+
if (host == nullptr) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// remove zero width spaces before copying the text
|
|
16
|
+
NSString *plainText = [host.textView.textStorage.string
|
|
17
|
+
substringWithRange:host.textView.selectedRange];
|
|
18
|
+
NSString *fixedPlainText =
|
|
19
|
+
[plainText stringByReplacingOccurrencesOfString:@"\u200B" withString:@""];
|
|
20
|
+
|
|
21
|
+
NSString *parsedHtml =
|
|
22
|
+
[HtmlParser parseToHtmlFromRange:host.textView.selectedRange host:host];
|
|
23
|
+
|
|
24
|
+
NSMutableAttributedString *attrStr = [[host.textView.textStorage
|
|
25
|
+
attributedSubstringFromRange:host.textView.selectedRange] mutableCopy];
|
|
26
|
+
NSRange fullAttrStrRange = NSMakeRange(0, attrStr.length);
|
|
27
|
+
[attrStr.mutableString replaceOccurrencesOfString:@"\u200B"
|
|
28
|
+
withString:@""
|
|
29
|
+
options:0
|
|
30
|
+
range:fullAttrStrRange];
|
|
31
|
+
|
|
32
|
+
NSData *rtfData =
|
|
33
|
+
[attrStr dataFromRange:NSMakeRange(0, attrStr.length)
|
|
34
|
+
documentAttributes:@{
|
|
35
|
+
NSDocumentTypeDocumentAttribute : NSRTFTextDocumentType
|
|
36
|
+
}
|
|
37
|
+
error:nullptr];
|
|
38
|
+
|
|
39
|
+
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
|
|
40
|
+
[pasteboard setItems:@[ @{
|
|
41
|
+
UTTypeUTF8PlainText.identifier : fixedPlainText,
|
|
42
|
+
UTTypeHTML.identifier : parsedHtml,
|
|
43
|
+
UTTypeRTF.identifier : rtfData
|
|
44
|
+
} ]];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
|
|
48
|
+
if (touches.count == 1) {
|
|
49
|
+
UITouch *touch = touches.anyObject;
|
|
50
|
+
CGPoint point = [touch locationInView:self];
|
|
51
|
+
[self.touchHandler handleTouchBeganAtPoint:point];
|
|
52
|
+
}
|
|
53
|
+
[super touchesBegan:touches withEvent:event];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
|
|
57
|
+
if (touches.count == 1) {
|
|
58
|
+
UITouch *touch = touches.anyObject;
|
|
59
|
+
CGPoint point = [touch locationInView:self];
|
|
60
|
+
[self.touchHandler handleTouchEndedAtPoint:point];
|
|
61
|
+
}
|
|
62
|
+
[super touchesEnded:touches withEvent:event];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
- (void)touchesCancelled:(NSSet<UITouch *> *)touches
|
|
66
|
+
withEvent:(UIEvent *)event {
|
|
67
|
+
[self.touchHandler handleTouchCancelled];
|
|
68
|
+
[super touchesCancelled:touches withEvent:event];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#import "ColorExtension.h"
|
|
2
|
+
|
|
3
|
+
@implementation UIColor (ColorExtension)
|
|
4
|
+
- (BOOL)isEqualToColor:(UIColor *)otherColor {
|
|
5
|
+
CGColorSpaceRef colorSpaceRGB = CGColorSpaceCreateDeviceRGB();
|
|
6
|
+
|
|
7
|
+
UIColor * (^convertColorToRGBSpace)(UIColor *) = ^(UIColor *color) {
|
|
8
|
+
if (CGColorSpaceGetModel(CGColorGetColorSpace(color.CGColor)) ==
|
|
9
|
+
kCGColorSpaceModelMonochrome) {
|
|
10
|
+
const CGFloat *oldComponents = CGColorGetComponents(color.CGColor);
|
|
11
|
+
CGFloat components[4] = {oldComponents[0], oldComponents[0],
|
|
12
|
+
oldComponents[0], oldComponents[1]};
|
|
13
|
+
CGColorRef colorRef = CGColorCreate(colorSpaceRGB, components);
|
|
14
|
+
|
|
15
|
+
UIColor *color = [UIColor colorWithCGColor:colorRef];
|
|
16
|
+
CGColorRelease(colorRef);
|
|
17
|
+
return color;
|
|
18
|
+
} else {
|
|
19
|
+
return color;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
UIColor *selfColor = convertColorToRGBSpace(self);
|
|
24
|
+
otherColor = convertColorToRGBSpace(otherColor);
|
|
25
|
+
CGColorSpaceRelease(colorSpaceRGB);
|
|
26
|
+
|
|
27
|
+
return [selfColor isEqual:otherColor];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Default fallback alpha of 0.4 — opaque colors get this applied so the text
|
|
31
|
+
// cursor remains visible through the highlight. If the caller already set a
|
|
32
|
+
// custom alpha (anything below 1.0), we respect that value instead.
|
|
33
|
+
- (UIColor *)colorWithResolvedAlpha {
|
|
34
|
+
return [self colorWithResolvedAlpha:0.4];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
- (UIColor *)colorWithResolvedAlpha:(CGFloat)newAlpha {
|
|
38
|
+
CGFloat alpha = 0.0;
|
|
39
|
+
[self getRed:nil green:nil blue:nil alpha:&alpha];
|
|
40
|
+
// alpha == 1.0 means the color was never given a custom transparency, so
|
|
41
|
+
// apply newAlpha. Any other value means the caller explicitly chose it —
|
|
42
|
+
// leave it untouched.
|
|
43
|
+
if (alpha >= 1.0) {
|
|
44
|
+
return [self colorWithAlphaComponent:newAlpha];
|
|
45
|
+
}
|
|
46
|
+
return self;
|
|
47
|
+
}
|
|
48
|
+
@end
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#import "FontExtension.h"
|
|
2
|
+
#import <React/RCTLog.h>
|
|
3
|
+
|
|
4
|
+
@implementation UIFont (FontExtension)
|
|
5
|
+
|
|
6
|
+
- (BOOL)isBold {
|
|
7
|
+
return (self.fontDescriptor.symbolicTraits & UIFontDescriptorTraitBold) ==
|
|
8
|
+
UIFontDescriptorTraitBold;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
- (UIFont *)setBold {
|
|
12
|
+
if ([self isBold]) {
|
|
13
|
+
return self;
|
|
14
|
+
}
|
|
15
|
+
UIFontDescriptorSymbolicTraits newTraits =
|
|
16
|
+
(self.fontDescriptor.symbolicTraits | UIFontDescriptorTraitBold);
|
|
17
|
+
UIFontDescriptor *fontDescriptor =
|
|
18
|
+
[self.fontDescriptor fontDescriptorWithSymbolicTraits:newTraits];
|
|
19
|
+
if (fontDescriptor != nullptr) {
|
|
20
|
+
return [UIFont fontWithDescriptor:fontDescriptor size:0];
|
|
21
|
+
} else {
|
|
22
|
+
RCTLogWarn(@"[EnrichedTextInput]: Couldn't apply bold trait to the font.");
|
|
23
|
+
return self;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
- (BOOL)isItalic {
|
|
28
|
+
return (self.fontDescriptor.symbolicTraits & UIFontDescriptorTraitItalic) ==
|
|
29
|
+
UIFontDescriptorTraitItalic;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
- (UIFont *)setItalic {
|
|
33
|
+
if ([self isItalic]) {
|
|
34
|
+
return self;
|
|
35
|
+
}
|
|
36
|
+
UIFontDescriptorSymbolicTraits newTraits =
|
|
37
|
+
(self.fontDescriptor.symbolicTraits | UIFontDescriptorTraitItalic);
|
|
38
|
+
UIFontDescriptor *fontDescriptor =
|
|
39
|
+
[self.fontDescriptor fontDescriptorWithSymbolicTraits:newTraits];
|
|
40
|
+
if (fontDescriptor != nullptr) {
|
|
41
|
+
return [UIFont fontWithDescriptor:fontDescriptor size:0];
|
|
42
|
+
} else {
|
|
43
|
+
RCTLogWarn(
|
|
44
|
+
@"[EnrichedTextInput]: Couldn't apply italic trait to the font.");
|
|
45
|
+
return self;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
- (UIFont *)withFontTraits:(UIFont *)from {
|
|
50
|
+
UIFont *newFont = self;
|
|
51
|
+
if ([from isBold]) {
|
|
52
|
+
newFont = [newFont setBold];
|
|
53
|
+
}
|
|
54
|
+
if ([from isItalic]) {
|
|
55
|
+
newFont = [newFont setItalic];
|
|
56
|
+
}
|
|
57
|
+
return newFont;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
- (UIFont *)setSize:(CGFloat)size {
|
|
61
|
+
UIFontDescriptor *newFontDescriptor =
|
|
62
|
+
[self.fontDescriptor fontDescriptorWithSize:size];
|
|
63
|
+
if (newFontDescriptor != nullptr) {
|
|
64
|
+
return [UIFont fontWithDescriptor:newFontDescriptor size:0];
|
|
65
|
+
} else {
|
|
66
|
+
RCTLogWarn(
|
|
67
|
+
@"[EnrichedTextInput]: Couldn't apply heading style to the font.");
|
|
68
|
+
return self;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#import <UIKit/UIKit.h>
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
UIImage (ImageExtension)
|
|
5
|
+
|
|
6
|
+
This category adds class methods to `UIImage` to create an animated
|
|
7
|
+
`UIImage` from animated image data (GIF or WebP).
|
|
8
|
+
*/
|
|
9
|
+
@interface UIImage (ImageExtension)
|
|
10
|
+
|
|
11
|
+
/*
|
|
12
|
+
UIImage *animation = [UIImage animatedImageWithData:theData];
|
|
13
|
+
|
|
14
|
+
I interpret `theData` as an animated image (GIF or WebP). I create an
|
|
15
|
+
animated `UIImage` using the source images and frame delays from the data.
|
|
16
|
+
|
|
17
|
+
The image stores a separate duration for each frame, in units of
|
|
18
|
+
centiseconds (hundredths of a second). However, a `UIImage` only has a
|
|
19
|
+
single, total `duration` property, which is a floating-point number.
|
|
20
|
+
|
|
21
|
+
To handle this mismatch, I add each source image to `animation` a varying
|
|
22
|
+
number of times to match the ratios between the frame durations.
|
|
23
|
+
|
|
24
|
+
For example, suppose the image contains three frames. Frame 0 has duration
|
|
25
|
+
3. Frame 1 has duration 9. Frame 2 has duration 15. I divide each
|
|
26
|
+
duration by the greatest common denominator of all the durations, which is 3,
|
|
27
|
+
and add each frame the resulting number of times. Thus `animation` will
|
|
28
|
+
contain frame 0 3/3 = 1 time, then frame 1 9/3 = 3 times, then frame 2
|
|
29
|
+
15/3 = 5 times. I set `animation.duration` to (3+9+15)/100 = 0.27 seconds.
|
|
30
|
+
*/
|
|
31
|
+
+ (UIImage *_Nullable)animatedImageWithData:(NSData *_Nonnull)theData;
|
|
32
|
+
|
|
33
|
+
@end
|