react-native-enriched-html 0.0.0 → 1.0.1
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/EnrichedSpanFlags.kt +39 -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 +1057 -0
- package/android/src/main/java/com/swmansion/enriched/common/parser/EnrichedSpanFactory.kt +83 -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 +84 -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 +362 -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 +86 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/EnrichedTextInputView.kt +1144 -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 +65 -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 +40 -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 +366 -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 +244 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/styles/ListStyles.kt +261 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/styles/ParagraphStyles.kt +440 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/styles/ParametrizedStyles.kt +435 -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 +342 -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 +157 -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 +107 -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 +973 -0
- package/cpp/parser/GumboParser.cpp +16 -0
- package/cpp/parser/GumboParser.hpp +23 -0
- package/cpp/tests/GumboParserTest.cpp +511 -0
- package/ios/EnrichedTextInputView.h +54 -0
- package/ios/EnrichedTextInputView.mm +2182 -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 +465 -0
- package/ios/extensions/StringExtension.h +15 -0
- package/ios/extensions/StringExtension.mm +144 -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 +14 -0
- package/ios/htmlParser/HtmlParser.mm +1486 -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 +228 -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 +114 -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 +518 -0
- package/ios/styles/MentionStyle.mm +592 -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 +182 -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 +296 -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 +5 -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 +14 -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/EnrichedText.css +343 -0
- package/lib/module/web/EnrichedText.js +55 -0
- package/lib/module/web/EnrichedText.js.map +1 -0
- package/lib/module/web/EnrichedTextInput.js +316 -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/constants/brokenImageGlyph.js +9 -0
- package/lib/module/web/constants/brokenImageGlyph.js.map +1 -0
- package/lib/module/web/constants/classNames.js +5 -0
- package/lib/module/web/constants/classNames.js.map +1 -0
- package/lib/module/web/emitLinkDetected.js +12 -0
- package/lib/module/web/emitLinkDetected.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 +180 -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/EnrichedTextAlign.js +82 -0
- package/lib/module/web/formats/EnrichedTextAlign.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 +64 -0
- package/lib/module/web/formats/applyWrappingListToSelection.js.map +1 -0
- package/lib/module/web/formats/formatRules.js +84 -0
- package/lib/module/web/formats/formatRules.js.map +1 -0
- package/lib/module/web/formats/listKeyboard.js +53 -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/normalization/checkboxHtmlNormalizer.js +54 -0
- package/lib/module/web/normalization/checkboxHtmlNormalizer.js.map +1 -0
- package/lib/module/web/normalization/htmlNormalizer.js +514 -0
- package/lib/module/web/normalization/htmlNormalizer.js.map +1 -0
- package/lib/module/web/normalization/prepareHtmlForWeb.js +78 -0
- package/lib/module/web/normalization/prepareHtmlForWeb.js.map +1 -0
- package/lib/module/web/normalization/tiptapHtmlNormalizer.js +34 -0
- package/lib/module/web/normalization/tiptapHtmlNormalizer.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/AutolinkPlugin/autolinkRegex.js +27 -0
- package/lib/module/web/pmPlugins/AutolinkPlugin/autolinkRegex.js.map +1 -0
- package/lib/module/web/pmPlugins/AutolinkPlugin/index.js +178 -0
- package/lib/module/web/pmPlugins/AutolinkPlugin/index.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 +86 -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 +57 -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/types.js +4 -0
- package/lib/module/web/pmPlugins/MentionPlugin/types.js.map +1 -0
- package/lib/module/web/pmPlugins/MentionPlugin/useMentionEvents.js +105 -0
- package/lib/module/web/pmPlugins/MentionPlugin/useMentionEvents.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 +134 -0
- package/lib/module/web/pmPlugins/ShortcutPlugin.js.map +1 -0
- package/lib/module/web/pmPlugins/StrictMarksPlugin.js +100 -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/sanitization/htmlSanitizer.js +10 -0
- package/lib/module/web/sanitization/htmlSanitizer.js.map +1 -0
- package/lib/module/web/styleConversion/buildMentionRulesCSS.js +39 -0
- package/lib/module/web/styleConversion/buildMentionRulesCSS.js.map +1 -0
- package/lib/module/web/styleConversion/enrichedBaseStyleToCSSProperties.js +159 -0
- package/lib/module/web/styleConversion/enrichedBaseStyleToCSSProperties.js.map +1 -0
- package/lib/module/web/styleConversion/enrichedInputStyleToCSSProperties.js +7 -0
- package/lib/module/web/styleConversion/enrichedInputStyleToCSSProperties.js.map +1 -0
- package/lib/module/web/styleConversion/enrichedTextStyleToCSSProperties.js +44 -0
- package/lib/module/web/styleConversion/enrichedTextStyleToCSSProperties.js.map +1 -0
- package/lib/module/web/styleConversion/enrichedThemingToCSSProperties.js +18 -0
- package/lib/module/web/styleConversion/enrichedThemingToCSSProperties.js.map +1 -0
- package/lib/module/web/styleConversion/htmlStyleToCSSVariables.js +168 -0
- package/lib/module/web/styleConversion/htmlStyleToCSSVariables.js.map +1 -0
- package/lib/module/web/styleConversion/inlineImageCSSVariables.js +7 -0
- package/lib/module/web/styleConversion/inlineImageCSSVariables.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/useImageErrorFallback.js +33 -0
- package/lib/module/web/useImageErrorFallback.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 +91 -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 +55 -0
- package/lib/module/web/useOnLinkDetected.js.map +1 -0
- package/lib/module/web/usePressInteractions.js +19 -0
- package/lib/module/web/usePressInteractions.js.map +1 -0
- package/lib/module/web/useStableRef.js +13 -0
- package/lib/module/web/useStableRef.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/index.d.ts +4 -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/EnrichedText.d.ts +4 -0
- package/lib/typescript/src/web/EnrichedText.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/constants/brokenImageGlyph.d.ts +3 -0
- package/lib/typescript/src/web/constants/brokenImageGlyph.d.ts.map +1 -0
- package/lib/typescript/src/web/constants/classNames.d.ts +3 -0
- package/lib/typescript/src/web/constants/classNames.d.ts.map +1 -0
- package/lib/typescript/src/web/emitLinkDetected.d.ts +10 -0
- package/lib/typescript/src/web/emitLinkDetected.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 +8 -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/EnrichedTextAlign.d.ts +2 -0
- package/lib/typescript/src/web/formats/EnrichedTextAlign.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 +12 -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/normalization/checkboxHtmlNormalizer.d.ts +3 -0
- package/lib/typescript/src/web/normalization/checkboxHtmlNormalizer.d.ts.map +1 -0
- package/lib/typescript/src/web/normalization/htmlNormalizer.d.ts +2 -0
- package/lib/typescript/src/web/normalization/htmlNormalizer.d.ts.map +1 -0
- package/lib/typescript/src/web/normalization/prepareHtmlForWeb.d.ts +2 -0
- package/lib/typescript/src/web/normalization/prepareHtmlForWeb.d.ts.map +1 -0
- package/lib/typescript/src/web/normalization/tiptapHtmlNormalizer.d.ts +3 -0
- package/lib/typescript/src/web/normalization/tiptapHtmlNormalizer.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/AutolinkPlugin/autolinkRegex.d.ts +7 -0
- package/lib/typescript/src/web/pmPlugins/AutolinkPlugin/autolinkRegex.d.ts.map +1 -0
- package/lib/typescript/src/web/pmPlugins/AutolinkPlugin/index.d.ts +8 -0
- package/lib/typescript/src/web/pmPlugins/AutolinkPlugin/index.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/types.d.ts +20 -0
- package/lib/typescript/src/web/pmPlugins/MentionPlugin/types.d.ts.map +1 -0
- package/lib/typescript/src/web/pmPlugins/MentionPlugin/useMentionEvents.d.ts +4 -0
- package/lib/typescript/src/web/pmPlugins/MentionPlugin/useMentionEvents.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 +15 -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/sanitization/htmlSanitizer.d.ts +2 -0
- package/lib/typescript/src/web/sanitization/htmlSanitizer.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/enrichedBaseStyleToCSSProperties.d.ts +8 -0
- package/lib/typescript/src/web/styleConversion/enrichedBaseStyleToCSSProperties.d.ts.map +1 -0
- package/lib/typescript/src/web/styleConversion/enrichedInputStyleToCSSProperties.d.ts +5 -0
- package/lib/typescript/src/web/styleConversion/enrichedInputStyleToCSSProperties.d.ts.map +1 -0
- package/lib/typescript/src/web/styleConversion/enrichedTextStyleToCSSProperties.d.ts +4 -0
- package/lib/typescript/src/web/styleConversion/enrichedTextStyleToCSSProperties.d.ts.map +1 -0
- package/lib/typescript/src/web/styleConversion/enrichedThemingToCSSProperties.d.ts +9 -0
- package/lib/typescript/src/web/styleConversion/enrichedThemingToCSSProperties.d.ts.map +1 -0
- package/lib/typescript/src/web/styleConversion/htmlStyleToCSSVariables.d.ts +11 -0
- package/lib/typescript/src/web/styleConversion/htmlStyleToCSSVariables.d.ts.map +1 -0
- package/lib/typescript/src/web/styleConversion/inlineImageCSSVariables.d.ts +3 -0
- package/lib/typescript/src/web/styleConversion/inlineImageCSSVariables.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/useImageErrorFallback.d.ts +3 -0
- package/lib/typescript/src/web/useImageErrorFallback.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/lib/typescript/src/web/usePressInteractions.d.ts +2 -0
- package/lib/typescript/src/web/usePressInteractions.d.ts.map +1 -0
- package/lib/typescript/src/web/useStableRef.d.ts +3 -0
- package/lib/typescript/src/web/useStableRef.d.ts.map +1 -0
- package/package.json +258 -1
- package/react-native.config.js +16 -0
- package/src/index.native.tsx +34 -0
- package/src/index.tsx +25 -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 +866 -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 +182 -0
- package/src/utils/nullthrows.ts +7 -0
- package/src/utils/regexParser.ts +56 -0
- package/src/web/EnrichedText.css +343 -0
- package/src/web/EnrichedText.tsx +82 -0
- package/src/web/EnrichedTextInput.tsx +417 -0
- package/src/web/adaptWebToNativeEvent.ts +37 -0
- package/src/web/constants/brokenImageGlyph.ts +7 -0
- package/src/web/constants/classNames.ts +2 -0
- package/src/web/emitLinkDetected.ts +29 -0
- package/src/web/formats/EnrichedBlockquote.ts +37 -0
- package/src/web/formats/EnrichedBold.ts +16 -0
- package/src/web/formats/EnrichedCheckboxItem.ts +35 -0
- package/src/web/formats/EnrichedCheckboxList.ts +50 -0
- package/src/web/formats/EnrichedCode.ts +13 -0
- package/src/web/formats/EnrichedCodeBlock.ts +54 -0
- package/src/web/formats/EnrichedHeading.ts +37 -0
- package/src/web/formats/EnrichedImage.ts +59 -0
- package/src/web/formats/EnrichedImageNodeView.tsx +87 -0
- package/src/web/formats/EnrichedItalic.ts +16 -0
- package/src/web/formats/EnrichedLink.ts +204 -0
- package/src/web/formats/EnrichedListItem.ts +17 -0
- package/src/web/formats/EnrichedMention.ts +55 -0
- package/src/web/formats/EnrichedOrderedList.ts +43 -0
- package/src/web/formats/EnrichedStrike.ts +16 -0
- package/src/web/formats/EnrichedTextAlign.ts +88 -0
- package/src/web/formats/EnrichedUnderline.ts +16 -0
- package/src/web/formats/EnrichedUnorderedList.ts +53 -0
- package/src/web/formats/applyWrappingListToSelection.ts +76 -0
- package/src/web/formats/formatRules.ts +128 -0
- package/src/web/formats/listKeyboard.ts +63 -0
- package/src/web/formats/wrappedBlockKeyboard.ts +76 -0
- package/src/web/normalization/checkboxHtmlNormalizer.ts +62 -0
- package/src/web/normalization/htmlNormalizer.ts +656 -0
- package/src/web/normalization/prepareHtmlForWeb.ts +93 -0
- package/src/web/normalization/tiptapHtmlNormalizer.ts +43 -0
- package/src/web/pasteImages.ts +96 -0
- package/src/web/pastedImageDimensions.ts +40 -0
- package/src/web/pmPlugins/AutolinkPlugin/autolinkRegex.ts +43 -0
- package/src/web/pmPlugins/AutolinkPlugin/index.ts +274 -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 +102 -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 +73 -0
- package/src/web/pmPlugins/MentionPlugin/startMention.ts +14 -0
- package/src/web/pmPlugins/MentionPlugin/stripPartialMentionMarks.ts +20 -0
- package/src/web/pmPlugins/MentionPlugin/types.ts +22 -0
- package/src/web/pmPlugins/MentionPlugin/useMentionEvents.ts +114 -0
- package/src/web/pmPlugins/MergeAdjacentSameKindBlocksPlugin.ts +57 -0
- package/src/web/pmPlugins/ShortcutPlugin.ts +105 -0
- package/src/web/pmPlugins/StrictMarksPlugin.ts +134 -0
- package/src/web/pmPlugins/StripBoldInStyledHeadingsPlugin.ts +84 -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/sanitization/htmlSanitizer.ts +8 -0
- package/src/web/styleConversion/buildMentionRulesCSS.ts +61 -0
- package/src/web/styleConversion/enrichedBaseStyleToCSSProperties.ts +228 -0
- package/src/web/styleConversion/enrichedInputStyleToCSSProperties.ts +13 -0
- package/src/web/styleConversion/enrichedTextStyleToCSSProperties.ts +53 -0
- package/src/web/styleConversion/enrichedThemingToCSSProperties.ts +34 -0
- package/src/web/styleConversion/htmlStyleToCSSVariables.ts +277 -0
- package/src/web/styleConversion/inlineImageCSSVariables.ts +6 -0
- package/src/web/styleConversion/mentionIndicatorCssKey.ts +14 -0
- package/src/web/styleConversion/toColor.ts +17 -0
- package/src/web/useImageErrorFallback.ts +37 -0
- package/src/web/useOnChangeHtml.ts +14 -0
- package/src/web/useOnChangeState.ts +127 -0
- package/src/web/useOnChangeText.ts +15 -0
- package/src/web/useOnEditorChange.ts +33 -0
- package/src/web/useOnLinkDetected.ts +70 -0
- package/src/web/usePressInteractions.tsx +22 -0
- package/src/web/useStableRef.ts +12 -0
|
@@ -0,0 +1,514 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Custom HTML normalizer for TipTap input.
|
|
5
|
+
* Mirrors the native GumboNormalizer (cpp/parser/GumboNormalizer.c)
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const INLINE_TAGS = new Set(['b', 'i', 'u', 's', 'code', 'a', 'strong', 'em', 'del', 'strike', 'ins', 'mention']);
|
|
9
|
+
const BLOCK_TAGS = new Set(['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'ul', 'ol', 'li', 'blockquote', 'codeblock', 'pre']);
|
|
10
|
+
const SELF_CLOSING_TAGS = new Set(['br', 'img']);
|
|
11
|
+
const PASS_TAGS = new Set(['html', 'head', 'body']);
|
|
12
|
+
const STRIPPED_TAGS = new Set(['meta', 'style', 'script', 'title', 'link']);
|
|
13
|
+
const TABLE_TAGS = new Set(['table', 'thead', 'tbody', 'tfoot', 'tr', 'td', 'th', 'caption', 'colgroup', 'col']);
|
|
14
|
+
function canonicalName(name) {
|
|
15
|
+
switch (name) {
|
|
16
|
+
case 'strong':
|
|
17
|
+
return 'b';
|
|
18
|
+
case 'em':
|
|
19
|
+
return 'i';
|
|
20
|
+
case 'del':
|
|
21
|
+
case 'strike':
|
|
22
|
+
return 's';
|
|
23
|
+
case 'ins':
|
|
24
|
+
return 'u';
|
|
25
|
+
case 'pre':
|
|
26
|
+
return 'codeblock';
|
|
27
|
+
default:
|
|
28
|
+
return name;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function classifyTag(name) {
|
|
32
|
+
if (INLINE_TAGS.has(name)) return 'inline';
|
|
33
|
+
if (BLOCK_TAGS.has(name)) return 'block';
|
|
34
|
+
if (SELF_CLOSING_TAGS.has(name)) return 'self-closing';
|
|
35
|
+
if (PASS_TAGS.has(name)) return 'pass';
|
|
36
|
+
return 'skip';
|
|
37
|
+
}
|
|
38
|
+
function isElement(node) {
|
|
39
|
+
return !!node && node.nodeType === Node.ELEMENT_NODE;
|
|
40
|
+
}
|
|
41
|
+
function isText(node) {
|
|
42
|
+
return !!node && node.nodeType === Node.TEXT_NODE;
|
|
43
|
+
}
|
|
44
|
+
function tagName(node) {
|
|
45
|
+
if (!isElement(node)) return null;
|
|
46
|
+
return node.tagName.toLowerCase();
|
|
47
|
+
}
|
|
48
|
+
function isListNode(node) {
|
|
49
|
+
const n = tagName(node);
|
|
50
|
+
return n === 'ul' || n === 'ol';
|
|
51
|
+
}
|
|
52
|
+
function isBlockquoteNode(node) {
|
|
53
|
+
return tagName(node) === 'blockquote';
|
|
54
|
+
}
|
|
55
|
+
function isBrNode(node) {
|
|
56
|
+
return tagName(node) === 'br';
|
|
57
|
+
}
|
|
58
|
+
function isBlockProducing(node) {
|
|
59
|
+
const n = tagName(node);
|
|
60
|
+
if (!n) return false;
|
|
61
|
+
if (classifyTag(n) === 'block') return true;
|
|
62
|
+
return n === 'div' || n === 'table' || n === 'tr';
|
|
63
|
+
}
|
|
64
|
+
function isPurelyInline(node) {
|
|
65
|
+
for (const child of Array.from(node.childNodes)) {
|
|
66
|
+
if (isBlockProducing(child)) return false;
|
|
67
|
+
}
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
function hasBlockOrBqChild(node) {
|
|
71
|
+
for (const child of Array.from(node.childNodes)) {
|
|
72
|
+
if (isBlockProducing(child) || isBlockquoteNode(child)) return true;
|
|
73
|
+
}
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
function findCssValue(style, prop) {
|
|
77
|
+
// Returns the value of the last declaration with this property name.
|
|
78
|
+
// Mirrors GumboNormalizer's find_css_value scanning behavior.
|
|
79
|
+
const re = new RegExp(`(?:^|;)\\s*${prop.replace(/[-/\\^$*+?.()|[\\]{}]/g, '\\$&')}\\s*:\\s*([^;]*)`, 'i');
|
|
80
|
+
const m = re.exec(style);
|
|
81
|
+
if (m !== null) {
|
|
82
|
+
return (m[1] ?? '').trim();
|
|
83
|
+
}
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
function findAllCssValues(style, prop) {
|
|
87
|
+
const re = new RegExp(`(?:^|;)\\s*${prop.replace(/[-/\\^$*+?.()|[\\]{}]/g, '\\$&')}\\s*:\\s*([^;]*)`, 'gi');
|
|
88
|
+
const out = [];
|
|
89
|
+
let m;
|
|
90
|
+
while ((m = re.exec(style)) !== null) {
|
|
91
|
+
out.push((m[1] ?? '').trim());
|
|
92
|
+
}
|
|
93
|
+
return out;
|
|
94
|
+
}
|
|
95
|
+
function parseCssStyle(style) {
|
|
96
|
+
const result = {
|
|
97
|
+
bold: false,
|
|
98
|
+
italic: false,
|
|
99
|
+
underline: false,
|
|
100
|
+
strikethrough: false
|
|
101
|
+
};
|
|
102
|
+
if (!style) return result;
|
|
103
|
+
const fw = findCssValue(style, 'font-weight');
|
|
104
|
+
if (fw) {
|
|
105
|
+
const lower = fw.toLowerCase();
|
|
106
|
+
if (lower.includes('bold') || lower.includes('bolder')) {
|
|
107
|
+
result.bold = true;
|
|
108
|
+
} else {
|
|
109
|
+
const num = parseInt(fw, 10);
|
|
110
|
+
if (!Number.isNaN(num) && num >= 700) result.bold = true;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
const fs = findCssValue(style, 'font-style');
|
|
114
|
+
if (fs) {
|
|
115
|
+
const lower = fs.toLowerCase();
|
|
116
|
+
if (lower.includes('italic') || lower.includes('oblique')) result.italic = true;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// text-decoration / text-decoration-line: scan ALL declarations
|
|
120
|
+
const decorations = [...findAllCssValues(style, 'text-decoration-line'), ...findAllCssValues(style, 'text-decoration')];
|
|
121
|
+
for (const v of decorations) {
|
|
122
|
+
const lower = v.toLowerCase();
|
|
123
|
+
if (lower.includes('underline')) result.underline = true;
|
|
124
|
+
if (lower.includes('line-through')) result.strikethrough = true;
|
|
125
|
+
}
|
|
126
|
+
return result;
|
|
127
|
+
}
|
|
128
|
+
function extraStyles(s, tag) {
|
|
129
|
+
return {
|
|
130
|
+
bold: s.bold && tag !== 'b',
|
|
131
|
+
italic: s.italic && tag !== 'i',
|
|
132
|
+
underline: s.underline && tag !== 'u',
|
|
133
|
+
strikethrough: s.strikethrough && tag !== 's'
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function emitStylesOpen(s) {
|
|
137
|
+
let out = '';
|
|
138
|
+
if (s.bold) out += '<b>';
|
|
139
|
+
if (s.italic) out += '<i>';
|
|
140
|
+
if (s.underline) out += '<u>';
|
|
141
|
+
if (s.strikethrough) out += '<s>';
|
|
142
|
+
return out;
|
|
143
|
+
}
|
|
144
|
+
function emitStylesClose(s) {
|
|
145
|
+
let out = '';
|
|
146
|
+
if (s.strikethrough) out += '</s>';
|
|
147
|
+
if (s.underline) out += '</u>';
|
|
148
|
+
if (s.italic) out += '</i>';
|
|
149
|
+
if (s.bold) out += '</b>';
|
|
150
|
+
return out;
|
|
151
|
+
}
|
|
152
|
+
function emitOneAttr(el, attr) {
|
|
153
|
+
const val = el.getAttribute(attr);
|
|
154
|
+
if (val == null || val === '') return '';
|
|
155
|
+
const escaped = escapeText(val);
|
|
156
|
+
return ` ${attr}="${escaped}"`;
|
|
157
|
+
}
|
|
158
|
+
function emitAttributes(el, name) {
|
|
159
|
+
switch (name) {
|
|
160
|
+
case 'a':
|
|
161
|
+
return emitOneAttr(el, 'href');
|
|
162
|
+
case 'img':
|
|
163
|
+
return emitOneAttr(el, 'src') + emitOneAttr(el, 'alt') + emitOneAttr(el, 'width') + emitOneAttr(el, 'height');
|
|
164
|
+
case 'ul':
|
|
165
|
+
return isCheckboxList(el) ? ' data-type="checkbox"' : '';
|
|
166
|
+
case 'li':
|
|
167
|
+
// "" is U+F0FE (MS Word checked box); often encoded as "\xEF\x83\xBE" in UTF-8.
|
|
168
|
+
const isChecked = el.hasAttribute('checked') || el.getAttribute('data-checked') === 'true' || el.getAttribute('aria-checked') === 'true' || el.getAttribute('data-leveltext') === ''; // MS Word checked box
|
|
169
|
+
return isChecked ? ' checked' : '';
|
|
170
|
+
case 'mention':
|
|
171
|
+
return emitOneAttr(el, 'id') + emitOneAttr(el, 'text') + emitOneAttr(el, 'indicator');
|
|
172
|
+
default:
|
|
173
|
+
return '';
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
function isCheckboxList(el) {
|
|
177
|
+
if (el.getAttribute('data-type') === 'checkbox' || el.getAttribute('data-type') === 'checkboxList') {
|
|
178
|
+
return true;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// In Google Docs and MS Word the <li> elements define if it is a checkbox
|
|
182
|
+
// list. We only need to check the first <li>.
|
|
183
|
+
const firstLi = Array.from(el.children).find(c => c.tagName.toLowerCase() === 'li');
|
|
184
|
+
if (firstLi) {
|
|
185
|
+
const role = firstLi.getAttribute('role');
|
|
186
|
+
const className = firstLi.getAttribute('class') || '';
|
|
187
|
+
|
|
188
|
+
// Matches Google Docs (role="checkbox") OR MS Word (class includes "checklist")
|
|
189
|
+
if (role === 'checkbox' || className.includes('checklist')) {
|
|
190
|
+
return true;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
function isGoogleDocsWrapper(el, tag) {
|
|
196
|
+
if (tag !== 'b') return false;
|
|
197
|
+
const id = el.getAttribute('id');
|
|
198
|
+
return !!id && id.startsWith('docs-internal-guid-') && id.length > 20;
|
|
199
|
+
}
|
|
200
|
+
function escapeText(s) {
|
|
201
|
+
return s.replace(/[&<>"']/g, match => {
|
|
202
|
+
switch (match) {
|
|
203
|
+
case '&':
|
|
204
|
+
return '&';
|
|
205
|
+
case '<':
|
|
206
|
+
return '<';
|
|
207
|
+
case '>':
|
|
208
|
+
return '>';
|
|
209
|
+
case '"':
|
|
210
|
+
return '"';
|
|
211
|
+
case "'":
|
|
212
|
+
return ''';
|
|
213
|
+
default:
|
|
214
|
+
return match;
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// --- Blockquote content flattening ---
|
|
220
|
+
|
|
221
|
+
function flushInlineP(ib, out) {
|
|
222
|
+
if (ib.buf.length > 0) {
|
|
223
|
+
out.buf += `<p>${ib.buf}</p>`;
|
|
224
|
+
ib.buf = '';
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
function flattenBqChildren(node, ib, out) {
|
|
228
|
+
for (const child of Array.from(node.childNodes)) {
|
|
229
|
+
flattenBqNode(child, ib, out);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
function flattenBqNode(node, ib, out) {
|
|
233
|
+
if (isText(node)) {
|
|
234
|
+
const t = node.textContent ?? '';
|
|
235
|
+
ib.buf += escapeText(t);
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
if (!isElement(node)) return;
|
|
239
|
+
if (isBrNode(node)) {
|
|
240
|
+
flushInlineP(ib, out);
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
if (isBlockProducing(node) || isBlockquoteNode(node)) {
|
|
244
|
+
flushInlineP(ib, out);
|
|
245
|
+
flattenBqChildren(node, ib, out);
|
|
246
|
+
flushInlineP(ib, out);
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
walkNode(node, ib);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// --- List item content flattening ---
|
|
253
|
+
|
|
254
|
+
function flushLiBuffer(ib, out, ctx) {
|
|
255
|
+
if (ib.buf.length === 0) return;
|
|
256
|
+
out.buf += `<li${emitAttributes(ctx.el, 'li')}>`;
|
|
257
|
+
out.buf += emitStylesOpen(ctx.styles);
|
|
258
|
+
out.buf += ib.buf;
|
|
259
|
+
out.buf += emitStylesClose(ctx.styles);
|
|
260
|
+
out.buf += '</li>';
|
|
261
|
+
ib.buf = '';
|
|
262
|
+
ctx.hasEmitted = true;
|
|
263
|
+
}
|
|
264
|
+
function flattenLiChildren(node, ib, out, ctx) {
|
|
265
|
+
for (const child of Array.from(node.childNodes)) {
|
|
266
|
+
flattenLiNode(child, ib, out, ctx);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
function flattenLiNode(node, ib, out, ctx) {
|
|
270
|
+
if (isText(node)) {
|
|
271
|
+
ib.buf += escapeText(node.textContent ?? '');
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
if (!isElement(node)) return;
|
|
275
|
+
if (tagName(node) === 'img') {
|
|
276
|
+
const role = ctx.el.getAttribute('role');
|
|
277
|
+
// strip the <img> that Google Docs uses for the display of a checkbox icon
|
|
278
|
+
if (role === 'checkbox') {
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
if (isListNode(node)) {
|
|
283
|
+
ctx.nestedLists.push(node);
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
if (isBrNode(node)) {
|
|
287
|
+
flushLiBuffer(ib, out, ctx);
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
if (isBlockProducing(node) || isBlockquoteNode(node)) {
|
|
291
|
+
flushLiBuffer(ib, out, ctx);
|
|
292
|
+
flattenLiChildren(node, ib, out, ctx);
|
|
293
|
+
flushLiBuffer(ib, out, ctx);
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
walkNode(node, ib);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// --- Main walker ---
|
|
300
|
+
|
|
301
|
+
function walkChildren(node, out) {
|
|
302
|
+
const children = Array.from(node.childNodes);
|
|
303
|
+
const parentIsList = isListNode(node);
|
|
304
|
+
let hasBlock = false;
|
|
305
|
+
for (const c of children) {
|
|
306
|
+
if (isBlockProducing(c)) {
|
|
307
|
+
hasBlock = true;
|
|
308
|
+
break;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
let i = 0;
|
|
312
|
+
while (i < children.length) {
|
|
313
|
+
const child = children[i];
|
|
314
|
+
|
|
315
|
+
// Flatten list-inside-list
|
|
316
|
+
if (parentIsList && isElement(child) && isListNode(child)) {
|
|
317
|
+
walkChildren(child, out);
|
|
318
|
+
i++;
|
|
319
|
+
continue;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// Merge consecutive blockquotes
|
|
323
|
+
if (isElement(child) && isBlockquoteNode(child)) {
|
|
324
|
+
out.buf += '<blockquote>';
|
|
325
|
+
const bqIb = {
|
|
326
|
+
buf: ''
|
|
327
|
+
};
|
|
328
|
+
while (i < children.length) {
|
|
329
|
+
const cur = children[i];
|
|
330
|
+
if (!cur || !isElement(cur) || !isBlockquoteNode(cur)) break;
|
|
331
|
+
flattenBqChildren(cur, bqIb, out);
|
|
332
|
+
i++;
|
|
333
|
+
}
|
|
334
|
+
flushInlineP(bqIb, out);
|
|
335
|
+
out.buf += '</blockquote>';
|
|
336
|
+
continue;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// Auto-paragraph: group inline runs into <p> when mixed with blocks
|
|
340
|
+
if (hasBlock && !parentIsList && !isBlockProducing(child) && !(isElement(child) && isBlockquoteNode(child))) {
|
|
341
|
+
const ib = {
|
|
342
|
+
buf: ''
|
|
343
|
+
};
|
|
344
|
+
while (i < children.length) {
|
|
345
|
+
const cur = children[i];
|
|
346
|
+
if (isBlockProducing(cur) || isElement(cur) && isBlockquoteNode(cur)) {
|
|
347
|
+
break;
|
|
348
|
+
}
|
|
349
|
+
if (isElement(cur) && isBrNode(cur)) {
|
|
350
|
+
if (ib.buf.length > 0) {
|
|
351
|
+
flushInlineP(ib, out);
|
|
352
|
+
} else {
|
|
353
|
+
out.buf += '<br>';
|
|
354
|
+
}
|
|
355
|
+
i++;
|
|
356
|
+
continue;
|
|
357
|
+
}
|
|
358
|
+
// Transparent inline wrapper for block/bq children
|
|
359
|
+
if (isElement(cur) && hasBlockOrBqChild(cur)) {
|
|
360
|
+
flushInlineP(ib, out);
|
|
361
|
+
walkChildren(cur, out);
|
|
362
|
+
i++;
|
|
363
|
+
continue;
|
|
364
|
+
}
|
|
365
|
+
walkNode(cur, ib);
|
|
366
|
+
i++;
|
|
367
|
+
}
|
|
368
|
+
flushInlineP(ib, out);
|
|
369
|
+
continue;
|
|
370
|
+
}
|
|
371
|
+
walkNode(child, out);
|
|
372
|
+
i++;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
function walkNode(node, out) {
|
|
376
|
+
if (isText(node)) {
|
|
377
|
+
out.buf += escapeText(node.textContent ?? '');
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
if (!isElement(node)) return;
|
|
381
|
+
const name = node.tagName.toLowerCase();
|
|
382
|
+
if (STRIPPED_TAGS.has(name)) return;
|
|
383
|
+
if (isGoogleDocsWrapper(node, name)) {
|
|
384
|
+
walkChildren(node, out);
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
const outName = canonicalName(name);
|
|
388
|
+
const cls = classifyTag(name);
|
|
389
|
+
|
|
390
|
+
// <span>: CSS style → inline tags
|
|
391
|
+
if (name === 'span') {
|
|
392
|
+
const s = parseCssStyle(node.getAttribute('style'));
|
|
393
|
+
out.buf += emitStylesOpen(s);
|
|
394
|
+
walkChildren(node, out);
|
|
395
|
+
out.buf += emitStylesClose(s);
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// <div>: becomes <p> or passes through
|
|
400
|
+
if (name === 'div') {
|
|
401
|
+
const s = parseCssStyle(node.getAttribute('style'));
|
|
402
|
+
if (isPurelyInline(node)) {
|
|
403
|
+
const pb = {
|
|
404
|
+
buf: ''
|
|
405
|
+
};
|
|
406
|
+
for (const dc of Array.from(node.childNodes)) {
|
|
407
|
+
if (isElement(dc) && isBrNode(dc)) {
|
|
408
|
+
if (pb.buf.length > 0) {
|
|
409
|
+
out.buf += `<p>${emitStylesOpen(s)}${pb.buf}${emitStylesClose(s)}</p>`;
|
|
410
|
+
} else {
|
|
411
|
+
out.buf += '<br>';
|
|
412
|
+
}
|
|
413
|
+
pb.buf = '';
|
|
414
|
+
continue;
|
|
415
|
+
}
|
|
416
|
+
walkNode(dc, pb);
|
|
417
|
+
}
|
|
418
|
+
if (pb.buf.length > 0) {
|
|
419
|
+
out.buf += `<p>${emitStylesOpen(s)}${pb.buf}${emitStylesClose(s)}</p>`;
|
|
420
|
+
}
|
|
421
|
+
} else {
|
|
422
|
+
out.buf += emitStylesOpen(s);
|
|
423
|
+
walkChildren(node, out);
|
|
424
|
+
out.buf += emitStylesClose(s);
|
|
425
|
+
}
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
// Table elements
|
|
430
|
+
if (TABLE_TAGS.has(name)) {
|
|
431
|
+
if (name === 'td' || name === 'th') {
|
|
432
|
+
walkChildren(node, out);
|
|
433
|
+
// Append space if there is a next element sibling
|
|
434
|
+
let sib = node.nextSibling;
|
|
435
|
+
while (sib && !isElement(sib)) sib = sib.nextSibling;
|
|
436
|
+
if (sib) out.buf += ' ';
|
|
437
|
+
} else if (name === 'tr') {
|
|
438
|
+
const row = {
|
|
439
|
+
buf: ''
|
|
440
|
+
};
|
|
441
|
+
walkChildren(node, row);
|
|
442
|
+
if (row.buf.length > 0) {
|
|
443
|
+
out.buf += `<p>${row.buf}</p>`;
|
|
444
|
+
}
|
|
445
|
+
} else {
|
|
446
|
+
walkChildren(node, out);
|
|
447
|
+
}
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
if (cls === 'pass' || cls === 'skip') {
|
|
451
|
+
walkChildren(node, out);
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
if (cls === 'self-closing') {
|
|
455
|
+
out.buf += `<${outName}${emitAttributes(node, outName)}`;
|
|
456
|
+
out.buf += outName === 'img' ? ' />' : '>';
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
// inline or block
|
|
461
|
+
const es = extraStyles(parseCssStyle(node.getAttribute('style')), outName);
|
|
462
|
+
|
|
463
|
+
// <li>: flatten
|
|
464
|
+
if (outName === 'li') {
|
|
465
|
+
const nestedLists = [];
|
|
466
|
+
const liIb = {
|
|
467
|
+
buf: ''
|
|
468
|
+
};
|
|
469
|
+
const ctx = {
|
|
470
|
+
el: node,
|
|
471
|
+
styles: es,
|
|
472
|
+
nestedLists,
|
|
473
|
+
hasEmitted: false
|
|
474
|
+
};
|
|
475
|
+
flattenLiChildren(node, liIb, out, ctx);
|
|
476
|
+
flushLiBuffer(liIb, out, ctx);
|
|
477
|
+
|
|
478
|
+
// if nothing emitted - the <li> is empty, we add it manually
|
|
479
|
+
if (!ctx.hasEmitted) {
|
|
480
|
+
out.buf += `<li${emitAttributes(ctx.el, 'li')}></li>`;
|
|
481
|
+
}
|
|
482
|
+
for (const nl of nestedLists) walkChildren(nl, out);
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
// <codeblock>: wrap inline content in <p>
|
|
487
|
+
if (outName === 'codeblock') {
|
|
488
|
+
const wrap = isPurelyInline(node);
|
|
489
|
+
out.buf += '<codeblock>';
|
|
490
|
+
if (wrap) out.buf += '<p>';
|
|
491
|
+
walkChildren(node, out);
|
|
492
|
+
if (wrap) out.buf += '</p>';
|
|
493
|
+
out.buf += '</codeblock>';
|
|
494
|
+
return;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
// Generic block/inline
|
|
498
|
+
out.buf += `<${outName}${emitAttributes(node, outName)}>`;
|
|
499
|
+
out.buf += emitStylesOpen(es);
|
|
500
|
+
walkChildren(node, out);
|
|
501
|
+
out.buf += emitStylesClose(es);
|
|
502
|
+
out.buf += `</${outName}>`;
|
|
503
|
+
}
|
|
504
|
+
export function normalizeHtml(html) {
|
|
505
|
+
const parser = new DOMParser();
|
|
506
|
+
const doc = parser.parseFromString(`<body>${html}</body>`, 'text/html');
|
|
507
|
+
const body = doc.body;
|
|
508
|
+
const out = {
|
|
509
|
+
buf: ''
|
|
510
|
+
};
|
|
511
|
+
walkChildren(body, out);
|
|
512
|
+
return out.buf;
|
|
513
|
+
}
|
|
514
|
+
//# sourceMappingURL=htmlNormalizer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["INLINE_TAGS","Set","BLOCK_TAGS","SELF_CLOSING_TAGS","PASS_TAGS","STRIPPED_TAGS","TABLE_TAGS","canonicalName","name","classifyTag","has","isElement","node","nodeType","Node","ELEMENT_NODE","isText","TEXT_NODE","tagName","toLowerCase","isListNode","n","isBlockquoteNode","isBrNode","isBlockProducing","isPurelyInline","child","Array","from","childNodes","hasBlockOrBqChild","findCssValue","style","prop","re","RegExp","replace","m","exec","trim","findAllCssValues","out","push","parseCssStyle","result","bold","italic","underline","strikethrough","fw","lower","includes","num","parseInt","Number","isNaN","fs","decorations","v","extraStyles","s","tag","emitStylesOpen","emitStylesClose","emitOneAttr","el","attr","val","getAttribute","escaped","escapeText","emitAttributes","isCheckboxList","isChecked","hasAttribute","firstLi","children","find","c","role","className","isGoogleDocsWrapper","id","startsWith","length","match","flushInlineP","ib","buf","flattenBqChildren","flattenBqNode","t","textContent","walkNode","flushLiBuffer","ctx","styles","hasEmitted","flattenLiChildren","flattenLiNode","nestedLists","walkChildren","parentIsList","hasBlock","i","bqIb","cur","outName","cls","pb","dc","sib","nextSibling","row","es","liIb","nl","wrap","normalizeHtml","html","parser","DOMParser","doc","parseFromString","body"],"sourceRoot":"../../../../src","sources":["web/normalization/htmlNormalizer.ts"],"mappings":";;AAAA;AACA;AACA;AACA;;AASA,MAAMA,WAAW,GAAG,IAAIC,GAAG,CAAC,CAC1B,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,MAAM,EACN,GAAG,EACH,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,KAAK,EACL,SAAS,CACV,CAAC;AAEF,MAAMC,UAAU,GAAG,IAAID,GAAG,CAAC,CACzB,GAAG,EACH,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,WAAW,EACX,KAAK,CACN,CAAC;AAEF,MAAME,iBAAiB,GAAG,IAAIF,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAEhD,MAAMG,SAAS,GAAG,IAAIH,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAEnD,MAAMI,aAAa,GAAG,IAAIJ,GAAG,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAE3E,MAAMK,UAAU,GAAG,IAAIL,GAAG,CAAC,CACzB,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,UAAU,EACV,KAAK,CACN,CAAC;AAEF,SAASM,aAAaA,CAACC,IAAY,EAAU;EAC3C,QAAQA,IAAI;IACV,KAAK,QAAQ;MACX,OAAO,GAAG;IACZ,KAAK,IAAI;MACP,OAAO,GAAG;IACZ,KAAK,KAAK;IACV,KAAK,QAAQ;MACX,OAAO,GAAG;IACZ,KAAK,KAAK;MACR,OAAO,GAAG;IACZ,KAAK,KAAK;MACR,OAAO,WAAW;IACpB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AAI,GAAG5F,cAAc,CAACb,IAAI,CAAC;IACjC6B,GAAG,CAAC+C,GAAG,IAAI,aAAa;IACxB,IAAI6B,IAAI,EAAE5E,GAAG,CAAC+C,GAAG,IAAI,KAAK;IAC1Ba,YAAY,CAACzF,IAAI,EAAE6B,GAAG,CAAC;IACvB,IAAI4E,IAAI,EAAE5E,GAAG,CAAC+C,GAAG,IAAI,MAAM;IAC3B/C,GAAG,CAAC+C,GAAG,IAAI,cAAc;IACzB;EACF;;EAEA;EACA/C,GAAG,CAAC+C,GAAG,IAAI,IAAImB,OAAO,GAAGpC,cAAc,CAAC3D,IAAI,EAAE+F,OAAO,CAAC,GAAG;EACzDlE,GAAG,CAAC+C,GAAG,IAAI1B,cAAc,CAACoD,EAAE,CAAC;EAC7Bb,YAAY,CAACzF,IAAI,EAAE6B,GAAG,CAAC;EACvBA,GAAG,CAAC+C,GAAG,IAAIzB,eAAe,CAACmD,EAAE,CAAC;EAC9BzE,GAAG,CAAC+C,GAAG,IAAI,KAAKmB,OAAO,GAAG;AAC5B;AAEA,OAAO,SAASW,aAAaA,CAACC,IAAY,EAAU;EAClD,MAAMC,MAAM,GAAG,IAAIC,SAAS,CAAC,CAAC;EAC9B,MAAMC,GAAG,GAAGF,MAAM,CAACG,eAAe,CAAC,SAASJ,IAAI,SAAS,EAAE,WAAW,CAAC;EACvE,MAAMK,IAAI,GAAGF,GAAG,CAACE,IAAI;EACrB,MAAMnF,GAAG,GAAG;IAAE+C,GAAG,EAAE;EAAG,CAAC;EACvBa,YAAY,CAACuB,IAAI,EAAEnF,GAAG,CAAC;EACvB,OAAOA,GAAG,CAAC+C,GAAG;AAChB","ignoreList":[]}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export function prepareHtmlForWeb(html) {
|
|
4
|
+
if (typeof DOMParser === 'undefined') return html;
|
|
5
|
+
const parser = new DOMParser();
|
|
6
|
+
const doc = parser.parseFromString(html, 'text/html');
|
|
7
|
+
wrapBareLiContentInParagraph(doc);
|
|
8
|
+
checkboxHtmlToWeb(doc);
|
|
9
|
+
return doc.body.innerHTML;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/*
|
|
13
|
+
* Native list format:
|
|
14
|
+
* <ul>
|
|
15
|
+
* <li>foo</li>
|
|
16
|
+
* <li></li>
|
|
17
|
+
* </ul>
|
|
18
|
+
*
|
|
19
|
+
* Web-native, with <p> wrappers to display the content correctly:
|
|
20
|
+
* <ul>
|
|
21
|
+
* <li>
|
|
22
|
+
* <p>foo</p>
|
|
23
|
+
* </li>
|
|
24
|
+
* <li>
|
|
25
|
+
* <p></p>
|
|
26
|
+
* </li>
|
|
27
|
+
* </ul>
|
|
28
|
+
*/
|
|
29
|
+
function wrapBareLiContentInParagraph(doc) {
|
|
30
|
+
// Target only standard lists (ignore checkbox lists, as they get wrapped in <label> later)
|
|
31
|
+
const listItems = doc.querySelectorAll('ul:not([data-type="checkbox"]) > li, ol > li');
|
|
32
|
+
listItems.forEach(li => {
|
|
33
|
+
if (li.firstElementChild?.tagName.toUpperCase() === 'P') return;
|
|
34
|
+
const nodesToWrap = [];
|
|
35
|
+
const childNodes = Array.from(li.childNodes);
|
|
36
|
+
for (const node of childNodes) {
|
|
37
|
+
if (node.nodeType === Node.ELEMENT_NODE && ['UL', 'OL'].includes(node.tagName.toUpperCase())) {
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
nodesToWrap.push(node);
|
|
41
|
+
}
|
|
42
|
+
if (nodesToWrap.length === 0 && childNodes.length > 0) return;
|
|
43
|
+
const p = doc.createElement('p');
|
|
44
|
+
li.insertBefore(p, childNodes[0] || null);
|
|
45
|
+
nodesToWrap.forEach(node => p.appendChild(node));
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/*
|
|
50
|
+
* Native checkbox format (as produced by the editor):
|
|
51
|
+
* <ul data-type="checkbox">
|
|
52
|
+
* <li checked>foo</li>
|
|
53
|
+
* <li>bar</li>
|
|
54
|
+
* </ul>
|
|
55
|
+
*
|
|
56
|
+
* Web-native, display-only format:
|
|
57
|
+
* <ul data-type="checkbox">
|
|
58
|
+
* <li>
|
|
59
|
+
* <input type="checkbox" checked>
|
|
60
|
+
* <label>foo</label>
|
|
61
|
+
* </li>
|
|
62
|
+
* <li>
|
|
63
|
+
* <input type="checkbox">
|
|
64
|
+
* <label>bar</label>
|
|
65
|
+
* </li>
|
|
66
|
+
* </ul>
|
|
67
|
+
*/
|
|
68
|
+
function checkboxHtmlToWeb(doc) {
|
|
69
|
+
doc.querySelectorAll('ul[data-type="checkbox"]').forEach(ul => {
|
|
70
|
+
ul.querySelectorAll('li').forEach(li => {
|
|
71
|
+
const checked = li.hasAttribute('checked');
|
|
72
|
+
const labelContent = li.innerHTML;
|
|
73
|
+
li.removeAttribute('checked');
|
|
74
|
+
li.innerHTML = `<input type="checkbox"${checked ? ' checked' : ''}>` + `<label>${labelContent}</label>`;
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=prepareHtmlForWeb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["prepareHtmlForWeb","html","DOMParser","parser","doc","parseFromString","wrapBareLiContentInParagraph","checkboxHtmlToWeb","body","innerHTML","listItems","querySelectorAll","forEach","li","firstElementChild","tagName","toUpperCase","nodesToWrap","childNodes","Array","from","node","nodeType","Node","ELEMENT_NODE","includes","push","length","p","createElement","insertBefore","appendChild","ul","checked","hasAttribute","labelContent","removeAttribute"],"sourceRoot":"../../../../src","sources":["web/normalization/prepareHtmlForWeb.ts"],"mappings":";;AAAA,OAAO,SAASA,iBAAiBA,CAACC,IAAY,EAAU;EACtD,IAAI,OAAOC,SAAS,KAAK,WAAW,EAAE,OAAOD,IAAI;EAEjD,MAAME,MAAM,GAAG,IAAID,SAAS,CAAC,CAAC;EAC9B,MAAME,GAAG,GAAGD,MAAM,CAACE,eAAe,CAACJ,I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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASd,iBAAiBA,CAACH,GAAa,EAAE;EACxCA,GAAG,CAACO,gBAAgB,CAAC,0BAA0B,CAAC,CAACC,OAAO,CAAEoB,EAAE,IAAK;IAC/DA,EAAE,CAACrB,gBAAgB,CAAC,IAAI,CAAC,CAACC,OAAO,CAAEC,EAAE,IAAK;MACxC,MAAMoB,OAAO,GAAGpB,EAAE,CAACqB,YAAY,CAAC,SAAS,CAAC;MAC1C,MAAMC,YAAY,GAAGtB,EAAE,CAACJ,SAAS;MAEjCI,EAAE,CAACuB,eAAe,CAAC,SAAS,CAAC;MAC7BvB,EAAE,CAACJ,SAAS,GACV,yBAAyBwB,OAAO,GAAG,UAAU,GAAG,EAAE,GAAG,GACrD,UAAUE,YAAY,UAAU;IACpC,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { checkboxHtmlForTiptap, checkboxHtmlFromTiptap } from "./checkboxHtmlNormalizer.js";
|
|
4
|
+
import { normalizeHtml } from "./htmlNormalizer.js";
|
|
5
|
+
export function prepareHtmlForTiptap(html, useHtmlNormalizer) {
|
|
6
|
+
if (useHtmlNormalizer) {
|
|
7
|
+
html = normalizeHtml(html);
|
|
8
|
+
}
|
|
9
|
+
html = checkboxHtmlForTiptap(html);
|
|
10
|
+
html = html.replace(/<br\s*\/?>/gi, '<p></p>');
|
|
11
|
+
return html;
|
|
12
|
+
}
|
|
13
|
+
export function normalizeHtmlFromTiptap(html) {
|
|
14
|
+
html = checkboxHtmlFromTiptap(html);
|
|
15
|
+
|
|
16
|
+
// Strip <p> wrappers inside <li> elements.
|
|
17
|
+
// TipTap renders <li><p>text</p></li> but native expects <li>text</li>.
|
|
18
|
+
// This regex is safe because EnrichedListItem.content is 'paragraph', which
|
|
19
|
+
// prevents TipTap from ever emitting nested lists
|
|
20
|
+
html = html.replace(/<li([^>]*)>\s*<p[^>]*>(.*?)<\/p>\s*<\/li>/gs, '<li$1>$2</li>');
|
|
21
|
+
|
|
22
|
+
// Convert remaining empty <p></p> to <br> (outside of lists)
|
|
23
|
+
html = html.replace(/<p><\/p>/g, '<br>');
|
|
24
|
+
|
|
25
|
+
// Convert <img> tags to self-closing tags
|
|
26
|
+
html = html.replace(/<img\b([^>]*)>/gi, (_, attrs) => {
|
|
27
|
+
if (attrs.trimEnd().endsWith('/')) {
|
|
28
|
+
return `<img${attrs}>`;
|
|
29
|
+
}
|
|
30
|
+
return `<img${attrs}/>`;
|
|
31
|
+
});
|
|
32
|
+
return `<html>${html}</html>`;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=tiptapHtmlNormalizer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["checkboxHtmlForTiptap","checkboxHtmlFromTiptap","normalizeHtml","prepareHtmlForTiptap","html","useHtmlNormalizer","replace","normalizeHtmlFromTiptap","_","attrs","trimEnd","endsWith"],"sourceRoot":"../../../../src","sources":["web/normalization/tiptapHtmlNormalizer.ts"],"mappings":";;AAAA,SACEA,qBAAqB,EACrBC,sBAAsB,QACjB,6BAA0B;AACjC,SAASC,aAAa,QAAQ,qBAAkB;AAEhD,OAAO,SAASC,oBAAoBA,CAClCC,IAAY,EACZC,iBAAsC,EAC9B;EACR,IAAIA,iBAAiB,EAAE;IACrBD,IAAI,GAAGF,aAAa,CAACE,IAAI,CAAC;EAC5B;EACAA,IAAI,GAAGJ,qBAAqB,CAACI,IAAI,CAAC;EAClCA,IAAI,GAAGA,IAAI,CAACE,OAAO,CAAC,cAAc,EAAE,SAAS,CAAC;EAC9C,OAAOF,IAAI;AACb;AAEA,OAAO,SAASG,uBAAuBA,CAACH,IAAY,EAAU;EAC5DA,IAAI,GAAGH,sBAAsB,CAACG,IAAI,CAAC;;EAEnC;EACA;EACA;EACA;EACAA,IAAI,GAAGA,IAAI,CAACE,OAAO,CACjB,6CAA6C,EAC7C,eACF,CAAC;;EAED;EACAF,IAAI,GAAGA,IAAI,CAACE,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC;;EAExC;EACAF,IAAI,GAAGA,IAAI,CAACE,OAAO,CAAC,kBAAkB,EAAE,CAACE,CAAC,EAAEC,KAAa,KAAK;IAC5D,IAAIA,KAAK,CAACC,OAAO,CAAC,CAAC,CAACC,QAAQ,CAAC,GAAG,CAAC,EAAE;MACjC,OAAO,OAAOF,KAAK,GAAG;IACxB;IACA,OAAO,OAAOA,KAAK,IAAI;EACzB,CAAC,CAAC;EAEF,OAAO,SAASL,IAAI,SAAS;AAC/B","ignoreList":[]}
|