react-native-enriched 0.2.1 → 0.4.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 (263) hide show
  1. package/README.md +21 -16
  2. package/android/build.gradle +77 -72
  3. package/android/generated/java/com/facebook/react/viewmanagers/EnrichedTextInputViewManagerDelegate.java +21 -0
  4. package/android/generated/java/com/facebook/react/viewmanagers/EnrichedTextInputViewManagerInterface.java +7 -0
  5. package/android/generated/jni/react/renderer/components/{RNEnrichedTextInputViewSpec → ReactNativeEnrichedSpec}/ComponentDescriptors.cpp +1 -1
  6. package/android/generated/jni/react/renderer/components/{RNEnrichedTextInputViewSpec → ReactNativeEnrichedSpec}/ComponentDescriptors.h +1 -1
  7. package/android/generated/jni/react/renderer/components/ReactNativeEnrichedSpec/EventEmitters.cpp +276 -0
  8. package/android/generated/jni/react/renderer/components/ReactNativeEnrichedSpec/EventEmitters.h +239 -0
  9. package/android/generated/jni/react/renderer/components/{RNEnrichedTextInputViewSpec → ReactNativeEnrichedSpec}/Props.cpp +10 -0
  10. package/android/generated/jni/react/renderer/components/{RNEnrichedTextInputViewSpec → ReactNativeEnrichedSpec}/Props.h +251 -0
  11. package/android/gradle.properties +5 -5
  12. package/android/lint.gradle +70 -0
  13. package/android/src/main/java/com/swmansion/enriched/{EnrichedTextInputViewPackage.kt → ReactNativeEnrichedPackage.kt} +4 -5
  14. package/android/src/main/java/com/swmansion/enriched/{utils → common}/AsyncDrawable.kt +50 -15
  15. package/android/src/main/java/com/swmansion/enriched/common/CheckboxDrawable.kt +81 -0
  16. package/android/src/main/java/com/swmansion/enriched/common/EnrichedConstants.kt +11 -0
  17. package/android/src/main/java/com/swmansion/enriched/common/EnrichedStyle.kt +57 -0
  18. package/android/src/main/java/com/swmansion/enriched/{spans/utils → common}/ForceRedrawSpan.kt +3 -2
  19. package/android/src/main/java/com/swmansion/enriched/common/MentionStyle.kt +7 -0
  20. package/android/src/main/java/com/swmansion/enriched/{utils → common}/ResourceManager.kt +1 -1
  21. package/android/src/main/java/com/swmansion/enriched/{utils → common/parser}/EnrichedParser.java +228 -160
  22. package/android/src/main/java/com/swmansion/enriched/common/parser/EnrichedSpanFactory.kt +79 -0
  23. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedBlockQuoteSpan.kt +53 -0
  24. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedBoldSpan.kt +12 -0
  25. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedCheckboxListSpan.kt +91 -0
  26. package/android/src/main/java/com/swmansion/enriched/{spans → common/spans}/EnrichedCodeBlockSpan.kt +12 -14
  27. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedH1Span.kt +20 -0
  28. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedH2Span.kt +20 -0
  29. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedH3Span.kt +20 -0
  30. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedH4Span.kt +21 -0
  31. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedH5Span.kt +20 -0
  32. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedH6Span.kt +20 -0
  33. package/android/src/main/java/com/swmansion/enriched/{spans → common/spans}/EnrichedImageSpan.kt +68 -51
  34. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedInlineCodeSpan.kt +24 -0
  35. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedItalicSpan.kt +12 -0
  36. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedLinkSpan.kt +26 -0
  37. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedMentionSpan.kt +35 -0
  38. package/android/src/main/java/com/swmansion/enriched/{spans → common/spans}/EnrichedOrderedListSpan.kt +21 -29
  39. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedStrikeThroughSpan.kt +11 -0
  40. package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedUnderlineSpan.kt +11 -0
  41. package/android/src/main/java/com/swmansion/enriched/{spans → common/spans}/EnrichedUnorderedListSpan.kt +13 -17
  42. package/android/src/main/java/com/swmansion/enriched/common/spans/interfaces/EnrichedBlockSpan.kt +5 -0
  43. package/android/src/main/java/com/swmansion/enriched/common/spans/interfaces/EnrichedHeadingSpan.kt +3 -0
  44. package/android/src/main/java/com/swmansion/enriched/common/spans/interfaces/EnrichedInlineSpan.kt +3 -0
  45. package/android/src/main/java/com/swmansion/enriched/common/spans/interfaces/EnrichedParagraphSpan.kt +5 -0
  46. package/android/src/main/java/com/swmansion/enriched/common/spans/interfaces/EnrichedSpan.kt +3 -0
  47. package/android/src/main/java/com/swmansion/enriched/{spans → common/spans}/interfaces/EnrichedZeroWidthSpaceSpan.kt +2 -3
  48. package/android/src/main/java/com/swmansion/enriched/textinput/EnrichedTextInputConnectionWrapper.kt +140 -0
  49. package/android/src/main/java/com/swmansion/enriched/textinput/EnrichedTextInputSpannableFactory.kt +83 -0
  50. package/android/src/main/java/com/swmansion/enriched/{EnrichedTextInputView.kt → textinput/EnrichedTextInputView.kt} +322 -157
  51. package/android/src/main/java/com/swmansion/enriched/{EnrichedTextInputViewLayoutManager.kt → textinput/EnrichedTextInputViewLayoutManager.kt} +4 -2
  52. package/android/src/main/java/com/swmansion/enriched/{EnrichedTextInputViewManager.kt → textinput/EnrichedTextInputViewManager.kt} +182 -66
  53. package/android/src/main/java/com/swmansion/enriched/{MeasurementStore.kt → textinput/MeasurementStore.kt} +75 -25
  54. package/android/src/main/java/com/swmansion/enriched/{events → textinput/events}/MentionHandler.kt +22 -12
  55. package/android/src/main/java/com/swmansion/enriched/textinput/events/OnChangeHtmlEvent.kt +27 -0
  56. package/android/src/main/java/com/swmansion/enriched/{events → textinput/events}/OnChangeSelectionEvent.kt +11 -10
  57. package/android/src/main/java/com/swmansion/enriched/textinput/events/OnChangeStateEvent.kt +21 -0
  58. package/android/src/main/java/com/swmansion/enriched/textinput/events/OnChangeTextEvent.kt +30 -0
  59. package/android/src/main/java/com/swmansion/enriched/textinput/events/OnInputBlurEvent.kt +25 -0
  60. package/android/src/main/java/com/swmansion/enriched/textinput/events/OnInputFocusEvent.kt +25 -0
  61. package/android/src/main/java/com/swmansion/enriched/textinput/events/OnInputKeyPressEvent.kt +27 -0
  62. package/android/src/main/java/com/swmansion/enriched/textinput/events/OnLinkDetectedEvent.kt +32 -0
  63. package/android/src/main/java/com/swmansion/enriched/{events → textinput/events}/OnMentionDetectedEvent.kt +11 -10
  64. package/android/src/main/java/com/swmansion/enriched/{events → textinput/events}/OnMentionEvent.kt +10 -9
  65. package/android/src/main/java/com/swmansion/enriched/textinput/events/OnPasteImagesEvent.kt +47 -0
  66. package/android/src/main/java/com/swmansion/enriched/{events → textinput/events}/OnRequestHtmlResultEvent.kt +2 -3
  67. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputBlockQuoteSpan.kt +14 -0
  68. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputBoldSpan.kt +14 -0
  69. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputCheckboxListSpan.kt +15 -0
  70. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputCodeBlockSpan.kt +14 -0
  71. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputH1Span.kt +14 -0
  72. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputH2Span.kt +14 -0
  73. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputH3Span.kt +14 -0
  74. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputH4Span.kt +14 -0
  75. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputH5Span.kt +14 -0
  76. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputH6Span.kt +14 -0
  77. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputImageSpan.kt +36 -0
  78. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputInlineCodeSpan.kt +14 -0
  79. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputItalicSpan.kt +14 -0
  80. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputLinkSpan.kt +15 -0
  81. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputMentionSpan.kt +18 -0
  82. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputOrderedListSpan.kt +21 -0
  83. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputStrikeThroughSpan.kt +14 -0
  84. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputUnderlineSpan.kt +14 -0
  85. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputUnorderedListSpan.kt +14 -0
  86. package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedSpans.kt +241 -0
  87. package/android/src/main/java/com/swmansion/enriched/textinput/spans/interfaces/EnrichedInputSpan.kt +10 -0
  88. package/android/src/main/java/com/swmansion/enriched/{styles → textinput/styles}/HtmlStyle.kt +129 -57
  89. package/android/src/main/java/com/swmansion/enriched/{styles → textinput/styles}/InlineStyles.kt +30 -13
  90. package/android/src/main/java/com/swmansion/enriched/textinput/styles/ListStyles.kt +263 -0
  91. package/android/src/main/java/com/swmansion/enriched/{styles → textinput/styles}/ParagraphStyles.kt +94 -34
  92. package/android/src/main/java/com/swmansion/enriched/{styles → textinput/styles}/ParametrizedStyles.kt +143 -67
  93. package/android/src/main/java/com/swmansion/enriched/textinput/utils/EnrichedEditableFactory.kt +17 -0
  94. package/android/src/main/java/com/swmansion/enriched/{utils → textinput/utils}/EnrichedSelection.kt +84 -54
  95. package/android/src/main/java/com/swmansion/enriched/textinput/utils/EnrichedSpanState.kt +304 -0
  96. package/android/src/main/java/com/swmansion/enriched/{utils/Utils.kt → textinput/utils/EnrichedSpannable.kt} +22 -31
  97. package/android/src/main/java/com/swmansion/enriched/textinput/utils/EnrichedSpannableStringBuilder.kt +16 -0
  98. package/android/src/main/java/com/swmansion/enriched/textinput/utils/RichContentReceiver.kt +127 -0
  99. package/android/src/main/java/com/swmansion/enriched/textinput/utils/Utils.kt +106 -0
  100. package/android/src/main/java/com/swmansion/enriched/{watchers → textinput/watchers}/EnrichedSpanWatcher.kt +56 -24
  101. package/android/src/main/java/com/swmansion/enriched/{watchers → textinput/watchers}/EnrichedTextWatcher.kt +37 -14
  102. package/android/src/main/new_arch/CMakeLists.txt +7 -1
  103. package/android/src/main/new_arch/ReactNativeEnrichedSpec.cpp +11 -0
  104. package/android/src/main/new_arch/ReactNativeEnrichedSpec.h +15 -0
  105. package/android/src/main/new_arch/react/renderer/components/{RNEnrichedTextInputViewSpec → ReactNativeEnrichedSpec}/EnrichedTextInputMeasurementManager.h +1 -1
  106. package/android/src/main/new_arch/react/renderer/components/{RNEnrichedTextInputViewSpec → ReactNativeEnrichedSpec}/EnrichedTextInputShadowNode.h +2 -2
  107. package/android/src/main/new_arch/react/renderer/components/ReactNativeEnrichedSpec/conversions.h +46 -0
  108. package/ios/EnrichedTextInputView.h +2 -1
  109. package/ios/EnrichedTextInputView.mm +603 -60
  110. package/ios/config/InputConfig.h +28 -0
  111. package/ios/config/InputConfig.mm +237 -8
  112. package/ios/extensions/ImageExtension.h +35 -0
  113. package/ios/extensions/ImageExtension.mm +156 -0
  114. package/ios/{utils → extensions}/LayoutManagerExtension.mm +115 -95
  115. package/ios/generated/{RNEnrichedTextInputViewSpec → ReactNativeEnrichedSpec}/ComponentDescriptors.cpp +1 -1
  116. package/ios/generated/{RNEnrichedTextInputViewSpec → ReactNativeEnrichedSpec}/ComponentDescriptors.h +1 -1
  117. package/ios/generated/ReactNativeEnrichedSpec/EventEmitters.cpp +276 -0
  118. package/ios/generated/ReactNativeEnrichedSpec/EventEmitters.h +239 -0
  119. package/ios/generated/{RNEnrichedTextInputViewSpec → ReactNativeEnrichedSpec}/Props.cpp +10 -0
  120. package/ios/generated/{RNEnrichedTextInputViewSpec → ReactNativeEnrichedSpec}/Props.h +251 -0
  121. package/ios/generated/{RNEnrichedTextInputViewSpec → ReactNativeEnrichedSpec}/RCTComponentViewHelpers.h +95 -0
  122. package/ios/inputParser/InputParser.mm +218 -18
  123. package/ios/inputTextView/InputTextView.mm +118 -0
  124. package/ios/{attachments → interfaces}/ImageAttachment.h +1 -0
  125. package/ios/interfaces/ImageAttachment.mm +46 -0
  126. package/ios/interfaces/LinkRegexConfig.h +19 -0
  127. package/ios/interfaces/LinkRegexConfig.mm +37 -0
  128. package/ios/{utils → interfaces}/MentionStyleProps.mm +2 -2
  129. package/ios/{utils → interfaces}/StyleHeaders.h +22 -1
  130. package/ios/{utils → interfaces}/StyleTypeEnum.h +4 -0
  131. package/ios/internals/EnrichedTextInputViewState.cpp +6 -6
  132. package/ios/styles/BlockQuoteStyle.mm +5 -5
  133. package/ios/styles/BoldStyle.mm +21 -6
  134. package/ios/styles/CheckboxListStyle.mm +321 -0
  135. package/ios/styles/CodeBlockStyle.mm +5 -5
  136. package/ios/styles/H1Style.mm +3 -0
  137. package/ios/styles/H2Style.mm +3 -0
  138. package/ios/styles/H3Style.mm +3 -0
  139. package/ios/styles/H4Style.mm +20 -0
  140. package/ios/styles/H5Style.mm +20 -0
  141. package/ios/styles/H6Style.mm +20 -0
  142. package/ios/styles/HeadingStyleBase.mm +161 -72
  143. package/ios/styles/ImageStyle.mm +5 -5
  144. package/ios/styles/InlineCodeStyle.mm +30 -19
  145. package/ios/styles/ItalicStyle.mm +5 -5
  146. package/ios/styles/LinkStyle.mm +98 -40
  147. package/ios/styles/MentionStyle.mm +4 -4
  148. package/ios/styles/OrderedListStyle.mm +5 -5
  149. package/ios/styles/StrikethroughStyle.mm +5 -5
  150. package/ios/styles/UnderlineStyle.mm +5 -5
  151. package/ios/styles/UnorderedListStyle.mm +5 -5
  152. package/ios/utils/CheckboxHitTestUtils.h +10 -0
  153. package/ios/utils/CheckboxHitTestUtils.mm +123 -0
  154. package/ios/utils/ParagraphAttributesUtils.h +4 -0
  155. package/ios/utils/ParagraphAttributesUtils.mm +142 -45
  156. package/ios/utils/ParagraphsUtils.mm +4 -4
  157. package/ios/utils/TextBlockTapGestureRecognizer.h +17 -0
  158. package/ios/utils/TextBlockTapGestureRecognizer.mm +56 -0
  159. package/ios/utils/ZeroWidthSpaceUtils.mm +14 -3
  160. package/lib/module/EnrichedTextInput.js +57 -11
  161. package/lib/module/EnrichedTextInput.js.map +1 -1
  162. package/lib/module/{EnrichedTextInputNativeComponent.ts → spec/EnrichedTextInputNativeComponent.ts} +175 -18
  163. package/lib/module/types.js +4 -0
  164. package/lib/module/types.js.map +1 -0
  165. package/lib/module/{normalizeHtmlStyle.js → utils/normalizeHtmlStyle.js} +18 -0
  166. package/lib/module/utils/normalizeHtmlStyle.js.map +1 -0
  167. package/lib/module/utils/nullthrows.js +9 -0
  168. package/lib/module/utils/nullthrows.js.map +1 -0
  169. package/lib/module/utils/regexParser.js +46 -0
  170. package/lib/module/utils/regexParser.js.map +1 -0
  171. package/lib/typescript/src/EnrichedTextInput.d.ts +20 -51
  172. package/lib/typescript/src/EnrichedTextInput.d.ts.map +1 -1
  173. package/lib/typescript/src/index.d.ts +2 -1
  174. package/lib/typescript/src/index.d.ts.map +1 -1
  175. package/lib/typescript/src/{EnrichedTextInputNativeComponent.d.ts → spec/EnrichedTextInputNativeComponent.d.ts} +154 -18
  176. package/lib/typescript/src/spec/EnrichedTextInputNativeComponent.d.ts.map +1 -0
  177. package/lib/typescript/src/types.d.ts +58 -0
  178. package/lib/typescript/src/types.d.ts.map +1 -0
  179. package/lib/typescript/src/utils/normalizeHtmlStyle.d.ts +4 -0
  180. package/lib/typescript/src/utils/normalizeHtmlStyle.d.ts.map +1 -0
  181. package/lib/typescript/src/utils/nullthrows.d.ts +2 -0
  182. package/lib/typescript/src/utils/nullthrows.d.ts.map +1 -0
  183. package/lib/typescript/src/utils/regexParser.d.ts +3 -0
  184. package/lib/typescript/src/utils/regexParser.d.ts.map +1 -0
  185. package/package.json +13 -9
  186. package/src/EnrichedTextInput.tsx +88 -63
  187. package/src/index.tsx +5 -1
  188. package/src/{EnrichedTextInputNativeComponent.ts → spec/EnrichedTextInputNativeComponent.ts} +175 -18
  189. package/src/types.ts +59 -0
  190. package/src/{normalizeHtmlStyle.ts → utils/normalizeHtmlStyle.ts} +20 -5
  191. package/src/utils/nullthrows.ts +7 -0
  192. package/src/utils/regexParser.ts +56 -0
  193. package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/EventEmitters.cpp +0 -128
  194. package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/EventEmitters.h +0 -102
  195. package/android/src/main/java/com/swmansion/enriched/events/OnChangeHtmlEvent.kt +0 -28
  196. package/android/src/main/java/com/swmansion/enriched/events/OnChangeStateEvent.kt +0 -24
  197. package/android/src/main/java/com/swmansion/enriched/events/OnChangeTextEvent.kt +0 -30
  198. package/android/src/main/java/com/swmansion/enriched/events/OnInputBlurEvent.kt +0 -27
  199. package/android/src/main/java/com/swmansion/enriched/events/OnInputFocusEvent.kt +0 -27
  200. package/android/src/main/java/com/swmansion/enriched/events/OnLinkDetectedEvent.kt +0 -30
  201. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedBlockQuoteSpan.kt +0 -44
  202. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedBoldSpan.kt +0 -16
  203. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedH1Span.kt +0 -23
  204. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedH2Span.kt +0 -23
  205. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedH3Span.kt +0 -23
  206. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedInlineCodeSpan.kt +0 -27
  207. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedItalicSpan.kt +0 -15
  208. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedLinkSpan.kt +0 -30
  209. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedMentionSpan.kt +0 -42
  210. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedSpans.kt +0 -136
  211. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedStrikeThroughSpan.kt +0 -14
  212. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedUnderlineSpan.kt +0 -14
  213. package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedBlockSpan.kt +0 -4
  214. package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedHeadingSpan.kt +0 -4
  215. package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedInlineSpan.kt +0 -4
  216. package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedParagraphSpan.kt +0 -4
  217. package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedSpan.kt +0 -8
  218. package/android/src/main/java/com/swmansion/enriched/styles/ListStyles.kt +0 -172
  219. package/android/src/main/java/com/swmansion/enriched/utils/EnrichedSpanState.kt +0 -204
  220. package/android/src/main/new_arch/RNEnrichedTextInputViewSpec.cpp +0 -22
  221. package/android/src/main/new_arch/RNEnrichedTextInputViewSpec.h +0 -26
  222. package/android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/conversions.h +0 -26
  223. package/ios/attachments/ImageAttachment.mm +0 -34
  224. package/ios/generated/RNEnrichedTextInputViewSpec/EventEmitters.cpp +0 -128
  225. package/ios/generated/RNEnrichedTextInputViewSpec/EventEmitters.h +0 -102
  226. package/lib/module/normalizeHtmlStyle.js.map +0 -1
  227. package/lib/typescript/src/EnrichedTextInputNativeComponent.d.ts.map +0 -1
  228. package/lib/typescript/src/normalizeHtmlStyle.d.ts +0 -4
  229. package/lib/typescript/src/normalizeHtmlStyle.d.ts.map +0 -1
  230. /package/android/generated/jni/react/renderer/components/{RNEnrichedTextInputViewSpec → ReactNativeEnrichedSpec}/ShadowNodes.cpp +0 -0
  231. /package/android/generated/jni/react/renderer/components/{RNEnrichedTextInputViewSpec → ReactNativeEnrichedSpec}/ShadowNodes.h +0 -0
  232. /package/android/generated/jni/react/renderer/components/{RNEnrichedTextInputViewSpec → ReactNativeEnrichedSpec}/States.cpp +0 -0
  233. /package/android/generated/jni/react/renderer/components/{RNEnrichedTextInputViewSpec → ReactNativeEnrichedSpec}/States.h +0 -0
  234. /package/android/src/main/new_arch/react/renderer/components/{RNEnrichedTextInputViewSpec → ReactNativeEnrichedSpec}/EnrichedTextInputComponentDescriptor.h +0 -0
  235. /package/android/src/main/new_arch/react/renderer/components/{RNEnrichedTextInputViewSpec → ReactNativeEnrichedSpec}/EnrichedTextInputMeasurementManager.cpp +0 -0
  236. /package/android/src/main/new_arch/react/renderer/components/{RNEnrichedTextInputViewSpec → ReactNativeEnrichedSpec}/EnrichedTextInputShadowNode.cpp +0 -0
  237. /package/android/src/main/new_arch/react/renderer/components/{RNEnrichedTextInputViewSpec → ReactNativeEnrichedSpec}/EnrichedTextInputState.cpp +0 -0
  238. /package/android/src/main/new_arch/react/renderer/components/{RNEnrichedTextInputViewSpec → ReactNativeEnrichedSpec}/EnrichedTextInputState.h +0 -0
  239. /package/ios/{utils → extensions}/ColorExtension.h +0 -0
  240. /package/ios/{utils → extensions}/ColorExtension.mm +0 -0
  241. /package/ios/{utils → extensions}/FontExtension.h +0 -0
  242. /package/ios/{utils → extensions}/FontExtension.mm +0 -0
  243. /package/ios/{utils → extensions}/LayoutManagerExtension.h +0 -0
  244. /package/ios/{utils → extensions}/StringExtension.h +0 -0
  245. /package/ios/{utils → extensions}/StringExtension.mm +0 -0
  246. /package/ios/generated/{RNEnrichedTextInputViewSpec → ReactNativeEnrichedSpec}/ShadowNodes.cpp +0 -0
  247. /package/ios/generated/{RNEnrichedTextInputViewSpec → ReactNativeEnrichedSpec}/ShadowNodes.h +0 -0
  248. /package/ios/generated/{RNEnrichedTextInputViewSpec → ReactNativeEnrichedSpec}/States.cpp +0 -0
  249. /package/ios/generated/{RNEnrichedTextInputViewSpec → ReactNativeEnrichedSpec}/States.h +0 -0
  250. /package/ios/{utils → interfaces}/BaseStyleProtocol.h +0 -0
  251. /package/ios/{utils → interfaces}/ImageData.h +0 -0
  252. /package/ios/{utils → interfaces}/ImageData.mm +0 -0
  253. /package/ios/{utils → interfaces}/LinkData.h +0 -0
  254. /package/ios/{utils → interfaces}/LinkData.mm +0 -0
  255. /package/ios/{attachments → interfaces}/MediaAttachment.h +0 -0
  256. /package/ios/{attachments → interfaces}/MediaAttachment.mm +0 -0
  257. /package/ios/{utils → interfaces}/MentionParams.h +0 -0
  258. /package/ios/{utils → interfaces}/MentionParams.mm +0 -0
  259. /package/ios/{utils → interfaces}/MentionStyleProps.h +0 -0
  260. /package/ios/{utils → interfaces}/StylePair.h +0 -0
  261. /package/ios/{utils → interfaces}/StylePair.mm +0 -0
  262. /package/ios/{utils → interfaces}/TextDecorationLineEnum.h +0 -0
  263. /package/ios/{utils → interfaces}/TextDecorationLineEnum.mm +0 -0
@@ -1,21 +1,28 @@
1
1
  #import "EnrichedTextInputView.h"
2
2
  #import "FontExtension.h"
3
3
  #import "OccurenceUtils.h"
4
+ #import "ParagraphsUtils.h"
4
5
  #import "StyleHeaders.h"
5
6
  #import "TextInsertionUtils.h"
6
7
 
7
8
  @implementation HeadingStyleBase
8
9
 
9
- // mock values since H1/2/3Style classes anyway are used
10
+ // mock values since H1/2/3/4/5/6Style classes anyway are used
10
11
  + (StyleType)getStyleType {
11
12
  return None;
12
13
  }
13
14
  - (CGFloat)getHeadingFontSize {
14
15
  return 0;
15
16
  }
17
+ - (NSString *)getHeadingLevelString {
18
+ return @"";
19
+ }
16
20
  - (BOOL)isHeadingBold {
17
21
  return false;
18
22
  }
23
+ + (BOOL)isParagraphStyle {
24
+ return true;
25
+ }
19
26
 
20
27
  - (EnrichedTextInputView *)typedInput {
21
28
  return (EnrichedTextInputView *)input;
@@ -39,17 +46,48 @@
39
46
  }
40
47
  }
41
48
 
49
+ - (NSTextList *)getTextListObject {
50
+ return [[NSTextList alloc]
51
+ initWithMarkerFormat:[NSString
52
+ stringWithFormat:@"{heading:%@}",
53
+ [self getHeadingLevelString]]
54
+ options:0];
55
+ }
56
+
42
57
  // the range will already be the proper full paragraph/s range
43
58
  - (void)addAttributes:(NSRange)range withTypingAttr:(BOOL)withTypingAttr {
44
- [[self typedInput]->textView.textStorage beginEditing];
45
- [[self typedInput]->textView.textStorage
46
- enumerateAttribute:NSFontAttributeName
47
- inRange:range
48
- options:0
49
- usingBlock:^(id _Nullable value, NSRange range,
50
- BOOL *_Nonnull stop) {
51
- UIFont *font = (UIFont *)value;
52
- if (font != nullptr) {
59
+ NSTextList *textListMarker = [self getTextListObject];
60
+ NSArray *paragraphs =
61
+ [ParagraphsUtils getSeparateParagraphsRangesIn:[self typedInput]->textView
62
+ range:range];
63
+ for (NSValue *value in paragraphs) {
64
+ NSRange paragraphRange = [value rangeValue];
65
+
66
+ [[self typedInput]->textView.textStorage
67
+ enumerateAttribute:NSParagraphStyleAttributeName
68
+ inRange:paragraphRange
69
+ options:0
70
+ usingBlock:^(id _Nullable value, NSRange range,
71
+ BOOL *_Nonnull stop) {
72
+ NSMutableParagraphStyle *pStyle =
73
+ [(NSParagraphStyle *)value mutableCopy];
74
+ pStyle.textLists = @[ textListMarker ];
75
+ [[self typedInput]->textView.textStorage
76
+ addAttribute:NSParagraphStyleAttributeName
77
+ value:pStyle
78
+ range:range];
79
+ }];
80
+
81
+ [[self typedInput]->textView.textStorage
82
+ enumerateAttribute:NSFontAttributeName
83
+ inRange:paragraphRange
84
+ options:0
85
+ usingBlock:^(id _Nullable value, NSRange range,
86
+ BOOL *_Nonnull stop) {
87
+ UIFont *font = (UIFont *)value;
88
+ if (font == nullptr) {
89
+ return;
90
+ }
53
91
  UIFont *newFont = [font setSize:[self getHeadingFontSize]];
54
92
  if ([self isHeadingBold]) {
55
93
  newFont = [newFont setBold];
@@ -58,9 +96,8 @@
58
96
  addAttribute:NSFontAttributeName
59
97
  value:newFont
60
98
  range:range];
61
- }
62
- }];
63
- [[self typedInput]->textView.textStorage endEditing];
99
+ }];
100
+ }
64
101
 
65
102
  // also toggle typing attributes
66
103
  if (withTypingAttr) {
@@ -71,36 +108,59 @@
71
108
  // will always be called on empty paragraphs so only typing attributes can be
72
109
  // changed
73
110
  - (void)addTypingAttributes {
74
- UIFont *currentFontAttr =
75
- (UIFont *)[self typedInput]
76
- ->textView.typingAttributes[NSFontAttributeName];
111
+ NSMutableDictionary *newTypingAttrs =
112
+ [[self typedInput]->textView.typingAttributes mutableCopy];
113
+
114
+ NSMutableParagraphStyle *pStyle =
115
+ [newTypingAttrs[NSParagraphStyleAttributeName] mutableCopy];
116
+ if (pStyle != nullptr) {
117
+ pStyle.textLists = @[ [self getTextListObject] ];
118
+ newTypingAttrs[NSParagraphStyleAttributeName] = pStyle;
119
+ }
120
+
121
+ UIFont *currentFontAttr = (UIFont *)newTypingAttrs[NSFontAttributeName];
77
122
  if (currentFontAttr != nullptr) {
78
- NSMutableDictionary *newTypingAttrs =
79
- [[self typedInput]->textView.typingAttributes mutableCopy];
80
123
  UIFont *newFont = [currentFontAttr setSize:[self getHeadingFontSize]];
81
124
  if ([self isHeadingBold]) {
82
125
  newFont = [newFont setBold];
83
126
  }
84
127
  newTypingAttrs[NSFontAttributeName] = newFont;
85
- [self typedInput]->textView.typingAttributes = newTypingAttrs;
86
128
  }
129
+
130
+ [self typedInput]->textView.typingAttributes = newTypingAttrs;
87
131
  }
88
132
 
89
133
  // we need to remove the style from the whole paragraph
90
134
  - (void)removeAttributes:(NSRange)range {
91
- NSRange paragraphRange = [[self typedInput]->textView.textStorage.string
92
- paragraphRangeForRange:range];
93
-
94
- [[self typedInput]->textView.textStorage beginEditing];
95
- [[self typedInput]->textView.textStorage
96
- enumerateAttribute:NSFontAttributeName
97
- inRange:paragraphRange
98
- options:0
99
- usingBlock:^(id _Nullable value, NSRange range,
100
- BOOL *_Nonnull stop) {
101
- if ([self styleCondition:value:range]) {
135
+ NSArray *paragraphs =
136
+ [ParagraphsUtils getSeparateParagraphsRangesIn:[self typedInput]->textView
137
+ range:range];
138
+
139
+ for (NSValue *value in paragraphs) {
140
+ NSRange paragraphRange = [value rangeValue];
141
+ [[self typedInput]->textView.textStorage
142
+ enumerateAttribute:NSParagraphStyleAttributeName
143
+ inRange:paragraphRange
144
+ options:0
145
+ usingBlock:^(id _Nullable value, NSRange range,
146
+ BOOL *_Nonnull stop) {
147
+ NSMutableParagraphStyle *pStyle =
148
+ [(NSParagraphStyle *)value mutableCopy];
149
+ pStyle.textLists = @[];
150
+ [[self typedInput]->textView.textStorage
151
+ addAttribute:NSParagraphStyleAttributeName
152
+ value:pStyle
153
+ range:range];
154
+ }];
155
+
156
+ [[self typedInput]->textView.textStorage
157
+ enumerateAttribute:NSFontAttributeName
158
+ inRange:paragraphRange
159
+ options:0
160
+ usingBlock:^(id _Nullable value, NSRange range,
161
+ BOOL *_Nonnull stop) {
102
162
  UIFont *newFont = [(UIFont *)value
103
- setSize:[[[self typedInput]->config primaryFontSize]
163
+ setSize:[[[self typedInput]->config scaledPrimaryFontSize]
104
164
  floatValue]];
105
165
  if ([self isHeadingBold]) {
106
166
  newFont = [newFont removeBold];
@@ -109,73 +169,81 @@
109
169
  addAttribute:NSFontAttributeName
110
170
  value:newFont
111
171
  range:range];
112
- }
113
- }];
114
- [[self typedInput]->textView.textStorage endEditing];
172
+ }];
173
+ }
115
174
 
116
175
  // typing attributes still need to be removed
117
- UIFont *currentFontAttr =
118
- (UIFont *)[self typedInput]
119
- ->textView.typingAttributes[NSFontAttributeName];
176
+ NSMutableDictionary *newTypingAttrs =
177
+ [[self typedInput]->textView.typingAttributes mutableCopy];
178
+
179
+ NSMutableParagraphStyle *pStyle =
180
+ [newTypingAttrs[NSParagraphStyleAttributeName] mutableCopy];
181
+ if (pStyle != nullptr) {
182
+ pStyle.textLists = @[];
183
+ newTypingAttrs[NSParagraphStyleAttributeName] = pStyle;
184
+ }
185
+
186
+ UIFont *currentFontAttr = (UIFont *)newTypingAttrs[NSFontAttributeName];
120
187
  if (currentFontAttr != nullptr) {
121
- NSMutableDictionary *newTypingAttrs =
122
- [[self typedInput]->textView.typingAttributes mutableCopy];
123
188
  UIFont *newFont = [currentFontAttr
124
- setSize:[[[self typedInput]->config primaryFontSize] floatValue]];
189
+ setSize:[[[self typedInput]->config scaledPrimaryFontSize] floatValue]];
125
190
  if ([self isHeadingBold]) {
126
191
  newFont = [newFont removeBold];
127
192
  }
128
193
  newTypingAttrs[NSFontAttributeName] = newFont;
129
- [self typedInput]->textView.typingAttributes = newTypingAttrs;
130
194
  }
195
+
196
+ [self typedInput]->textView.typingAttributes = newTypingAttrs;
131
197
  }
132
198
 
133
199
  - (void)removeTypingAttributes {
134
- // all the heading still needs to be removed because this function may be
135
- // called in conflicting styles logic typing attributes already get removed in
136
- // there as well
200
+ // All the heading still needs to be removed because this function may be
201
+ // called in conflicting styles logic. Typing attributes already get removed
202
+ // in there as well.
137
203
  [self removeAttributes:[self typedInput]->textView.selectedRange];
138
204
  }
139
205
 
140
- - (BOOL)styleCondition:(id _Nullable)value:(NSRange)range {
141
- UIFont *font = (UIFont *)value;
142
- return font != nullptr && font.pointSize == [self getHeadingFontSize];
206
+ - (BOOL)styleCondition:(id _Nullable)value range:(NSRange)range {
207
+ NSParagraphStyle *paragraph = (NSParagraphStyle *)value;
208
+ return paragraph != nullptr && paragraph.textLists.count == 1 &&
209
+ [paragraph.textLists.firstObject.markerFormat
210
+ isEqualToString:[self getTextListObject].markerFormat];
143
211
  }
144
212
 
145
213
  - (BOOL)detectStyle:(NSRange)range {
146
214
  if (range.length >= 1) {
147
- return [OccurenceUtils detect:NSFontAttributeName
215
+ return [OccurenceUtils detect:NSParagraphStyleAttributeName
148
216
  withInput:[self typedInput]
149
217
  inRange:range
150
218
  withCondition:^BOOL(id _Nullable value, NSRange range) {
151
- return [self styleCondition:value:range];
219
+ return [self styleCondition:value range:range];
152
220
  }];
153
221
  } else {
154
- return [OccurenceUtils detect:NSFontAttributeName
222
+ return [OccurenceUtils detect:NSParagraphStyleAttributeName
155
223
  withInput:[self typedInput]
156
224
  atIndex:range.location
157
225
  checkPrevious:YES
158
226
  withCondition:^BOOL(id _Nullable value, NSRange range) {
159
- return [self styleCondition:value:range];
227
+ return [self styleCondition:value range:range];
160
228
  }];
161
229
  }
162
230
  }
163
231
 
164
232
  - (BOOL)anyOccurence:(NSRange)range {
165
- return [OccurenceUtils any:NSFontAttributeName
233
+ return [OccurenceUtils any:NSParagraphStyleAttributeName
166
234
  withInput:[self typedInput]
167
235
  inRange:range
168
236
  withCondition:^BOOL(id _Nullable value, NSRange range) {
169
- return [self styleCondition:value:range];
237
+ return [self styleCondition:value range:range];
170
238
  }];
171
239
  }
172
240
 
173
241
  - (NSArray<StylePair *> *_Nullable)findAllOccurences:(NSRange)range {
174
- return [OccurenceUtils all:NSFontAttributeName
242
+ return [OccurenceUtils all:NSParagraphStyleAttributeName
175
243
  withInput:[self typedInput]
176
244
  inRange:range
177
245
  withCondition:^BOOL(id _Nullable value, NSRange range) {
178
- return [self styleCondition:value:range];
246
+ return [self styleCondition:value range:range];
179
247
  }];
180
248
  }
181
249
 
@@ -192,30 +260,51 @@
192
260
  additionalAttributes:nullptr
193
261
  input:[self typedInput]
194
262
  withSelection:YES];
195
- // remove the attribtues at the new selection
263
+ // remove the attributes at the new selection
196
264
  [self removeAttributes:[self typedInput]->textView.selectedRange];
197
265
  return YES;
198
266
  }
199
267
  return NO;
200
268
  }
201
269
 
202
- // backspacing a line after a heading "into" a heading will not result in the
203
- // text attaining heading attributes so, we do it manually
204
- - (void)handleImproperHeadings {
205
- NSArray *occurences = [self
206
- findAllOccurences:NSMakeRange(0,
207
- [self typedInput]
208
- ->textView.textStorage.string.length)];
209
- for (StylePair *pair in occurences) {
210
- NSRange occurenceRange = [pair.rangeValue rangeValue];
211
- NSRange paragraphRange = [[self typedInput]->textView.textStorage.string
212
- paragraphRangeForRange:occurenceRange];
213
- if (!NSEqualRanges(occurenceRange, paragraphRange)) {
214
- // we have a heading but it does not span its whole paragraph - let's fix
215
- // it
216
- [self addAttributes:paragraphRange withTypingAttr:NO];
217
- }
270
+ // Backspacing a line after a heading "into" a heading will not result in the
271
+ // text not receiving heading font attributes.
272
+ // Hence, we fix these attributes then.
273
+ - (BOOL)handleBackspaceInRange:(NSRange)range replacementText:(NSString *)text {
274
+ // Must be a backspace.
275
+ if (text.length != 0) {
276
+ return NO;
277
+ }
278
+
279
+ // Backspace must have removed a newline character.
280
+ NSString *removedString =
281
+ [[self typedInput]->textView.textStorage.string substringWithRange:range];
282
+ if ([removedString
283
+ rangeOfCharacterFromSet:[NSCharacterSet newlineCharacterSet]]
284
+ .location == NSNotFound) {
285
+ return NO;
218
286
  }
287
+
288
+ // Heading style must have been present in a paragraph before the backspaced
289
+ // range.
290
+ NSRange paragraphBeforeBackspaceRange =
291
+ [[self typedInput]->textView.textStorage.string
292
+ paragraphRangeForRange:NSMakeRange(range.location, 0)];
293
+ if (![self detectStyle:paragraphBeforeBackspaceRange]) {
294
+ return NO;
295
+ }
296
+
297
+ // Manually do the replacing.
298
+ [TextInsertionUtils replaceText:text
299
+ at:range
300
+ additionalAttributes:nullptr
301
+ input:[self typedInput]
302
+ withSelection:YES];
303
+ // Reapply attributes at the beginning of the backspaced range (it will cover
304
+ // the whole paragraph properly).
305
+ [self addAttributes:NSMakeRange(range.location, 0) withTypingAttr:YES];
306
+
307
+ return YES;
219
308
  }
220
309
 
221
310
  @end
@@ -54,7 +54,7 @@ static NSString *const ImageAttributeName = @"ImageAttributeName";
54
54
  _input->textView.typingAttributes = currentAttributes;
55
55
  }
56
56
 
57
- - (BOOL)styleCondition:(id _Nullable)value:(NSRange)range {
57
+ - (BOOL)styleCondition:(id _Nullable)value range:(NSRange)range {
58
58
  return [value isKindOfClass:[ImageData class]];
59
59
  }
60
60
 
@@ -63,7 +63,7 @@ static NSString *const ImageAttributeName = @"ImageAttributeName";
63
63
  withInput:_input
64
64
  inRange:range
65
65
  withCondition:^BOOL(id _Nullable value, NSRange range) {
66
- return [self styleCondition:value:range];
66
+ return [self styleCondition:value range:range];
67
67
  }];
68
68
  }
69
69
 
@@ -73,7 +73,7 @@ static NSString *const ImageAttributeName = @"ImageAttributeName";
73
73
  withInput:_input
74
74
  inRange:range
75
75
  withCondition:^BOOL(id _Nullable value, NSRange range) {
76
- return [self styleCondition:value:range];
76
+ return [self styleCondition:value range:range];
77
77
  }];
78
78
  } else {
79
79
  return [OccurenceUtils detect:ImageAttributeName
@@ -81,7 +81,7 @@ static NSString *const ImageAttributeName = @"ImageAttributeName";
81
81
  atIndex:range.location
82
82
  checkPrevious:YES
83
83
  withCondition:^BOOL(id _Nullable value, NSRange range) {
84
- return [self styleCondition:value:range];
84
+ return [self styleCondition:value range:range];
85
85
  }];
86
86
  }
87
87
  }
@@ -91,7 +91,7 @@ static NSString *const ImageAttributeName = @"ImageAttributeName";
91
91
  withInput:_input
92
92
  inRange:range
93
93
  withCondition:^BOOL(id _Nullable value, NSRange range) {
94
- return [self styleCondition:value:range];
94
+ return [self styleCondition:value range:range];
95
95
  }];
96
96
  }
97
97
 
@@ -151,27 +151,38 @@
151
151
 
152
152
  // making sure no newlines get inline code style, it looks bad
153
153
  - (void)handleNewlines {
154
- for (int i = 0; i < _input->textView.textStorage.string.length; i++) {
155
- if ([[NSCharacterSet newlineCharacterSet]
156
- characterIsMember:[_input->textView.textStorage.string
157
- characterAtIndex:i]]) {
158
- NSRange mockRange = NSMakeRange(0, 0);
159
- // can't use detect style because it intentionally doesn't take newlines
160
- // into consideration
161
- UIColor *bgColor =
162
- [_input->textView.textStorage attribute:NSBackgroundColorAttributeName
163
- atIndex:i
164
- effectiveRange:&mockRange];
165
- if ([self styleCondition:bgColor:NSMakeRange(i, 1)]) {
166
- [self removeAttributes:NSMakeRange(i, 1)];
167
- }
154
+ NSTextStorage *storage = _input->textView.textStorage;
155
+ NSString *string = storage.string;
156
+ NSUInteger length = string.length;
157
+
158
+ if (length == 0)
159
+ return;
160
+
161
+ CFStringInlineBuffer buffer;
162
+ CFStringInitInlineBuffer((CFStringRef)string, &buffer,
163
+ CFRangeMake(0, length));
164
+
165
+ for (NSUInteger index = 0; index < length; index++) {
166
+ unichar ch = CFStringGetCharacterFromInlineBuffer(&buffer, index);
167
+ // check new lines only
168
+ if (![[NSCharacterSet newlineCharacterSet] characterIsMember:ch])
169
+ continue;
170
+
171
+ NSRange newlineRange = NSMakeRange(index, 1);
172
+
173
+ UIColor *bgColor = [storage attribute:NSBackgroundColorAttributeName
174
+ atIndex:index
175
+ effectiveRange:nil];
176
+
177
+ if (bgColor != nil && [self styleCondition:bgColor range:newlineRange]) {
178
+ [self removeAttributes:newlineRange];
168
179
  }
169
180
  }
170
181
  }
171
182
 
172
183
  // emojis don't retain monospace font attribute so we check for the background
173
184
  // color if there is no mention
174
- - (BOOL)styleCondition:(id _Nullable)value:(NSRange)range {
185
+ - (BOOL)styleCondition:(id _Nullable)value range:(NSRange)range {
175
186
  UIColor *bgColor = (UIColor *)value;
176
187
  MentionStyle *mStyle = _input->stylesDict[@([MentionStyle getStyleType])];
177
188
  return bgColor != nullptr && mStyle != nullptr && ![mStyle detectStyle:range];
@@ -194,7 +205,7 @@
194
205
  withInput:_input
195
206
  inRange:currentRange
196
207
  withCondition:^BOOL(id _Nullable value, NSRange range) {
197
- return [self styleCondition:value:range];
208
+ return [self styleCondition:value range:range];
198
209
  }];
199
210
  detected = detected && currentDetected;
200
211
  }
@@ -206,7 +217,7 @@
206
217
  atIndex:range.location
207
218
  checkPrevious:NO
208
219
  withCondition:^BOOL(id _Nullable value, NSRange range) {
209
- return [self styleCondition:value:range];
220
+ return [self styleCondition:value range:range];
210
221
  }];
211
222
  }
212
223
  }
@@ -216,7 +227,7 @@
216
227
  withInput:_input
217
228
  inRange:range
218
229
  withCondition:^BOOL(id _Nullable value, NSRange range) {
219
- return [self styleCondition:value:range];
230
+ return [self styleCondition:value range:range];
220
231
  }];
221
232
  }
222
233
 
@@ -225,7 +236,7 @@
225
236
  withInput:_input
226
237
  inRange:range
227
238
  withCondition:^BOOL(id _Nullable value, NSRange range) {
228
- return [self styleCondition:value:range];
239
+ return [self styleCondition:value range:range];
229
240
  }];
230
241
  }
231
242
 
@@ -91,7 +91,7 @@
91
91
  }
92
92
  }
93
93
 
94
- - (BOOL)styleCondition:(id _Nullable)value:(NSRange)range {
94
+ - (BOOL)styleCondition:(id _Nullable)value range:(NSRange)range {
95
95
  UIFont *font = (UIFont *)value;
96
96
  return font != nullptr && [font isItalic];
97
97
  }
@@ -102,7 +102,7 @@
102
102
  withInput:_input
103
103
  inRange:range
104
104
  withCondition:^BOOL(id _Nullable value, NSRange range) {
105
- return [self styleCondition:value:range];
105
+ return [self styleCondition:value range:range];
106
106
  }];
107
107
  } else {
108
108
  return [OccurenceUtils detect:NSFontAttributeName
@@ -110,7 +110,7 @@
110
110
  atIndex:range.location
111
111
  checkPrevious:NO
112
112
  withCondition:^BOOL(id _Nullable value, NSRange range) {
113
- return [self styleCondition:value:range];
113
+ return [self styleCondition:value range:range];
114
114
  }];
115
115
  }
116
116
  }
@@ -120,7 +120,7 @@
120
120
  withInput:_input
121
121
  inRange:range
122
122
  withCondition:^BOOL(id _Nullable value, NSRange range) {
123
- return [self styleCondition:value:range];
123
+ return [self styleCondition:value range:range];
124
124
  }];
125
125
  }
126
126
 
@@ -129,7 +129,7 @@
129
129
  withInput:_input
130
130
  inRange:range
131
131
  withCondition:^BOOL(id _Nullable value, NSRange range) {
132
- return [self styleCondition:value:range];
132
+ return [self styleCondition:value range:range];
133
133
  }];
134
134
  }
135
135