react-native-enriched-html 0.0.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (666) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +402 -0
  3. package/ReactNativeEnrichedHtml.podspec +31 -0
  4. package/android/build.gradle +106 -0
  5. package/android/generated/java/com/facebook/react/viewmanagers/EnrichedTextInputViewManagerDelegate.java +203 -0
  6. package/android/generated/java/com/facebook/react/viewmanagers/EnrichedTextInputViewManagerInterface.java +74 -0
  7. package/android/generated/java/com/facebook/react/viewmanagers/EnrichedTextViewManagerDelegate.java +70 -0
  8. package/android/generated/java/com/facebook/react/viewmanagers/EnrichedTextViewManagerInterface.java +31 -0
  9. package/android/generated/jni/react/renderer/components/ReactNativeEnrichedSpec/ComponentDescriptors.cpp +22 -0
  10. package/android/generated/jni/react/renderer/components/ReactNativeEnrichedSpec/ComponentDescriptors.h +24 -0
  11. package/android/generated/jni/react/renderer/components/ReactNativeEnrichedSpec/EventEmitters.cpp +456 -0
  12. package/android/generated/jni/react/renderer/components/ReactNativeEnrichedSpec/EventEmitters.h +410 -0
  13. package/android/generated/jni/react/renderer/components/ReactNativeEnrichedSpec/Props.cpp +272 -0
  14. package/android/generated/jni/react/renderer/components/ReactNativeEnrichedSpec/Props.h +1595 -0
  15. package/android/generated/jni/react/renderer/components/ReactNativeEnrichedSpec/ShadowNodes.cpp +17 -0
  16. package/android/generated/jni/react/renderer/components/ReactNativeEnrichedSpec/ShadowNodes.h +23 -0
  17. package/android/generated/jni/react/renderer/components/ReactNativeEnrichedSpec/States.cpp +16 -0
  18. package/android/generated/jni/react/renderer/components/ReactNativeEnrichedSpec/States.h +20 -0
  19. package/android/gradle.properties +5 -0
  20. package/android/lint.gradle +70 -0
  21. package/android/src/main/AndroidManifest.xml +3 -0
  22. package/android/src/main/AndroidManifestNew.xml +2 -0
  23. package/android/src/main/java/com/swmansion/enriched/ReactNativeEnrichedPackage.kt +22 -0
  24. package/android/src/main/java/com/swmansion/enriched/common/AllowFontScaling.kt +36 -0
  25. package/android/src/main/java/com/swmansion/enriched/common/AsyncDrawable.kt +126 -0
  26. package/android/src/main/java/com/swmansion/enriched/common/CheckboxDrawable.kt +81 -0
  27. package/android/src/main/java/com/swmansion/enriched/common/EnrichedConstants.kt +16 -0
  28. package/android/src/main/java/com/swmansion/enriched/common/EnrichedStyle.kt +57 -0
  29. package/android/src/main/java/com/swmansion/enriched/common/ForceRedrawSpan.kt +14 -0
  30. package/android/src/main/java/com/swmansion/enriched/common/GumboNormalizer.kt +5 -0
  31. package/android/src/main/java/com/swmansion/enriched/common/MentionStyle.kt +9 -0
  32. package/android/src/main/java/com/swmansion/enriched/common/ResourceManager.kt +26 -0
  33. package/android/src/main/java/com/swmansion/enriched/common/parser/EnrichedParser.java +1034 -0
  34. package/android/src/main/java/com/swmansion/enriched/common/parser/EnrichedSpanFactory.kt +82 -0
  35. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedAlignmentSpan.kt +19 -0
  36. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedBlockQuoteSpan.kt +53 -0
  37. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedBoldSpan.kt +12 -0
  38. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedCheckboxListSpan.kt +92 -0
  39. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedCodeBlockSpan.kt +81 -0
  40. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedH1Span.kt +20 -0
  41. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedH2Span.kt +20 -0
  42. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedH3Span.kt +20 -0
  43. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedH4Span.kt +21 -0
  44. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedH5Span.kt +20 -0
  45. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedH6Span.kt +20 -0
  46. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedImageSpan.kt +185 -0
  47. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedInlineCodeSpan.kt +24 -0
  48. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedItalicSpan.kt +12 -0
  49. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedLinkSpan.kt +29 -0
  50. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedMentionSpan.kt +35 -0
  51. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedOrderedListSpan.kt +79 -0
  52. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedStrikeThroughSpan.kt +11 -0
  53. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedUnderlineSpan.kt +11 -0
  54. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedUnorderedListSpan.kt +62 -0
  55. package/android/src/main/java/com/swmansion/enriched/common/spans/interfaces/EnrichedBlockSpan.kt +5 -0
  56. package/android/src/main/java/com/swmansion/enriched/common/spans/interfaces/EnrichedHeadingSpan.kt +3 -0
  57. package/android/src/main/java/com/swmansion/enriched/common/spans/interfaces/EnrichedInlineSpan.kt +3 -0
  58. package/android/src/main/java/com/swmansion/enriched/common/spans/interfaces/EnrichedParagraphSpan.kt +5 -0
  59. package/android/src/main/java/com/swmansion/enriched/common/spans/interfaces/EnrichedSpan.kt +3 -0
  60. package/android/src/main/java/com/swmansion/enriched/common/spans/interfaces/EnrichedZeroWidthSpaceSpan.kt +4 -0
  61. package/android/src/main/java/com/swmansion/enriched/text/EnrichedTextMovementMethod.kt +75 -0
  62. package/android/src/main/java/com/swmansion/enriched/text/EnrichedTextSpanFactory.kt +83 -0
  63. package/android/src/main/java/com/swmansion/enriched/text/EnrichedTextStyle.kt +202 -0
  64. package/android/src/main/java/com/swmansion/enriched/text/EnrichedTextView.kt +361 -0
  65. package/android/src/main/java/com/swmansion/enriched/text/EnrichedTextViewManager.kt +157 -0
  66. package/android/src/main/java/com/swmansion/enriched/text/MeasurementStore.kt +170 -0
  67. package/android/src/main/java/com/swmansion/enriched/text/events/OnLinkPressEvent.kt +23 -0
  68. package/android/src/main/java/com/swmansion/enriched/text/events/OnMentionPressEvent.kt +32 -0
  69. package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextAlignmentSpan.kt +14 -0
  70. package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextBlockQuoteSpan.kt +14 -0
  71. package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextBoldSpan.kt +14 -0
  72. package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextCheckboxListSpan.kt +15 -0
  73. package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextCodeBlockSpan.kt +14 -0
  74. package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextH1Span.kt +14 -0
  75. package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextH2Span.kt +14 -0
  76. package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextH3Span.kt +15 -0
  77. package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextH4Span.kt +15 -0
  78. package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextH5Span.kt +14 -0
  79. package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextH6Span.kt +14 -0
  80. package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextImageSpan.kt +57 -0
  81. package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextInlineCodeSpan.kt +14 -0
  82. package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextItalicSpan.kt +14 -0
  83. package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextLinkSpan.kt +41 -0
  84. package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextMentionSpan.kt +63 -0
  85. package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextOrderedListSpan.kt +16 -0
  86. package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextStrikeThroughSpan.kt +15 -0
  87. package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextUnderlineSpan.kt +15 -0
  88. package/android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextUnorderedListSpan.kt +15 -0
  89. package/android/src/main/java/com/swmansion/enriched/text/spans/interfaces/EnrichedTextClickableSpan.kt +9 -0
  90. package/android/src/main/java/com/swmansion/enriched/text/spans/interfaces/EnrichedTextSpan.kt +10 -0
  91. package/android/src/main/java/com/swmansion/enriched/textinput/EnrichedTextInputConnectionWrapper.kt +140 -0
  92. package/android/src/main/java/com/swmansion/enriched/textinput/EnrichedTextInputSpannableFactory.kt +85 -0
  93. package/android/src/main/java/com/swmansion/enriched/textinput/EnrichedTextInputView.kt +1141 -0
  94. package/android/src/main/java/com/swmansion/enriched/textinput/EnrichedTextInputViewLayoutManager.kt +27 -0
  95. package/android/src/main/java/com/swmansion/enriched/textinput/EnrichedTextInputViewManager.kt +500 -0
  96. package/android/src/main/java/com/swmansion/enriched/textinput/MeasurementStore.kt +230 -0
  97. package/android/src/main/java/com/swmansion/enriched/textinput/events/MentionHandler.kt +55 -0
  98. package/android/src/main/java/com/swmansion/enriched/textinput/events/OnChangeHtmlEvent.kt +27 -0
  99. package/android/src/main/java/com/swmansion/enriched/textinput/events/OnChangeSelectionEvent.kt +30 -0
  100. package/android/src/main/java/com/swmansion/enriched/textinput/events/OnChangeStateEvent.kt +21 -0
  101. package/android/src/main/java/com/swmansion/enriched/textinput/events/OnChangeTextEvent.kt +30 -0
  102. package/android/src/main/java/com/swmansion/enriched/textinput/events/OnContextMenuItemPressEvent.kt +35 -0
  103. package/android/src/main/java/com/swmansion/enriched/textinput/events/OnInputBlurEvent.kt +25 -0
  104. package/android/src/main/java/com/swmansion/enriched/textinput/events/OnInputFocusEvent.kt +25 -0
  105. package/android/src/main/java/com/swmansion/enriched/textinput/events/OnInputKeyPressEvent.kt +27 -0
  106. package/android/src/main/java/com/swmansion/enriched/textinput/events/OnLinkDetectedEvent.kt +32 -0
  107. package/android/src/main/java/com/swmansion/enriched/textinput/events/OnMentionDetectedEvent.kt +30 -0
  108. package/android/src/main/java/com/swmansion/enriched/textinput/events/OnMentionEvent.kt +34 -0
  109. package/android/src/main/java/com/swmansion/enriched/textinput/events/OnPasteImagesEvent.kt +47 -0
  110. package/android/src/main/java/com/swmansion/enriched/textinput/events/OnRequestHtmlResultEvent.kt +32 -0
  111. package/android/src/main/java/com/swmansion/enriched/textinput/events/OnSubmitEditingEvent.kt +29 -0
  112. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputAlignmentSpan.kt +14 -0
  113. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputBlockQuoteSpan.kt +14 -0
  114. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputBoldSpan.kt +14 -0
  115. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputCheckboxListSpan.kt +15 -0
  116. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputCodeBlockSpan.kt +14 -0
  117. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputH1Span.kt +14 -0
  118. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputH2Span.kt +14 -0
  119. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputH3Span.kt +14 -0
  120. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputH4Span.kt +14 -0
  121. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputH5Span.kt +14 -0
  122. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputH6Span.kt +14 -0
  123. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputImageSpan.kt +36 -0
  124. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputInlineCodeSpan.kt +14 -0
  125. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputItalicSpan.kt +14 -0
  126. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputLinkSpan.kt +16 -0
  127. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputMentionSpan.kt +18 -0
  128. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputOrderedListSpan.kt +21 -0
  129. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputStrikeThroughSpan.kt +14 -0
  130. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputUnderlineSpan.kt +14 -0
  131. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputUnorderedListSpan.kt +14 -0
  132. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedLineHeightSpan.kt +45 -0
  133. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedSpans.kt +240 -0
  134. package/android/src/main/java/com/swmansion/enriched/textinput/spans/interfaces/EnrichedInputSpan.kt +10 -0
  135. package/android/src/main/java/com/swmansion/enriched/textinput/styles/AlignmentStyles.kt +367 -0
  136. package/android/src/main/java/com/swmansion/enriched/textinput/styles/HtmlStyle.kt +371 -0
  137. package/android/src/main/java/com/swmansion/enriched/textinput/styles/InlineStyles.kt +232 -0
  138. package/android/src/main/java/com/swmansion/enriched/textinput/styles/ListStyles.kt +260 -0
  139. package/android/src/main/java/com/swmansion/enriched/textinput/styles/ParagraphStyles.kt +439 -0
  140. package/android/src/main/java/com/swmansion/enriched/textinput/styles/ParametrizedStyles.kt +408 -0
  141. package/android/src/main/java/com/swmansion/enriched/textinput/utils/EnrichedEditableFactory.kt +17 -0
  142. package/android/src/main/java/com/swmansion/enriched/textinput/utils/EnrichedSelection.kt +340 -0
  143. package/android/src/main/java/com/swmansion/enriched/textinput/utils/EnrichedSpanState.kt +318 -0
  144. package/android/src/main/java/com/swmansion/enriched/textinput/utils/EnrichedSpannable.kt +156 -0
  145. package/android/src/main/java/com/swmansion/enriched/textinput/utils/EnrichedSpannableStringBuilder.kt +59 -0
  146. package/android/src/main/java/com/swmansion/enriched/textinput/utils/RichContentReceiver.kt +127 -0
  147. package/android/src/main/java/com/swmansion/enriched/textinput/utils/ShortcutsHandler.kt +150 -0
  148. package/android/src/main/java/com/swmansion/enriched/textinput/utils/StyleUtils.kt +51 -0
  149. package/android/src/main/java/com/swmansion/enriched/textinput/utils/Utils.kt +106 -0
  150. package/android/src/main/java/com/swmansion/enriched/textinput/watchers/EnrichedSpanWatcher.kt +109 -0
  151. package/android/src/main/java/com/swmansion/enriched/textinput/watchers/EnrichedTextWatcher.kt +106 -0
  152. package/android/src/main/new_arch/CMakeLists.txt +62 -0
  153. package/android/src/main/new_arch/GumboNormalizerJni.cpp +14 -0
  154. package/android/src/main/new_arch/ReactNativeEnrichedSpec.cpp +11 -0
  155. package/android/src/main/new_arch/ReactNativeEnrichedSpec.h +16 -0
  156. package/android/src/main/new_arch/react/renderer/components/ReactNativeEnrichedSpec/EnrichedTextComponentDescriptor.h +32 -0
  157. package/android/src/main/new_arch/react/renderer/components/ReactNativeEnrichedSpec/EnrichedTextInputComponentDescriptor.h +35 -0
  158. package/android/src/main/new_arch/react/renderer/components/ReactNativeEnrichedSpec/EnrichedTextInputMeasurementManager.cpp +53 -0
  159. package/android/src/main/new_arch/react/renderer/components/ReactNativeEnrichedSpec/EnrichedTextInputMeasurementManager.h +25 -0
  160. package/android/src/main/new_arch/react/renderer/components/ReactNativeEnrichedSpec/EnrichedTextInputShadowNode.cpp +35 -0
  161. package/android/src/main/new_arch/react/renderer/components/ReactNativeEnrichedSpec/EnrichedTextInputShadowNode.h +53 -0
  162. package/android/src/main/new_arch/react/renderer/components/ReactNativeEnrichedSpec/EnrichedTextInputState.cpp +9 -0
  163. package/android/src/main/new_arch/react/renderer/components/ReactNativeEnrichedSpec/EnrichedTextInputState.h +24 -0
  164. package/android/src/main/new_arch/react/renderer/components/ReactNativeEnrichedSpec/EnrichedTextMeasurementManager.cpp +45 -0
  165. package/android/src/main/new_arch/react/renderer/components/ReactNativeEnrichedSpec/EnrichedTextMeasurementManager.h +25 -0
  166. package/android/src/main/new_arch/react/renderer/components/ReactNativeEnrichedSpec/EnrichedTextShadowNode.cpp +21 -0
  167. package/android/src/main/new_arch/react/renderer/components/ReactNativeEnrichedSpec/EnrichedTextShadowNode.h +39 -0
  168. package/android/src/main/new_arch/react/renderer/components/ReactNativeEnrichedSpec/conversions.h +44 -0
  169. package/android/src/main/res/drawable/broken_image.xml +10 -0
  170. package/cpp/CMakeLists.txt +50 -0
  171. package/cpp/GumboParser/GumboParser.h +34043 -0
  172. package/cpp/README.md +59 -0
  173. package/cpp/parser/GumboNormalizer.c +915 -0
  174. package/cpp/parser/GumboParser.cpp +16 -0
  175. package/cpp/parser/GumboParser.hpp +23 -0
  176. package/cpp/tests/GumboParserTest.cpp +457 -0
  177. package/ios/EnrichedTextInputView.h +54 -0
  178. package/ios/EnrichedTextInputView.mm +2170 -0
  179. package/ios/EnrichedTextInputViewManager.mm +13 -0
  180. package/ios/EnrichedTextView.h +35 -0
  181. package/ios/EnrichedTextView.mm +806 -0
  182. package/ios/EnrichedTextViewManager.mm +13 -0
  183. package/ios/config/EnrichedConfig.h +114 -0
  184. package/ios/config/EnrichedConfig.mm +727 -0
  185. package/ios/enrichedInputTextView/EnrichedInputTextView.h +6 -0
  186. package/ios/enrichedInputTextView/EnrichedInputTextView.mm +334 -0
  187. package/ios/enrichedTextTextView/EnrichedTextTextView.h +16 -0
  188. package/ios/enrichedTextTextView/EnrichedTextTextView.mm +71 -0
  189. package/ios/extensions/ColorExtension.h +8 -0
  190. package/ios/extensions/ColorExtension.mm +48 -0
  191. package/ios/extensions/FontExtension.h +11 -0
  192. package/ios/extensions/FontExtension.mm +72 -0
  193. package/ios/extensions/ImageExtension.h +33 -0
  194. package/ios/extensions/ImageExtension.mm +176 -0
  195. package/ios/extensions/LayoutManagerExtension.h +6 -0
  196. package/ios/extensions/LayoutManagerExtension.mm +454 -0
  197. package/ios/extensions/StringExtension.h +15 -0
  198. package/ios/extensions/StringExtension.mm +69 -0
  199. package/ios/generated/ReactNativeEnrichedSpec/ComponentDescriptors.cpp +22 -0
  200. package/ios/generated/ReactNativeEnrichedSpec/ComponentDescriptors.h +24 -0
  201. package/ios/generated/ReactNativeEnrichedSpec/EventEmitters.cpp +456 -0
  202. package/ios/generated/ReactNativeEnrichedSpec/EventEmitters.h +410 -0
  203. package/ios/generated/ReactNativeEnrichedSpec/Props.cpp +272 -0
  204. package/ios/generated/ReactNativeEnrichedSpec/Props.h +1595 -0
  205. package/ios/generated/ReactNativeEnrichedSpec/RCTComponentViewHelpers.h +570 -0
  206. package/ios/generated/ReactNativeEnrichedSpec/ShadowNodes.cpp +17 -0
  207. package/ios/generated/ReactNativeEnrichedSpec/ShadowNodes.h +23 -0
  208. package/ios/generated/ReactNativeEnrichedSpec/States.cpp +16 -0
  209. package/ios/generated/ReactNativeEnrichedSpec/States.h +20 -0
  210. package/ios/htmlParser/HtmlParser.h +11 -0
  211. package/ios/htmlParser/HtmlParser.mm +1468 -0
  212. package/ios/inputAttributesManager/InputAttributesManager.h +18 -0
  213. package/ios/inputAttributesManager/InputAttributesManager.mm +222 -0
  214. package/ios/inputHtmlParser/InputHtmlParser.h +10 -0
  215. package/ios/inputHtmlParser/InputHtmlParser.mm +225 -0
  216. package/ios/interfaces/AlignmentEntry.h +9 -0
  217. package/ios/interfaces/AlignmentEntry.mm +4 -0
  218. package/ios/interfaces/AttributeEntry.h +9 -0
  219. package/ios/interfaces/AttributeEntry.mm +4 -0
  220. package/ios/interfaces/BaseStyleProtocol.h +17 -0
  221. package/ios/interfaces/EnrichedTextStyleHeaders.h +62 -0
  222. package/ios/interfaces/EnrichedViewHost.h +26 -0
  223. package/ios/interfaces/ImageAttachment.h +11 -0
  224. package/ios/interfaces/ImageAttachment.mm +107 -0
  225. package/ios/interfaces/ImageData.h +10 -0
  226. package/ios/interfaces/ImageData.mm +4 -0
  227. package/ios/interfaces/LinkData.h +11 -0
  228. package/ios/interfaces/LinkData.mm +43 -0
  229. package/ios/interfaces/LinkRegexConfig.h +19 -0
  230. package/ios/interfaces/LinkRegexConfig.mm +37 -0
  231. package/ios/interfaces/MediaAttachment.h +23 -0
  232. package/ios/interfaces/MediaAttachment.mm +31 -0
  233. package/ios/interfaces/MentionParams.h +8 -0
  234. package/ios/interfaces/MentionParams.mm +4 -0
  235. package/ios/interfaces/MentionStyleProps.h +17 -0
  236. package/ios/interfaces/MentionStyleProps.mm +80 -0
  237. package/ios/interfaces/StyleBase.h +38 -0
  238. package/ios/interfaces/StyleBase.mm +279 -0
  239. package/ios/interfaces/StyleHeaders.h +110 -0
  240. package/ios/interfaces/StylePair.h +9 -0
  241. package/ios/interfaces/StylePair.mm +4 -0
  242. package/ios/interfaces/StyleTypeEnum.h +27 -0
  243. package/ios/interfaces/TextDecorationLineEnum.h +6 -0
  244. package/ios/interfaces/TextDecorationLineEnum.mm +4 -0
  245. package/ios/internals/EnrichedTextComponentDescriptor.h +19 -0
  246. package/ios/internals/EnrichedTextInputViewComponentDescriptor.h +19 -0
  247. package/ios/internals/EnrichedTextInputViewShadowNode.h +44 -0
  248. package/ios/internals/EnrichedTextInputViewShadowNode.mm +103 -0
  249. package/ios/internals/EnrichedTextInputViewState.cpp +10 -0
  250. package/ios/internals/EnrichedTextInputViewState.h +22 -0
  251. package/ios/internals/EnrichedTextViewShadowNode.h +34 -0
  252. package/ios/internals/EnrichedTextViewShadowNode.mm +72 -0
  253. package/ios/internals/EnrichedTextViewState.cpp +7 -0
  254. package/ios/internals/EnrichedTextViewState.h +18 -0
  255. package/ios/styles/AlignmentStyle.mm +203 -0
  256. package/ios/styles/BlockQuoteStyle.mm +54 -0
  257. package/ios/styles/BoldStyle.mm +37 -0
  258. package/ios/styles/CheckboxListStyle.mm +154 -0
  259. package/ios/styles/CodeBlockStyle.mm +49 -0
  260. package/ios/styles/EnrichedTextStyles.mm +61 -0
  261. package/ios/styles/H1Style.mm +20 -0
  262. package/ios/styles/H2Style.mm +20 -0
  263. package/ios/styles/H3Style.mm +20 -0
  264. package/ios/styles/H4Style.mm +20 -0
  265. package/ios/styles/H5Style.mm +20 -0
  266. package/ios/styles/H6Style.mm +20 -0
  267. package/ios/styles/HeadingStyleBase.mm +96 -0
  268. package/ios/styles/ImageStyle.mm +150 -0
  269. package/ios/styles/InlineCodeStyle.mm +65 -0
  270. package/ios/styles/ItalicStyle.mm +37 -0
  271. package/ios/styles/LinkStyle.mm +532 -0
  272. package/ios/styles/MentionStyle.mm +541 -0
  273. package/ios/styles/OrderedListStyle.mm +48 -0
  274. package/ios/styles/StrikethroughStyle.mm +25 -0
  275. package/ios/styles/UnderlineStyle.mm +24 -0
  276. package/ios/styles/UnorderedListStyle.mm +48 -0
  277. package/ios/textHtmlParser/TextHtmlParser.h +10 -0
  278. package/ios/textHtmlParser/TextHtmlParser.mm +181 -0
  279. package/ios/utils/AlignmentUtils.h +20 -0
  280. package/ios/utils/AlignmentUtils.mm +111 -0
  281. package/ios/utils/AttachmentLayoutUtils.h +24 -0
  282. package/ios/utils/AttachmentLayoutUtils.mm +144 -0
  283. package/ios/utils/CheckboxHitTestUtils.h +10 -0
  284. package/ios/utils/CheckboxHitTestUtils.mm +122 -0
  285. package/ios/utils/DotReplacementUtils.h +10 -0
  286. package/ios/utils/DotReplacementUtils.mm +68 -0
  287. package/ios/utils/EnrichedTextTouchHandler.h +14 -0
  288. package/ios/utils/EnrichedTextTouchHandler.mm +152 -0
  289. package/ios/utils/KeyboardUtils.h +7 -0
  290. package/ios/utils/KeyboardUtils.mm +30 -0
  291. package/ios/utils/OccurenceUtils.h +44 -0
  292. package/ios/utils/OccurenceUtils.mm +185 -0
  293. package/ios/utils/ParagraphAttributesUtils.h +18 -0
  294. package/ios/utils/ParagraphAttributesUtils.mm +289 -0
  295. package/ios/utils/RangeUtils.h +12 -0
  296. package/ios/utils/RangeUtils.mm +183 -0
  297. package/ios/utils/ShortcutsUtils.h +21 -0
  298. package/ios/utils/ShortcutsUtils.mm +486 -0
  299. package/ios/utils/StyleUtils.h +33 -0
  300. package/ios/utils/StyleUtils.mm +290 -0
  301. package/ios/utils/TextBlockTapGestureRecognizer.h +17 -0
  302. package/ios/utils/TextBlockTapGestureRecognizer.mm +56 -0
  303. package/ios/utils/TextInsertionUtils.h +17 -0
  304. package/ios/utils/TextInsertionUtils.mm +60 -0
  305. package/ios/utils/TextListsUtils.h +40 -0
  306. package/ios/utils/TextListsUtils.mm +93 -0
  307. package/ios/utils/WeakBox.h +3 -0
  308. package/ios/utils/WeakBox.m +4 -0
  309. package/ios/utils/WordsUtils.h +7 -0
  310. package/ios/utils/WordsUtils.mm +98 -0
  311. package/ios/utils/ZeroWidthSpaceUtils.h +14 -0
  312. package/ios/utils/ZeroWidthSpaceUtils.mm +310 -0
  313. package/lib/module/index.js +4 -0
  314. package/lib/module/index.js.map +1 -0
  315. package/lib/module/index.native.js +7 -0
  316. package/lib/module/index.native.js.map +1 -0
  317. package/lib/module/native/EnrichedText.js +76 -0
  318. package/lib/module/native/EnrichedText.js.map +1 -0
  319. package/lib/module/native/EnrichedTextInput.js +306 -0
  320. package/lib/module/native/EnrichedTextInput.js.map +1 -0
  321. package/lib/module/package.json +1 -0
  322. package/lib/module/spec/EnrichedTextInputNativeComponent.ts +524 -0
  323. package/lib/module/spec/EnrichedTextNativeComponent.ts +110 -0
  324. package/lib/module/types.js +4 -0
  325. package/lib/module/types.js.map +1 -0
  326. package/lib/module/utils/EnrichedTextInputDefaultProps.js +20 -0
  327. package/lib/module/utils/EnrichedTextInputDefaultProps.js.map +1 -0
  328. package/lib/module/utils/defaultHtmlStyle.js +83 -0
  329. package/lib/module/utils/defaultHtmlStyle.js.map +1 -0
  330. package/lib/module/utils/expandMentionStylesForIndicators.js +15 -0
  331. package/lib/module/utils/expandMentionStylesForIndicators.js.map +1 -0
  332. package/lib/module/utils/isMentionStyleRecord.js +10 -0
  333. package/lib/module/utils/isMentionStyleRecord.js.map +1 -0
  334. package/lib/module/utils/normalizeHtmlStyle.js +126 -0
  335. package/lib/module/utils/normalizeHtmlStyle.js.map +1 -0
  336. package/lib/module/utils/nullthrows.js +9 -0
  337. package/lib/module/utils/nullthrows.js.map +1 -0
  338. package/lib/module/utils/regexParser.js +46 -0
  339. package/lib/module/utils/regexParser.js.map +1 -0
  340. package/lib/module/web/EnrichedTextInput.css +201 -0
  341. package/lib/module/web/EnrichedTextInput.js +314 -0
  342. package/lib/module/web/EnrichedTextInput.js.map +1 -0
  343. package/lib/module/web/adaptWebToNativeEvent.js +34 -0
  344. package/lib/module/web/adaptWebToNativeEvent.js.map +1 -0
  345. package/lib/module/web/checkboxHtmlNormalizer.js +54 -0
  346. package/lib/module/web/checkboxHtmlNormalizer.js.map +1 -0
  347. package/lib/module/web/formats/EnrichedBlockquote.js +32 -0
  348. package/lib/module/web/formats/EnrichedBlockquote.js.map +1 -0
  349. package/lib/module/web/formats/EnrichedBold.js +22 -0
  350. package/lib/module/web/formats/EnrichedBold.js.map +1 -0
  351. package/lib/module/web/formats/EnrichedCheckboxItem.js +32 -0
  352. package/lib/module/web/formats/EnrichedCheckboxItem.js.map +1 -0
  353. package/lib/module/web/formats/EnrichedCheckboxList.js +35 -0
  354. package/lib/module/web/formats/EnrichedCheckboxList.js.map +1 -0
  355. package/lib/module/web/formats/EnrichedCode.js +15 -0
  356. package/lib/module/web/formats/EnrichedCode.js.map +1 -0
  357. package/lib/module/web/formats/EnrichedCodeBlock.js +43 -0
  358. package/lib/module/web/formats/EnrichedCodeBlock.js.map +1 -0
  359. package/lib/module/web/formats/EnrichedHeading.js +27 -0
  360. package/lib/module/web/formats/EnrichedHeading.js.map +1 -0
  361. package/lib/module/web/formats/EnrichedImage.js +57 -0
  362. package/lib/module/web/formats/EnrichedImage.js.map +1 -0
  363. package/lib/module/web/formats/EnrichedImageNodeView.js +90 -0
  364. package/lib/module/web/formats/EnrichedImageNodeView.js.map +1 -0
  365. package/lib/module/web/formats/EnrichedItalic.js +22 -0
  366. package/lib/module/web/formats/EnrichedItalic.js.map +1 -0
  367. package/lib/module/web/formats/EnrichedLink.js +140 -0
  368. package/lib/module/web/formats/EnrichedLink.js.map +1 -0
  369. package/lib/module/web/formats/EnrichedListItem.js +19 -0
  370. package/lib/module/web/formats/EnrichedListItem.js.map +1 -0
  371. package/lib/module/web/formats/EnrichedMention.js +50 -0
  372. package/lib/module/web/formats/EnrichedMention.js.map +1 -0
  373. package/lib/module/web/formats/EnrichedOrderedList.js +32 -0
  374. package/lib/module/web/formats/EnrichedOrderedList.js.map +1 -0
  375. package/lib/module/web/formats/EnrichedStrike.js +22 -0
  376. package/lib/module/web/formats/EnrichedStrike.js.map +1 -0
  377. package/lib/module/web/formats/EnrichedUnderline.js +22 -0
  378. package/lib/module/web/formats/EnrichedUnderline.js.map +1 -0
  379. package/lib/module/web/formats/EnrichedUnorderedList.js +33 -0
  380. package/lib/module/web/formats/EnrichedUnorderedList.js.map +1 -0
  381. package/lib/module/web/formats/applyWrappingListToSelection.js +63 -0
  382. package/lib/module/web/formats/applyWrappingListToSelection.js.map +1 -0
  383. package/lib/module/web/formats/formatRules.js +48 -0
  384. package/lib/module/web/formats/formatRules.js.map +1 -0
  385. package/lib/module/web/formats/listKeyboard.js +50 -0
  386. package/lib/module/web/formats/listKeyboard.js.map +1 -0
  387. package/lib/module/web/formats/wrappedBlockKeyboard.js +58 -0
  388. package/lib/module/web/formats/wrappedBlockKeyboard.js.map +1 -0
  389. package/lib/module/web/pasteImages.js +78 -0
  390. package/lib/module/web/pasteImages.js.map +1 -0
  391. package/lib/module/web/pastedImageDimensions.js +49 -0
  392. package/lib/module/web/pastedImageDimensions.js.map +1 -0
  393. package/lib/module/web/pmPlugins/MentionPlugin/index.js +36 -0
  394. package/lib/module/web/pmPlugins/MentionPlugin/index.js.map +1 -0
  395. package/lib/module/web/pmPlugins/MentionPlugin/isCaretInBlockedContext.js +11 -0
  396. package/lib/module/web/pmPlugins/MentionPlugin/isCaretInBlockedContext.js.map +1 -0
  397. package/lib/module/web/pmPlugins/MentionPlugin/makeMentionPluginState.js +67 -0
  398. package/lib/module/web/pmPlugins/MentionPlugin/makeMentionPluginState.js.map +1 -0
  399. package/lib/module/web/pmPlugins/MentionPlugin/mentionPluginKey.js +5 -0
  400. package/lib/module/web/pmPlugins/MentionPlugin/mentionPluginKey.js.map +1 -0
  401. package/lib/module/web/pmPlugins/MentionPlugin/removeMentionMarksIfSpansResized.js +56 -0
  402. package/lib/module/web/pmPlugins/MentionPlugin/removeMentionMarksIfSpansResized.js.map +1 -0
  403. package/lib/module/web/pmPlugins/MentionPlugin/setMention.js +58 -0
  404. package/lib/module/web/pmPlugins/MentionPlugin/setMention.js.map +1 -0
  405. package/lib/module/web/pmPlugins/MentionPlugin/startMention.js +9 -0
  406. package/lib/module/web/pmPlugins/MentionPlugin/startMention.js.map +1 -0
  407. package/lib/module/web/pmPlugins/MentionPlugin/stripPartialMentionMarks.js +9 -0
  408. package/lib/module/web/pmPlugins/MentionPlugin/stripPartialMentionMarks.js.map +1 -0
  409. package/lib/module/web/pmPlugins/MentionPlugin/subscribeMentionEvents.js +100 -0
  410. package/lib/module/web/pmPlugins/MentionPlugin/subscribeMentionEvents.js.map +1 -0
  411. package/lib/module/web/pmPlugins/MentionPlugin/types.js +4 -0
  412. package/lib/module/web/pmPlugins/MentionPlugin/types.js.map +1 -0
  413. package/lib/module/web/pmPlugins/MergeAdjacentSameKindBlocksPlugin.js +42 -0
  414. package/lib/module/web/pmPlugins/MergeAdjacentSameKindBlocksPlugin.js.map +1 -0
  415. package/lib/module/web/pmPlugins/ShortcutPlugin.js +123 -0
  416. package/lib/module/web/pmPlugins/ShortcutPlugin.js.map +1 -0
  417. package/lib/module/web/pmPlugins/StrictMarksPlugin.js +98 -0
  418. package/lib/module/web/pmPlugins/StrictMarksPlugin.js.map +1 -0
  419. package/lib/module/web/pmPlugins/StripBoldInStyledHeadingsPlugin.js +56 -0
  420. package/lib/module/web/pmPlugins/StripBoldInStyledHeadingsPlugin.js.map +1 -0
  421. package/lib/module/web/pmPlugins/StripMarksInCodeBlockPlugin.js +28 -0
  422. package/lib/module/web/pmPlugins/StripMarksInCodeBlockPlugin.js.map +1 -0
  423. package/lib/module/web/pmPlugins/StripMarksOnImagePlugin.js +29 -0
  424. package/lib/module/web/pmPlugins/StripMarksOnImagePlugin.js.map +1 -0
  425. package/lib/module/web/positionMapping.js +76 -0
  426. package/lib/module/web/positionMapping.js.map +1 -0
  427. package/lib/module/web/returnKeyTypeToEnterKeyHint.js +20 -0
  428. package/lib/module/web/returnKeyTypeToEnterKeyHint.js.map +1 -0
  429. package/lib/module/web/styleConversion/buildMentionRulesCSS.js +33 -0
  430. package/lib/module/web/styleConversion/buildMentionRulesCSS.js.map +1 -0
  431. package/lib/module/web/styleConversion/enrichedInputStyleToCSSProperties.js +159 -0
  432. package/lib/module/web/styleConversion/enrichedInputStyleToCSSProperties.js.map +1 -0
  433. package/lib/module/web/styleConversion/enrichedInputThemingToCSSProperties.js +18 -0
  434. package/lib/module/web/styleConversion/enrichedInputThemingToCSSProperties.js.map +1 -0
  435. package/lib/module/web/styleConversion/htmlStyleToCSSVariables.js +145 -0
  436. package/lib/module/web/styleConversion/htmlStyleToCSSVariables.js.map +1 -0
  437. package/lib/module/web/styleConversion/mentionIndicatorCssKey.js +15 -0
  438. package/lib/module/web/styleConversion/mentionIndicatorCssKey.js.map +1 -0
  439. package/lib/module/web/styleConversion/toColor.js +18 -0
  440. package/lib/module/web/styleConversion/toColor.js.map +1 -0
  441. package/lib/module/web/tiptapHtmlNormalizer.js +30 -0
  442. package/lib/module/web/tiptapHtmlNormalizer.js.map +1 -0
  443. package/lib/module/web/useOnChangeHtml.js +8 -0
  444. package/lib/module/web/useOnChangeHtml.js.map +1 -0
  445. package/lib/module/web/useOnChangeState.js +88 -0
  446. package/lib/module/web/useOnChangeState.js.map +1 -0
  447. package/lib/module/web/useOnChangeText.js +11 -0
  448. package/lib/module/web/useOnChangeText.js.map +1 -0
  449. package/lib/module/web/useOnEditorChange.js +25 -0
  450. package/lib/module/web/useOnEditorChange.js.map +1 -0
  451. package/lib/module/web/useOnLinkDetected.js +68 -0
  452. package/lib/module/web/useOnLinkDetected.js.map +1 -0
  453. package/lib/typescript/package.json +1 -0
  454. package/lib/typescript/src/index.d.ts +3 -0
  455. package/lib/typescript/src/index.d.ts.map +1 -0
  456. package/lib/typescript/src/index.native.d.ts +5 -0
  457. package/lib/typescript/src/index.native.d.ts.map +1 -0
  458. package/lib/typescript/src/native/EnrichedText.d.ts +3 -0
  459. package/lib/typescript/src/native/EnrichedText.d.ts.map +1 -0
  460. package/lib/typescript/src/native/EnrichedTextInput.d.ts +3 -0
  461. package/lib/typescript/src/native/EnrichedTextInput.d.ts.map +1 -0
  462. package/lib/typescript/src/spec/EnrichedTextInputNativeComponent.d.ts +405 -0
  463. package/lib/typescript/src/spec/EnrichedTextInputNativeComponent.d.ts.map +1 -0
  464. package/lib/typescript/src/spec/EnrichedTextNativeComponent.d.ts +88 -0
  465. package/lib/typescript/src/spec/EnrichedTextNativeComponent.d.ts.map +1 -0
  466. package/lib/typescript/src/types.d.ts +721 -0
  467. package/lib/typescript/src/types.d.ts.map +1 -0
  468. package/lib/typescript/src/utils/EnrichedTextInputDefaultProps.d.ts +13 -0
  469. package/lib/typescript/src/utils/EnrichedTextInputDefaultProps.d.ts.map +1 -0
  470. package/lib/typescript/src/utils/defaultHtmlStyle.d.ts +4 -0
  471. package/lib/typescript/src/utils/defaultHtmlStyle.d.ts.map +1 -0
  472. package/lib/typescript/src/utils/expandMentionStylesForIndicators.d.ts +3 -0
  473. package/lib/typescript/src/utils/expandMentionStylesForIndicators.d.ts.map +1 -0
  474. package/lib/typescript/src/utils/isMentionStyleRecord.d.ts +3 -0
  475. package/lib/typescript/src/utils/isMentionStyleRecord.d.ts.map +1 -0
  476. package/lib/typescript/src/utils/normalizeHtmlStyle.d.ts +6 -0
  477. package/lib/typescript/src/utils/normalizeHtmlStyle.d.ts.map +1 -0
  478. package/lib/typescript/src/utils/nullthrows.d.ts +2 -0
  479. package/lib/typescript/src/utils/nullthrows.d.ts.map +1 -0
  480. package/lib/typescript/src/utils/regexParser.d.ts +3 -0
  481. package/lib/typescript/src/utils/regexParser.d.ts.map +1 -0
  482. package/lib/typescript/src/web/EnrichedTextInput.d.ts +4 -0
  483. package/lib/typescript/src/web/EnrichedTextInput.d.ts.map +1 -0
  484. package/lib/typescript/src/web/adaptWebToNativeEvent.d.ts +3 -0
  485. package/lib/typescript/src/web/adaptWebToNativeEvent.d.ts.map +1 -0
  486. package/lib/typescript/src/web/checkboxHtmlNormalizer.d.ts +3 -0
  487. package/lib/typescript/src/web/checkboxHtmlNormalizer.d.ts.map +1 -0
  488. package/lib/typescript/src/web/formats/EnrichedBlockquote.d.ts +2 -0
  489. package/lib/typescript/src/web/formats/EnrichedBlockquote.d.ts.map +1 -0
  490. package/lib/typescript/src/web/formats/EnrichedBold.d.ts +2 -0
  491. package/lib/typescript/src/web/formats/EnrichedBold.d.ts.map +1 -0
  492. package/lib/typescript/src/web/formats/EnrichedCheckboxItem.d.ts +2 -0
  493. package/lib/typescript/src/web/formats/EnrichedCheckboxItem.d.ts.map +1 -0
  494. package/lib/typescript/src/web/formats/EnrichedCheckboxList.d.ts +9 -0
  495. package/lib/typescript/src/web/formats/EnrichedCheckboxList.d.ts.map +1 -0
  496. package/lib/typescript/src/web/formats/EnrichedCode.d.ts +2 -0
  497. package/lib/typescript/src/web/formats/EnrichedCode.d.ts.map +1 -0
  498. package/lib/typescript/src/web/formats/EnrichedCodeBlock.d.ts +9 -0
  499. package/lib/typescript/src/web/formats/EnrichedCodeBlock.d.ts.map +1 -0
  500. package/lib/typescript/src/web/formats/EnrichedHeading.d.ts +5 -0
  501. package/lib/typescript/src/web/formats/EnrichedHeading.d.ts.map +1 -0
  502. package/lib/typescript/src/web/formats/EnrichedImage.d.ts +2 -0
  503. package/lib/typescript/src/web/formats/EnrichedImage.d.ts.map +1 -0
  504. package/lib/typescript/src/web/formats/EnrichedImageNodeView.d.ts +3 -0
  505. package/lib/typescript/src/web/formats/EnrichedImageNodeView.d.ts.map +1 -0
  506. package/lib/typescript/src/web/formats/EnrichedItalic.d.ts +2 -0
  507. package/lib/typescript/src/web/formats/EnrichedItalic.d.ts.map +1 -0
  508. package/lib/typescript/src/web/formats/EnrichedLink.d.ts +5 -0
  509. package/lib/typescript/src/web/formats/EnrichedLink.d.ts.map +1 -0
  510. package/lib/typescript/src/web/formats/EnrichedListItem.d.ts +2 -0
  511. package/lib/typescript/src/web/formats/EnrichedListItem.d.ts.map +1 -0
  512. package/lib/typescript/src/web/formats/EnrichedMention.d.ts +4 -0
  513. package/lib/typescript/src/web/formats/EnrichedMention.d.ts.map +1 -0
  514. package/lib/typescript/src/web/formats/EnrichedOrderedList.d.ts +2 -0
  515. package/lib/typescript/src/web/formats/EnrichedOrderedList.d.ts.map +1 -0
  516. package/lib/typescript/src/web/formats/EnrichedStrike.d.ts +2 -0
  517. package/lib/typescript/src/web/formats/EnrichedStrike.d.ts.map +1 -0
  518. package/lib/typescript/src/web/formats/EnrichedUnderline.d.ts +2 -0
  519. package/lib/typescript/src/web/formats/EnrichedUnderline.d.ts.map +1 -0
  520. package/lib/typescript/src/web/formats/EnrichedUnorderedList.d.ts +9 -0
  521. package/lib/typescript/src/web/formats/EnrichedUnorderedList.d.ts.map +1 -0
  522. package/lib/typescript/src/web/formats/applyWrappingListToSelection.d.ts +18 -0
  523. package/lib/typescript/src/web/formats/applyWrappingListToSelection.d.ts.map +1 -0
  524. package/lib/typescript/src/web/formats/formatRules.d.ts +10 -0
  525. package/lib/typescript/src/web/formats/formatRules.d.ts.map +1 -0
  526. package/lib/typescript/src/web/formats/listKeyboard.d.ts +4 -0
  527. package/lib/typescript/src/web/formats/listKeyboard.d.ts.map +1 -0
  528. package/lib/typescript/src/web/formats/wrappedBlockKeyboard.d.ts +12 -0
  529. package/lib/typescript/src/web/formats/wrappedBlockKeyboard.d.ts.map +1 -0
  530. package/lib/typescript/src/web/pasteImages.d.ts +10 -0
  531. package/lib/typescript/src/web/pasteImages.d.ts.map +1 -0
  532. package/lib/typescript/src/web/pastedImageDimensions.d.ts +9 -0
  533. package/lib/typescript/src/web/pastedImageDimensions.d.ts.map +1 -0
  534. package/lib/typescript/src/web/pmPlugins/MentionPlugin/index.d.ts +9 -0
  535. package/lib/typescript/src/web/pmPlugins/MentionPlugin/index.d.ts.map +1 -0
  536. package/lib/typescript/src/web/pmPlugins/MentionPlugin/isCaretInBlockedContext.d.ts +3 -0
  537. package/lib/typescript/src/web/pmPlugins/MentionPlugin/isCaretInBlockedContext.d.ts.map +1 -0
  538. package/lib/typescript/src/web/pmPlugins/MentionPlugin/makeMentionPluginState.d.ts +4 -0
  539. package/lib/typescript/src/web/pmPlugins/MentionPlugin/makeMentionPluginState.d.ts.map +1 -0
  540. package/lib/typescript/src/web/pmPlugins/MentionPlugin/mentionPluginKey.d.ts +4 -0
  541. package/lib/typescript/src/web/pmPlugins/MentionPlugin/mentionPluginKey.d.ts.map +1 -0
  542. package/lib/typescript/src/web/pmPlugins/MentionPlugin/removeMentionMarksIfSpansResized.d.ts +9 -0
  543. package/lib/typescript/src/web/pmPlugins/MentionPlugin/removeMentionMarksIfSpansResized.d.ts.map +1 -0
  544. package/lib/typescript/src/web/pmPlugins/MentionPlugin/setMention.d.ts +3 -0
  545. package/lib/typescript/src/web/pmPlugins/MentionPlugin/setMention.d.ts.map +1 -0
  546. package/lib/typescript/src/web/pmPlugins/MentionPlugin/startMention.d.ts +3 -0
  547. package/lib/typescript/src/web/pmPlugins/MentionPlugin/startMention.d.ts.map +1 -0
  548. package/lib/typescript/src/web/pmPlugins/MentionPlugin/stripPartialMentionMarks.d.ts +3 -0
  549. package/lib/typescript/src/web/pmPlugins/MentionPlugin/stripPartialMentionMarks.d.ts.map +1 -0
  550. package/lib/typescript/src/web/pmPlugins/MentionPlugin/subscribeMentionEvents.d.ts +4 -0
  551. package/lib/typescript/src/web/pmPlugins/MentionPlugin/subscribeMentionEvents.d.ts.map +1 -0
  552. package/lib/typescript/src/web/pmPlugins/MentionPlugin/types.d.ts +20 -0
  553. package/lib/typescript/src/web/pmPlugins/MentionPlugin/types.d.ts.map +1 -0
  554. package/lib/typescript/src/web/pmPlugins/MergeAdjacentSameKindBlocksPlugin.d.ts +3 -0
  555. package/lib/typescript/src/web/pmPlugins/MergeAdjacentSameKindBlocksPlugin.d.ts.map +1 -0
  556. package/lib/typescript/src/web/pmPlugins/ShortcutPlugin.d.ts +7 -0
  557. package/lib/typescript/src/web/pmPlugins/ShortcutPlugin.d.ts.map +1 -0
  558. package/lib/typescript/src/web/pmPlugins/StrictMarksPlugin.d.ts +3 -0
  559. package/lib/typescript/src/web/pmPlugins/StrictMarksPlugin.d.ts.map +1 -0
  560. package/lib/typescript/src/web/pmPlugins/StripBoldInStyledHeadingsPlugin.d.ts +10 -0
  561. package/lib/typescript/src/web/pmPlugins/StripBoldInStyledHeadingsPlugin.d.ts.map +1 -0
  562. package/lib/typescript/src/web/pmPlugins/StripMarksInCodeBlockPlugin.d.ts +3 -0
  563. package/lib/typescript/src/web/pmPlugins/StripMarksInCodeBlockPlugin.d.ts.map +1 -0
  564. package/lib/typescript/src/web/pmPlugins/StripMarksOnImagePlugin.d.ts +3 -0
  565. package/lib/typescript/src/web/pmPlugins/StripMarksOnImagePlugin.d.ts.map +1 -0
  566. package/lib/typescript/src/web/positionMapping.d.ts +39 -0
  567. package/lib/typescript/src/web/positionMapping.d.ts.map +1 -0
  568. package/lib/typescript/src/web/returnKeyTypeToEnterKeyHint.d.ts +4 -0
  569. package/lib/typescript/src/web/returnKeyTypeToEnterKeyHint.d.ts.map +1 -0
  570. package/lib/typescript/src/web/styleConversion/buildMentionRulesCSS.d.ts +3 -0
  571. package/lib/typescript/src/web/styleConversion/buildMentionRulesCSS.d.ts.map +1 -0
  572. package/lib/typescript/src/web/styleConversion/enrichedInputStyleToCSSProperties.d.ts +8 -0
  573. package/lib/typescript/src/web/styleConversion/enrichedInputStyleToCSSProperties.d.ts.map +1 -0
  574. package/lib/typescript/src/web/styleConversion/enrichedInputThemingToCSSProperties.d.ts +9 -0
  575. package/lib/typescript/src/web/styleConversion/enrichedInputThemingToCSSProperties.d.ts.map +1 -0
  576. package/lib/typescript/src/web/styleConversion/htmlStyleToCSSVariables.d.ts +10 -0
  577. package/lib/typescript/src/web/styleConversion/htmlStyleToCSSVariables.d.ts.map +1 -0
  578. package/lib/typescript/src/web/styleConversion/mentionIndicatorCssKey.d.ts +3 -0
  579. package/lib/typescript/src/web/styleConversion/mentionIndicatorCssKey.d.ts.map +1 -0
  580. package/lib/typescript/src/web/styleConversion/toColor.d.ts +3 -0
  581. package/lib/typescript/src/web/styleConversion/toColor.d.ts.map +1 -0
  582. package/lib/typescript/src/web/tiptapHtmlNormalizer.d.ts +3 -0
  583. package/lib/typescript/src/web/tiptapHtmlNormalizer.d.ts.map +1 -0
  584. package/lib/typescript/src/web/useOnChangeHtml.d.ts +5 -0
  585. package/lib/typescript/src/web/useOnChangeHtml.d.ts.map +1 -0
  586. package/lib/typescript/src/web/useOnChangeState.d.ts +6 -0
  587. package/lib/typescript/src/web/useOnChangeState.d.ts.map +1 -0
  588. package/lib/typescript/src/web/useOnChangeText.d.ts +5 -0
  589. package/lib/typescript/src/web/useOnChangeText.d.ts.map +1 -0
  590. package/lib/typescript/src/web/useOnEditorChange.d.ts +6 -0
  591. package/lib/typescript/src/web/useOnEditorChange.d.ts.map +1 -0
  592. package/lib/typescript/src/web/useOnLinkDetected.d.ts +4 -0
  593. package/lib/typescript/src/web/useOnLinkDetected.d.ts.map +1 -0
  594. package/package.json +232 -1
  595. package/react-native.config.js +16 -0
  596. package/src/index.native.tsx +34 -0
  597. package/src/index.tsx +24 -0
  598. package/src/native/EnrichedText.tsx +115 -0
  599. package/src/native/EnrichedTextInput.tsx +374 -0
  600. package/src/spec/EnrichedTextInputNativeComponent.ts +524 -0
  601. package/src/spec/EnrichedTextNativeComponent.ts +110 -0
  602. package/src/types.ts +864 -0
  603. package/src/utils/EnrichedTextInputDefaultProps.ts +16 -0
  604. package/src/utils/defaultHtmlStyle.ts +83 -0
  605. package/src/utils/expandMentionStylesForIndicators.ts +19 -0
  606. package/src/utils/isMentionStyleRecord.ts +22 -0
  607. package/src/utils/normalizeHtmlStyle.ts +181 -0
  608. package/src/utils/nullthrows.ts +7 -0
  609. package/src/utils/regexParser.ts +56 -0
  610. package/src/web/EnrichedTextInput.css +201 -0
  611. package/src/web/EnrichedTextInput.tsx +403 -0
  612. package/src/web/adaptWebToNativeEvent.ts +37 -0
  613. package/src/web/checkboxHtmlNormalizer.ts +62 -0
  614. package/src/web/formats/EnrichedBlockquote.ts +36 -0
  615. package/src/web/formats/EnrichedBold.ts +16 -0
  616. package/src/web/formats/EnrichedCheckboxItem.ts +35 -0
  617. package/src/web/formats/EnrichedCheckboxList.ts +47 -0
  618. package/src/web/formats/EnrichedCode.ts +13 -0
  619. package/src/web/formats/EnrichedCodeBlock.ts +53 -0
  620. package/src/web/formats/EnrichedHeading.ts +36 -0
  621. package/src/web/formats/EnrichedImage.ts +59 -0
  622. package/src/web/formats/EnrichedImageNodeView.tsx +89 -0
  623. package/src/web/formats/EnrichedItalic.ts +16 -0
  624. package/src/web/formats/EnrichedLink.ts +149 -0
  625. package/src/web/formats/EnrichedListItem.ts +17 -0
  626. package/src/web/formats/EnrichedMention.ts +55 -0
  627. package/src/web/formats/EnrichedOrderedList.ts +40 -0
  628. package/src/web/formats/EnrichedStrike.ts +16 -0
  629. package/src/web/formats/EnrichedUnderline.ts +16 -0
  630. package/src/web/formats/EnrichedUnorderedList.ts +50 -0
  631. package/src/web/formats/applyWrappingListToSelection.ts +76 -0
  632. package/src/web/formats/formatRules.ts +84 -0
  633. package/src/web/formats/listKeyboard.ts +58 -0
  634. package/src/web/formats/wrappedBlockKeyboard.ts +76 -0
  635. package/src/web/pasteImages.ts +96 -0
  636. package/src/web/pastedImageDimensions.ts +40 -0
  637. package/src/web/pmPlugins/MentionPlugin/index.ts +45 -0
  638. package/src/web/pmPlugins/MentionPlugin/isCaretInBlockedContext.ts +17 -0
  639. package/src/web/pmPlugins/MentionPlugin/makeMentionPluginState.ts +75 -0
  640. package/src/web/pmPlugins/MentionPlugin/mentionPluginKey.ts +4 -0
  641. package/src/web/pmPlugins/MentionPlugin/removeMentionMarksIfSpansResized.ts +68 -0
  642. package/src/web/pmPlugins/MentionPlugin/setMention.ts +83 -0
  643. package/src/web/pmPlugins/MentionPlugin/startMention.ts +14 -0
  644. package/src/web/pmPlugins/MentionPlugin/stripPartialMentionMarks.ts +20 -0
  645. package/src/web/pmPlugins/MentionPlugin/subscribeMentionEvents.ts +105 -0
  646. package/src/web/pmPlugins/MentionPlugin/types.ts +22 -0
  647. package/src/web/pmPlugins/MergeAdjacentSameKindBlocksPlugin.ts +57 -0
  648. package/src/web/pmPlugins/ShortcutPlugin.ts +98 -0
  649. package/src/web/pmPlugins/StrictMarksPlugin.ts +131 -0
  650. package/src/web/pmPlugins/StripBoldInStyledHeadingsPlugin.ts +79 -0
  651. package/src/web/pmPlugins/StripMarksInCodeBlockPlugin.ts +34 -0
  652. package/src/web/pmPlugins/StripMarksOnImagePlugin.ts +33 -0
  653. package/src/web/positionMapping.ts +81 -0
  654. package/src/web/returnKeyTypeToEnterKeyHint.ts +29 -0
  655. package/src/web/styleConversion/buildMentionRulesCSS.ts +42 -0
  656. package/src/web/styleConversion/enrichedInputStyleToCSSProperties.ts +224 -0
  657. package/src/web/styleConversion/enrichedInputThemingToCSSProperties.ts +34 -0
  658. package/src/web/styleConversion/htmlStyleToCSSVariables.ts +226 -0
  659. package/src/web/styleConversion/mentionIndicatorCssKey.ts +14 -0
  660. package/src/web/styleConversion/toColor.ts +17 -0
  661. package/src/web/tiptapHtmlNormalizer.ts +33 -0
  662. package/src/web/useOnChangeHtml.ts +14 -0
  663. package/src/web/useOnChangeState.ts +125 -0
  664. package/src/web/useOnChangeText.ts +15 -0
  665. package/src/web/useOnEditorChange.ts +33 -0
  666. package/src/web/useOnLinkDetected.ts +82 -0
@@ -0,0 +1,290 @@
1
+ #import "StyleUtils.h"
2
+
3
+ @implementation StyleUtils
4
+
5
+ + (NSDictionary *)conflictMap {
6
+ return @{
7
+ @([BoldStyle getType]) : @[],
8
+ @([ItalicStyle getType]) : @[],
9
+ @([UnderlineStyle getType]) : @[],
10
+ @([StrikethroughStyle getType]) : @[],
11
+ @([InlineCodeStyle getType]) :
12
+ @[ @([LinkStyle getType]), @([MentionStyle getType]) ],
13
+ @([LinkStyle getType]) :
14
+ @[ @([LinkStyle getType]), @([MentionStyle getType]) ],
15
+ @([MentionStyle getType]) : @[ @([LinkStyle getType]) ],
16
+ @([H1Style getType]) : @[
17
+ @([H2Style getType]), @([H3Style getType]), @([H4Style getType]),
18
+ @([H5Style getType]), @([H6Style getType]),
19
+ @([UnorderedListStyle getType]), @([OrderedListStyle getType]),
20
+ @([BlockQuoteStyle getType]), @([CodeBlockStyle getType]),
21
+ @([CheckboxListStyle getType])
22
+ ],
23
+ @([H2Style getType]) : @[
24
+ @([H1Style getType]), @([H3Style getType]), @([H4Style getType]),
25
+ @([H5Style getType]), @([H6Style getType]),
26
+ @([UnorderedListStyle getType]), @([OrderedListStyle getType]),
27
+ @([BlockQuoteStyle getType]), @([CodeBlockStyle getType]),
28
+ @([CheckboxListStyle getType])
29
+ ],
30
+ @([H3Style getType]) : @[
31
+ @([H1Style getType]), @([H2Style getType]), @([H4Style getType]),
32
+ @([H5Style getType]), @([H6Style getType]),
33
+ @([UnorderedListStyle getType]), @([OrderedListStyle getType]),
34
+ @([BlockQuoteStyle getType]), @([CodeBlockStyle getType]),
35
+ @([CheckboxListStyle getType])
36
+ ],
37
+ @([H4Style getType]) : @[
38
+ @([H1Style getType]), @([H2Style getType]), @([H3Style getType]),
39
+ @([H5Style getType]), @([H6Style getType]),
40
+ @([UnorderedListStyle getType]), @([OrderedListStyle getType]),
41
+ @([BlockQuoteStyle getType]), @([CodeBlockStyle getType]),
42
+ @([CheckboxListStyle getType])
43
+ ],
44
+ @([H5Style getType]) : @[
45
+ @([H1Style getType]), @([H2Style getType]), @([H3Style getType]),
46
+ @([H4Style getType]), @([H6Style getType]),
47
+ @([UnorderedListStyle getType]), @([OrderedListStyle getType]),
48
+ @([BlockQuoteStyle getType]), @([CodeBlockStyle getType]),
49
+ @([CheckboxListStyle getType])
50
+ ],
51
+ @([H6Style getType]) : @[
52
+ @([H1Style getType]), @([H2Style getType]), @([H3Style getType]),
53
+ @([H4Style getType]), @([H5Style getType]),
54
+ @([UnorderedListStyle getType]), @([OrderedListStyle getType]),
55
+ @([BlockQuoteStyle getType]), @([CodeBlockStyle getType]),
56
+ @([CheckboxListStyle getType])
57
+ ],
58
+ @([UnorderedListStyle getType]) : @[
59
+ @([H1Style getType]), @([H2Style getType]), @([H3Style getType]),
60
+ @([H4Style getType]), @([H5Style getType]), @([H6Style getType]),
61
+ @([OrderedListStyle getType]), @([BlockQuoteStyle getType]),
62
+ @([CodeBlockStyle getType]), @([CheckboxListStyle getType])
63
+ ],
64
+ @([OrderedListStyle getType]) : @[
65
+ @([H1Style getType]), @([H2Style getType]), @([H3Style getType]),
66
+ @([H4Style getType]), @([H5Style getType]), @([H6Style getType]),
67
+ @([UnorderedListStyle getType]), @([BlockQuoteStyle getType]),
68
+ @([CodeBlockStyle getType]), @([CheckboxListStyle getType])
69
+ ],
70
+ @([CheckboxListStyle getType]) : @[
71
+ @([H1Style getType]), @([H2Style getType]), @([H3Style getType]),
72
+ @([H4Style getType]), @([H5Style getType]), @([H6Style getType]),
73
+ @([UnorderedListStyle getType]), @([OrderedListStyle getType]),
74
+ @([BlockQuoteStyle getType]), @([CodeBlockStyle getType])
75
+ ],
76
+ @([AlignmentStyle getType]) : @[],
77
+ @([BlockQuoteStyle getType]) : @[
78
+ @([H1Style getType]), @([H2Style getType]), @([H3Style getType]),
79
+ @([H4Style getType]), @([H5Style getType]), @([H6Style getType]),
80
+ @([UnorderedListStyle getType]), @([OrderedListStyle getType]),
81
+ @([CodeBlockStyle getType]), @([CheckboxListStyle getType])
82
+ ],
83
+ @([CodeBlockStyle getType]) : @[
84
+ @([H1Style getType]), @([H2Style getType]), @([H3Style getType]),
85
+ @([H4Style getType]), @([H5Style getType]), @([H6Style getType]),
86
+ @([BoldStyle getType]), @([UnderlineStyle getType]),
87
+ @([ItalicStyle getType]), @([StrikethroughStyle getType]),
88
+ @([UnorderedListStyle getType]), @([OrderedListStyle getType]),
89
+ @([BlockQuoteStyle getType]), @([InlineCodeStyle getType]),
90
+ @([MentionStyle getType]), @([LinkStyle getType]),
91
+ @([CheckboxListStyle getType])
92
+ ],
93
+ @([ImageStyle getType]) :
94
+ @[ @([LinkStyle getType]), @([MentionStyle getType]) ]
95
+ };
96
+ }
97
+
98
+ + (NSDictionary *)blockingMap {
99
+ return @{
100
+ @([BoldStyle getType]) : @[ @([CodeBlockStyle getType]) ],
101
+ @([ItalicStyle getType]) : @[ @([CodeBlockStyle getType]) ],
102
+ @([UnderlineStyle getType]) : @[ @([CodeBlockStyle getType]) ],
103
+ @([StrikethroughStyle getType]) : @[ @([CodeBlockStyle getType]) ],
104
+ @([InlineCodeStyle getType]) :
105
+ @[ @([CodeBlockStyle getType]), @([ImageStyle getType]) ],
106
+ @([LinkStyle getType]) : @[
107
+ @([CodeBlockStyle getType]), @([ImageStyle getType]),
108
+ @([InlineCodeStyle getType])
109
+ ],
110
+ @([MentionStyle getType]) : @[
111
+ @([CodeBlockStyle getType]), @([ImageStyle getType]),
112
+ @([InlineCodeStyle getType])
113
+ ],
114
+ @([H1Style getType]) : @[],
115
+ @([H2Style getType]) : @[],
116
+ @([H3Style getType]) : @[],
117
+ @([H4Style getType]) : @[],
118
+ @([H5Style getType]) : @[],
119
+ @([H6Style getType]) : @[],
120
+ @([UnorderedListStyle getType]) : @[],
121
+ @([OrderedListStyle getType]) : @[],
122
+ @([CheckboxListStyle getType]) : @[],
123
+ @([AlignmentStyle getType]) : @[],
124
+ @([BlockQuoteStyle getType]) : @[],
125
+ @([CodeBlockStyle getType]) : @[],
126
+ @([ImageStyle getType]) : @[ @([InlineCodeStyle getType]) ]
127
+ };
128
+ }
129
+
130
+ + (NSDictionary *)stylesDictForHost:(id<EnrichedViewHost>)host
131
+ isInput:(BOOL)isInput {
132
+ NSArray<Class> *baseClasses = @[
133
+ [BoldStyle class], [ItalicStyle class],
134
+ [UnderlineStyle class], [StrikethroughStyle class],
135
+ [InlineCodeStyle class], [LinkStyle class],
136
+ [MentionStyle class], [H1Style class],
137
+ [H2Style class], [H3Style class],
138
+ [H4Style class], [H5Style class],
139
+ [H6Style class], [UnorderedListStyle class],
140
+ [OrderedListStyle class], [CheckboxListStyle class],
141
+ [AlignmentStyle class], [BlockQuoteStyle class],
142
+ [CodeBlockStyle class], [ImageStyle class]
143
+ ];
144
+
145
+ NSArray<Class> *viewerClasses = @[
146
+ [EnrichedTextBoldStyle class],
147
+ [EnrichedTextItalicStyle class],
148
+ [EnrichedTextUnderlineStyle class],
149
+ [EnrichedTextStrikethroughStyle class],
150
+ [EnrichedTextInlineCodeStyle class],
151
+ [EnrichedTextLinkStyle class],
152
+ [EnrichedTextMentionStyle class],
153
+ [EnrichedTextH1Style class],
154
+ [EnrichedTextH2Style class],
155
+ [EnrichedTextH3Style class],
156
+ [EnrichedTextH4Style class],
157
+ [EnrichedTextH5Style class],
158
+ [EnrichedTextH6Style class],
159
+ [EnrichedTextUnorderedListStyle class],
160
+ [EnrichedTextOrderedListStyle class],
161
+ [EnrichedTextCheckboxListStyle class],
162
+ [EnrichedTextAlignmentStyle class],
163
+ [EnrichedTextBlockQuoteStyle class],
164
+ [EnrichedTextCodeBlockStyle class],
165
+ [EnrichedTextImageStyle class]
166
+ ];
167
+
168
+ NSMutableDictionary *dict = [NSMutableDictionary new];
169
+
170
+ for (NSUInteger i = 0; i < baseClasses.count; i++) {
171
+ // Choose the class based on the context
172
+ Class targetClass = isInput ? baseClasses[i] : viewerClasses[i];
173
+
174
+ // Instantiate and add to dictionary
175
+ // We use [baseClasses[i] getType] for the key to ensure the
176
+ // conflict maps (which use base types) always match.
177
+ StyleBase *instance = [[targetClass alloc] initWithHost:host];
178
+ dict[@([baseClasses[i] getType])] = instance;
179
+ }
180
+
181
+ return [dict copy];
182
+ }
183
+
184
+ // returns false when style shouldn't be applied and true when it can be
185
+ + (BOOL)isStyleBlocked:(StyleType)type
186
+ range:(NSRange)range
187
+ forHost:(id<EnrichedViewHost>)host {
188
+ NSArray<NSNumber *> *blocking =
189
+ [self getPresentStyleTypesFrom:host.blockingStyles[@(type)]
190
+ range:range
191
+ forHost:host];
192
+ return blocking.count != 0;
193
+ }
194
+
195
+ // returns false when style shouldn't be applied and true when it can be
196
+ + (BOOL)handleStyleBlocksAndConflicts:(StyleType)type
197
+ range:(NSRange)range
198
+ forHost:(id<EnrichedViewHost>)host {
199
+ if ([self isStyleBlocked:type range:range forHost:host]) {
200
+ return NO;
201
+ }
202
+
203
+ // handle conflicting styles: remove styles within the range
204
+ NSArray<NSNumber *> *conflicting =
205
+ [self getPresentStyleTypesFrom:host.conflictingStyles[@(type)]
206
+ range:range
207
+ forHost:host];
208
+ if (conflicting.count != 0) {
209
+ for (NSNumber *type in conflicting) {
210
+ StyleBase *style = host.stylesDict[type];
211
+
212
+ if ([style isParagraph]) {
213
+ // for paragraph styles we can just call remove since it will pick up
214
+ // proper paragraph range
215
+ [style remove:range withDirtyRange:YES];
216
+ } else {
217
+ // for inline styles we have to differentiate betweeen normal and typing
218
+ // attributes removal
219
+ range.length >= 1 ? [style remove:range withDirtyRange:YES]
220
+ : [style removeTyping];
221
+ }
222
+ }
223
+ }
224
+ return YES;
225
+ }
226
+
227
+ + (NSArray *)getPresentStyleTypesFrom:(NSArray *)types
228
+ range:(NSRange)range
229
+ forHost:(id<EnrichedViewHost>)host {
230
+ NSMutableArray<NSNumber *> *resultArray =
231
+ [[NSMutableArray<NSNumber *> alloc] init];
232
+ for (NSNumber *type in types) {
233
+ StyleBase *style = host.stylesDict[type];
234
+
235
+ if (range.length >= 1) {
236
+ if ([style any:range]) {
237
+ [resultArray addObject:type];
238
+ }
239
+ } else {
240
+ if ([style detect:range]) {
241
+ [resultArray addObject:type];
242
+ }
243
+ }
244
+ }
245
+ return resultArray;
246
+ }
247
+
248
+ + (void)addStyleBlock:(StyleType)blocking
249
+ to:(StyleType)blocked
250
+ forHost:(id<EnrichedViewHost>)host {
251
+ NSMutableArray *blocksArr = [host.blockingStyles[@(blocked)] mutableCopy];
252
+ if (![blocksArr containsObject:@(blocking)]) {
253
+ [blocksArr addObject:@(blocking)];
254
+ host.blockingStyles[@(blocked)] = blocksArr;
255
+ }
256
+ }
257
+
258
+ + (void)removeStyleBlock:(StyleType)blocking
259
+ from:(StyleType)blocked
260
+ forHost:(id<EnrichedViewHost>)host {
261
+ NSMutableArray *blocksArr = [host.blockingStyles[@(blocked)] mutableCopy];
262
+ if ([blocksArr containsObject:@(blocking)]) {
263
+ [blocksArr removeObject:@(blocking)];
264
+ host.blockingStyles[@(blocked)] = blocksArr;
265
+ }
266
+ }
267
+
268
+ + (void)addStyleConflict:(StyleType)conflicting
269
+ to:(StyleType)conflicted
270
+ forHost:(id<EnrichedViewHost>)host {
271
+ NSMutableArray *conflictsArr =
272
+ [host.conflictingStyles[@(conflicted)] mutableCopy];
273
+ if (![conflictsArr containsObject:@(conflicting)]) {
274
+ [conflictsArr addObject:@(conflicting)];
275
+ host.conflictingStyles[@(conflicted)] = conflictsArr;
276
+ }
277
+ }
278
+
279
+ + (void)removeStyleConflict:(StyleType)conflicting
280
+ from:(StyleType)conflicted
281
+ forHost:(id<EnrichedViewHost>)host {
282
+ NSMutableArray *conflictsArr =
283
+ [host.conflictingStyles[@(conflicted)] mutableCopy];
284
+ if ([conflictsArr containsObject:@(conflicting)]) {
285
+ [conflictsArr removeObject:@(conflicting)];
286
+ host.conflictingStyles[@(conflicted)] = conflictsArr;
287
+ }
288
+ }
289
+
290
+ @end
@@ -0,0 +1,17 @@
1
+ typedef NS_ENUM(NSInteger, TextBlockTapKind) {
2
+ TextBlockTapKindNone = 0,
3
+ TextBlockTapKindCheckbox,
4
+ };
5
+
6
+ @class EnrichedTextInputView;
7
+
8
+ @interface TextBlockTapGestureRecognizer : UITapGestureRecognizer
9
+ - (instancetype _Nonnull)initWithInput:(id _Nonnull)input
10
+ action:(SEL _Nonnull)action;
11
+
12
+ @property(nonatomic, weak) EnrichedTextInputView *input;
13
+
14
+ @property(nonatomic, assign, readonly) TextBlockTapKind tapKind;
15
+ @property(nonatomic, assign, readonly) NSInteger characterIndex;
16
+
17
+ @end
@@ -0,0 +1,56 @@
1
+ #import "TextBlockTapGestureRecognizer.h"
2
+ #import "CheckboxHitTestUtils.h"
3
+ #import "EnrichedTextInputView.h"
4
+
5
+ @implementation TextBlockTapGestureRecognizer {
6
+ TextBlockTapKind _tapKind;
7
+ NSInteger _characterIndex;
8
+ }
9
+
10
+ - (instancetype)initWithInput:(id)input action:(SEL)action {
11
+ self = [super initWithTarget:input action:action];
12
+ _input = input;
13
+
14
+ self.cancelsTouchesInView = YES;
15
+ self.delaysTouchesBegan = YES;
16
+ self.delaysTouchesEnded = YES;
17
+
18
+ for (UIGestureRecognizer *gr in _input->textView.gestureRecognizers) {
19
+ [gr requireGestureRecognizerToFail:self];
20
+ }
21
+
22
+ return self;
23
+ }
24
+
25
+ - (TextBlockTapKind)tapKind {
26
+ return _tapKind;
27
+ }
28
+
29
+ - (NSInteger)characterIndex {
30
+ return _characterIndex;
31
+ }
32
+
33
+ - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
34
+ _tapKind = TextBlockTapKindNone;
35
+ _characterIndex = NSNotFound;
36
+
37
+ if (!self.input) {
38
+ self.state = UIGestureRecognizerStateFailed;
39
+ return;
40
+ }
41
+
42
+ UITouch *touch = touches.anyObject;
43
+ CGPoint point = [touch locationInView:self.input->textView];
44
+ NSInteger checkboxIndex =
45
+ [CheckboxHitTestUtils hitTestCheckboxAtPoint:point inInput:self.input];
46
+
47
+ if (checkboxIndex >= 0) {
48
+ _tapKind = TextBlockTapKindCheckbox;
49
+ _characterIndex = checkboxIndex;
50
+ [super touchesBegan:touches withEvent:event];
51
+ return;
52
+ }
53
+ self.state = UIGestureRecognizerStateFailed;
54
+ }
55
+
56
+ @end
@@ -0,0 +1,17 @@
1
+ #import "EnrichedViewHost.h"
2
+ #import <UIKit/UIKit.h>
3
+
4
+ @interface TextInsertionUtils : NSObject
5
+ + (void)insertText:(NSString *)text
6
+ at:(NSInteger)index
7
+ additionalAttributes:
8
+ (NSDictionary<NSAttributedStringKey, id> *)additionalAttrs
9
+ host:(id<EnrichedViewHost>)host
10
+ withSelection:(BOOL)withSelection;
11
+ + (void)replaceText:(NSString *)text
12
+ at:(NSRange)range
13
+ additionalAttributes:
14
+ (NSDictionary<NSAttributedStringKey, id> *)additionalAttrs
15
+ host:(id<EnrichedViewHost>)host
16
+ withSelection:(BOOL)withSelection;
17
+ @end
@@ -0,0 +1,60 @@
1
+ #import "TextInsertionUtils.h"
2
+ #import "UIView+React.h"
3
+
4
+ @implementation TextInsertionUtils
5
+ + (void)insertText:(NSString *)text
6
+ at:(NSInteger)index
7
+ additionalAttributes:
8
+ (NSDictionary<NSAttributedStringKey, id> *)additionalAttrs
9
+ host:(id<EnrichedViewHost>)host
10
+ withSelection:(BOOL)withSelection {
11
+ if (host == nullptr) {
12
+ return;
13
+ }
14
+
15
+ UITextView *textView = host.textView;
16
+
17
+ NSMutableDictionary<NSAttributedStringKey, id> *copiedAttrs =
18
+ [textView.typingAttributes mutableCopy];
19
+ if (additionalAttrs != nullptr) {
20
+ [copiedAttrs addEntriesFromDictionary:additionalAttrs];
21
+ }
22
+
23
+ NSAttributedString *newAttrStr =
24
+ [[NSAttributedString alloc] initWithString:text attributes:copiedAttrs];
25
+ [textView.textStorage insertAttributedString:newAttrStr atIndex:index];
26
+
27
+ if (withSelection) {
28
+ if (![textView isFirstResponder]) {
29
+ [textView reactFocus];
30
+ }
31
+ textView.selectedRange = NSMakeRange(index + text.length, 0);
32
+ }
33
+ }
34
+
35
+ + (void)replaceText:(NSString *)text
36
+ at:(NSRange)range
37
+ additionalAttributes:
38
+ (NSDictionary<NSAttributedStringKey, id> *)additionalAttrs
39
+ host:(id<EnrichedViewHost>)host
40
+ withSelection:(BOOL)withSelection {
41
+ if (host == nullptr) {
42
+ return;
43
+ }
44
+
45
+ UITextView *textView = host.textView;
46
+ [textView.textStorage replaceCharactersInRange:range withString:text];
47
+ if (additionalAttrs != nullptr) {
48
+ [textView.textStorage
49
+ addAttributes:additionalAttrs
50
+ range:NSMakeRange(range.location, [text length])];
51
+ }
52
+
53
+ if (withSelection) {
54
+ if (![textView isFirstResponder]) {
55
+ [textView reactFocus];
56
+ }
57
+ textView.selectedRange = NSMakeRange(range.location + text.length, 0);
58
+ }
59
+ }
60
+ @end
@@ -0,0 +1,40 @@
1
+ #pragma once
2
+ #import <UIKit/UIKit.h>
3
+
4
+ @interface TextListsUtils : NSObject
5
+
6
+ // Appends value to the array. If exclusivePrefix is non-nil, any existing
7
+ // entry whose markerFormat starts with that prefix is evicted first, ensuring
8
+ // only one value from the family is present at a time.
9
+ + (NSArray<NSTextList *> *_Nonnull)
10
+ textListsByAdding:(NSString *_Nonnull)value
11
+ withExclusivePrefix:(NSString *_Nullable)prefix
12
+ toArray:(NSArray<NSTextList *> *_Nullable)existing;
13
+
14
+ // Returns a new array without entries whose markerFormat equals value removed
15
+ // or whose markerFormat starts with prefix
16
+ + (NSArray<NSTextList *> *_Nonnull)
17
+ textListsByRemoving:(NSString *_Nonnull)value
18
+ withPrefix:(NSString *_Nullable)prefix
19
+ fromArray:(NSArray<NSTextList *> *_Nullable)existing;
20
+
21
+ // Returns a new array without entries whose markerFormat starts with prefix
22
+ + (NSArray<NSTextList *> *_Nonnull)
23
+ textListsByRemovingPrefix:(NSString *_Nullable)prefix
24
+ fromArray:(NSArray<NSTextList *> *_Nullable)existing;
25
+
26
+ // Returns YES if any entry's markerFormat equals value exactly.
27
+ + (BOOL)textLists:(NSArray<NSTextList *> *_Nullable)textLists
28
+ containsValue:(NSString *_Nonnull)value;
29
+
30
+ // Returns YES if any entry's markerFormat starts with prefix.
31
+ + (BOOL)textLists:(NSArray<NSTextList *> *_Nullable)textLists
32
+ containsPrefix:(NSString *_Nullable)prefix;
33
+
34
+ // Returns the first entry with a markerFormat that starts with prefix,
35
+ // otherwise nil.
36
+ + (NSTextList *_Nullable)
37
+ firstTextListWithPrefix:(NSString *_Nullable)prefix
38
+ inArray:(NSArray<NSTextList *> *_Nullable)textLists;
39
+
40
+ @end
@@ -0,0 +1,93 @@
1
+ #import "TextListsUtils.h"
2
+
3
+ @implementation TextListsUtils
4
+
5
+ + (NSArray<NSTextList *> *_Nonnull)
6
+ textListsByAdding:(NSString *_Nonnull)value
7
+ withExclusivePrefix:(NSString *_Nullable)prefix
8
+ toArray:(NSArray<NSTextList *> *_Nullable)existing {
9
+ NSMutableArray<NSTextList *> *updated =
10
+ existing ? [existing mutableCopy] : [NSMutableArray array];
11
+
12
+ if (prefix != nil) {
13
+ NSUInteger i = 0;
14
+ while (i < updated.count) {
15
+ if ([updated[i].markerFormat hasPrefix:prefix]) {
16
+ if ([updated[i].markerFormat isEqualToString:value]) {
17
+ return updated;
18
+ }
19
+ [updated removeObjectAtIndex:i];
20
+ } else {
21
+ i++;
22
+ }
23
+ }
24
+ } else {
25
+ for (NSTextList *list in updated) {
26
+ if ([list.markerFormat isEqualToString:value]) {
27
+ return updated;
28
+ }
29
+ }
30
+ }
31
+
32
+ [updated addObject:[[NSTextList alloc] initWithMarkerFormat:value options:0]];
33
+ return updated;
34
+ }
35
+
36
+ + (NSArray<NSTextList *> *_Nonnull)
37
+ textListsByRemoving:(NSString *_Nonnull)value
38
+ withPrefix:(NSString *_Nullable)prefix
39
+ fromArray:(NSArray<NSTextList *> *_Nullable)existing {
40
+ NSMutableArray<NSTextList *> *updated = [NSMutableArray array];
41
+ for (NSTextList *list in existing) {
42
+ if ((prefix == nullptr && ![list.markerFormat isEqualToString:value]) ||
43
+ (prefix != nullptr && ![list.markerFormat hasPrefix:prefix])) {
44
+ [updated addObject:list];
45
+ }
46
+ }
47
+ return updated;
48
+ }
49
+
50
+ + (NSArray<NSTextList *> *_Nonnull)
51
+ textListsByRemovingPrefix:(NSString *_Nullable)prefix
52
+ fromArray:(NSArray<NSTextList *> *_Nullable)existing {
53
+ NSMutableArray<NSTextList *> *updated = [NSMutableArray array];
54
+ for (NSTextList *list in existing) {
55
+ if (![list.markerFormat hasPrefix:prefix]) {
56
+ [updated addObject:list];
57
+ }
58
+ }
59
+ return updated;
60
+ }
61
+
62
+ + (BOOL)textLists:(NSArray<NSTextList *> *_Nullable)textLists
63
+ containsValue:(NSString *_Nonnull)value {
64
+ for (NSTextList *list in textLists) {
65
+ if ([list.markerFormat isEqualToString:value]) {
66
+ return YES;
67
+ }
68
+ }
69
+ return NO;
70
+ }
71
+
72
+ + (BOOL)textLists:(NSArray<NSTextList *> *_Nullable)textLists
73
+ containsPrefix:(NSString *_Nullable)prefix {
74
+ for (NSTextList *list in textLists) {
75
+ if ([list.markerFormat hasPrefix:prefix]) {
76
+ return YES;
77
+ }
78
+ }
79
+ return NO;
80
+ }
81
+
82
+ + (NSTextList *_Nullable)
83
+ firstTextListWithPrefix:(NSString *_Nullable)prefix
84
+ inArray:(NSArray<NSTextList *> *_Nullable)textLists {
85
+ for (NSTextList *list in textLists) {
86
+ if ([list.markerFormat hasPrefix:prefix]) {
87
+ return list;
88
+ }
89
+ }
90
+ return nil;
91
+ }
92
+
93
+ @end
@@ -0,0 +1,3 @@
1
+ @interface WeakBox : NSObject
2
+ @property(nonatomic, weak) id value;
3
+ @end
@@ -0,0 +1,4 @@
1
+ #import "WeakBox.h"
2
+
3
+ @implementation WeakBox
4
+ @end
@@ -0,0 +1,7 @@
1
+ #import <UIKit/UIKit.h>
2
+
3
+ @interface WordsUtils : NSObject
4
+ + (NSArray<NSDictionary *> *)getAffectedWordsFromText:(NSString *)text
5
+ modificationRange:(NSRange)range;
6
+ + (NSDictionary *)getCurrentWord:(NSString *)text range:(NSRange)range;
7
+ @end
@@ -0,0 +1,98 @@
1
+ #import "WordsUtils.h"
2
+
3
+ @implementation WordsUtils
4
+
5
+ + (NSArray<NSDictionary *> *)getAffectedWordsFromText:(NSString *)text
6
+ modificationRange:(NSRange)range {
7
+ if (text.length == 0) {
8
+ return [[NSArray alloc] init];
9
+ }
10
+
11
+ NSInteger leftIt = range.location - 1;
12
+ leftIt = MIN(leftIt, NSInteger(text.length - 1));
13
+ if (leftIt > 0) {
14
+ while (leftIt >= 0) {
15
+ unichar charAtIndex = [text characterAtIndex:leftIt];
16
+ if ([[NSCharacterSet whitespaceAndNewlineCharacterSet]
17
+ characterIsMember:charAtIndex]) {
18
+ leftIt += 1;
19
+ break;
20
+ }
21
+ leftIt -= 1;
22
+ }
23
+ }
24
+ leftIt = MAX(0, leftIt);
25
+ leftIt = MIN(NSInteger(text.length - 1), leftIt);
26
+
27
+ NSInteger rightIt = range.location + range.length;
28
+ if (rightIt < text.length - 1) {
29
+ while (rightIt <= text.length - 1) {
30
+ unichar charAtIndex = [text characterAtIndex:rightIt];
31
+ if ([[NSCharacterSet whitespaceAndNewlineCharacterSet]
32
+ characterIsMember:charAtIndex]) {
33
+ rightIt -= 1;
34
+ break;
35
+ }
36
+ rightIt += 1;
37
+ }
38
+ }
39
+ rightIt = MIN(NSInteger(text.length - 1), rightIt);
40
+
41
+ if (leftIt > rightIt) {
42
+ return [[NSArray alloc] init];
43
+ }
44
+
45
+ NSMutableArray<NSDictionary *> *separatedWords =
46
+ [[NSMutableArray<NSDictionary *> alloc] init];
47
+ NSMutableString *currentWord = [[NSMutableString alloc] init];
48
+ NSInteger currentRangeStart = leftIt;
49
+ NSInteger currentIdx = leftIt;
50
+
51
+ while (currentIdx <= rightIt) {
52
+ unichar charAtIndex = [text characterAtIndex:currentIdx];
53
+ if ([[NSCharacterSet whitespaceAndNewlineCharacterSet]
54
+ characterIsMember:charAtIndex]) {
55
+ if (currentWord.length > 0) {
56
+ [separatedWords addObject:@{
57
+ @"word" : [currentWord copy],
58
+ @"range" : [NSValue
59
+ valueWithRange:NSMakeRange(currentRangeStart, currentWord.length)]
60
+ }];
61
+ [currentWord setString:@""];
62
+ }
63
+ currentRangeStart = currentIdx + 1;
64
+ } else {
65
+ [currentWord appendFormat:@"%C", charAtIndex];
66
+ }
67
+ currentIdx += 1;
68
+ }
69
+
70
+ if (currentWord.length > 0) {
71
+ [separatedWords addObject:@{
72
+ @"word" : [currentWord copy],
73
+ @"range" :
74
+ [NSValue valueWithRange:NSMakeRange(currentRangeStart,
75
+ rightIt - currentRangeStart + 1)]
76
+ }];
77
+ }
78
+
79
+ return separatedWords;
80
+ }
81
+
82
+ + (NSDictionary *)getCurrentWord:(NSString *)text range:(NSRange)range {
83
+ // we just get current word at the cursor
84
+ if (range.length > 0) {
85
+ return nullptr;
86
+ }
87
+
88
+ NSArray<NSDictionary *> *words = [WordsUtils getAffectedWordsFromText:text
89
+ modificationRange:range];
90
+ if (words != nullptr && [words count] == 1 &&
91
+ [words firstObject] != nullptr) {
92
+ return [words firstObject];
93
+ }
94
+
95
+ return nullptr;
96
+ }
97
+
98
+ @end