react-native-enriched 0.2.1 → 0.3.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.
- package/README.md +15 -12
- package/android/build.gradle +77 -72
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedTextInputViewManagerDelegate.java +18 -0
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedTextInputViewManagerInterface.java +6 -0
- package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/EventEmitters.cpp +146 -0
- package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/EventEmitters.h +140 -0
- package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/Props.cpp +10 -0
- package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/Props.h +194 -0
- package/android/lint.gradle +70 -0
- package/android/src/main/java/com/swmansion/enriched/EnrichedTextInputConnectionWrapper.kt +140 -0
- package/android/src/main/java/com/swmansion/enriched/EnrichedTextInputView.kt +245 -116
- package/android/src/main/java/com/swmansion/enriched/EnrichedTextInputViewLayoutManager.kt +3 -1
- package/android/src/main/java/com/swmansion/enriched/EnrichedTextInputViewManager.kt +162 -53
- package/android/src/main/java/com/swmansion/enriched/EnrichedTextInputViewPackage.kt +1 -3
- package/android/src/main/java/com/swmansion/enriched/MeasurementStore.kt +70 -21
- package/android/src/main/java/com/swmansion/enriched/events/MentionHandler.kt +20 -10
- package/android/src/main/java/com/swmansion/enriched/events/OnChangeHtmlEvent.kt +8 -9
- package/android/src/main/java/com/swmansion/enriched/events/OnChangeSelectionEvent.kt +10 -9
- package/android/src/main/java/com/swmansion/enriched/events/OnChangeStateDeprecatedEvent.kt +21 -0
- package/android/src/main/java/com/swmansion/enriched/events/OnChangeStateEvent.kt +9 -12
- package/android/src/main/java/com/swmansion/enriched/events/OnChangeTextEvent.kt +10 -10
- package/android/src/main/java/com/swmansion/enriched/events/OnInputBlurEvent.kt +7 -9
- package/android/src/main/java/com/swmansion/enriched/events/OnInputFocusEvent.kt +7 -9
- package/android/src/main/java/com/swmansion/enriched/events/OnInputKeyPressEvent.kt +27 -0
- package/android/src/main/java/com/swmansion/enriched/events/OnLinkDetectedEvent.kt +13 -11
- package/android/src/main/java/com/swmansion/enriched/events/OnMentionDetectedEvent.kt +10 -9
- package/android/src/main/java/com/swmansion/enriched/events/OnMentionEvent.kt +9 -8
- package/android/src/main/java/com/swmansion/enriched/events/OnRequestHtmlResultEvent.kt +1 -2
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedBlockQuoteSpan.kt +21 -8
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedBoldSpan.kt +5 -4
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedCodeBlockSpan.kt +7 -5
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedH1Span.kt +5 -4
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedH2Span.kt +5 -4
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedH3Span.kt +5 -4
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedH4Span.kt +24 -0
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedH5Span.kt +24 -0
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedH6Span.kt +24 -0
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedImageSpan.kt +29 -17
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedInlineCodeSpan.kt +5 -4
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedItalicSpan.kt +5 -4
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedLinkSpan.kt +7 -7
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedMentionSpan.kt +11 -14
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedOrderedListSpan.kt +15 -14
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedSpans.kt +167 -71
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedStrikeThroughSpan.kt +5 -4
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedUnderlineSpan.kt +5 -4
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedUnorderedListSpan.kt +8 -8
- package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedBlockSpan.kt +3 -2
- package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedHeadingSpan.kt +1 -2
- package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedInlineSpan.kt +1 -2
- package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedParagraphSpan.kt +3 -2
- package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedSpan.kt +1 -0
- package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedZeroWidthSpaceSpan.kt +1 -2
- package/android/src/main/java/com/swmansion/enriched/spans/utils/ForceRedrawSpan.kt +2 -1
- package/android/src/main/java/com/swmansion/enriched/styles/HtmlStyle.kt +78 -21
- package/android/src/main/java/com/swmansion/enriched/styles/InlineStyles.kt +25 -8
- package/android/src/main/java/com/swmansion/enriched/styles/ListStyles.kt +60 -20
- package/android/src/main/java/com/swmansion/enriched/styles/ParagraphStyles.kt +86 -26
- package/android/src/main/java/com/swmansion/enriched/styles/ParametrizedStyles.kt +128 -52
- package/android/src/main/java/com/swmansion/enriched/utils/AsyncDrawable.kt +10 -7
- package/android/src/main/java/com/swmansion/enriched/utils/EnrichedConstants.kt +11 -0
- package/android/src/main/java/com/swmansion/enriched/utils/EnrichedEditableFactory.kt +17 -0
- package/android/src/main/java/com/swmansion/enriched/utils/EnrichedParser.java +128 -87
- package/android/src/main/java/com/swmansion/enriched/utils/EnrichedSelection.kt +71 -42
- package/android/src/main/java/com/swmansion/enriched/utils/EnrichedSpanState.kt +183 -48
- package/android/src/main/java/com/swmansion/enriched/utils/EnrichedSpannable.kt +82 -0
- package/android/src/main/java/com/swmansion/enriched/utils/EnrichedSpannableStringBuilder.kt +15 -0
- package/android/src/main/java/com/swmansion/enriched/utils/Utils.kt +0 -70
- package/android/src/main/java/com/swmansion/enriched/watchers/EnrichedSpanWatcher.kt +46 -14
- package/android/src/main/java/com/swmansion/enriched/watchers/EnrichedTextWatcher.kt +34 -11
- package/android/src/main/new_arch/CMakeLists.txt +6 -0
- package/android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/conversions.h +21 -1
- package/ios/EnrichedTextInputView.h +1 -1
- package/ios/EnrichedTextInputView.mm +381 -49
- package/ios/config/InputConfig.h +18 -0
- package/ios/config/InputConfig.mm +118 -8
- package/ios/generated/RNEnrichedTextInputViewSpec/EventEmitters.cpp +146 -0
- package/ios/generated/RNEnrichedTextInputViewSpec/EventEmitters.h +140 -0
- package/ios/generated/RNEnrichedTextInputViewSpec/Props.cpp +10 -0
- package/ios/generated/RNEnrichedTextInputViewSpec/Props.h +194 -0
- package/ios/generated/RNEnrichedTextInputViewSpec/RCTComponentViewHelpers.h +74 -0
- package/ios/inputParser/InputParser.mm +83 -10
- package/ios/{attachments → interfaces}/ImageAttachment.mm +3 -1
- package/ios/interfaces/LinkRegexConfig.h +19 -0
- package/ios/interfaces/LinkRegexConfig.mm +37 -0
- package/ios/{utils → interfaces}/MentionStyleProps.mm +2 -2
- package/ios/{utils → interfaces}/StyleHeaders.h +10 -0
- package/ios/{utils → interfaces}/StyleTypeEnum.h +3 -0
- package/ios/styles/BlockQuoteStyle.mm +5 -5
- package/ios/styles/BoldStyle.mm +21 -6
- package/ios/styles/CodeBlockStyle.mm +5 -5
- package/ios/styles/H4Style.mm +17 -0
- package/ios/styles/H5Style.mm +17 -0
- package/ios/styles/H6Style.mm +17 -0
- package/ios/styles/HeadingStyleBase.mm +27 -10
- package/ios/styles/ImageStyle.mm +5 -5
- package/ios/styles/InlineCodeStyle.mm +30 -19
- package/ios/styles/ItalicStyle.mm +5 -5
- package/ios/styles/LinkStyle.mm +98 -40
- package/ios/styles/MentionStyle.mm +4 -4
- package/ios/styles/OrderedListStyle.mm +5 -5
- package/ios/styles/StrikethroughStyle.mm +5 -5
- package/ios/styles/UnderlineStyle.mm +5 -5
- package/ios/styles/UnorderedListStyle.mm +5 -5
- package/ios/utils/ParagraphAttributesUtils.h +4 -0
- package/ios/utils/ParagraphAttributesUtils.mm +67 -0
- package/ios/utils/ParagraphsUtils.mm +4 -4
- package/lib/module/EnrichedTextInput.js +22 -1
- package/lib/module/EnrichedTextInput.js.map +1 -1
- package/lib/module/EnrichedTextInputNativeComponent.ts +138 -12
- package/lib/module/{normalizeHtmlStyle.js → utils/normalizeHtmlStyle.js} +12 -0
- package/lib/module/utils/normalizeHtmlStyle.js.map +1 -0
- package/lib/module/utils/regexParser.js +46 -0
- package/lib/module/utils/regexParser.js.map +1 -0
- package/lib/typescript/src/EnrichedTextInput.d.ts +23 -14
- package/lib/typescript/src/EnrichedTextInput.d.ts.map +1 -1
- package/lib/typescript/src/EnrichedTextInputNativeComponent.d.ts +123 -12
- package/lib/typescript/src/EnrichedTextInputNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/normalizeHtmlStyle.d.ts +4 -0
- package/lib/typescript/src/utils/normalizeHtmlStyle.d.ts.map +1 -0
- package/lib/typescript/src/utils/regexParser.d.ts +3 -0
- package/lib/typescript/src/utils/regexParser.d.ts.map +1 -0
- package/package.json +10 -6
- package/src/EnrichedTextInput.tsx +51 -13
- package/src/EnrichedTextInputNativeComponent.ts +138 -12
- package/src/index.tsx +2 -0
- package/src/{normalizeHtmlStyle.ts → utils/normalizeHtmlStyle.ts} +14 -2
- package/src/utils/regexParser.ts +56 -0
- package/lib/module/normalizeHtmlStyle.js.map +0 -1
- package/lib/typescript/src/normalizeHtmlStyle.d.ts +0 -4
- package/lib/typescript/src/normalizeHtmlStyle.d.ts.map +0 -1
- /package/ios/{utils → extensions}/ColorExtension.h +0 -0
- /package/ios/{utils → extensions}/ColorExtension.mm +0 -0
- /package/ios/{utils → extensions}/FontExtension.h +0 -0
- /package/ios/{utils → extensions}/FontExtension.mm +0 -0
- /package/ios/{utils → extensions}/LayoutManagerExtension.h +0 -0
- /package/ios/{utils → extensions}/LayoutManagerExtension.mm +0 -0
- /package/ios/{utils → extensions}/StringExtension.h +0 -0
- /package/ios/{utils → extensions}/StringExtension.mm +0 -0
- /package/ios/{utils → interfaces}/BaseStyleProtocol.h +0 -0
- /package/ios/{attachments → interfaces}/ImageAttachment.h +0 -0
- /package/ios/{utils → interfaces}/ImageData.h +0 -0
- /package/ios/{utils → interfaces}/ImageData.mm +0 -0
- /package/ios/{utils → interfaces}/LinkData.h +0 -0
- /package/ios/{utils → interfaces}/LinkData.mm +0 -0
- /package/ios/{attachments → interfaces}/MediaAttachment.h +0 -0
- /package/ios/{attachments → interfaces}/MediaAttachment.mm +0 -0
- /package/ios/{utils → interfaces}/MentionParams.h +0 -0
- /package/ios/{utils → interfaces}/MentionParams.mm +0 -0
- /package/ios/{utils → interfaces}/MentionStyleProps.h +0 -0
- /package/ios/{utils → interfaces}/StylePair.h +0 -0
- /package/ios/{utils → interfaces}/StylePair.mm +0 -0
- /package/ios/{utils → interfaces}/TextDecorationLineEnum.h +0 -0
- /package/ios/{utils → interfaces}/TextDecorationLineEnum.mm +0 -0
|
@@ -135,6 +135,123 @@ static inline folly::dynamic toDynamic(const EnrichedTextInputViewHtmlStyleH3Str
|
|
|
135
135
|
}
|
|
136
136
|
#endif
|
|
137
137
|
|
|
138
|
+
struct EnrichedTextInputViewHtmlStyleH4Struct {
|
|
139
|
+
Float fontSize{0.0};
|
|
140
|
+
bool bold{false};
|
|
141
|
+
|
|
142
|
+
#ifdef RN_SERIALIZABLE_STATE
|
|
143
|
+
bool operator==(const EnrichedTextInputViewHtmlStyleH4Struct&) const = default;
|
|
144
|
+
|
|
145
|
+
folly::dynamic toDynamic() const {
|
|
146
|
+
folly::dynamic result = folly::dynamic::object();
|
|
147
|
+
result["fontSize"] = fontSize;
|
|
148
|
+
result["bold"] = bold;
|
|
149
|
+
return result;
|
|
150
|
+
}
|
|
151
|
+
#endif
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, EnrichedTextInputViewHtmlStyleH4Struct &result) {
|
|
155
|
+
auto map = (std::unordered_map<std::string, RawValue>)value;
|
|
156
|
+
|
|
157
|
+
auto tmp_fontSize = map.find("fontSize");
|
|
158
|
+
if (tmp_fontSize != map.end()) {
|
|
159
|
+
fromRawValue(context, tmp_fontSize->second, result.fontSize);
|
|
160
|
+
}
|
|
161
|
+
auto tmp_bold = map.find("bold");
|
|
162
|
+
if (tmp_bold != map.end()) {
|
|
163
|
+
fromRawValue(context, tmp_bold->second, result.bold);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
static inline std::string toString(const EnrichedTextInputViewHtmlStyleH4Struct &value) {
|
|
168
|
+
return "[Object EnrichedTextInputViewHtmlStyleH4Struct]";
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
#ifdef RN_SERIALIZABLE_STATE
|
|
172
|
+
static inline folly::dynamic toDynamic(const EnrichedTextInputViewHtmlStyleH4Struct &value) {
|
|
173
|
+
return value.toDynamic();
|
|
174
|
+
}
|
|
175
|
+
#endif
|
|
176
|
+
|
|
177
|
+
struct EnrichedTextInputViewHtmlStyleH5Struct {
|
|
178
|
+
Float fontSize{0.0};
|
|
179
|
+
bool bold{false};
|
|
180
|
+
|
|
181
|
+
#ifdef RN_SERIALIZABLE_STATE
|
|
182
|
+
bool operator==(const EnrichedTextInputViewHtmlStyleH5Struct&) const = default;
|
|
183
|
+
|
|
184
|
+
folly::dynamic toDynamic() const {
|
|
185
|
+
folly::dynamic result = folly::dynamic::object();
|
|
186
|
+
result["fontSize"] = fontSize;
|
|
187
|
+
result["bold"] = bold;
|
|
188
|
+
return result;
|
|
189
|
+
}
|
|
190
|
+
#endif
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, EnrichedTextInputViewHtmlStyleH5Struct &result) {
|
|
194
|
+
auto map = (std::unordered_map<std::string, RawValue>)value;
|
|
195
|
+
|
|
196
|
+
auto tmp_fontSize = map.find("fontSize");
|
|
197
|
+
if (tmp_fontSize != map.end()) {
|
|
198
|
+
fromRawValue(context, tmp_fontSize->second, result.fontSize);
|
|
199
|
+
}
|
|
200
|
+
auto tmp_bold = map.find("bold");
|
|
201
|
+
if (tmp_bold != map.end()) {
|
|
202
|
+
fromRawValue(context, tmp_bold->second, result.bold);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
static inline std::string toString(const EnrichedTextInputViewHtmlStyleH5Struct &value) {
|
|
207
|
+
return "[Object EnrichedTextInputViewHtmlStyleH5Struct]";
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
#ifdef RN_SERIALIZABLE_STATE
|
|
211
|
+
static inline folly::dynamic toDynamic(const EnrichedTextInputViewHtmlStyleH5Struct &value) {
|
|
212
|
+
return value.toDynamic();
|
|
213
|
+
}
|
|
214
|
+
#endif
|
|
215
|
+
|
|
216
|
+
struct EnrichedTextInputViewHtmlStyleH6Struct {
|
|
217
|
+
Float fontSize{0.0};
|
|
218
|
+
bool bold{false};
|
|
219
|
+
|
|
220
|
+
#ifdef RN_SERIALIZABLE_STATE
|
|
221
|
+
bool operator==(const EnrichedTextInputViewHtmlStyleH6Struct&) const = default;
|
|
222
|
+
|
|
223
|
+
folly::dynamic toDynamic() const {
|
|
224
|
+
folly::dynamic result = folly::dynamic::object();
|
|
225
|
+
result["fontSize"] = fontSize;
|
|
226
|
+
result["bold"] = bold;
|
|
227
|
+
return result;
|
|
228
|
+
}
|
|
229
|
+
#endif
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, EnrichedTextInputViewHtmlStyleH6Struct &result) {
|
|
233
|
+
auto map = (std::unordered_map<std::string, RawValue>)value;
|
|
234
|
+
|
|
235
|
+
auto tmp_fontSize = map.find("fontSize");
|
|
236
|
+
if (tmp_fontSize != map.end()) {
|
|
237
|
+
fromRawValue(context, tmp_fontSize->second, result.fontSize);
|
|
238
|
+
}
|
|
239
|
+
auto tmp_bold = map.find("bold");
|
|
240
|
+
if (tmp_bold != map.end()) {
|
|
241
|
+
fromRawValue(context, tmp_bold->second, result.bold);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
static inline std::string toString(const EnrichedTextInputViewHtmlStyleH6Struct &value) {
|
|
246
|
+
return "[Object EnrichedTextInputViewHtmlStyleH6Struct]";
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
#ifdef RN_SERIALIZABLE_STATE
|
|
250
|
+
static inline folly::dynamic toDynamic(const EnrichedTextInputViewHtmlStyleH6Struct &value) {
|
|
251
|
+
return value.toDynamic();
|
|
252
|
+
}
|
|
253
|
+
#endif
|
|
254
|
+
|
|
138
255
|
struct EnrichedTextInputViewHtmlStyleBlockquoteStruct {
|
|
139
256
|
SharedColor borderColor{};
|
|
140
257
|
Float borderWidth{0.0};
|
|
@@ -415,6 +532,9 @@ struct EnrichedTextInputViewHtmlStyleStruct {
|
|
|
415
532
|
EnrichedTextInputViewHtmlStyleH1Struct h1{};
|
|
416
533
|
EnrichedTextInputViewHtmlStyleH2Struct h2{};
|
|
417
534
|
EnrichedTextInputViewHtmlStyleH3Struct h3{};
|
|
535
|
+
EnrichedTextInputViewHtmlStyleH4Struct h4{};
|
|
536
|
+
EnrichedTextInputViewHtmlStyleH5Struct h5{};
|
|
537
|
+
EnrichedTextInputViewHtmlStyleH6Struct h6{};
|
|
418
538
|
EnrichedTextInputViewHtmlStyleBlockquoteStruct blockquote{};
|
|
419
539
|
EnrichedTextInputViewHtmlStyleCodeblockStruct codeblock{};
|
|
420
540
|
EnrichedTextInputViewHtmlStyleCodeStruct code{};
|
|
@@ -431,6 +551,9 @@ struct EnrichedTextInputViewHtmlStyleStruct {
|
|
|
431
551
|
result["h1"] = ::facebook::react::toDynamic(h1);
|
|
432
552
|
result["h2"] = ::facebook::react::toDynamic(h2);
|
|
433
553
|
result["h3"] = ::facebook::react::toDynamic(h3);
|
|
554
|
+
result["h4"] = ::facebook::react::toDynamic(h4);
|
|
555
|
+
result["h5"] = ::facebook::react::toDynamic(h5);
|
|
556
|
+
result["h6"] = ::facebook::react::toDynamic(h6);
|
|
434
557
|
result["blockquote"] = ::facebook::react::toDynamic(blockquote);
|
|
435
558
|
result["codeblock"] = ::facebook::react::toDynamic(codeblock);
|
|
436
559
|
result["code"] = ::facebook::react::toDynamic(code);
|
|
@@ -458,6 +581,18 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
|
|
458
581
|
if (tmp_h3 != map.end()) {
|
|
459
582
|
fromRawValue(context, tmp_h3->second, result.h3);
|
|
460
583
|
}
|
|
584
|
+
auto tmp_h4 = map.find("h4");
|
|
585
|
+
if (tmp_h4 != map.end()) {
|
|
586
|
+
fromRawValue(context, tmp_h4->second, result.h4);
|
|
587
|
+
}
|
|
588
|
+
auto tmp_h5 = map.find("h5");
|
|
589
|
+
if (tmp_h5 != map.end()) {
|
|
590
|
+
fromRawValue(context, tmp_h5->second, result.h5);
|
|
591
|
+
}
|
|
592
|
+
auto tmp_h6 = map.find("h6");
|
|
593
|
+
if (tmp_h6 != map.end()) {
|
|
594
|
+
fromRawValue(context, tmp_h6->second, result.h6);
|
|
595
|
+
}
|
|
461
596
|
auto tmp_blockquote = map.find("blockquote");
|
|
462
597
|
if (tmp_blockquote != map.end()) {
|
|
463
598
|
fromRawValue(context, tmp_blockquote->second, result.blockquote);
|
|
@@ -497,6 +632,63 @@ static inline folly::dynamic toDynamic(const EnrichedTextInputViewHtmlStyleStruc
|
|
|
497
632
|
return value.toDynamic();
|
|
498
633
|
}
|
|
499
634
|
#endif
|
|
635
|
+
|
|
636
|
+
struct EnrichedTextInputViewLinkRegexStruct {
|
|
637
|
+
std::string pattern{};
|
|
638
|
+
bool caseInsensitive{false};
|
|
639
|
+
bool dotAll{false};
|
|
640
|
+
bool isDisabled{false};
|
|
641
|
+
bool isDefault{false};
|
|
642
|
+
|
|
643
|
+
#ifdef RN_SERIALIZABLE_STATE
|
|
644
|
+
bool operator==(const EnrichedTextInputViewLinkRegexStruct&) const = default;
|
|
645
|
+
|
|
646
|
+
folly::dynamic toDynamic() const {
|
|
647
|
+
folly::dynamic result = folly::dynamic::object();
|
|
648
|
+
result["pattern"] = pattern;
|
|
649
|
+
result["caseInsensitive"] = caseInsensitive;
|
|
650
|
+
result["dotAll"] = dotAll;
|
|
651
|
+
result["isDisabled"] = isDisabled;
|
|
652
|
+
result["isDefault"] = isDefault;
|
|
653
|
+
return result;
|
|
654
|
+
}
|
|
655
|
+
#endif
|
|
656
|
+
};
|
|
657
|
+
|
|
658
|
+
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, EnrichedTextInputViewLinkRegexStruct &result) {
|
|
659
|
+
auto map = (std::unordered_map<std::string, RawValue>)value;
|
|
660
|
+
|
|
661
|
+
auto tmp_pattern = map.find("pattern");
|
|
662
|
+
if (tmp_pattern != map.end()) {
|
|
663
|
+
fromRawValue(context, tmp_pattern->second, result.pattern);
|
|
664
|
+
}
|
|
665
|
+
auto tmp_caseInsensitive = map.find("caseInsensitive");
|
|
666
|
+
if (tmp_caseInsensitive != map.end()) {
|
|
667
|
+
fromRawValue(context, tmp_caseInsensitive->second, result.caseInsensitive);
|
|
668
|
+
}
|
|
669
|
+
auto tmp_dotAll = map.find("dotAll");
|
|
670
|
+
if (tmp_dotAll != map.end()) {
|
|
671
|
+
fromRawValue(context, tmp_dotAll->second, result.dotAll);
|
|
672
|
+
}
|
|
673
|
+
auto tmp_isDisabled = map.find("isDisabled");
|
|
674
|
+
if (tmp_isDisabled != map.end()) {
|
|
675
|
+
fromRawValue(context, tmp_isDisabled->second, result.isDisabled);
|
|
676
|
+
}
|
|
677
|
+
auto tmp_isDefault = map.find("isDefault");
|
|
678
|
+
if (tmp_isDefault != map.end()) {
|
|
679
|
+
fromRawValue(context, tmp_isDefault->second, result.isDefault);
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
static inline std::string toString(const EnrichedTextInputViewLinkRegexStruct &value) {
|
|
684
|
+
return "[Object EnrichedTextInputViewLinkRegexStruct]";
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
#ifdef RN_SERIALIZABLE_STATE
|
|
688
|
+
static inline folly::dynamic toDynamic(const EnrichedTextInputViewLinkRegexStruct &value) {
|
|
689
|
+
return value.toDynamic();
|
|
690
|
+
}
|
|
691
|
+
#endif
|
|
500
692
|
class EnrichedTextInputViewProps final : public ViewProps {
|
|
501
693
|
public:
|
|
502
694
|
EnrichedTextInputViewProps() = default;
|
|
@@ -515,12 +707,14 @@ class EnrichedTextInputViewProps final : public ViewProps {
|
|
|
515
707
|
std::string autoCapitalize{};
|
|
516
708
|
EnrichedTextInputViewHtmlStyleStruct htmlStyle{};
|
|
517
709
|
bool scrollEnabled{false};
|
|
710
|
+
EnrichedTextInputViewLinkRegexStruct linkRegex{};
|
|
518
711
|
SharedColor color{};
|
|
519
712
|
Float fontSize{0.0};
|
|
520
713
|
std::string fontFamily{};
|
|
521
714
|
std::string fontWeight{};
|
|
522
715
|
std::string fontStyle{};
|
|
523
716
|
bool isOnChangeHtmlSet{false};
|
|
717
|
+
bool isOnChangeTextSet{false};
|
|
524
718
|
bool androidExperimentalSynchronousEvents{false};
|
|
525
719
|
|
|
526
720
|
#ifdef RN_SERIALIZABLE_STATE
|
|
@@ -17,6 +17,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
17
17
|
- (void)focus;
|
|
18
18
|
- (void)blur;
|
|
19
19
|
- (void)setValue:(NSString *)text;
|
|
20
|
+
- (void)setSelection:(NSInteger)start end:(NSInteger)end;
|
|
20
21
|
- (void)toggleBold;
|
|
21
22
|
- (void)toggleItalic;
|
|
22
23
|
- (void)toggleUnderline;
|
|
@@ -25,6 +26,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
25
26
|
- (void)toggleH1;
|
|
26
27
|
- (void)toggleH2;
|
|
27
28
|
- (void)toggleH3;
|
|
29
|
+
- (void)toggleH4;
|
|
30
|
+
- (void)toggleH5;
|
|
31
|
+
- (void)toggleH6;
|
|
28
32
|
- (void)toggleCodeBlock;
|
|
29
33
|
- (void)toggleBlockQuote;
|
|
30
34
|
- (void)toggleOrderedList;
|
|
@@ -89,6 +93,34 @@ if ([commandName isEqualToString:@"setValue"]) {
|
|
|
89
93
|
return;
|
|
90
94
|
}
|
|
91
95
|
|
|
96
|
+
if ([commandName isEqualToString:@"setSelection"]) {
|
|
97
|
+
#if RCT_DEBUG
|
|
98
|
+
if ([args count] != 2) {
|
|
99
|
+
RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"EnrichedTextInputView", commandName, (int)[args count], 2);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
#endif
|
|
103
|
+
|
|
104
|
+
NSObject *arg0 = args[0];
|
|
105
|
+
#if RCT_DEBUG
|
|
106
|
+
if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"number", @"EnrichedTextInputView", commandName, @"1st")) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
#endif
|
|
110
|
+
NSInteger start = [(NSNumber *)arg0 intValue];
|
|
111
|
+
|
|
112
|
+
NSObject *arg1 = args[1];
|
|
113
|
+
#if RCT_DEBUG
|
|
114
|
+
if (!RCTValidateTypeOfViewCommandArgument(arg1, [NSNumber class], @"number", @"EnrichedTextInputView", commandName, @"2nd")) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
#endif
|
|
118
|
+
NSInteger end = [(NSNumber *)arg1 intValue];
|
|
119
|
+
|
|
120
|
+
[componentView setSelection:start end:end];
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
|
|
92
124
|
if ([commandName isEqualToString:@"toggleBold"]) {
|
|
93
125
|
#if RCT_DEBUG
|
|
94
126
|
if ([args count] != 0) {
|
|
@@ -201,6 +233,48 @@ if ([commandName isEqualToString:@"toggleH3"]) {
|
|
|
201
233
|
return;
|
|
202
234
|
}
|
|
203
235
|
|
|
236
|
+
if ([commandName isEqualToString:@"toggleH4"]) {
|
|
237
|
+
#if RCT_DEBUG
|
|
238
|
+
if ([args count] != 0) {
|
|
239
|
+
RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"EnrichedTextInputView", commandName, (int)[args count], 0);
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
#endif
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
[componentView toggleH4];
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
if ([commandName isEqualToString:@"toggleH5"]) {
|
|
251
|
+
#if RCT_DEBUG
|
|
252
|
+
if ([args count] != 0) {
|
|
253
|
+
RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"EnrichedTextInputView", commandName, (int)[args count], 0);
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
#endif
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
[componentView toggleH5];
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
if ([commandName isEqualToString:@"toggleH6"]) {
|
|
265
|
+
#if RCT_DEBUG
|
|
266
|
+
if ([args count] != 0) {
|
|
267
|
+
RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"EnrichedTextInputView", commandName, (int)[args count], 0);
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
#endif
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
[componentView toggleH6];
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
|
|
204
278
|
if ([commandName isEqualToString:@"toggleCodeBlock"]) {
|
|
205
279
|
#if RCT_DEBUG
|
|
206
280
|
if ([args count] != 0) {
|
|
@@ -7,11 +7,13 @@
|
|
|
7
7
|
|
|
8
8
|
@implementation InputParser {
|
|
9
9
|
EnrichedTextInputView *_input;
|
|
10
|
+
NSInteger _precedingImageCount;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
- (instancetype)initWithInput:(id)input {
|
|
13
14
|
self = [super init];
|
|
14
15
|
_input = (EnrichedTextInputView *)input;
|
|
16
|
+
_precedingImageCount = 0;
|
|
15
17
|
return self;
|
|
16
18
|
}
|
|
17
19
|
|
|
@@ -137,6 +139,9 @@
|
|
|
137
139
|
[previousActiveStyles containsObject:@([H1Style getStyleType])] ||
|
|
138
140
|
[previousActiveStyles containsObject:@([H2Style getStyleType])] ||
|
|
139
141
|
[previousActiveStyles containsObject:@([H3Style getStyleType])] ||
|
|
142
|
+
[previousActiveStyles containsObject:@([H4Style getStyleType])] ||
|
|
143
|
+
[previousActiveStyles containsObject:@([H5Style getStyleType])] ||
|
|
144
|
+
[previousActiveStyles containsObject:@([H6Style getStyleType])] ||
|
|
140
145
|
[previousActiveStyles
|
|
141
146
|
containsObject:@([BlockQuoteStyle getStyleType])] ||
|
|
142
147
|
[previousActiveStyles
|
|
@@ -224,6 +229,9 @@
|
|
|
224
229
|
[currentActiveStyles containsObject:@([H1Style getStyleType])] ||
|
|
225
230
|
[currentActiveStyles containsObject:@([H2Style getStyleType])] ||
|
|
226
231
|
[currentActiveStyles containsObject:@([H3Style getStyleType])] ||
|
|
232
|
+
[currentActiveStyles containsObject:@([H4Style getStyleType])] ||
|
|
233
|
+
[currentActiveStyles containsObject:@([H5Style getStyleType])] ||
|
|
234
|
+
[currentActiveStyles containsObject:@([H6Style getStyleType])] ||
|
|
227
235
|
[currentActiveStyles
|
|
228
236
|
containsObject:@([BlockQuoteStyle getStyleType])] ||
|
|
229
237
|
[currentActiveStyles
|
|
@@ -378,8 +386,14 @@
|
|
|
378
386
|
[previousActiveStyles
|
|
379
387
|
containsObject:@([H2Style getStyleType])] ||
|
|
380
388
|
[previousActiveStyles
|
|
381
|
-
containsObject:@([H3Style getStyleType])]
|
|
382
|
-
|
|
389
|
+
containsObject:@([H3Style getStyleType])] ||
|
|
390
|
+
[previousActiveStyles
|
|
391
|
+
containsObject:@([H4Style getStyleType])] ||
|
|
392
|
+
[previousActiveStyles
|
|
393
|
+
containsObject:@([H5Style getStyleType])] ||
|
|
394
|
+
[previousActiveStyles
|
|
395
|
+
containsObject:@([H6Style getStyleType])]) {
|
|
396
|
+
// do nothing, heading closing tag has already been appended
|
|
383
397
|
} else {
|
|
384
398
|
[result appendString:@"</p>"];
|
|
385
399
|
}
|
|
@@ -405,6 +419,12 @@
|
|
|
405
419
|
|
|
406
420
|
[result appendString:@"\n</html>"];
|
|
407
421
|
|
|
422
|
+
// remove Object Replacement Characters in the very end
|
|
423
|
+
[result replaceOccurrencesOfString:@"\uFFFC"
|
|
424
|
+
withString:@""
|
|
425
|
+
options:0
|
|
426
|
+
range:NSMakeRange(0, result.length)];
|
|
427
|
+
|
|
408
428
|
// remove zero width spaces in the very end
|
|
409
429
|
[result replaceOccurrencesOfString:@"\u200B"
|
|
410
430
|
withString:@""
|
|
@@ -507,6 +527,12 @@
|
|
|
507
527
|
return @"h2";
|
|
508
528
|
} else if ([style isEqualToNumber:@([H3Style getStyleType])]) {
|
|
509
529
|
return @"h3";
|
|
530
|
+
} else if ([style isEqualToNumber:@([H4Style getStyleType])]) {
|
|
531
|
+
return @"h4";
|
|
532
|
+
} else if ([style isEqualToNumber:@([H5Style getStyleType])]) {
|
|
533
|
+
return @"h5";
|
|
534
|
+
} else if ([style isEqualToNumber:@([H6Style getStyleType])]) {
|
|
535
|
+
return @"h6";
|
|
510
536
|
} else if ([style isEqualToNumber:@([UnorderedListStyle getStyleType])] ||
|
|
511
537
|
[style isEqualToNumber:@([OrderedListStyle getStyleType])]) {
|
|
512
538
|
return @"li";
|
|
@@ -738,6 +764,18 @@
|
|
|
738
764
|
inString:fixedHtml
|
|
739
765
|
leading:YES
|
|
740
766
|
trailing:NO];
|
|
767
|
+
fixedHtml = [self stringByAddingNewlinesToTag:@"<h4>"
|
|
768
|
+
inString:fixedHtml
|
|
769
|
+
leading:YES
|
|
770
|
+
trailing:NO];
|
|
771
|
+
fixedHtml = [self stringByAddingNewlinesToTag:@"<h5>"
|
|
772
|
+
inString:fixedHtml
|
|
773
|
+
leading:YES
|
|
774
|
+
trailing:NO];
|
|
775
|
+
fixedHtml = [self stringByAddingNewlinesToTag:@"<h6>"
|
|
776
|
+
inString:fixedHtml
|
|
777
|
+
leading:YES
|
|
778
|
+
trailing:NO];
|
|
741
779
|
|
|
742
780
|
// line closing tags
|
|
743
781
|
fixedHtml = [self stringByAddingNewlinesToTag:@"</p>"
|
|
@@ -760,6 +798,18 @@
|
|
|
760
798
|
inString:fixedHtml
|
|
761
799
|
leading:NO
|
|
762
800
|
trailing:YES];
|
|
801
|
+
fixedHtml = [self stringByAddingNewlinesToTag:@"</h4>"
|
|
802
|
+
inString:fixedHtml
|
|
803
|
+
leading:NO
|
|
804
|
+
trailing:YES];
|
|
805
|
+
fixedHtml = [self stringByAddingNewlinesToTag:@"</h5>"
|
|
806
|
+
inString:fixedHtml
|
|
807
|
+
leading:NO
|
|
808
|
+
trailing:YES];
|
|
809
|
+
fixedHtml = [self stringByAddingNewlinesToTag:@"</h6>"
|
|
810
|
+
inString:fixedHtml
|
|
811
|
+
leading:NO
|
|
812
|
+
trailing:YES];
|
|
763
813
|
|
|
764
814
|
// this is more like a hack but for some reason the last <br> in
|
|
765
815
|
// <blockquote> and <codeblock> are not properly changed into zero width
|
|
@@ -788,11 +838,11 @@
|
|
|
788
838
|
* APPROACH:
|
|
789
839
|
* This function treats the HTML as having two distinct states:
|
|
790
840
|
* 1. Structure Mode (Depth == 0): We are inside or between container tags (like
|
|
791
|
-
*
|
|
841
|
+
* blockquote, ul, codeblock). In this mode whitespace and newlines are
|
|
792
842
|
* considered layout artifacts and are REMOVED to prevent the parser from
|
|
793
843
|
* creating unwanted spaces.
|
|
794
|
-
* 2. Content Mode (Depth > 0): We are inside a text-containing tag (like
|
|
795
|
-
*
|
|
844
|
+
* 2. Content Mode (Depth > 0): We are inside a text-containing tag (like p,
|
|
845
|
+
* b, li). In this mode, all whitespace is PRESERVED exactly as is, ensuring
|
|
796
846
|
* that sentences and inline formatting remain readable.
|
|
797
847
|
*
|
|
798
848
|
* The function iterates character-by-character, using a depth counter to track
|
|
@@ -800,13 +850,13 @@
|
|
|
800
850
|
*
|
|
801
851
|
* IMPORTANT:
|
|
802
852
|
* The `textTags` set acts as a whitelist for "Content Mode". If you add support
|
|
803
|
-
* for a new HTML tag that contains visible text (e.g.,
|
|
853
|
+
* for a new HTML tag that contains visible text (e.g., h4, h5, h6),
|
|
804
854
|
* you MUST add it to the `textTags` set below.
|
|
805
855
|
*/
|
|
806
856
|
- (NSString *)stripExtraWhiteSpacesAndNewlines:(NSString *)html {
|
|
807
|
-
NSSet *textTags =
|
|
808
|
-
|
|
809
|
-
|
|
857
|
+
NSSet *textTags = [NSSet setWithObjects:@"p", @"h1", @"h2", @"h3", @"h4",
|
|
858
|
+
@"h5", @"h6", @"li", @"b", @"a", @"s",
|
|
859
|
+
@"mention", @"code", @"u", @"i", nil];
|
|
810
860
|
|
|
811
861
|
NSMutableString *output = [NSMutableString stringWithCapacity:html.length];
|
|
812
862
|
NSMutableString *currentTagBuffer = [NSMutableString string];
|
|
@@ -901,7 +951,19 @@
|
|
|
901
951
|
|
|
902
952
|
NSArray *tagData = ongoingTags[tagName];
|
|
903
953
|
NSInteger tagLocation = [((NSNumber *)tagData[0]) intValue];
|
|
904
|
-
|
|
954
|
+
|
|
955
|
+
// 'tagLocation' is an index based on 'plainText' which currently only holds
|
|
956
|
+
// raw text.
|
|
957
|
+
//
|
|
958
|
+
// Since 'plainText' does not yet contain the special placeholders for images,
|
|
959
|
+
// the indices for any text following an image are lower than they will be
|
|
960
|
+
// in the final NSTextStorage.
|
|
961
|
+
//
|
|
962
|
+
// We add '_precedingImageCount' to shift the start index forward, aligning
|
|
963
|
+
// this style's range with the actual position in the final text (where each
|
|
964
|
+
// image adds 1 character).
|
|
965
|
+
NSRange tagRange = NSMakeRange(tagLocation + _precedingImageCount,
|
|
966
|
+
plainText.length - tagLocation);
|
|
905
967
|
|
|
906
968
|
[tagEntry addObject:[tagName copy]];
|
|
907
969
|
[tagEntry addObject:[NSValue valueWithRange:tagRange]];
|
|
@@ -911,12 +973,17 @@
|
|
|
911
973
|
|
|
912
974
|
[processedTags addObject:tagEntry];
|
|
913
975
|
[ongoingTags removeObjectForKey:tagName];
|
|
976
|
+
|
|
977
|
+
if ([tagName isEqualToString:@"img"]) {
|
|
978
|
+
_precedingImageCount++;
|
|
979
|
+
}
|
|
914
980
|
}
|
|
915
981
|
|
|
916
982
|
- (NSArray *)getTextAndStylesFromHtml:(NSString *)fixedHtml {
|
|
917
983
|
NSMutableString *plainText = [[NSMutableString alloc] initWithString:@""];
|
|
918
984
|
NSMutableDictionary *ongoingTags = [[NSMutableDictionary alloc] init];
|
|
919
985
|
NSMutableArray *initiallyProcessedTags = [[NSMutableArray alloc] init];
|
|
986
|
+
_precedingImageCount = 0;
|
|
920
987
|
BOOL insideTag = NO;
|
|
921
988
|
BOOL gettingTagName = NO;
|
|
922
989
|
BOOL gettingTagParams = NO;
|
|
@@ -1192,6 +1259,12 @@
|
|
|
1192
1259
|
[styleArr addObject:@([H2Style getStyleType])];
|
|
1193
1260
|
} else if ([tagName isEqualToString:@"h3"]) {
|
|
1194
1261
|
[styleArr addObject:@([H3Style getStyleType])];
|
|
1262
|
+
} else if ([tagName isEqualToString:@"h4"]) {
|
|
1263
|
+
[styleArr addObject:@([H4Style getStyleType])];
|
|
1264
|
+
} else if ([tagName isEqualToString:@"h5"]) {
|
|
1265
|
+
[styleArr addObject:@([H5Style getStyleType])];
|
|
1266
|
+
} else if ([tagName isEqualToString:@"h6"]) {
|
|
1267
|
+
[styleArr addObject:@([H6Style getStyleType])];
|
|
1195
1268
|
}
|
|
1196
1269
|
} else if ([tagName isEqualToString:@"ul"]) {
|
|
1197
1270
|
[styleArr addObject:@([UnorderedListStyle getStyleType])];
|
|
@@ -16,8 +16,10 @@
|
|
|
16
16
|
|
|
17
17
|
- (void)loadAsync {
|
|
18
18
|
NSURL *url = [NSURL URLWithString:self.uri];
|
|
19
|
-
if (!url)
|
|
19
|
+
if (!url) {
|
|
20
|
+
self.image = [UIImage systemImageNamed:@"file"];
|
|
20
21
|
return;
|
|
22
|
+
}
|
|
21
23
|
|
|
22
24
|
dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), ^{
|
|
23
25
|
NSData *bytes = [NSData dataWithContentsOfURL:url];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
#import <ReactNativeEnriched/Props.h>
|
|
3
|
+
#import <UIKit/UIKit.h>
|
|
4
|
+
|
|
5
|
+
using namespace facebook::react;
|
|
6
|
+
|
|
7
|
+
@interface LinkRegexConfig : NSObject
|
|
8
|
+
|
|
9
|
+
@property NSString *pattern;
|
|
10
|
+
@property BOOL caseInsensitive;
|
|
11
|
+
@property BOOL dotAll;
|
|
12
|
+
@property BOOL isDisabled;
|
|
13
|
+
@property BOOL isDefault;
|
|
14
|
+
|
|
15
|
+
- (instancetype)initWithLinkRegexProp:
|
|
16
|
+
(EnrichedTextInputViewLinkRegexStruct)prop;
|
|
17
|
+
- (BOOL)isEqualToConfig:(LinkRegexConfig *)otherObj;
|
|
18
|
+
|
|
19
|
+
@end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#import "LinkRegexConfig.h"
|
|
2
|
+
#import "StringExtension.h"
|
|
3
|
+
|
|
4
|
+
@implementation LinkRegexConfig
|
|
5
|
+
|
|
6
|
+
- (instancetype)initWithLinkRegexProp:
|
|
7
|
+
(EnrichedTextInputViewLinkRegexStruct)prop {
|
|
8
|
+
if (!self)
|
|
9
|
+
return nil;
|
|
10
|
+
|
|
11
|
+
_pattern = [NSString fromCppString:prop.pattern];
|
|
12
|
+
_caseInsensitive = prop.caseInsensitive;
|
|
13
|
+
_dotAll = prop.dotAll;
|
|
14
|
+
_isDefault = prop.isDefault;
|
|
15
|
+
_isDisabled = prop.isDisabled;
|
|
16
|
+
|
|
17
|
+
return self;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
- (id)copyWithZone:(NSZone *)zone {
|
|
21
|
+
LinkRegexConfig *copy = [[[self class] allocWithZone:zone] init];
|
|
22
|
+
copy->_pattern = [_pattern copy];
|
|
23
|
+
copy->_caseInsensitive = _caseInsensitive;
|
|
24
|
+
copy->_dotAll = _dotAll;
|
|
25
|
+
copy->_isDefault = _isDefault;
|
|
26
|
+
copy->_isDisabled = _isDisabled;
|
|
27
|
+
return copy;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
- (BOOL)isEqualToConfig:(LinkRegexConfig *)otherObj {
|
|
31
|
+
return [_pattern isEqualToString:otherObj.pattern] &&
|
|
32
|
+
_caseInsensitive == otherObj.caseInsensitive &&
|
|
33
|
+
_dotAll == otherObj.dotAll && _isDefault == otherObj.isDefault &&
|
|
34
|
+
_isDisabled == otherObj.isDisabled;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@end
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
if (folly["color"].isNumber()) {
|
|
12
12
|
facebook::react::SharedColor color = facebook::react::SharedColor(
|
|
13
|
-
facebook::react::Color(folly["color"].asInt()));
|
|
13
|
+
facebook::react::Color(int32_t(folly["color"].asInt())));
|
|
14
14
|
nativeProps.color = RCTUIColorFromSharedColor(color);
|
|
15
15
|
} else {
|
|
16
16
|
nativeProps.color = [UIColor blueColor];
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
if (folly["backgroundColor"].isNumber()) {
|
|
20
20
|
facebook::react::SharedColor bgColor = facebook::react::SharedColor(
|
|
21
|
-
facebook::react::Color(folly["backgroundColor"].asInt()));
|
|
21
|
+
facebook::react::Color(int32_t(folly["backgroundColor"].asInt())));
|
|
22
22
|
nativeProps.backgroundColor = RCTUIColorFromSharedColor(bgColor);
|
|
23
23
|
} else {
|
|
24
24
|
nativeProps.backgroundColor = [UIColor yellowColor];
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
- (BOOL)isHeadingBold;
|
|
59
59
|
- (BOOL)handleNewlinesInRange:(NSRange)range replacementText:(NSString *)text;
|
|
60
60
|
- (void)handleImproperHeadings;
|
|
61
|
+
@property(nonatomic, assign) CGFloat lastAppliedFontSize;
|
|
61
62
|
@end
|
|
62
63
|
|
|
63
64
|
@interface H1Style : HeadingStyleBase
|
|
@@ -69,6 +70,15 @@
|
|
|
69
70
|
@interface H3Style : HeadingStyleBase
|
|
70
71
|
@end
|
|
71
72
|
|
|
73
|
+
@interface H4Style : HeadingStyleBase
|
|
74
|
+
@end
|
|
75
|
+
|
|
76
|
+
@interface H5Style : HeadingStyleBase
|
|
77
|
+
@end
|
|
78
|
+
|
|
79
|
+
@interface H6Style : HeadingStyleBase
|
|
80
|
+
@end
|
|
81
|
+
|
|
72
82
|
@interface UnorderedListStyle : NSObject <BaseStyleProtocol>
|
|
73
83
|
- (BOOL)handleBackspaceInRange:(NSRange)range replacementText:(NSString *)text;
|
|
74
84
|
- (BOOL)tryHandlingListShorcutInRange:(NSRange)range
|