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,176 @@
|
|
|
1
|
+
#import "ImageExtension.h"
|
|
2
|
+
#import <ImageIO/ImageIO.h>
|
|
3
|
+
#include <cmath>
|
|
4
|
+
#include <vector>
|
|
5
|
+
|
|
6
|
+
#if __has_feature(objc_arc)
|
|
7
|
+
#define toCF (__bridge CFTypeRef)
|
|
8
|
+
#define fromCF (__bridge id)
|
|
9
|
+
#else
|
|
10
|
+
#define toCF (CFTypeRef)
|
|
11
|
+
#define fromCF (id)
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
// implementation from:
|
|
15
|
+
// https://github.com/mayoff/uiimage-from-animated-gif/blob/master/uiimage-from-animated-gif/UIImage%2BanimatedGIF.m
|
|
16
|
+
@implementation UIImage (ImageExtension)
|
|
17
|
+
|
|
18
|
+
static int delayCentisecondsForImageAtIndex(CGImageSourceRef const source,
|
|
19
|
+
size_t const i) {
|
|
20
|
+
int delayCentiseconds = 1;
|
|
21
|
+
CFDictionaryRef const properties =
|
|
22
|
+
CGImageSourceCopyPropertiesAtIndex(source, i, NULL);
|
|
23
|
+
if (properties) {
|
|
24
|
+
// Try GIF frame delay first
|
|
25
|
+
CFDictionaryRef formatDict = (CFDictionaryRef)CFDictionaryGetValue(
|
|
26
|
+
properties, kCGImagePropertyGIFDictionary);
|
|
27
|
+
CFStringRef unclampedKey = kCGImagePropertyGIFUnclampedDelayTime;
|
|
28
|
+
CFStringRef delayKey = kCGImagePropertyGIFDelayTime;
|
|
29
|
+
|
|
30
|
+
// Fall back to WebP frame delay
|
|
31
|
+
if (!formatDict) {
|
|
32
|
+
formatDict = (CFDictionaryRef)CFDictionaryGetValue(
|
|
33
|
+
properties, kCGImagePropertyWebPDictionary);
|
|
34
|
+
unclampedKey = kCGImagePropertyWebPUnclampedDelayTime;
|
|
35
|
+
delayKey = kCGImagePropertyWebPDelayTime;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (formatDict) {
|
|
39
|
+
NSNumber *number = fromCF CFDictionaryGetValue(formatDict, unclampedKey);
|
|
40
|
+
if (number == NULL || [number doubleValue] == 0) {
|
|
41
|
+
number = fromCF CFDictionaryGetValue(formatDict, delayKey);
|
|
42
|
+
}
|
|
43
|
+
if ([number doubleValue] > 0) {
|
|
44
|
+
// ImageIO exposes frame delays in seconds; convert to centiseconds.
|
|
45
|
+
delayCentiseconds = (int)lrint([number doubleValue] * 100);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
CFRelease(properties);
|
|
49
|
+
}
|
|
50
|
+
return delayCentiseconds;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Changed to use std::vector references instead of C-arrays
|
|
54
|
+
static void createImagesAndDelays(CGImageSourceRef source, size_t count,
|
|
55
|
+
std::vector<CGImageRef> &imagesOut,
|
|
56
|
+
std::vector<int> &delayCentisecondsOut) {
|
|
57
|
+
for (size_t i = 0; i < count; ++i) {
|
|
58
|
+
imagesOut[i] = CGImageSourceCreateImageAtIndex(source, i, NULL);
|
|
59
|
+
delayCentisecondsOut[i] = delayCentisecondsForImageAtIndex(source, i);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
static int sum(const std::vector<int> &values) {
|
|
64
|
+
int theSum = 0;
|
|
65
|
+
for (int value : values) {
|
|
66
|
+
theSum += value;
|
|
67
|
+
}
|
|
68
|
+
return theSum;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
static int pairGCD(int a, int b) {
|
|
72
|
+
if (a < b)
|
|
73
|
+
return pairGCD(b, a);
|
|
74
|
+
while (true) {
|
|
75
|
+
int const r = a % b;
|
|
76
|
+
if (r == 0)
|
|
77
|
+
return b;
|
|
78
|
+
a = b;
|
|
79
|
+
b = r;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
static int vectorGCD(const std::vector<int> &values) {
|
|
84
|
+
if (values.empty())
|
|
85
|
+
return 1;
|
|
86
|
+
|
|
87
|
+
int gcd = values[0];
|
|
88
|
+
for (size_t i = 1; i < values.size(); ++i) {
|
|
89
|
+
// Note that after I process the first few elements of the vector, `gcd`
|
|
90
|
+
// will probably be smaller than any remaining element. By passing the
|
|
91
|
+
// smaller value as the second argument to `pairGCD`, I avoid making it swap
|
|
92
|
+
// the arguments.
|
|
93
|
+
gcd = pairGCD(values[i], gcd);
|
|
94
|
+
}
|
|
95
|
+
return gcd;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
static NSArray *frameArray(const std::vector<CGImageRef> &images,
|
|
99
|
+
const std::vector<int> &delayCentiseconds,
|
|
100
|
+
int const totalDurationCentiseconds) {
|
|
101
|
+
int const gcd = vectorGCD(delayCentiseconds);
|
|
102
|
+
size_t const frameCount = totalDurationCentiseconds / gcd;
|
|
103
|
+
|
|
104
|
+
// Replaced VLA with NSMutableArray for safety and OBJ-C++ compatibility
|
|
105
|
+
NSMutableArray *frames = [NSMutableArray arrayWithCapacity:frameCount];
|
|
106
|
+
|
|
107
|
+
for (size_t i = 0; i < images.size(); ++i) {
|
|
108
|
+
UIImage *const frame = [UIImage imageWithCGImage:images[i]];
|
|
109
|
+
for (size_t j = delayCentiseconds[i] / gcd; j > 0; --j) {
|
|
110
|
+
[frames addObject:frame];
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return frames;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
static void releaseImages(const std::vector<CGImageRef> &images) {
|
|
117
|
+
for (CGImageRef image : images) {
|
|
118
|
+
if (image)
|
|
119
|
+
CGImageRelease(image);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
static UIImage *animatedImageWithImageSource(CGImageSourceRef const source) {
|
|
124
|
+
size_t const count = CGImageSourceGetCount(source);
|
|
125
|
+
if (count == 0) {
|
|
126
|
+
return nil;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Replaced VLAs (variable length arrays) with std::vector
|
|
130
|
+
std::vector<CGImageRef> images(count);
|
|
131
|
+
std::vector<int> delayCentiseconds(count); // in centiseconds
|
|
132
|
+
|
|
133
|
+
createImagesAndDelays(source, count, images, delayCentiseconds);
|
|
134
|
+
|
|
135
|
+
int const totalDurationCentiseconds = sum(delayCentiseconds);
|
|
136
|
+
NSArray *const frames =
|
|
137
|
+
frameArray(images, delayCentiseconds, totalDurationCentiseconds);
|
|
138
|
+
|
|
139
|
+
UIImage *const animation = [UIImage
|
|
140
|
+
animatedImageWithImages:frames
|
|
141
|
+
duration:(NSTimeInterval)totalDurationCentiseconds /
|
|
142
|
+
100.0];
|
|
143
|
+
|
|
144
|
+
releaseImages(images);
|
|
145
|
+
return animation;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
static UIImage *
|
|
149
|
+
animatedImageWithReleasingSource(CGImageSourceRef CF_RELEASES_ARGUMENT source) {
|
|
150
|
+
if (source) {
|
|
151
|
+
UIImage *const image = animatedImageWithImageSource(source);
|
|
152
|
+
CFRelease(source);
|
|
153
|
+
return image;
|
|
154
|
+
} else {
|
|
155
|
+
return nil;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
+ (UIImage *)animatedImageWithData:(NSData *)data {
|
|
160
|
+
CGImageSourceRef source =
|
|
161
|
+
CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL);
|
|
162
|
+
if (!source) {
|
|
163
|
+
return nil;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Preserve EXIF orientation for static images (e.g. JPEG/HEIC camera photos)
|
|
167
|
+
// by using UIKit decoding path directly.
|
|
168
|
+
if (CGImageSourceGetCount(source) <= 1) {
|
|
169
|
+
CFRelease(source);
|
|
170
|
+
return [UIImage imageWithData:data];
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return animatedImageWithReleasingSource(source);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
@end
|
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
#import "LayoutManagerExtension.h"
|
|
2
|
+
#import "ColorExtension.h"
|
|
3
|
+
#import "EnrichedViewHost.h"
|
|
4
|
+
#import "RangeUtils.h"
|
|
5
|
+
#import "StyleHeaders.h"
|
|
6
|
+
#import "WeakBox.h"
|
|
7
|
+
#import <objc/runtime.h>
|
|
8
|
+
|
|
9
|
+
@implementation NSLayoutManager (LayoutManagerExtension)
|
|
10
|
+
|
|
11
|
+
static void const *kInputKey = &kInputKey;
|
|
12
|
+
|
|
13
|
+
- (id)input {
|
|
14
|
+
WeakBox *box = objc_getAssociatedObject(self, kInputKey);
|
|
15
|
+
return box.value;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
- (void)setInput:(id)value {
|
|
19
|
+
WeakBox *box = [WeakBox new];
|
|
20
|
+
box.value = value;
|
|
21
|
+
objc_setAssociatedObject(self, kInputKey, box,
|
|
22
|
+
OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
+ (void)load {
|
|
26
|
+
static dispatch_once_t onceToken;
|
|
27
|
+
dispatch_once(&onceToken, ^{
|
|
28
|
+
Class myClass = [NSLayoutManager class];
|
|
29
|
+
SEL originalSelector = @selector(drawBackgroundForGlyphRange:atPoint:);
|
|
30
|
+
SEL swizzledSelector = @selector(my_drawBackgroundForGlyphRange:atPoint:);
|
|
31
|
+
Method originalMethod = class_getInstanceMethod(myClass, originalSelector);
|
|
32
|
+
Method swizzledMethod = class_getInstanceMethod(myClass, swizzledSelector);
|
|
33
|
+
|
|
34
|
+
BOOL didAddMethod = class_addMethod(
|
|
35
|
+
myClass, originalSelector, method_getImplementation(swizzledMethod),
|
|
36
|
+
method_getTypeEncoding(swizzledMethod));
|
|
37
|
+
|
|
38
|
+
if (didAddMethod) {
|
|
39
|
+
class_replaceMethod(myClass, swizzledSelector,
|
|
40
|
+
method_getImplementation(originalMethod),
|
|
41
|
+
method_getTypeEncoding(originalMethod));
|
|
42
|
+
} else {
|
|
43
|
+
method_exchangeImplementations(originalMethod, swizzledMethod);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
- (void)my_drawBackgroundForGlyphRange:(NSRange)glyphRange
|
|
49
|
+
atPoint:(CGPoint)origin {
|
|
50
|
+
[self my_drawBackgroundForGlyphRange:glyphRange atPoint:origin];
|
|
51
|
+
|
|
52
|
+
id<EnrichedViewHost> host = self.input;
|
|
53
|
+
if (host == nullptr) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
NSRange visibleCharRange = [self characterRangeForGlyphRange:glyphRange
|
|
58
|
+
actualGlyphRange:NULL];
|
|
59
|
+
|
|
60
|
+
[self drawBlockQuotes:host origin:origin visibleCharRange:visibleCharRange];
|
|
61
|
+
[self drawLists:host origin:origin visibleCharRange:visibleCharRange];
|
|
62
|
+
[self drawCodeBlocks:host origin:origin visibleCharRange:visibleCharRange];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
- (void)drawCodeBlocks:(id<EnrichedViewHost>)host
|
|
66
|
+
origin:(CGPoint)origin
|
|
67
|
+
visibleCharRange:(NSRange)visibleCharRange {
|
|
68
|
+
CodeBlockStyle *codeBlockStyle = host.stylesDict[@([CodeBlockStyle getType])];
|
|
69
|
+
if (codeBlockStyle == nullptr) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
NSArray<StylePair *> *allCodeBlocks = [codeBlockStyle all:visibleCharRange];
|
|
74
|
+
NSArray<StylePair *> *mergedCodeBlocks =
|
|
75
|
+
[self mergeContiguousStylePairs:allCodeBlocks];
|
|
76
|
+
UIColor *bgColor = [[host.config codeBlockBgColor] colorWithResolvedAlpha];
|
|
77
|
+
CGFloat radius = [host.config codeBlockBorderRadius];
|
|
78
|
+
[bgColor setFill];
|
|
79
|
+
|
|
80
|
+
for (StylePair *pair in mergedCodeBlocks) {
|
|
81
|
+
NSRange blockCharacterRange = [pair.rangeValue rangeValue];
|
|
82
|
+
if (blockCharacterRange.length == 0)
|
|
83
|
+
continue;
|
|
84
|
+
|
|
85
|
+
NSArray *paragraphs =
|
|
86
|
+
[RangeUtils getSeparateParagraphsRangesIn:host.textView
|
|
87
|
+
range:blockCharacterRange];
|
|
88
|
+
if (paragraphs.count == 0)
|
|
89
|
+
continue;
|
|
90
|
+
|
|
91
|
+
NSRange firstParagraphRange =
|
|
92
|
+
[((NSValue *)[paragraphs firstObject]) rangeValue];
|
|
93
|
+
NSRange lastParagraphRange =
|
|
94
|
+
[((NSValue *)[paragraphs lastObject]) rangeValue];
|
|
95
|
+
|
|
96
|
+
for (NSValue *paragraphValue in paragraphs) {
|
|
97
|
+
NSRange paragraphCharacterRange = [paragraphValue rangeValue];
|
|
98
|
+
|
|
99
|
+
BOOL isFirstParagraph =
|
|
100
|
+
NSEqualRanges(paragraphCharacterRange, firstParagraphRange);
|
|
101
|
+
BOOL isLastParagraph =
|
|
102
|
+
NSEqualRanges(paragraphCharacterRange, lastParagraphRange);
|
|
103
|
+
|
|
104
|
+
NSRange paragraphGlyphRange =
|
|
105
|
+
[self glyphRangeForCharacterRange:paragraphCharacterRange
|
|
106
|
+
actualCharacterRange:NULL];
|
|
107
|
+
|
|
108
|
+
__block BOOL isFirstLineOfParagraph = YES;
|
|
109
|
+
|
|
110
|
+
[self
|
|
111
|
+
enumerateLineFragmentsForGlyphRange:paragraphGlyphRange
|
|
112
|
+
usingBlock:^(
|
|
113
|
+
CGRect rect, CGRect usedRect,
|
|
114
|
+
NSTextContainer *_Nonnull textContainer,
|
|
115
|
+
NSRange glyphRange,
|
|
116
|
+
BOOL *_Nonnull stop) {
|
|
117
|
+
CGRect lineBgRect = rect;
|
|
118
|
+
lineBgRect.origin.x = origin.x;
|
|
119
|
+
lineBgRect.origin.y += origin.y;
|
|
120
|
+
lineBgRect.size.width =
|
|
121
|
+
textContainer.size.width;
|
|
122
|
+
|
|
123
|
+
UIRectCorner cornersForThisLine = 0;
|
|
124
|
+
|
|
125
|
+
if (isFirstParagraph &&
|
|
126
|
+
isFirstLineOfParagraph) {
|
|
127
|
+
cornersForThisLine =
|
|
128
|
+
UIRectCornerTopLeft |
|
|
129
|
+
UIRectCornerTopRight;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
BOOL isLastLineOfParagraph =
|
|
133
|
+
(NSMaxRange(glyphRange) >=
|
|
134
|
+
NSMaxRange(paragraphGlyphRange));
|
|
135
|
+
|
|
136
|
+
if (isLastParagraph &&
|
|
137
|
+
isLastLineOfParagraph) {
|
|
138
|
+
cornersForThisLine =
|
|
139
|
+
cornersForThisLine |
|
|
140
|
+
UIRectCornerBottomLeft |
|
|
141
|
+
UIRectCornerBottomRight;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
UIBezierPath *path = [UIBezierPath
|
|
145
|
+
bezierPathWithRoundedRect:lineBgRect
|
|
146
|
+
byRoundingCorners:
|
|
147
|
+
cornersForThisLine
|
|
148
|
+
cornerRadii:CGSizeMake(
|
|
149
|
+
radius,
|
|
150
|
+
radius)];
|
|
151
|
+
[path fill];
|
|
152
|
+
|
|
153
|
+
isFirstLineOfParagraph = NO;
|
|
154
|
+
}];
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
- (NSArray<StylePair *> *)mergeContiguousStylePairs:
|
|
160
|
+
(NSArray<StylePair *> *)pairs {
|
|
161
|
+
if (pairs.count == 0) {
|
|
162
|
+
return @[];
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
NSMutableArray<StylePair *> *mergedPairs = [[NSMutableArray alloc] init];
|
|
166
|
+
StylePair *currentPair = pairs[0];
|
|
167
|
+
NSRange currentRange = [currentPair.rangeValue rangeValue];
|
|
168
|
+
for (NSUInteger i = 1; i < pairs.count; i++) {
|
|
169
|
+
StylePair *nextPair = pairs[i];
|
|
170
|
+
NSRange nextRange = [nextPair.rangeValue rangeValue];
|
|
171
|
+
|
|
172
|
+
// The Gap Check:
|
|
173
|
+
// NSMaxRange(currentRange) is where the current block ends.
|
|
174
|
+
// nextRange.location is where the next block starts.
|
|
175
|
+
if (NSMaxRange(currentRange) == nextRange.location) {
|
|
176
|
+
// They touch perfectly (no gap). Merge them.
|
|
177
|
+
currentRange.length += nextRange.length;
|
|
178
|
+
} else {
|
|
179
|
+
// There is a gap (indices don't match).
|
|
180
|
+
// 1. Save the finished block.
|
|
181
|
+
StylePair *mergedPair = [[StylePair alloc] init];
|
|
182
|
+
mergedPair.rangeValue = [NSValue valueWithRange:currentRange];
|
|
183
|
+
mergedPair.styleValue = currentPair.styleValue;
|
|
184
|
+
[mergedPairs addObject:mergedPair];
|
|
185
|
+
|
|
186
|
+
// 2. Start a brand new block.
|
|
187
|
+
currentPair = nextPair;
|
|
188
|
+
currentRange = nextRange;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// Add the final block
|
|
193
|
+
StylePair *lastPair = [[StylePair alloc] init];
|
|
194
|
+
lastPair.rangeValue = [NSValue valueWithRange:currentRange];
|
|
195
|
+
lastPair.styleValue = currentPair.styleValue;
|
|
196
|
+
[mergedPairs addObject:lastPair];
|
|
197
|
+
|
|
198
|
+
return mergedPairs;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
- (void)drawBlockQuotes:(id<EnrichedViewHost>)host
|
|
202
|
+
origin:(CGPoint)origin
|
|
203
|
+
visibleCharRange:(NSRange)visibleCharRange {
|
|
204
|
+
BlockQuoteStyle *bqStyle = host.stylesDict[@([BlockQuoteStyle getType])];
|
|
205
|
+
if (bqStyle == nullptr) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
NSArray *allBlockquotes = [bqStyle all:visibleCharRange];
|
|
210
|
+
|
|
211
|
+
for (StylePair *pair in allBlockquotes) {
|
|
212
|
+
NSRange paragraphRange = [host.textView.textStorage.string
|
|
213
|
+
paragraphRangeForRange:[pair.rangeValue rangeValue]];
|
|
214
|
+
NSRange paragraphGlyphRange =
|
|
215
|
+
[self glyphRangeForCharacterRange:paragraphRange
|
|
216
|
+
actualCharacterRange:nullptr];
|
|
217
|
+
[self
|
|
218
|
+
enumerateLineFragmentsForGlyphRange:paragraphGlyphRange
|
|
219
|
+
usingBlock:^(
|
|
220
|
+
CGRect rect, CGRect usedRect,
|
|
221
|
+
NSTextContainer *_Nonnull textContainer,
|
|
222
|
+
NSRange glyphRange, BOOL *_Nonnull stop) {
|
|
223
|
+
CGFloat paddingLeft = origin.x;
|
|
224
|
+
CGFloat paddingTop = origin.y;
|
|
225
|
+
CGFloat x = paddingLeft;
|
|
226
|
+
CGFloat y = paddingTop + rect.origin.y;
|
|
227
|
+
CGFloat width =
|
|
228
|
+
[host.config blockquoteBorderWidth];
|
|
229
|
+
CGFloat height = rect.size.height;
|
|
230
|
+
|
|
231
|
+
CGRect lineRect =
|
|
232
|
+
CGRectMake(x, y, width, height);
|
|
233
|
+
[[host.config blockquoteBorderColor]
|
|
234
|
+
setFill];
|
|
235
|
+
UIRectFill(lineRect);
|
|
236
|
+
}];
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
- (void)drawLists:(id<EnrichedViewHost>)host
|
|
241
|
+
origin:(CGPoint)origin
|
|
242
|
+
visibleCharRange:(NSRange)visibleCharRange {
|
|
243
|
+
UnorderedListStyle *ulStyle =
|
|
244
|
+
host.stylesDict[@([UnorderedListStyle getType])];
|
|
245
|
+
OrderedListStyle *olStyle = host.stylesDict[@([OrderedListStyle getType])];
|
|
246
|
+
CheckboxListStyle *cbStyle = host.stylesDict[@([CheckboxListStyle getType])];
|
|
247
|
+
|
|
248
|
+
NSMutableArray *allLists = [[NSMutableArray alloc] init];
|
|
249
|
+
|
|
250
|
+
if (ulStyle != nullptr) {
|
|
251
|
+
[allLists addObjectsFromArray:[ulStyle all:visibleCharRange]];
|
|
252
|
+
}
|
|
253
|
+
if (olStyle != nullptr) {
|
|
254
|
+
[allLists addObjectsFromArray:[olStyle all:visibleCharRange]];
|
|
255
|
+
}
|
|
256
|
+
if (cbStyle != nullptr) {
|
|
257
|
+
[allLists addObjectsFromArray:[cbStyle all:visibleCharRange]];
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
for (StylePair *pair in allLists) {
|
|
261
|
+
NSParagraphStyle *pStyle = (NSParagraphStyle *)pair.styleValue;
|
|
262
|
+
NSDictionary *markerAttributes = @{
|
|
263
|
+
NSFontAttributeName : [host.config orderedListMarkerFont],
|
|
264
|
+
NSForegroundColorAttributeName : [host.config orderedListMarkerColor]
|
|
265
|
+
};
|
|
266
|
+
CGFloat indent = pStyle.firstLineHeadIndent;
|
|
267
|
+
|
|
268
|
+
NSArray *paragraphs =
|
|
269
|
+
[RangeUtils getSeparateParagraphsRangesIn:host.textView
|
|
270
|
+
range:[pair.rangeValue rangeValue]];
|
|
271
|
+
|
|
272
|
+
for (NSValue *paragraph in paragraphs) {
|
|
273
|
+
NSRange paragraphGlyphRange =
|
|
274
|
+
[self glyphRangeForCharacterRange:[paragraph rangeValue]
|
|
275
|
+
actualCharacterRange:nullptr];
|
|
276
|
+
|
|
277
|
+
[self enumerateLineFragmentsForGlyphRange:paragraphGlyphRange
|
|
278
|
+
usingBlock:^(CGRect rect, CGRect usedRect,
|
|
279
|
+
NSTextContainer *container,
|
|
280
|
+
NSRange lineGlyphRange,
|
|
281
|
+
BOOL *stop) {
|
|
282
|
+
NSUInteger charIdx =
|
|
283
|
+
[self characterIndexForGlyphAtIndex:
|
|
284
|
+
lineGlyphRange.location];
|
|
285
|
+
UIFont *font = [host.textView.textStorage
|
|
286
|
+
attribute:NSFontAttributeName
|
|
287
|
+
atIndex:charIdx
|
|
288
|
+
effectiveRange:nil];
|
|
289
|
+
CGRect textUsedRect =
|
|
290
|
+
[self getTextAlignedUsedRect:usedRect
|
|
291
|
+
font:font];
|
|
292
|
+
|
|
293
|
+
for (NSTextList *list in pStyle
|
|
294
|
+
.textLists) {
|
|
295
|
+
NSString *markerFormat =
|
|
296
|
+
list.markerFormat;
|
|
297
|
+
|
|
298
|
+
if ([markerFormat
|
|
299
|
+
hasPrefix:
|
|
300
|
+
@"EnrichedAlignment"]) {
|
|
301
|
+
continue;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
if ([markerFormat
|
|
305
|
+
isEqualToString:
|
|
306
|
+
@"EnrichedOrderedList"]) {
|
|
307
|
+
NSString *marker = [self
|
|
308
|
+
getDecimalMarkerForList:host
|
|
309
|
+
charIndex:charIdx];
|
|
310
|
+
[self drawDecimal:host
|
|
311
|
+
marker:marker
|
|
312
|
+
markerAttributes:markerAttributes
|
|
313
|
+
origin:origin
|
|
314
|
+
usedRect:usedRect
|
|
315
|
+
indent:indent];
|
|
316
|
+
} else if ([markerFormat
|
|
317
|
+
isEqualToString:
|
|
318
|
+
@"EnrichedUnordered"
|
|
319
|
+
@"Lis"
|
|
320
|
+
@"t"]) {
|
|
321
|
+
[self drawBullet:host
|
|
322
|
+
origin:origin
|
|
323
|
+
usedRect:textUsedRect
|
|
324
|
+
indent:indent];
|
|
325
|
+
|
|
326
|
+
} else if ([markerFormat
|
|
327
|
+
hasPrefix:@"EnrichedChe"
|
|
328
|
+
@"ckbox"]) {
|
|
329
|
+
[self drawCheckbox:host
|
|
330
|
+
markerFormat:markerFormat
|
|
331
|
+
origin:origin
|
|
332
|
+
usedRect:textUsedRect
|
|
333
|
+
indent:indent];
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
// only first line of a list gets its
|
|
337
|
+
// marker drawn
|
|
338
|
+
*stop = YES;
|
|
339
|
+
}];
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
- (NSString *)getDecimalMarkerForList:(id<EnrichedViewHost>)host
|
|
345
|
+
charIndex:(NSUInteger)index {
|
|
346
|
+
NSString *fullText = host.textView.textStorage.string;
|
|
347
|
+
NSInteger itemNumber = 1;
|
|
348
|
+
|
|
349
|
+
NSRange currentParagraph =
|
|
350
|
+
[fullText paragraphRangeForRange:NSMakeRange(index, 0)];
|
|
351
|
+
if (currentParagraph.location > 0) {
|
|
352
|
+
OrderedListStyle *olStyle = host.stylesDict[@([OrderedListStyle getType])];
|
|
353
|
+
|
|
354
|
+
NSInteger prevParagraphsCount = 0;
|
|
355
|
+
NSInteger recentParagraphLocation =
|
|
356
|
+
[fullText paragraphRangeForRange:NSMakeRange(
|
|
357
|
+
currentParagraph.location - 1, 0)]
|
|
358
|
+
.location;
|
|
359
|
+
|
|
360
|
+
// seek for previous lists
|
|
361
|
+
while (true) {
|
|
362
|
+
if ([olStyle detect:NSMakeRange(recentParagraphLocation, 0)]) {
|
|
363
|
+
prevParagraphsCount += 1;
|
|
364
|
+
|
|
365
|
+
if (recentParagraphLocation > 0) {
|
|
366
|
+
recentParagraphLocation =
|
|
367
|
+
[fullText
|
|
368
|
+
paragraphRangeForRange:NSMakeRange(
|
|
369
|
+
recentParagraphLocation - 1, 0)]
|
|
370
|
+
.location;
|
|
371
|
+
} else {
|
|
372
|
+
break;
|
|
373
|
+
}
|
|
374
|
+
} else {
|
|
375
|
+
break;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
itemNumber = prevParagraphsCount + 1;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
return [NSString stringWithFormat:@"%ld.", (long)(itemNumber)];
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
// Returns a usedRect adjusted to cover only the text portion of the line.
|
|
386
|
+
// When minimumLineHeight expands the line box, extra space is added at the top
|
|
387
|
+
// and text stays at the bottom. This strips that padding so markers align with
|
|
388
|
+
// the text, not the full line box.
|
|
389
|
+
- (CGRect)getTextAlignedUsedRect:(CGRect)usedRect font:(UIFont *)font {
|
|
390
|
+
if (font && usedRect.size.height > font.lineHeight) {
|
|
391
|
+
CGFloat extraSpace = usedRect.size.height - font.lineHeight;
|
|
392
|
+
usedRect.origin.y += extraSpace;
|
|
393
|
+
usedRect.size.height = font.lineHeight;
|
|
394
|
+
}
|
|
395
|
+
return usedRect;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
- (void)drawCheckbox:(id<EnrichedViewHost>)host
|
|
399
|
+
markerFormat:(NSString *)markerFormat
|
|
400
|
+
origin:(CGPoint)origin
|
|
401
|
+
usedRect:(CGRect)usedRect
|
|
402
|
+
indent:(CGFloat)indent {
|
|
403
|
+
BOOL isChecked = [markerFormat isEqualToString:@"EnrichedCheckbox1"];
|
|
404
|
+
|
|
405
|
+
UIImage *image = isChecked ? host.config.checkboxCheckedImage
|
|
406
|
+
: host.config.checkboxUncheckedImage;
|
|
407
|
+
CGFloat gapWidth = [host.config checkboxListGapWidth];
|
|
408
|
+
CGFloat configuredBoxSize = [host.config checkboxListBoxSize];
|
|
409
|
+
|
|
410
|
+
CGFloat boxSize = MIN(configuredBoxSize, usedRect.size.height);
|
|
411
|
+
CGFloat centerY = CGRectGetMidY(usedRect) + origin.y;
|
|
412
|
+
CGFloat boxX = origin.x + indent - gapWidth - boxSize;
|
|
413
|
+
CGFloat boxY = centerY - boxSize / 2.0;
|
|
414
|
+
|
|
415
|
+
[image drawInRect:CGRectMake(boxX, boxY, boxSize, boxSize)];
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
- (void)drawBullet:(id<EnrichedViewHost>)host
|
|
419
|
+
origin:(CGPoint)origin
|
|
420
|
+
usedRect:(CGRect)usedRect
|
|
421
|
+
indent:(CGFloat)indent {
|
|
422
|
+
CGFloat gapWidth = [host.config unorderedListGapWidth];
|
|
423
|
+
CGFloat bulletSize = [host.config unorderedListBulletSize];
|
|
424
|
+
CGFloat bulletX = origin.x + indent - gapWidth - bulletSize / 2;
|
|
425
|
+
CGFloat centerY = CGRectGetMidY(usedRect) + origin.y;
|
|
426
|
+
|
|
427
|
+
CGContextRef context = UIGraphicsGetCurrentContext();
|
|
428
|
+
CGContextSaveGState(context);
|
|
429
|
+
{
|
|
430
|
+
[[host.config unorderedListBulletColor] setFill];
|
|
431
|
+
CGContextAddArc(context, bulletX, centerY, bulletSize / 2, 0, 2 * M_PI,
|
|
432
|
+
YES);
|
|
433
|
+
CGContextFillPath(context);
|
|
434
|
+
}
|
|
435
|
+
CGContextRestoreGState(context);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
- (void)drawDecimal:(id<EnrichedViewHost>)host
|
|
439
|
+
marker:(NSString *)marker
|
|
440
|
+
markerAttributes:(NSDictionary *)markerAttributes
|
|
441
|
+
origin:(CGPoint)origin
|
|
442
|
+
usedRect:(CGRect)usedRect
|
|
443
|
+
indent:(CGFloat)indent {
|
|
444
|
+
CGFloat gapWidth = [host.config orderedListGapWidth];
|
|
445
|
+
CGSize markerSize = [marker sizeWithAttributes:markerAttributes];
|
|
446
|
+
CGFloat markerX = origin.x + indent - gapWidth - markerSize.width / 2;
|
|
447
|
+
CGFloat centerY = CGRectGetMidY(usedRect) + origin.y;
|
|
448
|
+
CGFloat markerY = centerY - markerSize.height / 2.0;
|
|
449
|
+
|
|
450
|
+
[marker drawAtPoint:CGPointMake(markerX, markerY)
|
|
451
|
+
withAttributes:markerAttributes];
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
@end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#include "string"
|
|
2
|
+
#import <UIKit/UIKit.h>
|
|
3
|
+
#pragma once
|
|
4
|
+
|
|
5
|
+
@interface NSString (StringExtension)
|
|
6
|
+
- (std::string)toCppString;
|
|
7
|
+
+ (NSString *)fromCppString:(std::string)string;
|
|
8
|
+
+ (NSString *)stringByEscapingHtml:(NSString *)html;
|
|
9
|
+
+ (NSDictionary *)getEscapedCharactersInfoFrom:(NSString *)text;
|
|
10
|
+
@end
|
|
11
|
+
|
|
12
|
+
@interface NSMutableString (StringExtension)
|
|
13
|
+
- (std::string)toCppString;
|
|
14
|
+
+ (NSMutableString *)fromCppString:(std::string)string;
|
|
15
|
+
@end
|