react-native-enriched 0.0.0 → 0.1.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 (169) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +869 -0
  3. package/ReactNativeEnriched.podspec +27 -0
  4. package/android/build.gradle +101 -0
  5. package/android/generated/java/com/facebook/react/viewmanagers/EnrichedTextInputViewManagerDelegate.java +146 -0
  6. package/android/generated/java/com/facebook/react/viewmanagers/EnrichedTextInputViewManagerInterface.java +55 -0
  7. package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/ComponentDescriptors.cpp +22 -0
  8. package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/ComponentDescriptors.h +24 -0
  9. package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/EventEmitters.cpp +118 -0
  10. package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/EventEmitters.h +95 -0
  11. package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/Props.cpp +128 -0
  12. package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/Props.h +577 -0
  13. package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/ShadowNodes.cpp +17 -0
  14. package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/ShadowNodes.h +23 -0
  15. package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/States.cpp +16 -0
  16. package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/States.h +20 -0
  17. package/android/gradle.properties +5 -0
  18. package/android/src/main/AndroidManifest.xml +3 -0
  19. package/android/src/main/AndroidManifestNew.xml +2 -0
  20. package/android/src/main/java/com/swmansion/enriched/EnrichedTextInputView.kt +535 -0
  21. package/android/src/main/java/com/swmansion/enriched/EnrichedTextInputViewLayoutManager.kt +64 -0
  22. package/android/src/main/java/com/swmansion/enriched/EnrichedTextInputViewManager.kt +292 -0
  23. package/android/src/main/java/com/swmansion/enriched/EnrichedTextInputViewPackage.kt +19 -0
  24. package/android/src/main/java/com/swmansion/enriched/events/MentionHandler.kt +40 -0
  25. package/android/src/main/java/com/swmansion/enriched/events/OnChangeHtmlEvent.kt +28 -0
  26. package/android/src/main/java/com/swmansion/enriched/events/OnChangeSelectionEvent.kt +29 -0
  27. package/android/src/main/java/com/swmansion/enriched/events/OnChangeStateEvent.kt +24 -0
  28. package/android/src/main/java/com/swmansion/enriched/events/OnChangeTextEvent.kt +30 -0
  29. package/android/src/main/java/com/swmansion/enriched/events/OnInputBlurEvent.kt +27 -0
  30. package/android/src/main/java/com/swmansion/enriched/events/OnInputFocusEvent.kt +27 -0
  31. package/android/src/main/java/com/swmansion/enriched/events/OnLinkDetectedEvent.kt +30 -0
  32. package/android/src/main/java/com/swmansion/enriched/events/OnMentionDetectedEvent.kt +29 -0
  33. package/android/src/main/java/com/swmansion/enriched/events/OnMentionEvent.kt +33 -0
  34. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedBlockQuoteSpan.kt +34 -0
  35. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedBoldSpan.kt +10 -0
  36. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedCodeBlockSpan.kt +38 -0
  37. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedH1Span.kt +17 -0
  38. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedH2Span.kt +17 -0
  39. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedH3Span.kt +17 -0
  40. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedImageSpan.kt +41 -0
  41. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedInlineCodeSpan.kt +16 -0
  42. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedItalicSpan.kt +10 -0
  43. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedLinkSpan.kt +24 -0
  44. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedMentionSpan.kt +36 -0
  45. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedOrderedListSpan.kt +71 -0
  46. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedSpans.kt +111 -0
  47. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedStrikeThroughSpan.kt +9 -0
  48. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedUnderlineSpan.kt +9 -0
  49. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedUnorderedListSpan.kt +49 -0
  50. package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedBlockSpan.kt +4 -0
  51. package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedHeadingSpan.kt +4 -0
  52. package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedInlineSpan.kt +4 -0
  53. package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedParagraphSpan.kt +4 -0
  54. package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedSpan.kt +4 -0
  55. package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedZeroWidthSpaceSpan.kt +5 -0
  56. package/android/src/main/java/com/swmansion/enriched/styles/HtmlStyle.kt +227 -0
  57. package/android/src/main/java/com/swmansion/enriched/styles/InlineStyles.kt +146 -0
  58. package/android/src/main/java/com/swmansion/enriched/styles/ListStyles.kt +173 -0
  59. package/android/src/main/java/com/swmansion/enriched/styles/ParagraphStyles.kt +186 -0
  60. package/android/src/main/java/com/swmansion/enriched/styles/ParametrizedStyles.kt +223 -0
  61. package/android/src/main/java/com/swmansion/enriched/utils/EnrichedParser.java +857 -0
  62. package/android/src/main/java/com/swmansion/enriched/utils/EnrichedSelection.kt +285 -0
  63. package/android/src/main/java/com/swmansion/enriched/utils/EnrichedSpanState.kt +204 -0
  64. package/android/src/main/java/com/swmansion/enriched/utils/Utils.kt +91 -0
  65. package/android/src/main/java/com/swmansion/enriched/watchers/EnrichedSpanWatcher.kt +73 -0
  66. package/android/src/main/java/com/swmansion/enriched/watchers/EnrichedTextWatcher.kt +51 -0
  67. package/android/src/main/new_arch/CMakeLists.txt +56 -0
  68. package/android/src/main/new_arch/RNEnrichedTextInputViewSpec.cpp +22 -0
  69. package/android/src/main/new_arch/RNEnrichedTextInputViewSpec.h +26 -0
  70. package/android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/EnrichedTextInputComponentDescriptor.h +35 -0
  71. package/android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/EnrichedTextInputMeasurementManager.cpp +51 -0
  72. package/android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/EnrichedTextInputMeasurementManager.h +26 -0
  73. package/android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/EnrichedTextInputShadowNode.cpp +34 -0
  74. package/android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/EnrichedTextInputShadowNode.h +54 -0
  75. package/android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/EnrichedTextInputState.cpp +9 -0
  76. package/android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/EnrichedTextInputState.h +25 -0
  77. package/ios/EnrichedTextInputView.h +33 -0
  78. package/ios/EnrichedTextInputView.mm +1190 -0
  79. package/ios/EnrichedTextInputViewManager.mm +13 -0
  80. package/ios/config/InputConfig.h +67 -0
  81. package/ios/config/InputConfig.mm +382 -0
  82. package/ios/generated/RNEnrichedTextInputViewSpec/ComponentDescriptors.cpp +22 -0
  83. package/ios/generated/RNEnrichedTextInputViewSpec/ComponentDescriptors.h +24 -0
  84. package/ios/generated/RNEnrichedTextInputViewSpec/EventEmitters.cpp +118 -0
  85. package/ios/generated/RNEnrichedTextInputViewSpec/EventEmitters.h +95 -0
  86. package/ios/generated/RNEnrichedTextInputViewSpec/Props.cpp +128 -0
  87. package/ios/generated/RNEnrichedTextInputViewSpec/Props.h +577 -0
  88. package/ios/generated/RNEnrichedTextInputViewSpec/RCTComponentViewHelpers.h +384 -0
  89. package/ios/generated/RNEnrichedTextInputViewSpec/ShadowNodes.cpp +17 -0
  90. package/ios/generated/RNEnrichedTextInputViewSpec/ShadowNodes.h +23 -0
  91. package/ios/generated/RNEnrichedTextInputViewSpec/States.cpp +16 -0
  92. package/ios/generated/RNEnrichedTextInputViewSpec/States.h +20 -0
  93. package/ios/inputParser/InputParser.h +11 -0
  94. package/ios/inputParser/InputParser.mm +669 -0
  95. package/ios/inputTextView/InputTextView.h +6 -0
  96. package/ios/inputTextView/InputTextView.mm +115 -0
  97. package/ios/internals/EnrichedTextInputViewComponentDescriptor.h +17 -0
  98. package/ios/internals/EnrichedTextInputViewShadowNode.h +40 -0
  99. package/ios/internals/EnrichedTextInputViewShadowNode.mm +83 -0
  100. package/ios/internals/EnrichedTextInputViewState.cpp +10 -0
  101. package/ios/internals/EnrichedTextInputViewState.h +20 -0
  102. package/ios/styles/BlockQuoteStyle.mm +248 -0
  103. package/ios/styles/BoldStyle.mm +122 -0
  104. package/ios/styles/H1Style.mm +10 -0
  105. package/ios/styles/H2Style.mm +10 -0
  106. package/ios/styles/H3Style.mm +10 -0
  107. package/ios/styles/HeadingStyleBase.mm +144 -0
  108. package/ios/styles/InlineCodeStyle.mm +163 -0
  109. package/ios/styles/ItalicStyle.mm +110 -0
  110. package/ios/styles/LinkStyle.mm +463 -0
  111. package/ios/styles/MentionStyle.mm +476 -0
  112. package/ios/styles/OrderedListStyle.mm +225 -0
  113. package/ios/styles/StrikethroughStyle.mm +80 -0
  114. package/ios/styles/UnderlineStyle.mm +112 -0
  115. package/ios/styles/UnorderedListStyle.mm +225 -0
  116. package/ios/utils/BaseStyleProtocol.h +16 -0
  117. package/ios/utils/ColorExtension.h +6 -0
  118. package/ios/utils/ColorExtension.mm +27 -0
  119. package/ios/utils/FontExtension.h +13 -0
  120. package/ios/utils/FontExtension.mm +91 -0
  121. package/ios/utils/LayoutManagerExtension.h +6 -0
  122. package/ios/utils/LayoutManagerExtension.mm +171 -0
  123. package/ios/utils/LinkData.h +9 -0
  124. package/ios/utils/LinkData.mm +4 -0
  125. package/ios/utils/MentionParams.h +9 -0
  126. package/ios/utils/MentionParams.mm +4 -0
  127. package/ios/utils/MentionStyleProps.h +13 -0
  128. package/ios/utils/MentionStyleProps.mm +56 -0
  129. package/ios/utils/OccurenceUtils.h +37 -0
  130. package/ios/utils/OccurenceUtils.mm +124 -0
  131. package/ios/utils/ParagraphsUtils.h +7 -0
  132. package/ios/utils/ParagraphsUtils.mm +54 -0
  133. package/ios/utils/StringExtension.h +15 -0
  134. package/ios/utils/StringExtension.mm +57 -0
  135. package/ios/utils/StyleHeaders.h +74 -0
  136. package/ios/utils/StylePair.h +9 -0
  137. package/ios/utils/StylePair.mm +4 -0
  138. package/ios/utils/StyleTypeEnum.h +22 -0
  139. package/ios/utils/TextDecorationLineEnum.h +6 -0
  140. package/ios/utils/TextDecorationLineEnum.mm +4 -0
  141. package/ios/utils/TextInsertionUtils.h +6 -0
  142. package/ios/utils/TextInsertionUtils.mm +48 -0
  143. package/ios/utils/WordsUtils.h +6 -0
  144. package/ios/utils/WordsUtils.mm +88 -0
  145. package/ios/utils/ZeroWidthSpaceUtils.h +7 -0
  146. package/ios/utils/ZeroWidthSpaceUtils.mm +164 -0
  147. package/lib/module/EnrichedTextInput.js +191 -0
  148. package/lib/module/EnrichedTextInput.js.map +1 -0
  149. package/lib/module/EnrichedTextInputNativeComponent.ts +235 -0
  150. package/lib/module/index.js +4 -0
  151. package/lib/module/index.js.map +1 -0
  152. package/lib/module/normalizeHtmlStyle.js +141 -0
  153. package/lib/module/normalizeHtmlStyle.js.map +1 -0
  154. package/lib/module/package.json +1 -0
  155. package/lib/typescript/package.json +1 -0
  156. package/lib/typescript/src/EnrichedTextInput.d.ts +113 -0
  157. package/lib/typescript/src/EnrichedTextInput.d.ts.map +1 -0
  158. package/lib/typescript/src/EnrichedTextInputNativeComponent.d.ts +160 -0
  159. package/lib/typescript/src/EnrichedTextInputNativeComponent.d.ts.map +1 -0
  160. package/lib/typescript/src/index.d.ts +3 -0
  161. package/lib/typescript/src/index.d.ts.map +1 -0
  162. package/lib/typescript/src/normalizeHtmlStyle.d.ts +4 -0
  163. package/lib/typescript/src/normalizeHtmlStyle.d.ts.map +1 -0
  164. package/package.json +172 -1
  165. package/react-native.config.js +13 -0
  166. package/src/EnrichedTextInput.tsx +358 -0
  167. package/src/EnrichedTextInputNativeComponent.ts +235 -0
  168. package/src/index.tsx +9 -0
  169. package/src/normalizeHtmlStyle.ts +188 -0
@@ -0,0 +1,6 @@
1
+ #pragma once
2
+ #import <UIKit/UIKit.h>
3
+
4
+ typedef NSString *TextDecorationLineEnum NS_TYPED_ENUM;
5
+ extern TextDecorationLineEnum const DecorationUnderline;
6
+ extern TextDecorationLineEnum const DecorationNone;
@@ -0,0 +1,4 @@
1
+ #import "TextDecorationLineEnum.h"
2
+
3
+ TextDecorationLineEnum const DecorationUnderline = @"underline";
4
+ TextDecorationLineEnum const DecorationNone = @"none";
@@ -0,0 +1,6 @@
1
+ #import <UIKit/UIKit.h>
2
+
3
+ @interface TextInsertionUtils : NSObject
4
+ + (void)insertText:(NSString*)text at:(NSInteger)index additionalAttributes:(NSDictionary<NSAttributedStringKey, id>*)additionalAttrs input:(id)input withSelection:(BOOL)withSelection;
5
+ + (void)replaceText:(NSString*)text at:(NSRange)range additionalAttributes:(NSDictionary<NSAttributedStringKey, id>*)additionalAttrs input:(id)input withSelection:(BOOL)withSelection;;
6
+ @end
@@ -0,0 +1,48 @@
1
+ #import "TextInsertionUtils.h"
2
+ #import "UIView+React.h"
3
+ #import "EnrichedTextInputView.h"
4
+
5
+ @implementation TextInsertionUtils
6
+ + (void)insertText:(NSString*)text at:(NSInteger)index additionalAttributes:(NSDictionary<NSAttributedStringKey, id>*)additionalAttrs input:(id)input withSelection:(BOOL)withSelection {
7
+ EnrichedTextInputView *typedInput = (EnrichedTextInputView *)input;
8
+ if(typedInput == nullptr) { return; }
9
+
10
+ UITextView *textView = typedInput->textView;
11
+
12
+ NSMutableDictionary<NSAttributedStringKey, id> *copiedAttrs = [textView.typingAttributes mutableCopy];
13
+ if(additionalAttrs != nullptr) {
14
+ [copiedAttrs addEntriesFromDictionary: additionalAttrs];
15
+ }
16
+
17
+ NSAttributedString *newAttrStr = [[NSAttributedString alloc] initWithString:text attributes:copiedAttrs];
18
+ [textView.textStorage insertAttributedString:newAttrStr atIndex:index];
19
+
20
+ if(withSelection) {
21
+ if(!textView.focused) {
22
+ [textView reactFocus];
23
+ }
24
+ textView.selectedRange = NSMakeRange(index + text.length, 0);
25
+ }
26
+ typedInput->recentlyChangedRange = NSMakeRange(index, text.length);
27
+ }
28
+
29
+ + (void)replaceText:(NSString*)text at:(NSRange)range additionalAttributes:(NSDictionary<NSAttributedStringKey, id>*)additionalAttrs input:(id)input withSelection:(BOOL)withSelection {
30
+ EnrichedTextInputView *typedInput = (EnrichedTextInputView *)input;
31
+ if(typedInput == nullptr) { return; }
32
+
33
+ UITextView *textView = typedInput->textView;
34
+
35
+ [textView.textStorage replaceCharactersInRange:range withString:text];
36
+ if(additionalAttrs != nullptr) {
37
+ [textView.textStorage addAttributes:additionalAttrs range:NSMakeRange(range.location, [text length])];
38
+ }
39
+
40
+ if(withSelection) {
41
+ if(!textView.focused) {
42
+ [textView reactFocus];
43
+ }
44
+ textView.selectedRange = NSMakeRange(range.location + text.length, 0);
45
+ }
46
+ typedInput->recentlyChangedRange = NSMakeRange(range.location, text.length);
47
+ }
48
+ @end
@@ -0,0 +1,6 @@
1
+ #import <UIKit/UIKit.h>
2
+
3
+ @interface WordsUtils : NSObject
4
+ + (NSArray<NSDictionary *> *)getAffectedWordsFromText:(NSString *)text modificationRange:(NSRange)range;
5
+ + (NSDictionary *)getCurrentWord:(NSString *)text range:(NSRange)range;
6
+ @end
@@ -0,0 +1,88 @@
1
+ #import "WordsUtils.h"
2
+
3
+ @implementation WordsUtils
4
+
5
+ + (NSArray<NSDictionary *> *)getAffectedWordsFromText:(NSString *)text modificationRange:(NSRange)range {
6
+ if(text.length == 0) {
7
+ return [[NSArray alloc] init];
8
+ }
9
+
10
+ NSInteger leftIt = range.location - 1;
11
+ leftIt = MIN(leftIt, NSInteger(text.length - 1));
12
+ if (leftIt > 0) {
13
+ while (leftIt >= 0) {
14
+ unichar charAtIndex = [text characterAtIndex:leftIt];
15
+ if ([[NSCharacterSet whitespaceAndNewlineCharacterSet] characterIsMember:charAtIndex]) {
16
+ leftIt += 1;
17
+ break;
18
+ }
19
+ leftIt -= 1;
20
+ }
21
+ }
22
+ leftIt = MAX(0, leftIt);
23
+ leftIt = MIN(NSInteger(text.length - 1), leftIt);
24
+
25
+ NSInteger rightIt = range.location + range.length;
26
+ if (rightIt < text.length - 1) {
27
+ while (rightIt <= text.length - 1) {
28
+ unichar charAtIndex = [text characterAtIndex:rightIt];
29
+ if ([[NSCharacterSet whitespaceAndNewlineCharacterSet] characterIsMember:charAtIndex]) {
30
+ rightIt -= 1;
31
+ break;
32
+ }
33
+ rightIt += 1;
34
+ }
35
+ }
36
+ rightIt = MIN(NSInteger(text.length - 1), rightIt);
37
+
38
+ if(leftIt > rightIt) {
39
+ return [[NSArray alloc] init];
40
+ }
41
+
42
+ NSMutableArray<NSDictionary *> *separatedWords = [[NSMutableArray<NSDictionary *> alloc] init];
43
+ NSMutableString *currentWord = [[NSMutableString alloc] init];
44
+ NSInteger currentRangeStart = leftIt;
45
+ NSInteger currentIdx = leftIt;
46
+
47
+ while (currentIdx <= rightIt) {
48
+ unichar charAtIndex = [text characterAtIndex:currentIdx];
49
+ if ([[NSCharacterSet whitespaceAndNewlineCharacterSet] characterIsMember:charAtIndex]) {
50
+ if (currentWord.length > 0) {
51
+ [separatedWords addObject:@{
52
+ @"word": [currentWord copy],
53
+ @"range": [NSValue valueWithRange:NSMakeRange(currentRangeStart, currentWord.length)]
54
+ }];
55
+ [currentWord setString:@""];
56
+ }
57
+ currentRangeStart = currentIdx + 1;
58
+ } else {
59
+ [currentWord appendFormat:@"%C", charAtIndex];
60
+ }
61
+ currentIdx += 1;
62
+ }
63
+
64
+ if (currentWord.length > 0) {
65
+ [separatedWords addObject:@{
66
+ @"word": [currentWord copy],
67
+ @"range": [NSValue valueWithRange:NSMakeRange(currentRangeStart, rightIt - currentRangeStart + 1)]
68
+ }];
69
+ }
70
+
71
+ return separatedWords;
72
+ }
73
+
74
+ + (NSDictionary *)getCurrentWord:(NSString *)text range:(NSRange)range {
75
+ // we just get current word at the cursor
76
+ if(range.length > 0) {
77
+ return nullptr;
78
+ }
79
+
80
+ NSArray<NSDictionary *> *words = [WordsUtils getAffectedWordsFromText:text modificationRange:range];
81
+ if(words != nullptr && [words count] == 1 && [words firstObject] != nullptr) {
82
+ return [words firstObject];
83
+ }
84
+
85
+ return nullptr;
86
+ }
87
+
88
+ @end
@@ -0,0 +1,7 @@
1
+ #import <UIKit/UIKit.h>
2
+ #pragma once
3
+
4
+ @interface ZeroWidthSpaceUtils : NSObject
5
+ + (void)handleZeroWidthSpacesInInput:(id)input;
6
+ + (BOOL)handleBackspaceInRange:(NSRange)range replacementText:(NSString *)text input:(id)input;
7
+ @end
@@ -0,0 +1,164 @@
1
+ #import "ZeroWidthSpaceUtils.h"
2
+ #import "EnrichedTextInputView.h"
3
+ #import "StyleHeaders.h"
4
+ #import "TextInsertionUtils.h"
5
+ #import "UIView+React.h"
6
+
7
+ @implementation ZeroWidthSpaceUtils
8
+ + (void)handleZeroWidthSpacesInInput:(id)input {
9
+ EnrichedTextInputView *typedInput = (EnrichedTextInputView *)input;
10
+ if(typedInput == nullptr) { return; }
11
+
12
+ [self removeSpacesIfNeededinInput:typedInput];
13
+ [self addSpacesIfNeededinInput:typedInput];
14
+ }
15
+
16
+ + (void)removeSpacesIfNeededinInput:(EnrichedTextInputView *)input {
17
+ NSMutableArray *indexesToBeRemoved = [[NSMutableArray alloc] init];
18
+ NSRange preRemoveSelection = input->textView.selectedRange;
19
+
20
+ for(int i = 0; i < input->textView.textStorage.string.length; i++) {
21
+ unichar character = [input->textView.textStorage.string characterAtIndex:i];
22
+ if(character == 0x200B) {
23
+ NSRange characterRange = NSMakeRange(i, 1);
24
+
25
+ NSRange paragraphRange = [input->textView.textStorage.string paragraphRangeForRange:characterRange];
26
+ // having paragraph longer than 1 character means someone most likely added something and we probably can remove the space
27
+ BOOL removeSpace = paragraphRange.length > 1;
28
+ // exception; 2 characters paragraph with zero width space + newline
29
+ // here, we still need zero width space to keep the empty list items
30
+ if(paragraphRange.length == 2 &&
31
+ paragraphRange.location == i &&
32
+ [[NSCharacterSet newlineCharacterSet] characterIsMember:[input->textView.textStorage.string characterAtIndex:i+1]]
33
+ ) {
34
+ removeSpace = NO;
35
+ }
36
+
37
+ if(removeSpace) {
38
+ [indexesToBeRemoved addObject:@(characterRange.location)];
39
+ continue;
40
+ }
41
+
42
+ UnorderedListStyle *ulStyle = input->stylesDict[@([UnorderedListStyle getStyleType])];
43
+ OrderedListStyle *olStyle = input->stylesDict[@([OrderedListStyle getStyleType])];
44
+ BlockQuoteStyle *bqStyle = input->stylesDict[@([BlockQuoteStyle getStyleType])];
45
+
46
+ // zero width spaces with no lists/blockquote styles on them get removed
47
+ if(![ulStyle detectStyle:characterRange] && ![olStyle detectStyle:characterRange] && ![bqStyle detectStyle:characterRange]) {
48
+ [indexesToBeRemoved addObject:@(characterRange.location)];
49
+ }
50
+ }
51
+ }
52
+
53
+ // do the removing
54
+ NSInteger offset = 0;
55
+ NSInteger postRemoveOffset = 0;
56
+ for(NSNumber *index in indexesToBeRemoved) {
57
+ NSRange replaceRange = NSMakeRange([index integerValue] + offset, 1);
58
+ [TextInsertionUtils replaceText:@"" at:replaceRange additionalAttributes:nullptr input:input withSelection:NO];
59
+ offset -= 1;
60
+ if([index integerValue] < preRemoveSelection.location) {
61
+ postRemoveOffset -= 1;
62
+ }
63
+ }
64
+
65
+ // fix the selection if needed
66
+ if(input->textView.focused) {
67
+ [input->textView reactFocus];
68
+ input->textView.selectedRange = NSMakeRange(preRemoveSelection.location + postRemoveOffset, preRemoveSelection.length);
69
+ }
70
+ }
71
+
72
+ + (void)addSpacesIfNeededinInput:(EnrichedTextInputView *)input {
73
+ UnorderedListStyle *ulStyle = input->stylesDict[@([UnorderedListStyle getStyleType])];
74
+ OrderedListStyle *olStyle = input->stylesDict[@([OrderedListStyle getStyleType])];
75
+ BlockQuoteStyle *bqStyle = input->stylesDict[@([BlockQuoteStyle getStyleType])];
76
+ NSMutableArray *indexesToBeInserted = [[NSMutableArray alloc] init];
77
+ NSRange preAddSelection = input->textView.selectedRange;
78
+
79
+ for(int i = 0; i < input->textView.textStorage.string.length; i++) {
80
+ unichar character = [input->textView.textStorage.string characterAtIndex:i];
81
+
82
+ if([[NSCharacterSet newlineCharacterSet] characterIsMember:character]) {
83
+ NSRange characterRange = NSMakeRange(i, 1);
84
+ NSRange paragraphRange = [input->textView.textStorage.string paragraphRangeForRange:characterRange];
85
+
86
+ if(paragraphRange.length == 1) {
87
+ if([ulStyle detectStyle:characterRange] || [olStyle detectStyle:characterRange] || [bqStyle detectStyle:characterRange]) {
88
+ // we have an empty list or quote item with no space: add it!
89
+ [indexesToBeInserted addObject:@(paragraphRange.location)];
90
+ }
91
+ }
92
+ }
93
+ }
94
+
95
+ // do the replacing
96
+ NSInteger offset = 0;
97
+ NSInteger postAddOffset = 0;
98
+ for(NSNumber *index in indexesToBeInserted) {
99
+ NSRange replaceRange = NSMakeRange([index integerValue] + offset, 1);
100
+ [TextInsertionUtils replaceText:@"\u200B\n" at:replaceRange additionalAttributes:nullptr input:input withSelection:NO];
101
+ offset += 1;
102
+ if([index integerValue] < preAddSelection.location) {
103
+ postAddOffset += 1;
104
+ }
105
+ }
106
+
107
+ // additional check for last index of the input
108
+ NSRange lastRange = NSMakeRange(input->textView.textStorage.string.length, 0);
109
+ NSRange lastParagraphRange = [input->textView.textStorage.string paragraphRangeForRange:lastRange];
110
+ if(lastParagraphRange.length == 0 && ([ulStyle detectStyle:lastRange] || [olStyle detectStyle:lastRange] || [bqStyle detectStyle:lastRange])) {
111
+ [TextInsertionUtils insertText:@"\u200B" at:lastRange.location additionalAttributes:nullptr input:input withSelection:NO];
112
+ }
113
+
114
+ // fix the selection if needed
115
+ if(input->textView.focused) {
116
+ [input->textView reactFocus];
117
+ input->textView.selectedRange = NSMakeRange(preAddSelection.location + postAddOffset, preAddSelection.length);
118
+ }
119
+ }
120
+
121
+ + (BOOL)handleBackspaceInRange:(NSRange)range replacementText:(NSString *)text input:(id)input {
122
+ if(range.length != 1 || ![text isEqualToString:@""]) { return NO; }
123
+ EnrichedTextInputView *typedInput = (EnrichedTextInputView *)input;
124
+ if(typedInput == nullptr) { return NO; }
125
+
126
+ unichar character = [typedInput->textView.textStorage.string characterAtIndex:range.location];
127
+ // zero-width space got backspaced
128
+ if(character == 0x200B) {
129
+ // in such case: remove the whole line without the endline if there is one
130
+
131
+ NSRange paragraphRange = [typedInput->textView.textStorage.string paragraphRangeForRange:range];
132
+ NSRange removalRange = paragraphRange;
133
+ // if whole paragraph gets removed then 0 length for style removal
134
+ NSRange styleRemovalRange = NSMakeRange(paragraphRange.location, 0);
135
+
136
+ if([[NSCharacterSet newlineCharacterSet] characterIsMember:[typedInput->textView.textStorage.string characterAtIndex:NSMaxRange(paragraphRange) - 1]]) {
137
+ // if endline is there, don't remove it
138
+ removalRange = NSMakeRange(paragraphRange.location, paragraphRange.length - 1);
139
+ // if endline is left then 1 length for style removal
140
+ styleRemovalRange = NSMakeRange(paragraphRange.location, 1);
141
+ }
142
+
143
+ [TextInsertionUtils replaceText:@"" at:removalRange additionalAttributes:nullptr input:typedInput withSelection:YES];
144
+
145
+ // and then remove associated styling
146
+
147
+ UnorderedListStyle *ulStyle = typedInput->stylesDict[@([UnorderedListStyle getStyleType])];
148
+ OrderedListStyle *olStyle = typedInput->stylesDict[@([OrderedListStyle getStyleType])];
149
+ BlockQuoteStyle *bqStyle = typedInput->stylesDict[@([BlockQuoteStyle getStyleType])];
150
+
151
+ if([ulStyle detectStyle:styleRemovalRange]) {
152
+ [ulStyle removeAttributes:styleRemovalRange];
153
+ } else if([olStyle detectStyle:styleRemovalRange]) {
154
+ [olStyle removeAttributes:styleRemovalRange];
155
+ } else if([bqStyle detectStyle:styleRemovalRange]) {
156
+ [bqStyle removeAttributes:styleRemovalRange];
157
+ }
158
+
159
+ return YES;
160
+ }
161
+ return NO;
162
+ }
163
+ @end
164
+
@@ -0,0 +1,191 @@
1
+ "use strict";
2
+
3
+ import { useImperativeHandle, useMemo, useRef } from 'react';
4
+ import EnrichedTextInputNativeComponent, { Commands } from './EnrichedTextInputNativeComponent';
5
+ import { normalizeHtmlStyle } from "./normalizeHtmlStyle.js";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ const nullthrows = value => {
8
+ if (value == null) {
9
+ throw new Error('Unexpected null or undefined value');
10
+ }
11
+ return value;
12
+ };
13
+ const warnAboutMissconfiguredMentions = indicator => {
14
+ console.warn(`Looks like you are trying to set a "${indicator}" but it's not in the mentionIndicators prop`);
15
+ };
16
+ export const EnrichedTextInput = ({
17
+ ref,
18
+ autoFocus,
19
+ editable = true,
20
+ mentionIndicators = ['@'],
21
+ defaultValue,
22
+ placeholder,
23
+ placeholderTextColor,
24
+ cursorColor,
25
+ selectionColor,
26
+ style,
27
+ autoCapitalize = 'sentences',
28
+ htmlStyle = {},
29
+ onFocus,
30
+ onBlur,
31
+ onChangeText,
32
+ onChangeHtml,
33
+ onChangeState,
34
+ onLinkDetected,
35
+ onMentionDetected,
36
+ onStartMention,
37
+ onChangeMention,
38
+ onEndMention,
39
+ onChangeSelection,
40
+ androidExperimentalSynchronousEvents = false,
41
+ ...rest
42
+ }) => {
43
+ const nativeRef = useRef(null);
44
+ const normalizedHtmlStyle = useMemo(() => normalizeHtmlStyle(htmlStyle, mentionIndicators), [htmlStyle, mentionIndicators]);
45
+ useImperativeHandle(ref, () => ({
46
+ measureInWindow: callback => {
47
+ nullthrows(nativeRef.current).measureInWindow(callback);
48
+ },
49
+ measure: callback => {
50
+ nullthrows(nativeRef.current).measure(callback);
51
+ },
52
+ measureLayout: (relativeToNativeComponentRef, onSuccess, onFail) => {
53
+ nullthrows(nativeRef.current).measureLayout(relativeToNativeComponentRef, onSuccess, onFail);
54
+ },
55
+ setNativeProps: nativeProps => {
56
+ nullthrows(nativeRef.current).setNativeProps(nativeProps);
57
+ },
58
+ focus: () => {
59
+ Commands.focus(nullthrows(nativeRef.current));
60
+ },
61
+ blur: () => {
62
+ Commands.blur(nullthrows(nativeRef.current));
63
+ },
64
+ setValue: value => {
65
+ Commands.setValue(nullthrows(nativeRef.current), value);
66
+ },
67
+ toggleBold: () => {
68
+ Commands.toggleBold(nullthrows(nativeRef.current));
69
+ },
70
+ toggleItalic: () => {
71
+ Commands.toggleItalic(nullthrows(nativeRef.current));
72
+ },
73
+ toggleUnderline: () => {
74
+ Commands.toggleUnderline(nullthrows(nativeRef.current));
75
+ },
76
+ toggleStrikeThrough: () => {
77
+ Commands.toggleStrikeThrough(nullthrows(nativeRef.current));
78
+ },
79
+ toggleInlineCode: () => {
80
+ Commands.toggleInlineCode(nullthrows(nativeRef.current));
81
+ },
82
+ toggleH1: () => {
83
+ Commands.toggleH1(nullthrows(nativeRef.current));
84
+ },
85
+ toggleH2: () => {
86
+ Commands.toggleH2(nullthrows(nativeRef.current));
87
+ },
88
+ toggleH3: () => {
89
+ Commands.toggleH3(nullthrows(nativeRef.current));
90
+ },
91
+ toggleCodeBlock: () => {
92
+ Commands.toggleCodeBlock(nullthrows(nativeRef.current));
93
+ },
94
+ toggleBlockQuote: () => {
95
+ Commands.toggleBlockQuote(nullthrows(nativeRef.current));
96
+ },
97
+ toggleOrderedList: () => {
98
+ Commands.toggleOrderedList(nullthrows(nativeRef.current));
99
+ },
100
+ toggleUnorderedList: () => {
101
+ Commands.toggleUnorderedList(nullthrows(nativeRef.current));
102
+ },
103
+ setLink: (start, end, text, url) => {
104
+ Commands.addLink(nullthrows(nativeRef.current), start, end, text, url);
105
+ },
106
+ setImage: uri => {
107
+ Commands.addImage(nullthrows(nativeRef.current), uri);
108
+ },
109
+ setMention: (indicator, text, attributes) => {
110
+ // Codegen does not support objects as Commands parameters, so we stringify attributes
111
+ const parsedAttributes = JSON.stringify(attributes ?? {});
112
+ Commands.addMention(nullthrows(nativeRef.current), indicator, text, parsedAttributes);
113
+ },
114
+ startMention: indicator => {
115
+ if (!mentionIndicators?.includes(indicator)) {
116
+ warnAboutMissconfiguredMentions(indicator);
117
+ }
118
+ Commands.startMention(nullthrows(nativeRef.current), indicator);
119
+ }
120
+ }));
121
+ const handleMentionEvent = e => {
122
+ const mentionText = e.nativeEvent.text;
123
+ const mentionIndicator = e.nativeEvent.indicator;
124
+ if (typeof mentionText === 'string') {
125
+ if (mentionText === '') {
126
+ onStartMention?.(mentionIndicator);
127
+ } else {
128
+ onChangeMention?.({
129
+ indicator: mentionIndicator,
130
+ text: mentionText
131
+ });
132
+ }
133
+ } else if (mentionText === null) {
134
+ onEndMention?.(mentionIndicator);
135
+ }
136
+ };
137
+ const handleLinkDetected = e => {
138
+ const {
139
+ text,
140
+ url,
141
+ start,
142
+ end
143
+ } = e.nativeEvent;
144
+ onLinkDetected?.({
145
+ text,
146
+ url,
147
+ start,
148
+ end
149
+ });
150
+ };
151
+ const handleMentionDetected = e => {
152
+ const {
153
+ text,
154
+ indicator,
155
+ payload
156
+ } = e.nativeEvent;
157
+ const attributes = JSON.parse(payload);
158
+ onMentionDetected?.({
159
+ text,
160
+ indicator,
161
+ attributes
162
+ });
163
+ };
164
+ return /*#__PURE__*/_jsx(EnrichedTextInputNativeComponent, {
165
+ ref: nativeRef,
166
+ mentionIndicators: mentionIndicators,
167
+ editable: editable,
168
+ autoFocus: autoFocus,
169
+ defaultValue: defaultValue,
170
+ placeholder: placeholder,
171
+ placeholderTextColor: placeholderTextColor,
172
+ cursorColor: cursorColor,
173
+ selectionColor: selectionColor,
174
+ style: style,
175
+ autoCapitalize: autoCapitalize,
176
+ htmlStyle: normalizedHtmlStyle,
177
+ onInputFocus: onFocus,
178
+ onInputBlur: onBlur,
179
+ onChangeText: onChangeText,
180
+ onChangeHtml: onChangeHtml,
181
+ isOnChangeHtmlSet: onChangeHtml !== undefined,
182
+ onChangeState: onChangeState,
183
+ onLinkDetected: handleLinkDetected,
184
+ onMentionDetected: handleMentionDetected,
185
+ onMention: handleMentionEvent,
186
+ onChangeSelection: onChangeSelection,
187
+ androidExperimentalSynchronousEvents: androidExperimentalSynchronousEvents,
188
+ ...rest
189
+ });
190
+ };
191
+ //# sourceMappingURL=EnrichedTextInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useImperativeHandle","useMemo","useRef","EnrichedTextInputNativeComponent","Commands","normalizeHtmlStyle","jsx","_jsx","nullthrows","value","Error","warnAboutMissconfiguredMentions","indicator","console","warn","EnrichedTextInput","ref","autoFocus","editable","mentionIndicators","defaultValue","placeholder","placeholderTextColor","cursorColor","selectionColor","style","autoCapitalize","htmlStyle","onFocus","onBlur","onChangeText","onChangeHtml","onChangeState","onLinkDetected","onMentionDetected","onStartMention","onChangeMention","onEndMention","onChangeSelection","androidExperimentalSynchronousEvents","rest","nativeRef","normalizedHtmlStyle","measureInWindow","callback","current","measure","measureLayout","relativeToNativeComponentRef","onSuccess","onFail","setNativeProps","nativeProps","focus","blur","setValue","toggleBold","toggleItalic","toggleUnderline","toggleStrikeThrough","toggleInlineCode","toggleH1","toggleH2","toggleH3","toggleCodeBlock","toggleBlockQuote","toggleOrderedList","toggleUnorderedList","setLink","start","end","text","url","addLink","setImage","uri","addImage","setMention","attributes","parsedAttributes","JSON","stringify","addMention","startMention","includes","handleMentionEvent","e","mentionText","nativeEvent","mentionIndicator","handleLinkDetected","handleMentionDetected","payload","parse","onInputFocus","onInputBlur","isOnChangeHtmlSet","undefined","onMention"],"sourceRoot":"../../src","sources":["EnrichedTextInput.tsx"],"mappings":";;AAAA,SAGEA,mBAAmB,EACnBC,OAAO,EACPC,MAAM,QACD,OAAO;AACd,OAAOC,gCAAgC,IACrCC,QAAQ,QAWH,oCAAoC;AAa3C,SAASC,kBAAkB,QAAQ,yBAAsB;AAAC,SAAAC,G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