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
package/src/index.tsx
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export { default as EnrichedMarkdownText } from './EnrichedMarkdownText';
|
|
2
|
-
export { default as EnrichedMarkdownTextNativeComponent } from './EnrichedMarkdownTextNativeComponent';
|
|
3
2
|
export type {
|
|
4
3
|
EnrichedMarkdownTextProps,
|
|
5
4
|
MarkdownStyle,
|
|
5
|
+
Md4cFlags,
|
|
6
6
|
} from './EnrichedMarkdownText';
|
|
7
|
-
export type {
|
|
7
|
+
export type {
|
|
8
|
+
LinkPressEvent,
|
|
9
|
+
LinkLongPressEvent,
|
|
10
|
+
} from './EnrichedMarkdownTextNativeComponent';
|
|
@@ -37,7 +37,9 @@ const paragraphDefaultStyles: MarkdownStyleInternal['paragraph'] = {
|
|
|
37
37
|
fontWeight: '',
|
|
38
38
|
color: defaultTextColor,
|
|
39
39
|
lineHeight: Platform.select({ ios: 24, android: 26, default: 26 }),
|
|
40
|
+
marginTop: 0,
|
|
40
41
|
marginBottom: 16,
|
|
42
|
+
textAlign: 'left',
|
|
41
43
|
};
|
|
42
44
|
|
|
43
45
|
const defaultH1Style: MarkdownStyleInternal['h1'] = {
|
|
@@ -46,7 +48,9 @@ const defaultH1Style: MarkdownStyleInternal['h1'] = {
|
|
|
46
48
|
fontWeight: '',
|
|
47
49
|
color: defaultHeadingColor,
|
|
48
50
|
lineHeight: Platform.select({ ios: 36, android: 38, default: 38 }),
|
|
51
|
+
marginTop: 0,
|
|
49
52
|
marginBottom: 8,
|
|
53
|
+
textAlign: 'left',
|
|
50
54
|
};
|
|
51
55
|
|
|
52
56
|
const defaultH2Style: MarkdownStyleInternal['h2'] = {
|
|
@@ -55,7 +59,9 @@ const defaultH2Style: MarkdownStyleInternal['h2'] = {
|
|
|
55
59
|
fontWeight: '',
|
|
56
60
|
color: defaultHeadingColor,
|
|
57
61
|
lineHeight: Platform.select({ ios: 30, android: 32, default: 32 }),
|
|
62
|
+
marginTop: 0,
|
|
58
63
|
marginBottom: 8,
|
|
64
|
+
textAlign: 'left',
|
|
59
65
|
};
|
|
60
66
|
|
|
61
67
|
const defaultH3Style: MarkdownStyleInternal['h3'] = {
|
|
@@ -64,7 +70,9 @@ const defaultH3Style: MarkdownStyleInternal['h3'] = {
|
|
|
64
70
|
fontWeight: '',
|
|
65
71
|
color: defaultHeadingColor,
|
|
66
72
|
lineHeight: Platform.select({ ios: 26, android: 28, default: 28 }),
|
|
73
|
+
marginTop: 0,
|
|
67
74
|
marginBottom: 8,
|
|
75
|
+
textAlign: 'left',
|
|
68
76
|
};
|
|
69
77
|
|
|
70
78
|
const defaultH4Style: MarkdownStyleInternal['h4'] = {
|
|
@@ -73,7 +81,9 @@ const defaultH4Style: MarkdownStyleInternal['h4'] = {
|
|
|
73
81
|
fontWeight: '',
|
|
74
82
|
color: defaultHeadingColor,
|
|
75
83
|
lineHeight: Platform.select({ ios: 24, android: 26, default: 26 }),
|
|
84
|
+
marginTop: 0,
|
|
76
85
|
marginBottom: 8,
|
|
86
|
+
textAlign: 'left',
|
|
77
87
|
};
|
|
78
88
|
|
|
79
89
|
const defaultH5Style: MarkdownStyleInternal['h5'] = {
|
|
@@ -82,7 +92,9 @@ const defaultH5Style: MarkdownStyleInternal['h5'] = {
|
|
|
82
92
|
fontWeight: '',
|
|
83
93
|
color: processColor('#374151') as ColorValue,
|
|
84
94
|
lineHeight: Platform.select({ ios: 22, android: 24, default: 24 }),
|
|
95
|
+
marginTop: 0,
|
|
85
96
|
marginBottom: 8,
|
|
97
|
+
textAlign: 'left',
|
|
86
98
|
};
|
|
87
99
|
|
|
88
100
|
const defaultH6Style: MarkdownStyleInternal['h6'] = {
|
|
@@ -91,7 +103,9 @@ const defaultH6Style: MarkdownStyleInternal['h6'] = {
|
|
|
91
103
|
fontWeight: '',
|
|
92
104
|
color: processColor('#4B5563') as ColorValue,
|
|
93
105
|
lineHeight: Platform.select({ ios: 20, android: 22, default: 22 }),
|
|
106
|
+
marginTop: 0,
|
|
94
107
|
marginBottom: 8,
|
|
108
|
+
textAlign: 'left',
|
|
95
109
|
};
|
|
96
110
|
|
|
97
111
|
const defaultLinkColor = processColor('#2563EB') as ColorValue;
|
|
@@ -114,6 +128,7 @@ const defaultCodeStyle: MarkdownStyleInternal['code'] = {
|
|
|
114
128
|
const defaultImageStyle: MarkdownStyleInternal['image'] = {
|
|
115
129
|
height: 200,
|
|
116
130
|
borderRadius: 8,
|
|
131
|
+
marginTop: 0,
|
|
117
132
|
marginBottom: 16,
|
|
118
133
|
};
|
|
119
134
|
|
|
@@ -131,6 +146,7 @@ const defaultBlockquoteStyle: MarkdownStyleInternal['blockquote'] = {
|
|
|
131
146
|
fontWeight: '',
|
|
132
147
|
color: processColor('#4B5563') as ColorValue,
|
|
133
148
|
lineHeight: Platform.select({ ios: 24, android: 26, default: 26 }),
|
|
149
|
+
marginTop: 0,
|
|
134
150
|
marginBottom: 16,
|
|
135
151
|
borderColor: defaultBlockquoteBorderColor,
|
|
136
152
|
borderWidth: 3,
|
|
@@ -151,6 +167,7 @@ const defaultListStyle: MarkdownStyleInternal['list'] = {
|
|
|
151
167
|
android: 26,
|
|
152
168
|
default: 26,
|
|
153
169
|
}),
|
|
170
|
+
marginTop: 0,
|
|
154
171
|
marginBottom: 16,
|
|
155
172
|
bulletColor: defaultListBulletColor,
|
|
156
173
|
bulletSize: 6,
|
|
@@ -170,6 +187,7 @@ const defaultCodeBlockStyle: MarkdownStyleInternal['codeBlock'] = {
|
|
|
170
187
|
fontWeight: '',
|
|
171
188
|
color: defaultCodeBlockTextColor,
|
|
172
189
|
lineHeight: Platform.select({ ios: 20, android: 22, default: 22 }),
|
|
190
|
+
marginTop: 0,
|
|
173
191
|
marginBottom: 16,
|
|
174
192
|
backgroundColor: defaultCodeBlockBackgroundColor,
|
|
175
193
|
borderColor: defaultCodeBlockBorderColor,
|
|
@@ -178,6 +196,9 @@ const defaultCodeBlockStyle: MarkdownStyleInternal['codeBlock'] = {
|
|
|
178
196
|
padding: 16,
|
|
179
197
|
};
|
|
180
198
|
|
|
199
|
+
const defaultStrikethroughColor = processColor('#9CA3AF') as ColorValue;
|
|
200
|
+
const defaultUnderlineColor = defaultTextColor;
|
|
201
|
+
|
|
181
202
|
const defaultThematicBreakColor = processColor('#E5E7EB') as ColorValue;
|
|
182
203
|
|
|
183
204
|
const defaultThematicBreakStyle: MarkdownStyleInternal['thematicBreak'] = {
|
|
@@ -198,10 +219,12 @@ export const normalizeMarkdownStyle = (
|
|
|
198
219
|
style.paragraph?.fontWeight ?? paragraphDefaultStyles.fontWeight,
|
|
199
220
|
color:
|
|
200
221
|
normalizeColor(style.paragraph?.color) ?? paragraphDefaultStyles.color,
|
|
222
|
+
marginTop: style.paragraph?.marginTop ?? paragraphDefaultStyles.marginTop,
|
|
201
223
|
marginBottom:
|
|
202
224
|
style.paragraph?.marginBottom ?? paragraphDefaultStyles.marginBottom,
|
|
203
225
|
lineHeight:
|
|
204
226
|
style.paragraph?.lineHeight ?? paragraphDefaultStyles.lineHeight,
|
|
227
|
+
textAlign: style.paragraph?.textAlign ?? paragraphDefaultStyles.textAlign,
|
|
205
228
|
};
|
|
206
229
|
|
|
207
230
|
const h1: MarkdownStyleInternal['h1'] = {
|
|
@@ -209,8 +232,10 @@ export const normalizeMarkdownStyle = (
|
|
|
209
232
|
fontFamily: style.h1?.fontFamily ?? defaultH1Style.fontFamily,
|
|
210
233
|
fontWeight: style.h1?.fontWeight ?? defaultH1Style.fontWeight,
|
|
211
234
|
color: normalizeColor(style.h1?.color) ?? defaultH1Style.color,
|
|
235
|
+
marginTop: style.h1?.marginTop ?? defaultH1Style.marginTop,
|
|
212
236
|
marginBottom: style.h1?.marginBottom ?? defaultH1Style.marginBottom,
|
|
213
237
|
lineHeight: style.h1?.lineHeight ?? defaultH1Style.lineHeight,
|
|
238
|
+
textAlign: style.h1?.textAlign ?? defaultH1Style.textAlign,
|
|
214
239
|
};
|
|
215
240
|
|
|
216
241
|
const h2: MarkdownStyleInternal['h2'] = {
|
|
@@ -218,8 +243,10 @@ export const normalizeMarkdownStyle = (
|
|
|
218
243
|
fontFamily: style.h2?.fontFamily ?? defaultH2Style.fontFamily,
|
|
219
244
|
fontWeight: style.h2?.fontWeight ?? defaultH2Style.fontWeight,
|
|
220
245
|
color: normalizeColor(style.h2?.color) ?? defaultH2Style.color,
|
|
246
|
+
marginTop: style.h2?.marginTop ?? defaultH2Style.marginTop,
|
|
221
247
|
marginBottom: style.h2?.marginBottom ?? defaultH2Style.marginBottom,
|
|
222
248
|
lineHeight: style.h2?.lineHeight ?? defaultH2Style.lineHeight,
|
|
249
|
+
textAlign: style.h2?.textAlign ?? defaultH2Style.textAlign,
|
|
223
250
|
};
|
|
224
251
|
|
|
225
252
|
const h3: MarkdownStyleInternal['h3'] = {
|
|
@@ -227,8 +254,10 @@ export const normalizeMarkdownStyle = (
|
|
|
227
254
|
fontFamily: style.h3?.fontFamily ?? defaultH3Style.fontFamily,
|
|
228
255
|
fontWeight: style.h3?.fontWeight ?? defaultH3Style.fontWeight,
|
|
229
256
|
color: normalizeColor(style.h3?.color) ?? defaultH3Style.color,
|
|
257
|
+
marginTop: style.h3?.marginTop ?? defaultH3Style.marginTop,
|
|
230
258
|
marginBottom: style.h3?.marginBottom ?? defaultH3Style.marginBottom,
|
|
231
259
|
lineHeight: style.h3?.lineHeight ?? defaultH3Style.lineHeight,
|
|
260
|
+
textAlign: style.h3?.textAlign ?? defaultH3Style.textAlign,
|
|
232
261
|
};
|
|
233
262
|
|
|
234
263
|
const h4: MarkdownStyleInternal['h4'] = {
|
|
@@ -236,8 +265,10 @@ export const normalizeMarkdownStyle = (
|
|
|
236
265
|
fontFamily: style.h4?.fontFamily ?? defaultH4Style.fontFamily,
|
|
237
266
|
fontWeight: style.h4?.fontWeight ?? defaultH4Style.fontWeight,
|
|
238
267
|
color: normalizeColor(style.h4?.color) ?? defaultH4Style.color,
|
|
268
|
+
marginTop: style.h4?.marginTop ?? defaultH4Style.marginTop,
|
|
239
269
|
marginBottom: style.h4?.marginBottom ?? defaultH4Style.marginBottom,
|
|
240
270
|
lineHeight: style.h4?.lineHeight ?? defaultH4Style.lineHeight,
|
|
271
|
+
textAlign: style.h4?.textAlign ?? defaultH4Style.textAlign,
|
|
241
272
|
};
|
|
242
273
|
|
|
243
274
|
const h5: MarkdownStyleInternal['h5'] = {
|
|
@@ -245,8 +276,10 @@ export const normalizeMarkdownStyle = (
|
|
|
245
276
|
fontFamily: style.h5?.fontFamily ?? defaultH5Style.fontFamily,
|
|
246
277
|
fontWeight: style.h5?.fontWeight ?? defaultH5Style.fontWeight,
|
|
247
278
|
color: normalizeColor(style.h5?.color) ?? defaultH5Style.color,
|
|
279
|
+
marginTop: style.h5?.marginTop ?? defaultH5Style.marginTop,
|
|
248
280
|
marginBottom: style.h5?.marginBottom ?? defaultH5Style.marginBottom,
|
|
249
281
|
lineHeight: style.h5?.lineHeight ?? defaultH5Style.lineHeight,
|
|
282
|
+
textAlign: style.h5?.textAlign ?? defaultH5Style.textAlign,
|
|
250
283
|
};
|
|
251
284
|
|
|
252
285
|
const h6: MarkdownStyleInternal['h6'] = {
|
|
@@ -254,8 +287,10 @@ export const normalizeMarkdownStyle = (
|
|
|
254
287
|
fontFamily: style.h6?.fontFamily ?? defaultH6Style.fontFamily,
|
|
255
288
|
fontWeight: style.h6?.fontWeight ?? defaultH6Style.fontWeight,
|
|
256
289
|
color: normalizeColor(style.h6?.color) ?? defaultH6Style.color,
|
|
290
|
+
marginTop: style.h6?.marginTop ?? defaultH6Style.marginTop,
|
|
257
291
|
marginBottom: style.h6?.marginBottom ?? defaultH6Style.marginBottom,
|
|
258
292
|
lineHeight: style.h6?.lineHeight ?? defaultH6Style.lineHeight,
|
|
293
|
+
textAlign: style.h6?.textAlign ?? defaultH6Style.textAlign,
|
|
259
294
|
};
|
|
260
295
|
|
|
261
296
|
const blockquote: MarkdownStyleInternal['blockquote'] = {
|
|
@@ -266,6 +301,7 @@ export const normalizeMarkdownStyle = (
|
|
|
266
301
|
style.blockquote?.fontWeight ?? defaultBlockquoteStyle.fontWeight,
|
|
267
302
|
color:
|
|
268
303
|
normalizeColor(style.blockquote?.color) ?? defaultBlockquoteStyle.color,
|
|
304
|
+
marginTop: style.blockquote?.marginTop ?? defaultBlockquoteStyle.marginTop,
|
|
269
305
|
marginBottom:
|
|
270
306
|
style.blockquote?.marginBottom ?? defaultBlockquoteStyle.marginBottom,
|
|
271
307
|
lineHeight:
|
|
@@ -286,6 +322,7 @@ export const normalizeMarkdownStyle = (
|
|
|
286
322
|
fontFamily: style.list?.fontFamily ?? defaultListStyle.fontFamily,
|
|
287
323
|
fontWeight: style.list?.fontWeight ?? defaultListStyle.fontWeight,
|
|
288
324
|
color: normalizeColor(style.list?.color) ?? defaultListStyle.color,
|
|
325
|
+
marginTop: style.list?.marginTop ?? defaultListStyle.marginTop,
|
|
289
326
|
marginBottom: style.list?.marginBottom ?? defaultListStyle.marginBottom,
|
|
290
327
|
lineHeight: style.list?.lineHeight ?? defaultListStyle.lineHeight,
|
|
291
328
|
bulletColor:
|
|
@@ -305,6 +342,7 @@ export const normalizeMarkdownStyle = (
|
|
|
305
342
|
fontWeight: style.codeBlock?.fontWeight ?? defaultCodeBlockStyle.fontWeight,
|
|
306
343
|
color:
|
|
307
344
|
normalizeColor(style.codeBlock?.color) ?? defaultCodeBlockStyle.color,
|
|
345
|
+
marginTop: style.codeBlock?.marginTop ?? defaultCodeBlockStyle.marginTop,
|
|
308
346
|
marginBottom:
|
|
309
347
|
style.codeBlock?.marginBottom ?? defaultCodeBlockStyle.marginBottom,
|
|
310
348
|
lineHeight: style.codeBlock?.lineHeight ?? defaultCodeBlockStyle.lineHeight,
|
|
@@ -343,6 +381,13 @@ export const normalizeMarkdownStyle = (
|
|
|
343
381
|
em: {
|
|
344
382
|
color: normalizeColor(style.em?.color),
|
|
345
383
|
},
|
|
384
|
+
strikethrough: {
|
|
385
|
+
color:
|
|
386
|
+
normalizeColor(style.strikethrough?.color) ?? defaultStrikethroughColor,
|
|
387
|
+
},
|
|
388
|
+
underline: {
|
|
389
|
+
color: normalizeColor(style.underline?.color) ?? defaultUnderlineColor,
|
|
390
|
+
},
|
|
346
391
|
code: {
|
|
347
392
|
...defaultCodeStyle,
|
|
348
393
|
color: normalizeColor(style.code?.color) ?? defaultCodeStyle.color,
|
|
@@ -356,6 +401,7 @@ export const normalizeMarkdownStyle = (
|
|
|
356
401
|
...defaultImageStyle,
|
|
357
402
|
height: style.image?.height ?? defaultImageStyle.height,
|
|
358
403
|
borderRadius: style.image?.borderRadius ?? defaultImageStyle.borderRadius,
|
|
404
|
+
marginTop: style.image?.marginTop ?? defaultImageStyle.marginTop,
|
|
359
405
|
marginBottom: style.image?.marginBottom ?? defaultImageStyle.marginBottom,
|
|
360
406
|
},
|
|
361
407
|
inlineImage: {
|
package/android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownTextState.h
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <folly/dynamic.h>
|
|
4
|
-
|
|
5
|
-
namespace facebook::react {
|
|
6
|
-
|
|
7
|
-
class MarkdownTextState {
|
|
8
|
-
public:
|
|
9
|
-
MarkdownTextState() : forceHeightRecalculationCounter_(0) {}
|
|
10
|
-
|
|
11
|
-
// Used by Kotlin to set current state value
|
|
12
|
-
MarkdownTextState(MarkdownTextState const &previousState, folly::dynamic data)
|
|
13
|
-
: forceHeightRecalculationCounter_((int)data["forceHeightRecalculationCounter"].getInt()){};
|
|
14
|
-
|
|
15
|
-
folly::dynamic getDynamic() const {
|
|
16
|
-
return {};
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
int getForceHeightRecalculationCounter() const;
|
|
20
|
-
|
|
21
|
-
private:
|
|
22
|
-
const int forceHeightRecalculationCounter_{};
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
} // namespace facebook::react
|