react-native-enriched-markdown 0.1.1 → 0.2.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 +80 -8
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownTextManagerDelegate.java +17 -2
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownTextManagerInterface.java +6 -1
- package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/EventEmitters.cpp +9 -0
- package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/EventEmitters.h +6 -0
- package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/Props.cpp +28 -3
- package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/Props.h +225 -1
- package/android/src/main/cpp/jni-adapter.cpp +28 -11
- package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownText.kt +132 -15
- package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownTextLayoutManager.kt +1 -16
- package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownTextManager.kt +67 -13
- package/android/src/main/java/com/swmansion/enriched/markdown/MeasurementStore.kt +241 -21
- package/android/src/main/java/com/swmansion/enriched/markdown/accessibility/MarkdownAccessibilityHelper.kt +279 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/events/LinkLongPressEvent.kt +23 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/parser/MarkdownASTNode.kt +2 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/parser/Parser.kt +17 -3
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/BlockquoteRenderer.kt +13 -18
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/CodeBlockRenderer.kt +23 -24
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/CodeRenderer.kt +1 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/DocumentRenderer.kt +2 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/EmphasisRenderer.kt +2 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/HeadingRenderer.kt +18 -2
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/ImageRenderer.kt +22 -6
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/LineBreakRenderer.kt +1 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/LinkRenderer.kt +3 -2
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/ListItemRenderer.kt +2 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/ListRenderer.kt +16 -9
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/NodeRenderer.kt +5 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/ParagraphRenderer.kt +23 -9
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/Renderer.kt +24 -10
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/SpanStyleCache.kt +1 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/StrikethroughRenderer.kt +27 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/StrongRenderer.kt +2 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/TextRenderer.kt +1 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/ThematicBreakRenderer.kt +1 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/UnderlineRenderer.kt +27 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/ImageSpan.kt +1 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/LineHeightSpan.kt +8 -17
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/LinkSpan.kt +19 -5
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/MarginBottomSpan.kt +1 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/StrikethroughSpan.kt +12 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/BaseBlockStyle.kt +1 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/BlockquoteStyle.kt +3 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/CodeBlockStyle.kt +3 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/HeadingStyle.kt +5 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/ImageStyle.kt +3 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/ListStyle.kt +3 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/ParagraphStyle.kt +5 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/StrikethroughStyle.kt +17 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/StyleConfig.kt +32 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/StyleParser.kt +22 -5
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/TextAlignment.kt +32 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/UnderlineStyle.kt +17 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/HTMLGenerator.kt +23 -5
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/LinkLongPressMovementMethod.kt +121 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/MarkdownExtractor.kt +10 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/Utils.kt +58 -56
- package/android/src/main/jni/CMakeLists.txt +1 -13
- package/android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownTextShadowNode.cpp +0 -13
- package/android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownTextShadowNode.h +2 -14
- package/android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/conversions.h +3 -0
- package/cpp/parser/MD4CParser.cpp +21 -8
- package/cpp/parser/MD4CParser.hpp +5 -1
- package/cpp/parser/MarkdownASTNode.hpp +2 -0
- package/ios/EnrichedMarkdownText.mm +356 -29
- package/ios/attachments/{ImageAttachment.h → EnrichedMarkdownImageAttachment.h} +1 -1
- package/ios/attachments/{ImageAttachment.m → EnrichedMarkdownImageAttachment.m} +4 -4
- package/ios/generated/EnrichedMarkdownTextSpec/EventEmitters.cpp +9 -0
- package/ios/generated/EnrichedMarkdownTextSpec/EventEmitters.h +6 -0
- package/ios/generated/EnrichedMarkdownTextSpec/Props.cpp +28 -3
- package/ios/generated/EnrichedMarkdownTextSpec/Props.h +225 -1
- package/ios/parser/MarkdownASTNode.h +2 -0
- package/ios/parser/MarkdownParser.h +9 -0
- package/ios/parser/MarkdownParser.mm +31 -2
- package/ios/parser/MarkdownParserBridge.mm +13 -3
- package/ios/renderer/AttributedRenderer.h +2 -0
- package/ios/renderer/AttributedRenderer.m +52 -19
- package/ios/renderer/BlockquoteRenderer.m +7 -6
- package/ios/renderer/CodeBlockRenderer.m +9 -8
- package/ios/renderer/HeadingRenderer.m +31 -24
- package/ios/renderer/ImageRenderer.m +31 -10
- package/ios/renderer/ListItemRenderer.m +51 -39
- package/ios/renderer/ListRenderer.m +21 -18
- package/ios/renderer/ParagraphRenderer.m +27 -16
- package/ios/renderer/RenderContext.h +17 -0
- package/ios/renderer/RenderContext.m +66 -2
- package/ios/renderer/RendererFactory.m +6 -0
- package/ios/renderer/StrikethroughRenderer.h +6 -0
- package/ios/renderer/StrikethroughRenderer.m +40 -0
- package/ios/renderer/UnderlineRenderer.h +6 -0
- package/ios/renderer/UnderlineRenderer.m +39 -0
- package/ios/styles/StyleConfig.h +46 -0
- package/ios/styles/StyleConfig.mm +351 -12
- package/ios/utils/AccessibilityInfo.h +35 -0
- package/ios/utils/AccessibilityInfo.m +24 -0
- package/ios/utils/CodeBlockBackground.m +4 -9
- package/ios/utils/FontUtils.h +5 -0
- package/ios/utils/FontUtils.m +14 -0
- package/ios/utils/HTMLGenerator.m +21 -7
- package/ios/utils/MarkdownAccessibilityElementBuilder.h +45 -0
- package/ios/utils/MarkdownAccessibilityElementBuilder.m +323 -0
- package/ios/utils/MarkdownExtractor.m +18 -5
- package/ios/utils/ParagraphStyleUtils.h +10 -2
- package/ios/utils/ParagraphStyleUtils.m +57 -2
- package/ios/utils/PasteboardUtils.h +1 -1
- package/ios/utils/PasteboardUtils.m +3 -3
- package/lib/module/EnrichedMarkdownText.js +33 -2
- package/lib/module/EnrichedMarkdownText.js.map +1 -1
- package/lib/module/EnrichedMarkdownTextNativeComponent.ts +83 -3
- package/lib/module/index.js +0 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/normalizeMarkdownStyle.js +58 -14
- package/lib/module/normalizeMarkdownStyle.js.map +1 -1
- package/lib/typescript/src/EnrichedMarkdownText.d.ts +85 -3
- package/lib/typescript/src/EnrichedMarkdownText.d.ts.map +1 -1
- package/lib/typescript/src/EnrichedMarkdownTextNativeComponent.d.ts +75 -1
- package/lib/typescript/src/EnrichedMarkdownTextNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -3
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/normalizeMarkdownStyle.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/EnrichedMarkdownText.tsx +133 -5
- package/src/EnrichedMarkdownTextNativeComponent.ts +83 -3
- package/src/index.tsx +5 -2
- package/src/normalizeMarkdownStyle.ts +46 -0
- package/android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownTextState.cpp +0 -9
- package/android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownTextState.h +0 -25
|
@@ -21,8 +21,10 @@ struct EnrichedMarkdownTextMarkdownStyleParagraphStruct {
|
|
|
21
21
|
std::string fontFamily{};
|
|
22
22
|
std::string fontWeight{};
|
|
23
23
|
SharedColor color{};
|
|
24
|
+
Float marginTop{0.0};
|
|
24
25
|
Float marginBottom{0.0};
|
|
25
26
|
Float lineHeight{0.0};
|
|
27
|
+
std::string textAlign{};
|
|
26
28
|
|
|
27
29
|
#ifdef RN_SERIALIZABLE_STATE
|
|
28
30
|
bool operator==(const EnrichedMarkdownTextMarkdownStyleParagraphStruct&) const = default;
|
|
@@ -33,8 +35,10 @@ struct EnrichedMarkdownTextMarkdownStyleParagraphStruct {
|
|
|
33
35
|
result["fontFamily"] = fontFamily;
|
|
34
36
|
result["fontWeight"] = fontWeight;
|
|
35
37
|
result["color"] = ::facebook::react::toDynamic(color);
|
|
38
|
+
result["marginTop"] = marginTop;
|
|
36
39
|
result["marginBottom"] = marginBottom;
|
|
37
40
|
result["lineHeight"] = lineHeight;
|
|
41
|
+
result["textAlign"] = textAlign;
|
|
38
42
|
return result;
|
|
39
43
|
}
|
|
40
44
|
#endif
|
|
@@ -59,6 +63,10 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
|
|
59
63
|
if (tmp_color != map.end()) {
|
|
60
64
|
fromRawValue(context, tmp_color->second, result.color);
|
|
61
65
|
}
|
|
66
|
+
auto tmp_marginTop = map.find("marginTop");
|
|
67
|
+
if (tmp_marginTop != map.end()) {
|
|
68
|
+
fromRawValue(context, tmp_marginTop->second, result.marginTop);
|
|
69
|
+
}
|
|
62
70
|
auto tmp_marginBottom = map.find("marginBottom");
|
|
63
71
|
if (tmp_marginBottom != map.end()) {
|
|
64
72
|
fromRawValue(context, tmp_marginBottom->second, result.marginBottom);
|
|
@@ -67,6 +75,10 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
|
|
67
75
|
if (tmp_lineHeight != map.end()) {
|
|
68
76
|
fromRawValue(context, tmp_lineHeight->second, result.lineHeight);
|
|
69
77
|
}
|
|
78
|
+
auto tmp_textAlign = map.find("textAlign");
|
|
79
|
+
if (tmp_textAlign != map.end()) {
|
|
80
|
+
fromRawValue(context, tmp_textAlign->second, result.textAlign);
|
|
81
|
+
}
|
|
70
82
|
}
|
|
71
83
|
|
|
72
84
|
static inline std::string toString(const EnrichedMarkdownTextMarkdownStyleParagraphStruct &value) {
|
|
@@ -84,8 +96,10 @@ struct EnrichedMarkdownTextMarkdownStyleH1Struct {
|
|
|
84
96
|
std::string fontFamily{};
|
|
85
97
|
std::string fontWeight{};
|
|
86
98
|
SharedColor color{};
|
|
99
|
+
Float marginTop{0.0};
|
|
87
100
|
Float marginBottom{0.0};
|
|
88
101
|
Float lineHeight{0.0};
|
|
102
|
+
std::string textAlign{};
|
|
89
103
|
|
|
90
104
|
#ifdef RN_SERIALIZABLE_STATE
|
|
91
105
|
bool operator==(const EnrichedMarkdownTextMarkdownStyleH1Struct&) const = default;
|
|
@@ -96,8 +110,10 @@ struct EnrichedMarkdownTextMarkdownStyleH1Struct {
|
|
|
96
110
|
result["fontFamily"] = fontFamily;
|
|
97
111
|
result["fontWeight"] = fontWeight;
|
|
98
112
|
result["color"] = ::facebook::react::toDynamic(color);
|
|
113
|
+
result["marginTop"] = marginTop;
|
|
99
114
|
result["marginBottom"] = marginBottom;
|
|
100
115
|
result["lineHeight"] = lineHeight;
|
|
116
|
+
result["textAlign"] = textAlign;
|
|
101
117
|
return result;
|
|
102
118
|
}
|
|
103
119
|
#endif
|
|
@@ -122,6 +138,10 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
|
|
122
138
|
if (tmp_color != map.end()) {
|
|
123
139
|
fromRawValue(context, tmp_color->second, result.color);
|
|
124
140
|
}
|
|
141
|
+
auto tmp_marginTop = map.find("marginTop");
|
|
142
|
+
if (tmp_marginTop != map.end()) {
|
|
143
|
+
fromRawValue(context, tmp_marginTop->second, result.marginTop);
|
|
144
|
+
}
|
|
125
145
|
auto tmp_marginBottom = map.find("marginBottom");
|
|
126
146
|
if (tmp_marginBottom != map.end()) {
|
|
127
147
|
fromRawValue(context, tmp_marginBottom->second, result.marginBottom);
|
|
@@ -130,6 +150,10 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
|
|
130
150
|
if (tmp_lineHeight != map.end()) {
|
|
131
151
|
fromRawValue(context, tmp_lineHeight->second, result.lineHeight);
|
|
132
152
|
}
|
|
153
|
+
auto tmp_textAlign = map.find("textAlign");
|
|
154
|
+
if (tmp_textAlign != map.end()) {
|
|
155
|
+
fromRawValue(context, tmp_textAlign->second, result.textAlign);
|
|
156
|
+
}
|
|
133
157
|
}
|
|
134
158
|
|
|
135
159
|
static inline std::string toString(const EnrichedMarkdownTextMarkdownStyleH1Struct &value) {
|
|
@@ -147,8 +171,10 @@ struct EnrichedMarkdownTextMarkdownStyleH2Struct {
|
|
|
147
171
|
std::string fontFamily{};
|
|
148
172
|
std::string fontWeight{};
|
|
149
173
|
SharedColor color{};
|
|
174
|
+
Float marginTop{0.0};
|
|
150
175
|
Float marginBottom{0.0};
|
|
151
176
|
Float lineHeight{0.0};
|
|
177
|
+
std::string textAlign{};
|
|
152
178
|
|
|
153
179
|
#ifdef RN_SERIALIZABLE_STATE
|
|
154
180
|
bool operator==(const EnrichedMarkdownTextMarkdownStyleH2Struct&) const = default;
|
|
@@ -159,8 +185,10 @@ struct EnrichedMarkdownTextMarkdownStyleH2Struct {
|
|
|
159
185
|
result["fontFamily"] = fontFamily;
|
|
160
186
|
result["fontWeight"] = fontWeight;
|
|
161
187
|
result["color"] = ::facebook::react::toDynamic(color);
|
|
188
|
+
result["marginTop"] = marginTop;
|
|
162
189
|
result["marginBottom"] = marginBottom;
|
|
163
190
|
result["lineHeight"] = lineHeight;
|
|
191
|
+
result["textAlign"] = textAlign;
|
|
164
192
|
return result;
|
|
165
193
|
}
|
|
166
194
|
#endif
|
|
@@ -185,6 +213,10 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
|
|
185
213
|
if (tmp_color != map.end()) {
|
|
186
214
|
fromRawValue(context, tmp_color->second, result.color);
|
|
187
215
|
}
|
|
216
|
+
auto tmp_marginTop = map.find("marginTop");
|
|
217
|
+
if (tmp_marginTop != map.end()) {
|
|
218
|
+
fromRawValue(context, tmp_marginTop->second, result.marginTop);
|
|
219
|
+
}
|
|
188
220
|
auto tmp_marginBottom = map.find("marginBottom");
|
|
189
221
|
if (tmp_marginBottom != map.end()) {
|
|
190
222
|
fromRawValue(context, tmp_marginBottom->second, result.marginBottom);
|
|
@@ -193,6 +225,10 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
|
|
193
225
|
if (tmp_lineHeight != map.end()) {
|
|
194
226
|
fromRawValue(context, tmp_lineHeight->second, result.lineHeight);
|
|
195
227
|
}
|
|
228
|
+
auto tmp_textAlign = map.find("textAlign");
|
|
229
|
+
if (tmp_textAlign != map.end()) {
|
|
230
|
+
fromRawValue(context, tmp_textAlign->second, result.textAlign);
|
|
231
|
+
}
|
|
196
232
|
}
|
|
197
233
|
|
|
198
234
|
static inline std::string toString(const EnrichedMarkdownTextMarkdownStyleH2Struct &value) {
|
|
@@ -210,8 +246,10 @@ struct EnrichedMarkdownTextMarkdownStyleH3Struct {
|
|
|
210
246
|
std::string fontFamily{};
|
|
211
247
|
std::string fontWeight{};
|
|
212
248
|
SharedColor color{};
|
|
249
|
+
Float marginTop{0.0};
|
|
213
250
|
Float marginBottom{0.0};
|
|
214
251
|
Float lineHeight{0.0};
|
|
252
|
+
std::string textAlign{};
|
|
215
253
|
|
|
216
254
|
#ifdef RN_SERIALIZABLE_STATE
|
|
217
255
|
bool operator==(const EnrichedMarkdownTextMarkdownStyleH3Struct&) const = default;
|
|
@@ -222,8 +260,10 @@ struct EnrichedMarkdownTextMarkdownStyleH3Struct {
|
|
|
222
260
|
result["fontFamily"] = fontFamily;
|
|
223
261
|
result["fontWeight"] = fontWeight;
|
|
224
262
|
result["color"] = ::facebook::react::toDynamic(color);
|
|
263
|
+
result["marginTop"] = marginTop;
|
|
225
264
|
result["marginBottom"] = marginBottom;
|
|
226
265
|
result["lineHeight"] = lineHeight;
|
|
266
|
+
result["textAlign"] = textAlign;
|
|
227
267
|
return result;
|
|
228
268
|
}
|
|
229
269
|
#endif
|
|
@@ -248,6 +288,10 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
|
|
248
288
|
if (tmp_color != map.end()) {
|
|
249
289
|
fromRawValue(context, tmp_color->second, result.color);
|
|
250
290
|
}
|
|
291
|
+
auto tmp_marginTop = map.find("marginTop");
|
|
292
|
+
if (tmp_marginTop != map.end()) {
|
|
293
|
+
fromRawValue(context, tmp_marginTop->second, result.marginTop);
|
|
294
|
+
}
|
|
251
295
|
auto tmp_marginBottom = map.find("marginBottom");
|
|
252
296
|
if (tmp_marginBottom != map.end()) {
|
|
253
297
|
fromRawValue(context, tmp_marginBottom->second, result.marginBottom);
|
|
@@ -256,6 +300,10 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
|
|
256
300
|
if (tmp_lineHeight != map.end()) {
|
|
257
301
|
fromRawValue(context, tmp_lineHeight->second, result.lineHeight);
|
|
258
302
|
}
|
|
303
|
+
auto tmp_textAlign = map.find("textAlign");
|
|
304
|
+
if (tmp_textAlign != map.end()) {
|
|
305
|
+
fromRawValue(context, tmp_textAlign->second, result.textAlign);
|
|
306
|
+
}
|
|
259
307
|
}
|
|
260
308
|
|
|
261
309
|
static inline std::string toString(const EnrichedMarkdownTextMarkdownStyleH3Struct &value) {
|
|
@@ -273,8 +321,10 @@ struct EnrichedMarkdownTextMarkdownStyleH4Struct {
|
|
|
273
321
|
std::string fontFamily{};
|
|
274
322
|
std::string fontWeight{};
|
|
275
323
|
SharedColor color{};
|
|
324
|
+
Float marginTop{0.0};
|
|
276
325
|
Float marginBottom{0.0};
|
|
277
326
|
Float lineHeight{0.0};
|
|
327
|
+
std::string textAlign{};
|
|
278
328
|
|
|
279
329
|
#ifdef RN_SERIALIZABLE_STATE
|
|
280
330
|
bool operator==(const EnrichedMarkdownTextMarkdownStyleH4Struct&) const = default;
|
|
@@ -285,8 +335,10 @@ struct EnrichedMarkdownTextMarkdownStyleH4Struct {
|
|
|
285
335
|
result["fontFamily"] = fontFamily;
|
|
286
336
|
result["fontWeight"] = fontWeight;
|
|
287
337
|
result["color"] = ::facebook::react::toDynamic(color);
|
|
338
|
+
result["marginTop"] = marginTop;
|
|
288
339
|
result["marginBottom"] = marginBottom;
|
|
289
340
|
result["lineHeight"] = lineHeight;
|
|
341
|
+
result["textAlign"] = textAlign;
|
|
290
342
|
return result;
|
|
291
343
|
}
|
|
292
344
|
#endif
|
|
@@ -311,6 +363,10 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
|
|
311
363
|
if (tmp_color != map.end()) {
|
|
312
364
|
fromRawValue(context, tmp_color->second, result.color);
|
|
313
365
|
}
|
|
366
|
+
auto tmp_marginTop = map.find("marginTop");
|
|
367
|
+
if (tmp_marginTop != map.end()) {
|
|
368
|
+
fromRawValue(context, tmp_marginTop->second, result.marginTop);
|
|
369
|
+
}
|
|
314
370
|
auto tmp_marginBottom = map.find("marginBottom");
|
|
315
371
|
if (tmp_marginBottom != map.end()) {
|
|
316
372
|
fromRawValue(context, tmp_marginBottom->second, result.marginBottom);
|
|
@@ -319,6 +375,10 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
|
|
319
375
|
if (tmp_lineHeight != map.end()) {
|
|
320
376
|
fromRawValue(context, tmp_lineHeight->second, result.lineHeight);
|
|
321
377
|
}
|
|
378
|
+
auto tmp_textAlign = map.find("textAlign");
|
|
379
|
+
if (tmp_textAlign != map.end()) {
|
|
380
|
+
fromRawValue(context, tmp_textAlign->second, result.textAlign);
|
|
381
|
+
}
|
|
322
382
|
}
|
|
323
383
|
|
|
324
384
|
static inline std::string toString(const EnrichedMarkdownTextMarkdownStyleH4Struct &value) {
|
|
@@ -336,8 +396,10 @@ struct EnrichedMarkdownTextMarkdownStyleH5Struct {
|
|
|
336
396
|
std::string fontFamily{};
|
|
337
397
|
std::string fontWeight{};
|
|
338
398
|
SharedColor color{};
|
|
399
|
+
Float marginTop{0.0};
|
|
339
400
|
Float marginBottom{0.0};
|
|
340
401
|
Float lineHeight{0.0};
|
|
402
|
+
std::string textAlign{};
|
|
341
403
|
|
|
342
404
|
#ifdef RN_SERIALIZABLE_STATE
|
|
343
405
|
bool operator==(const EnrichedMarkdownTextMarkdownStyleH5Struct&) const = default;
|
|
@@ -348,8 +410,10 @@ struct EnrichedMarkdownTextMarkdownStyleH5Struct {
|
|
|
348
410
|
result["fontFamily"] = fontFamily;
|
|
349
411
|
result["fontWeight"] = fontWeight;
|
|
350
412
|
result["color"] = ::facebook::react::toDynamic(color);
|
|
413
|
+
result["marginTop"] = marginTop;
|
|
351
414
|
result["marginBottom"] = marginBottom;
|
|
352
415
|
result["lineHeight"] = lineHeight;
|
|
416
|
+
result["textAlign"] = textAlign;
|
|
353
417
|
return result;
|
|
354
418
|
}
|
|
355
419
|
#endif
|
|
@@ -374,6 +438,10 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
|
|
374
438
|
if (tmp_color != map.end()) {
|
|
375
439
|
fromRawValue(context, tmp_color->second, result.color);
|
|
376
440
|
}
|
|
441
|
+
auto tmp_marginTop = map.find("marginTop");
|
|
442
|
+
if (tmp_marginTop != map.end()) {
|
|
443
|
+
fromRawValue(context, tmp_marginTop->second, result.marginTop);
|
|
444
|
+
}
|
|
377
445
|
auto tmp_marginBottom = map.find("marginBottom");
|
|
378
446
|
if (tmp_marginBottom != map.end()) {
|
|
379
447
|
fromRawValue(context, tmp_marginBottom->second, result.marginBottom);
|
|
@@ -382,6 +450,10 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
|
|
382
450
|
if (tmp_lineHeight != map.end()) {
|
|
383
451
|
fromRawValue(context, tmp_lineHeight->second, result.lineHeight);
|
|
384
452
|
}
|
|
453
|
+
auto tmp_textAlign = map.find("textAlign");
|
|
454
|
+
if (tmp_textAlign != map.end()) {
|
|
455
|
+
fromRawValue(context, tmp_textAlign->second, result.textAlign);
|
|
456
|
+
}
|
|
385
457
|
}
|
|
386
458
|
|
|
387
459
|
static inline std::string toString(const EnrichedMarkdownTextMarkdownStyleH5Struct &value) {
|
|
@@ -399,8 +471,10 @@ struct EnrichedMarkdownTextMarkdownStyleH6Struct {
|
|
|
399
471
|
std::string fontFamily{};
|
|
400
472
|
std::string fontWeight{};
|
|
401
473
|
SharedColor color{};
|
|
474
|
+
Float marginTop{0.0};
|
|
402
475
|
Float marginBottom{0.0};
|
|
403
476
|
Float lineHeight{0.0};
|
|
477
|
+
std::string textAlign{};
|
|
404
478
|
|
|
405
479
|
#ifdef RN_SERIALIZABLE_STATE
|
|
406
480
|
bool operator==(const EnrichedMarkdownTextMarkdownStyleH6Struct&) const = default;
|
|
@@ -411,8 +485,10 @@ struct EnrichedMarkdownTextMarkdownStyleH6Struct {
|
|
|
411
485
|
result["fontFamily"] = fontFamily;
|
|
412
486
|
result["fontWeight"] = fontWeight;
|
|
413
487
|
result["color"] = ::facebook::react::toDynamic(color);
|
|
488
|
+
result["marginTop"] = marginTop;
|
|
414
489
|
result["marginBottom"] = marginBottom;
|
|
415
490
|
result["lineHeight"] = lineHeight;
|
|
491
|
+
result["textAlign"] = textAlign;
|
|
416
492
|
return result;
|
|
417
493
|
}
|
|
418
494
|
#endif
|
|
@@ -437,6 +513,10 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
|
|
437
513
|
if (tmp_color != map.end()) {
|
|
438
514
|
fromRawValue(context, tmp_color->second, result.color);
|
|
439
515
|
}
|
|
516
|
+
auto tmp_marginTop = map.find("marginTop");
|
|
517
|
+
if (tmp_marginTop != map.end()) {
|
|
518
|
+
fromRawValue(context, tmp_marginTop->second, result.marginTop);
|
|
519
|
+
}
|
|
440
520
|
auto tmp_marginBottom = map.find("marginBottom");
|
|
441
521
|
if (tmp_marginBottom != map.end()) {
|
|
442
522
|
fromRawValue(context, tmp_marginBottom->second, result.marginBottom);
|
|
@@ -445,6 +525,10 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
|
|
445
525
|
if (tmp_lineHeight != map.end()) {
|
|
446
526
|
fromRawValue(context, tmp_lineHeight->second, result.lineHeight);
|
|
447
527
|
}
|
|
528
|
+
auto tmp_textAlign = map.find("textAlign");
|
|
529
|
+
if (tmp_textAlign != map.end()) {
|
|
530
|
+
fromRawValue(context, tmp_textAlign->second, result.textAlign);
|
|
531
|
+
}
|
|
448
532
|
}
|
|
449
533
|
|
|
450
534
|
static inline std::string toString(const EnrichedMarkdownTextMarkdownStyleH6Struct &value) {
|
|
@@ -462,6 +546,7 @@ struct EnrichedMarkdownTextMarkdownStyleBlockquoteStruct {
|
|
|
462
546
|
std::string fontFamily{};
|
|
463
547
|
std::string fontWeight{};
|
|
464
548
|
SharedColor color{};
|
|
549
|
+
Float marginTop{0.0};
|
|
465
550
|
Float marginBottom{0.0};
|
|
466
551
|
Float lineHeight{0.0};
|
|
467
552
|
SharedColor borderColor{};
|
|
@@ -478,6 +563,7 @@ struct EnrichedMarkdownTextMarkdownStyleBlockquoteStruct {
|
|
|
478
563
|
result["fontFamily"] = fontFamily;
|
|
479
564
|
result["fontWeight"] = fontWeight;
|
|
480
565
|
result["color"] = ::facebook::react::toDynamic(color);
|
|
566
|
+
result["marginTop"] = marginTop;
|
|
481
567
|
result["marginBottom"] = marginBottom;
|
|
482
568
|
result["lineHeight"] = lineHeight;
|
|
483
569
|
result["borderColor"] = ::facebook::react::toDynamic(borderColor);
|
|
@@ -508,6 +594,10 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
|
|
508
594
|
if (tmp_color != map.end()) {
|
|
509
595
|
fromRawValue(context, tmp_color->second, result.color);
|
|
510
596
|
}
|
|
597
|
+
auto tmp_marginTop = map.find("marginTop");
|
|
598
|
+
if (tmp_marginTop != map.end()) {
|
|
599
|
+
fromRawValue(context, tmp_marginTop->second, result.marginTop);
|
|
600
|
+
}
|
|
511
601
|
auto tmp_marginBottom = map.find("marginBottom");
|
|
512
602
|
if (tmp_marginBottom != map.end()) {
|
|
513
603
|
fromRawValue(context, tmp_marginBottom->second, result.marginBottom);
|
|
@@ -549,6 +639,7 @@ struct EnrichedMarkdownTextMarkdownStyleListStruct {
|
|
|
549
639
|
std::string fontFamily{};
|
|
550
640
|
std::string fontWeight{};
|
|
551
641
|
SharedColor color{};
|
|
642
|
+
Float marginTop{0.0};
|
|
552
643
|
Float marginBottom{0.0};
|
|
553
644
|
Float lineHeight{0.0};
|
|
554
645
|
SharedColor bulletColor{};
|
|
@@ -567,6 +658,7 @@ struct EnrichedMarkdownTextMarkdownStyleListStruct {
|
|
|
567
658
|
result["fontFamily"] = fontFamily;
|
|
568
659
|
result["fontWeight"] = fontWeight;
|
|
569
660
|
result["color"] = ::facebook::react::toDynamic(color);
|
|
661
|
+
result["marginTop"] = marginTop;
|
|
570
662
|
result["marginBottom"] = marginBottom;
|
|
571
663
|
result["lineHeight"] = lineHeight;
|
|
572
664
|
result["bulletColor"] = ::facebook::react::toDynamic(bulletColor);
|
|
@@ -599,6 +691,10 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
|
|
599
691
|
if (tmp_color != map.end()) {
|
|
600
692
|
fromRawValue(context, tmp_color->second, result.color);
|
|
601
693
|
}
|
|
694
|
+
auto tmp_marginTop = map.find("marginTop");
|
|
695
|
+
if (tmp_marginTop != map.end()) {
|
|
696
|
+
fromRawValue(context, tmp_marginTop->second, result.marginTop);
|
|
697
|
+
}
|
|
602
698
|
auto tmp_marginBottom = map.find("marginBottom");
|
|
603
699
|
if (tmp_marginBottom != map.end()) {
|
|
604
700
|
fromRawValue(context, tmp_marginBottom->second, result.marginBottom);
|
|
@@ -648,6 +744,7 @@ struct EnrichedMarkdownTextMarkdownStyleCodeBlockStruct {
|
|
|
648
744
|
std::string fontFamily{};
|
|
649
745
|
std::string fontWeight{};
|
|
650
746
|
SharedColor color{};
|
|
747
|
+
Float marginTop{0.0};
|
|
651
748
|
Float marginBottom{0.0};
|
|
652
749
|
Float lineHeight{0.0};
|
|
653
750
|
SharedColor backgroundColor{};
|
|
@@ -665,6 +762,7 @@ struct EnrichedMarkdownTextMarkdownStyleCodeBlockStruct {
|
|
|
665
762
|
result["fontFamily"] = fontFamily;
|
|
666
763
|
result["fontWeight"] = fontWeight;
|
|
667
764
|
result["color"] = ::facebook::react::toDynamic(color);
|
|
765
|
+
result["marginTop"] = marginTop;
|
|
668
766
|
result["marginBottom"] = marginBottom;
|
|
669
767
|
result["lineHeight"] = lineHeight;
|
|
670
768
|
result["backgroundColor"] = ::facebook::react::toDynamic(backgroundColor);
|
|
@@ -696,6 +794,10 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
|
|
696
794
|
if (tmp_color != map.end()) {
|
|
697
795
|
fromRawValue(context, tmp_color->second, result.color);
|
|
698
796
|
}
|
|
797
|
+
auto tmp_marginTop = map.find("marginTop");
|
|
798
|
+
if (tmp_marginTop != map.end()) {
|
|
799
|
+
fromRawValue(context, tmp_marginTop->second, result.marginTop);
|
|
800
|
+
}
|
|
699
801
|
auto tmp_marginBottom = map.find("marginBottom");
|
|
700
802
|
if (tmp_marginBottom != map.end()) {
|
|
701
803
|
fromRawValue(context, tmp_marginBottom->second, result.marginBottom);
|
|
@@ -841,6 +943,72 @@ static inline folly::dynamic toDynamic(const EnrichedMarkdownTextMarkdownStyleEm
|
|
|
841
943
|
}
|
|
842
944
|
#endif
|
|
843
945
|
|
|
946
|
+
struct EnrichedMarkdownTextMarkdownStyleStrikethroughStruct {
|
|
947
|
+
SharedColor color{};
|
|
948
|
+
|
|
949
|
+
#ifdef RN_SERIALIZABLE_STATE
|
|
950
|
+
bool operator==(const EnrichedMarkdownTextMarkdownStyleStrikethroughStruct&) const = default;
|
|
951
|
+
|
|
952
|
+
folly::dynamic toDynamic() const {
|
|
953
|
+
folly::dynamic result = folly::dynamic::object();
|
|
954
|
+
result["color"] = ::facebook::react::toDynamic(color);
|
|
955
|
+
return result;
|
|
956
|
+
}
|
|
957
|
+
#endif
|
|
958
|
+
};
|
|
959
|
+
|
|
960
|
+
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, EnrichedMarkdownTextMarkdownStyleStrikethroughStruct &result) {
|
|
961
|
+
auto map = (std::unordered_map<std::string, RawValue>)value;
|
|
962
|
+
|
|
963
|
+
auto tmp_color = map.find("color");
|
|
964
|
+
if (tmp_color != map.end()) {
|
|
965
|
+
fromRawValue(context, tmp_color->second, result.color);
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
static inline std::string toString(const EnrichedMarkdownTextMarkdownStyleStrikethroughStruct &value) {
|
|
970
|
+
return "[Object EnrichedMarkdownTextMarkdownStyleStrikethroughStruct]";
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
#ifdef RN_SERIALIZABLE_STATE
|
|
974
|
+
static inline folly::dynamic toDynamic(const EnrichedMarkdownTextMarkdownStyleStrikethroughStruct &value) {
|
|
975
|
+
return value.toDynamic();
|
|
976
|
+
}
|
|
977
|
+
#endif
|
|
978
|
+
|
|
979
|
+
struct EnrichedMarkdownTextMarkdownStyleUnderlineStruct {
|
|
980
|
+
SharedColor color{};
|
|
981
|
+
|
|
982
|
+
#ifdef RN_SERIALIZABLE_STATE
|
|
983
|
+
bool operator==(const EnrichedMarkdownTextMarkdownStyleUnderlineStruct&) const = default;
|
|
984
|
+
|
|
985
|
+
folly::dynamic toDynamic() const {
|
|
986
|
+
folly::dynamic result = folly::dynamic::object();
|
|
987
|
+
result["color"] = ::facebook::react::toDynamic(color);
|
|
988
|
+
return result;
|
|
989
|
+
}
|
|
990
|
+
#endif
|
|
991
|
+
};
|
|
992
|
+
|
|
993
|
+
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, EnrichedMarkdownTextMarkdownStyleUnderlineStruct &result) {
|
|
994
|
+
auto map = (std::unordered_map<std::string, RawValue>)value;
|
|
995
|
+
|
|
996
|
+
auto tmp_color = map.find("color");
|
|
997
|
+
if (tmp_color != map.end()) {
|
|
998
|
+
fromRawValue(context, tmp_color->second, result.color);
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
static inline std::string toString(const EnrichedMarkdownTextMarkdownStyleUnderlineStruct &value) {
|
|
1003
|
+
return "[Object EnrichedMarkdownTextMarkdownStyleUnderlineStruct]";
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
#ifdef RN_SERIALIZABLE_STATE
|
|
1007
|
+
static inline folly::dynamic toDynamic(const EnrichedMarkdownTextMarkdownStyleUnderlineStruct &value) {
|
|
1008
|
+
return value.toDynamic();
|
|
1009
|
+
}
|
|
1010
|
+
#endif
|
|
1011
|
+
|
|
844
1012
|
struct EnrichedMarkdownTextMarkdownStyleCodeStruct {
|
|
845
1013
|
SharedColor color{};
|
|
846
1014
|
SharedColor backgroundColor{};
|
|
@@ -889,6 +1057,7 @@ static inline folly::dynamic toDynamic(const EnrichedMarkdownTextMarkdownStyleCo
|
|
|
889
1057
|
struct EnrichedMarkdownTextMarkdownStyleImageStruct {
|
|
890
1058
|
Float height{0.0};
|
|
891
1059
|
Float borderRadius{0.0};
|
|
1060
|
+
Float marginTop{0.0};
|
|
892
1061
|
Float marginBottom{0.0};
|
|
893
1062
|
|
|
894
1063
|
#ifdef RN_SERIALIZABLE_STATE
|
|
@@ -898,6 +1067,7 @@ struct EnrichedMarkdownTextMarkdownStyleImageStruct {
|
|
|
898
1067
|
folly::dynamic result = folly::dynamic::object();
|
|
899
1068
|
result["height"] = height;
|
|
900
1069
|
result["borderRadius"] = borderRadius;
|
|
1070
|
+
result["marginTop"] = marginTop;
|
|
901
1071
|
result["marginBottom"] = marginBottom;
|
|
902
1072
|
return result;
|
|
903
1073
|
}
|
|
@@ -915,6 +1085,10 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
|
|
915
1085
|
if (tmp_borderRadius != map.end()) {
|
|
916
1086
|
fromRawValue(context, tmp_borderRadius->second, result.borderRadius);
|
|
917
1087
|
}
|
|
1088
|
+
auto tmp_marginTop = map.find("marginTop");
|
|
1089
|
+
if (tmp_marginTop != map.end()) {
|
|
1090
|
+
fromRawValue(context, tmp_marginTop->second, result.marginTop);
|
|
1091
|
+
}
|
|
918
1092
|
auto tmp_marginBottom = map.find("marginBottom");
|
|
919
1093
|
if (tmp_marginBottom != map.end()) {
|
|
920
1094
|
fromRawValue(context, tmp_marginBottom->second, result.marginBottom);
|
|
@@ -1029,6 +1203,8 @@ struct EnrichedMarkdownTextMarkdownStyleStruct {
|
|
|
1029
1203
|
EnrichedMarkdownTextMarkdownStyleLinkStruct link{};
|
|
1030
1204
|
EnrichedMarkdownTextMarkdownStyleStrongStruct strong{};
|
|
1031
1205
|
EnrichedMarkdownTextMarkdownStyleEmStruct em{};
|
|
1206
|
+
EnrichedMarkdownTextMarkdownStyleStrikethroughStruct strikethrough{};
|
|
1207
|
+
EnrichedMarkdownTextMarkdownStyleUnderlineStruct underline{};
|
|
1032
1208
|
EnrichedMarkdownTextMarkdownStyleCodeStruct code{};
|
|
1033
1209
|
EnrichedMarkdownTextMarkdownStyleImageStruct image{};
|
|
1034
1210
|
EnrichedMarkdownTextMarkdownStyleInlineImageStruct inlineImage{};
|
|
@@ -1052,6 +1228,8 @@ struct EnrichedMarkdownTextMarkdownStyleStruct {
|
|
|
1052
1228
|
result["link"] = ::facebook::react::toDynamic(link);
|
|
1053
1229
|
result["strong"] = ::facebook::react::toDynamic(strong);
|
|
1054
1230
|
result["em"] = ::facebook::react::toDynamic(em);
|
|
1231
|
+
result["strikethrough"] = ::facebook::react::toDynamic(strikethrough);
|
|
1232
|
+
result["underline"] = ::facebook::react::toDynamic(underline);
|
|
1055
1233
|
result["code"] = ::facebook::react::toDynamic(code);
|
|
1056
1234
|
result["image"] = ::facebook::react::toDynamic(image);
|
|
1057
1235
|
result["inlineImage"] = ::facebook::react::toDynamic(inlineImage);
|
|
@@ -1116,6 +1294,14 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
|
|
1116
1294
|
if (tmp_em != map.end()) {
|
|
1117
1295
|
fromRawValue(context, tmp_em->second, result.em);
|
|
1118
1296
|
}
|
|
1297
|
+
auto tmp_strikethrough = map.find("strikethrough");
|
|
1298
|
+
if (tmp_strikethrough != map.end()) {
|
|
1299
|
+
fromRawValue(context, tmp_strikethrough->second, result.strikethrough);
|
|
1300
|
+
}
|
|
1301
|
+
auto tmp_underline = map.find("underline");
|
|
1302
|
+
if (tmp_underline != map.end()) {
|
|
1303
|
+
fromRawValue(context, tmp_underline->second, result.underline);
|
|
1304
|
+
}
|
|
1119
1305
|
auto tmp_code = map.find("code");
|
|
1120
1306
|
if (tmp_code != map.end()) {
|
|
1121
1307
|
fromRawValue(context, tmp_code->second, result.code);
|
|
@@ -1143,6 +1329,39 @@ static inline folly::dynamic toDynamic(const EnrichedMarkdownTextMarkdownStyleSt
|
|
|
1143
1329
|
return value.toDynamic();
|
|
1144
1330
|
}
|
|
1145
1331
|
#endif
|
|
1332
|
+
|
|
1333
|
+
struct EnrichedMarkdownTextMd4cFlagsStruct {
|
|
1334
|
+
bool underline{false};
|
|
1335
|
+
|
|
1336
|
+
#ifdef RN_SERIALIZABLE_STATE
|
|
1337
|
+
bool operator==(const EnrichedMarkdownTextMd4cFlagsStruct&) const = default;
|
|
1338
|
+
|
|
1339
|
+
folly::dynamic toDynamic() const {
|
|
1340
|
+
folly::dynamic result = folly::dynamic::object();
|
|
1341
|
+
result["underline"] = underline;
|
|
1342
|
+
return result;
|
|
1343
|
+
}
|
|
1344
|
+
#endif
|
|
1345
|
+
};
|
|
1346
|
+
|
|
1347
|
+
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, EnrichedMarkdownTextMd4cFlagsStruct &result) {
|
|
1348
|
+
auto map = (std::unordered_map<std::string, RawValue>)value;
|
|
1349
|
+
|
|
1350
|
+
auto tmp_underline = map.find("underline");
|
|
1351
|
+
if (tmp_underline != map.end()) {
|
|
1352
|
+
fromRawValue(context, tmp_underline->second, result.underline);
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
static inline std::string toString(const EnrichedMarkdownTextMd4cFlagsStruct &value) {
|
|
1357
|
+
return "[Object EnrichedMarkdownTextMd4cFlagsStruct]";
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
#ifdef RN_SERIALIZABLE_STATE
|
|
1361
|
+
static inline folly::dynamic toDynamic(const EnrichedMarkdownTextMd4cFlagsStruct &value) {
|
|
1362
|
+
return value.toDynamic();
|
|
1363
|
+
}
|
|
1364
|
+
#endif
|
|
1146
1365
|
class EnrichedMarkdownTextProps final : public ViewProps {
|
|
1147
1366
|
public:
|
|
1148
1367
|
EnrichedMarkdownTextProps() = default;
|
|
@@ -1152,7 +1371,12 @@ class EnrichedMarkdownTextProps final : public ViewProps {
|
|
|
1152
1371
|
|
|
1153
1372
|
std::string markdown{};
|
|
1154
1373
|
EnrichedMarkdownTextMarkdownStyleStruct markdownStyle{};
|
|
1155
|
-
bool
|
|
1374
|
+
bool enableLinkPreview{true};
|
|
1375
|
+
bool selectable{false};
|
|
1376
|
+
EnrichedMarkdownTextMd4cFlagsStruct md4cFlags{};
|
|
1377
|
+
bool allowFontScaling{true};
|
|
1378
|
+
Float maxFontSizeMultiplier{0.0};
|
|
1379
|
+
bool allowTrailingMargin{false};
|
|
1156
1380
|
|
|
1157
1381
|
#ifdef RN_SERIALIZABLE_STATE
|
|
1158
1382
|
ComponentName getDiffPropsImplementationTarget() const override;
|
|
@@ -28,22 +28,26 @@ static jint nodeTypeToJavaOrdinal(NodeType type) {
|
|
|
28
28
|
return 6;
|
|
29
29
|
case NodeType::Emphasis:
|
|
30
30
|
return 7;
|
|
31
|
-
case NodeType::
|
|
31
|
+
case NodeType::Strikethrough:
|
|
32
32
|
return 8;
|
|
33
|
-
case NodeType::
|
|
33
|
+
case NodeType::Underline:
|
|
34
34
|
return 9;
|
|
35
|
-
case NodeType::
|
|
35
|
+
case NodeType::Code:
|
|
36
36
|
return 10;
|
|
37
|
-
case NodeType::
|
|
37
|
+
case NodeType::Image:
|
|
38
38
|
return 11;
|
|
39
|
-
case NodeType::
|
|
39
|
+
case NodeType::Blockquote:
|
|
40
40
|
return 12;
|
|
41
|
-
case NodeType::
|
|
41
|
+
case NodeType::UnorderedList:
|
|
42
42
|
return 13;
|
|
43
|
-
case NodeType::
|
|
43
|
+
case NodeType::OrderedList:
|
|
44
44
|
return 14;
|
|
45
|
-
case NodeType::
|
|
45
|
+
case NodeType::ListItem:
|
|
46
46
|
return 15;
|
|
47
|
+
case NodeType::CodeBlock:
|
|
48
|
+
return 16;
|
|
49
|
+
case NodeType::ThematicBreak:
|
|
50
|
+
return 17;
|
|
47
51
|
default:
|
|
48
52
|
return 0;
|
|
49
53
|
}
|
|
@@ -157,7 +161,8 @@ extern "C" {
|
|
|
157
161
|
|
|
158
162
|
JNIEXPORT jobject JNICALL Java_com_swmansion_enriched_markdown_parser_Parser_nativeParseMarkdown(JNIEnv *env,
|
|
159
163
|
jobject /* this */,
|
|
160
|
-
jstring markdown
|
|
164
|
+
jstring markdown,
|
|
165
|
+
jobject flags) {
|
|
161
166
|
if (!markdown) {
|
|
162
167
|
LOGE("Markdown string is null");
|
|
163
168
|
return nullptr;
|
|
@@ -170,9 +175,21 @@ JNIEXPORT jobject JNICALL Java_com_swmansion_enriched_markdown_parser_Parser_nat
|
|
|
170
175
|
}
|
|
171
176
|
|
|
172
177
|
try {
|
|
173
|
-
//
|
|
178
|
+
// Extract flags from Kotlin Md4cFlags data class
|
|
179
|
+
Md4cFlags md4cFlags;
|
|
180
|
+
if (flags) {
|
|
181
|
+
jclass flagsClass = env->GetObjectClass(flags);
|
|
182
|
+
if (flagsClass) {
|
|
183
|
+
jfieldID underlineField = env->GetFieldID(flagsClass, "underline", "Z");
|
|
184
|
+
if (underlineField) {
|
|
185
|
+
md4cFlags.underline = env->GetBooleanField(flags, underlineField) == JNI_TRUE;
|
|
186
|
+
}
|
|
187
|
+
env->DeleteLocalRef(flagsClass);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
174
191
|
MD4CParser parser;
|
|
175
|
-
auto ast = parser.parse(std::string(markdownStr));
|
|
192
|
+
auto ast = parser.parse(std::string(markdownStr), md4cFlags);
|
|
176
193
|
|
|
177
194
|
env->ReleaseStringUTFChars(markdown, markdownStr);
|
|
178
195
|
|