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
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
#import "StyleConfig.h"
|
|
2
|
+
#import "FontUtils.h"
|
|
2
3
|
#import <React/RCTFont.h>
|
|
4
|
+
#import <React/RCTUtils.h>
|
|
3
5
|
|
|
4
6
|
static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
5
7
|
{
|
|
@@ -12,6 +14,8 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
@implementation StyleConfig {
|
|
17
|
+
BOOL _allowFontScaling;
|
|
18
|
+
CGFloat _maxFontSizeMultiplier;
|
|
15
19
|
// Primary font properties
|
|
16
20
|
UIColor *_primaryColor;
|
|
17
21
|
NSNumber *_primaryFontSize;
|
|
@@ -24,8 +28,10 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
24
28
|
NSString *_paragraphFontFamily;
|
|
25
29
|
NSString *_paragraphFontWeight;
|
|
26
30
|
UIColor *_paragraphColor;
|
|
31
|
+
CGFloat _paragraphMarginTop;
|
|
27
32
|
CGFloat _paragraphMarginBottom;
|
|
28
33
|
CGFloat _paragraphLineHeight;
|
|
34
|
+
NSTextAlignment _paragraphTextAlign;
|
|
29
35
|
UIFont *_paragraphFont;
|
|
30
36
|
BOOL _paragraphFontNeedsRecreation;
|
|
31
37
|
// H1 properties
|
|
@@ -33,8 +39,10 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
33
39
|
NSString *_h1FontFamily;
|
|
34
40
|
NSString *_h1FontWeight;
|
|
35
41
|
UIColor *_h1Color;
|
|
42
|
+
CGFloat _h1MarginTop;
|
|
36
43
|
CGFloat _h1MarginBottom;
|
|
37
44
|
CGFloat _h1LineHeight;
|
|
45
|
+
NSTextAlignment _h1TextAlign;
|
|
38
46
|
UIFont *_h1Font;
|
|
39
47
|
BOOL _h1FontNeedsRecreation;
|
|
40
48
|
// H2 properties
|
|
@@ -42,8 +50,10 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
42
50
|
NSString *_h2FontFamily;
|
|
43
51
|
NSString *_h2FontWeight;
|
|
44
52
|
UIColor *_h2Color;
|
|
53
|
+
CGFloat _h2MarginTop;
|
|
45
54
|
CGFloat _h2MarginBottom;
|
|
46
55
|
CGFloat _h2LineHeight;
|
|
56
|
+
NSTextAlignment _h2TextAlign;
|
|
47
57
|
UIFont *_h2Font;
|
|
48
58
|
BOOL _h2FontNeedsRecreation;
|
|
49
59
|
// H3 properties
|
|
@@ -51,8 +61,10 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
51
61
|
NSString *_h3FontFamily;
|
|
52
62
|
NSString *_h3FontWeight;
|
|
53
63
|
UIColor *_h3Color;
|
|
64
|
+
CGFloat _h3MarginTop;
|
|
54
65
|
CGFloat _h3MarginBottom;
|
|
55
66
|
CGFloat _h3LineHeight;
|
|
67
|
+
NSTextAlignment _h3TextAlign;
|
|
56
68
|
UIFont *_h3Font;
|
|
57
69
|
BOOL _h3FontNeedsRecreation;
|
|
58
70
|
// H4 properties
|
|
@@ -60,8 +72,10 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
60
72
|
NSString *_h4FontFamily;
|
|
61
73
|
NSString *_h4FontWeight;
|
|
62
74
|
UIColor *_h4Color;
|
|
75
|
+
CGFloat _h4MarginTop;
|
|
63
76
|
CGFloat _h4MarginBottom;
|
|
64
77
|
CGFloat _h4LineHeight;
|
|
78
|
+
NSTextAlignment _h4TextAlign;
|
|
65
79
|
UIFont *_h4Font;
|
|
66
80
|
BOOL _h4FontNeedsRecreation;
|
|
67
81
|
// H5 properties
|
|
@@ -69,8 +83,10 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
69
83
|
NSString *_h5FontFamily;
|
|
70
84
|
NSString *_h5FontWeight;
|
|
71
85
|
UIColor *_h5Color;
|
|
86
|
+
CGFloat _h5MarginTop;
|
|
72
87
|
CGFloat _h5MarginBottom;
|
|
73
88
|
CGFloat _h5LineHeight;
|
|
89
|
+
NSTextAlignment _h5TextAlign;
|
|
74
90
|
UIFont *_h5Font;
|
|
75
91
|
BOOL _h5FontNeedsRecreation;
|
|
76
92
|
// H6 properties
|
|
@@ -78,8 +94,10 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
78
94
|
NSString *_h6FontFamily;
|
|
79
95
|
NSString *_h6FontWeight;
|
|
80
96
|
UIColor *_h6Color;
|
|
97
|
+
CGFloat _h6MarginTop;
|
|
81
98
|
CGFloat _h6MarginBottom;
|
|
82
99
|
CGFloat _h6LineHeight;
|
|
100
|
+
NSTextAlignment _h6TextAlign;
|
|
83
101
|
UIFont *_h6Font;
|
|
84
102
|
BOOL _h6FontNeedsRecreation;
|
|
85
103
|
// Link properties
|
|
@@ -89,6 +107,10 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
89
107
|
UIColor *_strongColor;
|
|
90
108
|
// Emphasis properties
|
|
91
109
|
UIColor *_emphasisColor;
|
|
110
|
+
// Strikethrough properties
|
|
111
|
+
UIColor *_strikethroughColor;
|
|
112
|
+
// Underline properties
|
|
113
|
+
UIColor *_underlineColor;
|
|
92
114
|
// Code properties
|
|
93
115
|
UIColor *_codeColor;
|
|
94
116
|
UIColor *_codeBackgroundColor;
|
|
@@ -96,6 +118,7 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
96
118
|
// Image properties
|
|
97
119
|
CGFloat _imageHeight;
|
|
98
120
|
CGFloat _imageBorderRadius;
|
|
121
|
+
CGFloat _imageMarginTop;
|
|
99
122
|
CGFloat _imageMarginBottom;
|
|
100
123
|
// Inline image properties
|
|
101
124
|
CGFloat _inlineImageSize;
|
|
@@ -104,6 +127,7 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
104
127
|
NSString *_blockquoteFontFamily;
|
|
105
128
|
NSString *_blockquoteFontWeight;
|
|
106
129
|
UIColor *_blockquoteColor;
|
|
130
|
+
CGFloat _blockquoteMarginTop;
|
|
107
131
|
CGFloat _blockquoteMarginBottom;
|
|
108
132
|
CGFloat _blockquoteLineHeight;
|
|
109
133
|
UIColor *_blockquoteBorderColor;
|
|
@@ -115,6 +139,7 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
115
139
|
NSString *_listStyleFontFamily;
|
|
116
140
|
NSString *_listStyleFontWeight;
|
|
117
141
|
UIColor *_listStyleColor;
|
|
142
|
+
CGFloat _listStyleMarginTop;
|
|
118
143
|
CGFloat _listStyleMarginBottom;
|
|
119
144
|
CGFloat _listStyleLineHeight;
|
|
120
145
|
UIColor *_listStyleBulletColor;
|
|
@@ -132,6 +157,7 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
132
157
|
NSString *_codeBlockFontFamily;
|
|
133
158
|
NSString *_codeBlockFontWeight;
|
|
134
159
|
UIColor *_codeBlockColor;
|
|
160
|
+
CGFloat _codeBlockMarginTop;
|
|
135
161
|
CGFloat _codeBlockMarginBottom;
|
|
136
162
|
CGFloat _codeBlockLineHeight;
|
|
137
163
|
UIColor *_codeBlockBackgroundColor;
|
|
@@ -153,6 +179,8 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
153
179
|
- (instancetype)init
|
|
154
180
|
{
|
|
155
181
|
self = [super init];
|
|
182
|
+
_allowFontScaling = YES;
|
|
183
|
+
_maxFontSizeMultiplier = 0;
|
|
156
184
|
_primaryFontNeedsRecreation = YES;
|
|
157
185
|
_paragraphFontNeedsRecreation = YES;
|
|
158
186
|
_h1FontNeedsRecreation = YES;
|
|
@@ -169,9 +197,70 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
169
197
|
return self;
|
|
170
198
|
}
|
|
171
199
|
|
|
200
|
+
- (CGFloat)fontScaleMultiplier
|
|
201
|
+
{
|
|
202
|
+
return _allowFontScaling ? RCTFontSizeMultiplier() : 1.0;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
- (void)setFontScaleMultiplier:(CGFloat)newValue
|
|
206
|
+
{
|
|
207
|
+
BOOL newAllowFontScaling = (newValue != 1.0);
|
|
208
|
+
if (_allowFontScaling != newAllowFontScaling) {
|
|
209
|
+
_allowFontScaling = newAllowFontScaling;
|
|
210
|
+
// Invalidate all cached fonts when scale changes
|
|
211
|
+
_primaryFontNeedsRecreation = YES;
|
|
212
|
+
_paragraphFontNeedsRecreation = YES;
|
|
213
|
+
_h1FontNeedsRecreation = YES;
|
|
214
|
+
_h2FontNeedsRecreation = YES;
|
|
215
|
+
_h3FontNeedsRecreation = YES;
|
|
216
|
+
_h4FontNeedsRecreation = YES;
|
|
217
|
+
_h5FontNeedsRecreation = YES;
|
|
218
|
+
_h6FontNeedsRecreation = YES;
|
|
219
|
+
_listMarkerFontNeedsRecreation = YES;
|
|
220
|
+
_listStyleFontNeedsRecreation = YES;
|
|
221
|
+
_codeBlockFontNeedsRecreation = YES;
|
|
222
|
+
_blockquoteFontNeedsRecreation = YES;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
- (CGFloat)effectiveScaleMultiplierForFontSize:(CGFloat)fontSize
|
|
227
|
+
{
|
|
228
|
+
if (!_allowFontScaling) {
|
|
229
|
+
return 1.0;
|
|
230
|
+
}
|
|
231
|
+
return RCTFontSizeMultiplierWithMax(_maxFontSizeMultiplier);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
- (CGFloat)maxFontSizeMultiplier
|
|
235
|
+
{
|
|
236
|
+
return _maxFontSizeMultiplier;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
- (void)setMaxFontSizeMultiplier:(CGFloat)newValue
|
|
240
|
+
{
|
|
241
|
+
if (_maxFontSizeMultiplier != newValue) {
|
|
242
|
+
_maxFontSizeMultiplier = newValue;
|
|
243
|
+
// Invalidate all cached fonts when max multiplier changes
|
|
244
|
+
_primaryFontNeedsRecreation = YES;
|
|
245
|
+
_paragraphFontNeedsRecreation = YES;
|
|
246
|
+
_h1FontNeedsRecreation = YES;
|
|
247
|
+
_h2FontNeedsRecreation = YES;
|
|
248
|
+
_h3FontNeedsRecreation = YES;
|
|
249
|
+
_h4FontNeedsRecreation = YES;
|
|
250
|
+
_h5FontNeedsRecreation = YES;
|
|
251
|
+
_h6FontNeedsRecreation = YES;
|
|
252
|
+
_listMarkerFontNeedsRecreation = YES;
|
|
253
|
+
_listStyleFontNeedsRecreation = YES;
|
|
254
|
+
_codeBlockFontNeedsRecreation = YES;
|
|
255
|
+
_blockquoteFontNeedsRecreation = YES;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
172
259
|
- (id)copyWithZone:(NSZone *)zone
|
|
173
260
|
{
|
|
174
261
|
StyleConfig *copy = [[[self class] allocWithZone:zone] init];
|
|
262
|
+
copy->_allowFontScaling = _allowFontScaling;
|
|
263
|
+
copy->_maxFontSizeMultiplier = _maxFontSizeMultiplier;
|
|
175
264
|
copy->_primaryColor = [_primaryColor copy];
|
|
176
265
|
copy->_primaryFontSize = [_primaryFontSize copy];
|
|
177
266
|
copy->_primaryFontWeight = [_primaryFontWeight copy];
|
|
@@ -182,66 +271,84 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
182
271
|
copy->_paragraphFontFamily = [_paragraphFontFamily copy];
|
|
183
272
|
copy->_paragraphFontWeight = [_paragraphFontWeight copy];
|
|
184
273
|
copy->_paragraphColor = [_paragraphColor copy];
|
|
274
|
+
copy->_paragraphMarginTop = _paragraphMarginTop;
|
|
185
275
|
copy->_paragraphMarginBottom = _paragraphMarginBottom;
|
|
186
276
|
copy->_paragraphLineHeight = _paragraphLineHeight;
|
|
277
|
+
copy->_paragraphTextAlign = _paragraphTextAlign;
|
|
187
278
|
copy->_paragraphFontNeedsRecreation = YES;
|
|
188
279
|
copy->_h1FontSize = _h1FontSize;
|
|
189
280
|
copy->_h1FontFamily = [_h1FontFamily copy];
|
|
190
281
|
copy->_h1FontWeight = [_h1FontWeight copy];
|
|
191
282
|
copy->_h1Color = [_h1Color copy];
|
|
283
|
+
copy->_h1MarginTop = _h1MarginTop;
|
|
192
284
|
copy->_h1MarginBottom = _h1MarginBottom;
|
|
193
285
|
copy->_h1LineHeight = _h1LineHeight;
|
|
286
|
+
copy->_h1TextAlign = _h1TextAlign;
|
|
194
287
|
copy->_h1FontNeedsRecreation = YES;
|
|
195
288
|
copy->_h2FontSize = _h2FontSize;
|
|
196
289
|
copy->_h2FontFamily = [_h2FontFamily copy];
|
|
197
290
|
copy->_h2FontWeight = [_h2FontWeight copy];
|
|
198
291
|
copy->_h2Color = [_h2Color copy];
|
|
292
|
+
copy->_h2MarginTop = _h2MarginTop;
|
|
199
293
|
copy->_h2MarginBottom = _h2MarginBottom;
|
|
200
294
|
copy->_h2LineHeight = _h2LineHeight;
|
|
295
|
+
copy->_h2TextAlign = _h2TextAlign;
|
|
201
296
|
copy->_h2FontNeedsRecreation = YES;
|
|
202
297
|
copy->_h3FontSize = _h3FontSize;
|
|
203
298
|
copy->_h3FontFamily = [_h3FontFamily copy];
|
|
204
299
|
copy->_h3FontWeight = [_h3FontWeight copy];
|
|
205
300
|
copy->_h3Color = [_h3Color copy];
|
|
301
|
+
copy->_h3MarginTop = _h3MarginTop;
|
|
206
302
|
copy->_h3MarginBottom = _h3MarginBottom;
|
|
207
303
|
copy->_h3LineHeight = _h3LineHeight;
|
|
304
|
+
copy->_h3TextAlign = _h3TextAlign;
|
|
208
305
|
copy->_h3FontNeedsRecreation = YES;
|
|
209
306
|
copy->_h4FontSize = _h4FontSize;
|
|
210
307
|
copy->_h4FontFamily = [_h4FontFamily copy];
|
|
211
308
|
copy->_h4FontWeight = [_h4FontWeight copy];
|
|
212
309
|
copy->_h4Color = [_h4Color copy];
|
|
310
|
+
copy->_h4MarginTop = _h4MarginTop;
|
|
213
311
|
copy->_h4MarginBottom = _h4MarginBottom;
|
|
214
312
|
copy->_h4LineHeight = _h4LineHeight;
|
|
313
|
+
copy->_h4TextAlign = _h4TextAlign;
|
|
215
314
|
copy->_h4FontNeedsRecreation = YES;
|
|
216
315
|
copy->_h5FontSize = _h5FontSize;
|
|
217
316
|
copy->_h5FontFamily = [_h5FontFamily copy];
|
|
218
317
|
copy->_h5FontWeight = [_h5FontWeight copy];
|
|
219
318
|
copy->_h5Color = [_h5Color copy];
|
|
319
|
+
copy->_h5MarginTop = _h5MarginTop;
|
|
220
320
|
copy->_h5MarginBottom = _h5MarginBottom;
|
|
221
321
|
copy->_h5LineHeight = _h5LineHeight;
|
|
322
|
+
copy->_h5TextAlign = _h5TextAlign;
|
|
222
323
|
copy->_h5FontNeedsRecreation = YES;
|
|
223
324
|
copy->_h6FontSize = _h6FontSize;
|
|
224
325
|
copy->_h6FontFamily = [_h6FontFamily copy];
|
|
225
326
|
copy->_h6FontWeight = [_h6FontWeight copy];
|
|
226
327
|
copy->_h6Color = [_h6Color copy];
|
|
328
|
+
copy->_h6MarginTop = _h6MarginTop;
|
|
227
329
|
copy->_h6MarginBottom = _h6MarginBottom;
|
|
228
330
|
copy->_h6LineHeight = _h6LineHeight;
|
|
331
|
+
copy->_h6TextAlign = _h6TextAlign;
|
|
229
332
|
copy->_h6FontNeedsRecreation = YES;
|
|
230
333
|
copy->_linkColor = [_linkColor copy];
|
|
231
334
|
copy->_linkUnderline = _linkUnderline;
|
|
232
335
|
copy->_strongColor = [_strongColor copy];
|
|
233
336
|
copy->_emphasisColor = [_emphasisColor copy];
|
|
337
|
+
copy->_strikethroughColor = [_strikethroughColor copy];
|
|
338
|
+
copy->_underlineColor = [_underlineColor copy];
|
|
234
339
|
copy->_codeColor = [_codeColor copy];
|
|
235
340
|
copy->_codeBackgroundColor = [_codeBackgroundColor copy];
|
|
236
341
|
copy->_codeBorderColor = [_codeBorderColor copy];
|
|
237
342
|
copy->_imageHeight = _imageHeight;
|
|
238
343
|
copy->_imageBorderRadius = _imageBorderRadius;
|
|
344
|
+
copy->_imageMarginTop = _imageMarginTop;
|
|
239
345
|
copy->_imageMarginBottom = _imageMarginBottom;
|
|
240
346
|
copy->_inlineImageSize = _inlineImageSize;
|
|
241
347
|
copy->_blockquoteFontSize = _blockquoteFontSize;
|
|
242
348
|
copy->_blockquoteFontFamily = [_blockquoteFontFamily copy];
|
|
243
349
|
copy->_blockquoteFontWeight = [_blockquoteFontWeight copy];
|
|
244
350
|
copy->_blockquoteColor = [_blockquoteColor copy];
|
|
351
|
+
copy->_blockquoteMarginTop = _blockquoteMarginTop;
|
|
245
352
|
copy->_blockquoteMarginBottom = _blockquoteMarginBottom;
|
|
246
353
|
copy->_blockquoteLineHeight = _blockquoteLineHeight;
|
|
247
354
|
copy->_blockquoteBorderColor = [_blockquoteBorderColor copy];
|
|
@@ -252,6 +359,7 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
252
359
|
copy->_listStyleFontFamily = [_listStyleFontFamily copy];
|
|
253
360
|
copy->_listStyleFontWeight = [_listStyleFontWeight copy];
|
|
254
361
|
copy->_listStyleColor = [_listStyleColor copy];
|
|
362
|
+
copy->_listStyleMarginTop = _listStyleMarginTop;
|
|
255
363
|
copy->_listStyleMarginBottom = _listStyleMarginBottom;
|
|
256
364
|
copy->_listStyleLineHeight = _listStyleLineHeight;
|
|
257
365
|
copy->_listStyleBulletColor = [_listStyleBulletColor copy];
|
|
@@ -265,6 +373,7 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
265
373
|
copy->_codeBlockFontFamily = [_codeBlockFontFamily copy];
|
|
266
374
|
copy->_codeBlockFontWeight = [_codeBlockFontWeight copy];
|
|
267
375
|
copy->_codeBlockColor = [_codeBlockColor copy];
|
|
376
|
+
copy->_codeBlockMarginTop = _codeBlockMarginTop;
|
|
268
377
|
copy->_codeBlockMarginBottom = _codeBlockMarginBottom;
|
|
269
378
|
copy->_codeBlockLineHeight = _codeBlockLineHeight;
|
|
270
379
|
copy->_codeBlockBackgroundColor = [_codeBlockBackgroundColor copy];
|
|
@@ -334,7 +443,7 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
334
443
|
weight:normalizedFontWeight(_primaryFontWeight)
|
|
335
444
|
style:nil
|
|
336
445
|
variant:nil
|
|
337
|
-
scaleMultiplier:
|
|
446
|
+
scaleMultiplier:[self effectiveScaleMultiplierForFontSize:[_primaryFontSize floatValue]]];
|
|
338
447
|
_primaryFontNeedsRecreation = NO;
|
|
339
448
|
}
|
|
340
449
|
return _primaryFont;
|
|
@@ -384,6 +493,16 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
384
493
|
_paragraphColor = newValue;
|
|
385
494
|
}
|
|
386
495
|
|
|
496
|
+
- (CGFloat)paragraphMarginTop
|
|
497
|
+
{
|
|
498
|
+
return _paragraphMarginTop;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
- (void)setParagraphMarginTop:(CGFloat)newValue
|
|
502
|
+
{
|
|
503
|
+
_paragraphMarginTop = newValue;
|
|
504
|
+
}
|
|
505
|
+
|
|
387
506
|
- (CGFloat)paragraphMarginBottom
|
|
388
507
|
{
|
|
389
508
|
return _paragraphMarginBottom;
|
|
@@ -396,6 +515,9 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
396
515
|
|
|
397
516
|
- (CGFloat)paragraphLineHeight
|
|
398
517
|
{
|
|
518
|
+
if (_allowFontScaling && _paragraphLineHeight > 0) {
|
|
519
|
+
return _paragraphLineHeight * RCTFontSizeMultiplierWithMax(_maxFontSizeMultiplier);
|
|
520
|
+
}
|
|
399
521
|
return _paragraphLineHeight;
|
|
400
522
|
}
|
|
401
523
|
|
|
@@ -404,6 +526,16 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
404
526
|
_paragraphLineHeight = newValue;
|
|
405
527
|
}
|
|
406
528
|
|
|
529
|
+
- (NSTextAlignment)paragraphTextAlign
|
|
530
|
+
{
|
|
531
|
+
return _paragraphTextAlign;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
- (void)setParagraphTextAlign:(NSTextAlignment)newValue
|
|
535
|
+
{
|
|
536
|
+
_paragraphTextAlign = newValue;
|
|
537
|
+
}
|
|
538
|
+
|
|
407
539
|
- (UIFont *)paragraphFont
|
|
408
540
|
{
|
|
409
541
|
if (_paragraphFontNeedsRecreation || !_paragraphFont) {
|
|
@@ -413,7 +545,7 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
413
545
|
weight:normalizedFontWeight(_paragraphFontWeight)
|
|
414
546
|
style:nil
|
|
415
547
|
variant:nil
|
|
416
|
-
scaleMultiplier:
|
|
548
|
+
scaleMultiplier:[self effectiveScaleMultiplierForFontSize:_paragraphFontSize]];
|
|
417
549
|
_paragraphFontNeedsRecreation = NO;
|
|
418
550
|
}
|
|
419
551
|
return _paragraphFont;
|
|
@@ -462,6 +594,16 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
462
594
|
_h1Color = newValue;
|
|
463
595
|
}
|
|
464
596
|
|
|
597
|
+
- (CGFloat)h1MarginTop
|
|
598
|
+
{
|
|
599
|
+
return _h1MarginTop;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
- (void)setH1MarginTop:(CGFloat)newValue
|
|
603
|
+
{
|
|
604
|
+
_h1MarginTop = newValue;
|
|
605
|
+
}
|
|
606
|
+
|
|
465
607
|
- (CGFloat)h1MarginBottom
|
|
466
608
|
{
|
|
467
609
|
return _h1MarginBottom;
|
|
@@ -474,6 +616,9 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
474
616
|
|
|
475
617
|
- (CGFloat)h1LineHeight
|
|
476
618
|
{
|
|
619
|
+
if (_allowFontScaling && _h1LineHeight > 0) {
|
|
620
|
+
return _h1LineHeight * RCTFontSizeMultiplierWithMax(_maxFontSizeMultiplier);
|
|
621
|
+
}
|
|
477
622
|
return _h1LineHeight;
|
|
478
623
|
}
|
|
479
624
|
|
|
@@ -482,6 +627,16 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
482
627
|
_h1LineHeight = newValue;
|
|
483
628
|
}
|
|
484
629
|
|
|
630
|
+
- (NSTextAlignment)h1TextAlign
|
|
631
|
+
{
|
|
632
|
+
return _h1TextAlign;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
- (void)setH1TextAlign:(NSTextAlignment)newValue
|
|
636
|
+
{
|
|
637
|
+
_h1TextAlign = newValue;
|
|
638
|
+
}
|
|
639
|
+
|
|
485
640
|
- (UIFont *)h1Font
|
|
486
641
|
{
|
|
487
642
|
if (_h1FontNeedsRecreation || !_h1Font) {
|
|
@@ -491,7 +646,7 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
491
646
|
weight:normalizedFontWeight(_h1FontWeight)
|
|
492
647
|
style:nil
|
|
493
648
|
variant:nil
|
|
494
|
-
scaleMultiplier:
|
|
649
|
+
scaleMultiplier:[self effectiveScaleMultiplierForFontSize:_h1FontSize]];
|
|
495
650
|
_h1FontNeedsRecreation = NO;
|
|
496
651
|
}
|
|
497
652
|
return _h1Font;
|
|
@@ -540,6 +695,16 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
540
695
|
_h2Color = newValue;
|
|
541
696
|
}
|
|
542
697
|
|
|
698
|
+
- (CGFloat)h2MarginTop
|
|
699
|
+
{
|
|
700
|
+
return _h2MarginTop;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
- (void)setH2MarginTop:(CGFloat)newValue
|
|
704
|
+
{
|
|
705
|
+
_h2MarginTop = newValue;
|
|
706
|
+
}
|
|
707
|
+
|
|
543
708
|
- (CGFloat)h2MarginBottom
|
|
544
709
|
{
|
|
545
710
|
return _h2MarginBottom;
|
|
@@ -552,6 +717,9 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
552
717
|
|
|
553
718
|
- (CGFloat)h2LineHeight
|
|
554
719
|
{
|
|
720
|
+
if (_allowFontScaling && _h2LineHeight > 0) {
|
|
721
|
+
return _h2LineHeight * RCTFontSizeMultiplierWithMax(_maxFontSizeMultiplier);
|
|
722
|
+
}
|
|
555
723
|
return _h2LineHeight;
|
|
556
724
|
}
|
|
557
725
|
|
|
@@ -560,6 +728,16 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
560
728
|
_h2LineHeight = newValue;
|
|
561
729
|
}
|
|
562
730
|
|
|
731
|
+
- (NSTextAlignment)h2TextAlign
|
|
732
|
+
{
|
|
733
|
+
return _h2TextAlign;
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
- (void)setH2TextAlign:(NSTextAlignment)newValue
|
|
737
|
+
{
|
|
738
|
+
_h2TextAlign = newValue;
|
|
739
|
+
}
|
|
740
|
+
|
|
563
741
|
- (UIFont *)h2Font
|
|
564
742
|
{
|
|
565
743
|
if (_h2FontNeedsRecreation || !_h2Font) {
|
|
@@ -569,7 +747,7 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
569
747
|
weight:normalizedFontWeight(_h2FontWeight)
|
|
570
748
|
style:nil
|
|
571
749
|
variant:nil
|
|
572
|
-
scaleMultiplier:
|
|
750
|
+
scaleMultiplier:[self effectiveScaleMultiplierForFontSize:_h2FontSize]];
|
|
573
751
|
_h2FontNeedsRecreation = NO;
|
|
574
752
|
}
|
|
575
753
|
return _h2Font;
|
|
@@ -618,6 +796,16 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
618
796
|
_h3Color = newValue;
|
|
619
797
|
}
|
|
620
798
|
|
|
799
|
+
- (CGFloat)h3MarginTop
|
|
800
|
+
{
|
|
801
|
+
return _h3MarginTop;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
- (void)setH3MarginTop:(CGFloat)newValue
|
|
805
|
+
{
|
|
806
|
+
_h3MarginTop = newValue;
|
|
807
|
+
}
|
|
808
|
+
|
|
621
809
|
- (CGFloat)h3MarginBottom
|
|
622
810
|
{
|
|
623
811
|
return _h3MarginBottom;
|
|
@@ -630,6 +818,9 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
630
818
|
|
|
631
819
|
- (CGFloat)h3LineHeight
|
|
632
820
|
{
|
|
821
|
+
if (_allowFontScaling && _h3LineHeight > 0) {
|
|
822
|
+
return _h3LineHeight * RCTFontSizeMultiplierWithMax(_maxFontSizeMultiplier);
|
|
823
|
+
}
|
|
633
824
|
return _h3LineHeight;
|
|
634
825
|
}
|
|
635
826
|
|
|
@@ -638,6 +829,16 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
638
829
|
_h3LineHeight = newValue;
|
|
639
830
|
}
|
|
640
831
|
|
|
832
|
+
- (NSTextAlignment)h3TextAlign
|
|
833
|
+
{
|
|
834
|
+
return _h3TextAlign;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
- (void)setH3TextAlign:(NSTextAlignment)newValue
|
|
838
|
+
{
|
|
839
|
+
_h3TextAlign = newValue;
|
|
840
|
+
}
|
|
841
|
+
|
|
641
842
|
- (UIFont *)h3Font
|
|
642
843
|
{
|
|
643
844
|
if (_h3FontNeedsRecreation || !_h3Font) {
|
|
@@ -647,7 +848,7 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
647
848
|
weight:normalizedFontWeight(_h3FontWeight)
|
|
648
849
|
style:nil
|
|
649
850
|
variant:nil
|
|
650
|
-
scaleMultiplier:
|
|
851
|
+
scaleMultiplier:[self effectiveScaleMultiplierForFontSize:_h3FontSize]];
|
|
651
852
|
_h3FontNeedsRecreation = NO;
|
|
652
853
|
}
|
|
653
854
|
return _h3Font;
|
|
@@ -696,6 +897,16 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
696
897
|
_h4Color = newValue;
|
|
697
898
|
}
|
|
698
899
|
|
|
900
|
+
- (CGFloat)h4MarginTop
|
|
901
|
+
{
|
|
902
|
+
return _h4MarginTop;
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
- (void)setH4MarginTop:(CGFloat)newValue
|
|
906
|
+
{
|
|
907
|
+
_h4MarginTop = newValue;
|
|
908
|
+
}
|
|
909
|
+
|
|
699
910
|
- (CGFloat)h4MarginBottom
|
|
700
911
|
{
|
|
701
912
|
return _h4MarginBottom;
|
|
@@ -708,6 +919,9 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
708
919
|
|
|
709
920
|
- (CGFloat)h4LineHeight
|
|
710
921
|
{
|
|
922
|
+
if (_allowFontScaling && _h4LineHeight > 0) {
|
|
923
|
+
return _h4LineHeight * RCTFontSizeMultiplierWithMax(_maxFontSizeMultiplier);
|
|
924
|
+
}
|
|
711
925
|
return _h4LineHeight;
|
|
712
926
|
}
|
|
713
927
|
|
|
@@ -716,6 +930,16 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
716
930
|
_h4LineHeight = newValue;
|
|
717
931
|
}
|
|
718
932
|
|
|
933
|
+
- (NSTextAlignment)h4TextAlign
|
|
934
|
+
{
|
|
935
|
+
return _h4TextAlign;
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
- (void)setH4TextAlign:(NSTextAlignment)newValue
|
|
939
|
+
{
|
|
940
|
+
_h4TextAlign = newValue;
|
|
941
|
+
}
|
|
942
|
+
|
|
719
943
|
- (UIFont *)h4Font
|
|
720
944
|
{
|
|
721
945
|
if (_h4FontNeedsRecreation || !_h4Font) {
|
|
@@ -725,7 +949,7 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
725
949
|
weight:normalizedFontWeight(_h4FontWeight)
|
|
726
950
|
style:nil
|
|
727
951
|
variant:nil
|
|
728
|
-
scaleMultiplier:
|
|
952
|
+
scaleMultiplier:[self effectiveScaleMultiplierForFontSize:_h4FontSize]];
|
|
729
953
|
_h4FontNeedsRecreation = NO;
|
|
730
954
|
}
|
|
731
955
|
return _h4Font;
|
|
@@ -774,6 +998,16 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
774
998
|
_h5Color = newValue;
|
|
775
999
|
}
|
|
776
1000
|
|
|
1001
|
+
- (CGFloat)h5MarginTop
|
|
1002
|
+
{
|
|
1003
|
+
return _h5MarginTop;
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
- (void)setH5MarginTop:(CGFloat)newValue
|
|
1007
|
+
{
|
|
1008
|
+
_h5MarginTop = newValue;
|
|
1009
|
+
}
|
|
1010
|
+
|
|
777
1011
|
- (CGFloat)h5MarginBottom
|
|
778
1012
|
{
|
|
779
1013
|
return _h5MarginBottom;
|
|
@@ -786,6 +1020,9 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
786
1020
|
|
|
787
1021
|
- (CGFloat)h5LineHeight
|
|
788
1022
|
{
|
|
1023
|
+
if (_allowFontScaling && _h5LineHeight > 0) {
|
|
1024
|
+
return _h5LineHeight * RCTFontSizeMultiplierWithMax(_maxFontSizeMultiplier);
|
|
1025
|
+
}
|
|
789
1026
|
return _h5LineHeight;
|
|
790
1027
|
}
|
|
791
1028
|
|
|
@@ -794,6 +1031,16 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
794
1031
|
_h5LineHeight = newValue;
|
|
795
1032
|
}
|
|
796
1033
|
|
|
1034
|
+
- (NSTextAlignment)h5TextAlign
|
|
1035
|
+
{
|
|
1036
|
+
return _h5TextAlign;
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
- (void)setH5TextAlign:(NSTextAlignment)newValue
|
|
1040
|
+
{
|
|
1041
|
+
_h5TextAlign = newValue;
|
|
1042
|
+
}
|
|
1043
|
+
|
|
797
1044
|
- (UIFont *)h5Font
|
|
798
1045
|
{
|
|
799
1046
|
if (_h5FontNeedsRecreation || !_h5Font) {
|
|
@@ -803,7 +1050,7 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
803
1050
|
weight:normalizedFontWeight(_h5FontWeight)
|
|
804
1051
|
style:nil
|
|
805
1052
|
variant:nil
|
|
806
|
-
scaleMultiplier:
|
|
1053
|
+
scaleMultiplier:[self effectiveScaleMultiplierForFontSize:_h5FontSize]];
|
|
807
1054
|
_h5FontNeedsRecreation = NO;
|
|
808
1055
|
}
|
|
809
1056
|
return _h5Font;
|
|
@@ -852,6 +1099,16 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
852
1099
|
_h6Color = newValue;
|
|
853
1100
|
}
|
|
854
1101
|
|
|
1102
|
+
- (CGFloat)h6MarginTop
|
|
1103
|
+
{
|
|
1104
|
+
return _h6MarginTop;
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
- (void)setH6MarginTop:(CGFloat)newValue
|
|
1108
|
+
{
|
|
1109
|
+
_h6MarginTop = newValue;
|
|
1110
|
+
}
|
|
1111
|
+
|
|
855
1112
|
- (CGFloat)h6MarginBottom
|
|
856
1113
|
{
|
|
857
1114
|
return _h6MarginBottom;
|
|
@@ -864,6 +1121,9 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
864
1121
|
|
|
865
1122
|
- (CGFloat)h6LineHeight
|
|
866
1123
|
{
|
|
1124
|
+
if (_allowFontScaling && _h6LineHeight > 0) {
|
|
1125
|
+
return _h6LineHeight * RCTFontSizeMultiplierWithMax(_maxFontSizeMultiplier);
|
|
1126
|
+
}
|
|
867
1127
|
return _h6LineHeight;
|
|
868
1128
|
}
|
|
869
1129
|
|
|
@@ -872,6 +1132,16 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
872
1132
|
_h6LineHeight = newValue;
|
|
873
1133
|
}
|
|
874
1134
|
|
|
1135
|
+
- (NSTextAlignment)h6TextAlign
|
|
1136
|
+
{
|
|
1137
|
+
return _h6TextAlign;
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
- (void)setH6TextAlign:(NSTextAlignment)newValue
|
|
1141
|
+
{
|
|
1142
|
+
_h6TextAlign = newValue;
|
|
1143
|
+
}
|
|
1144
|
+
|
|
875
1145
|
- (UIFont *)h6Font
|
|
876
1146
|
{
|
|
877
1147
|
if (_h6FontNeedsRecreation || !_h6Font) {
|
|
@@ -881,7 +1151,7 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
881
1151
|
weight:normalizedFontWeight(_h6FontWeight)
|
|
882
1152
|
style:nil
|
|
883
1153
|
variant:nil
|
|
884
|
-
scaleMultiplier:
|
|
1154
|
+
scaleMultiplier:[self effectiveScaleMultiplierForFontSize:_h6FontSize]];
|
|
885
1155
|
_h6FontNeedsRecreation = NO;
|
|
886
1156
|
}
|
|
887
1157
|
return _h6Font;
|
|
@@ -927,6 +1197,26 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
927
1197
|
_emphasisColor = newValue;
|
|
928
1198
|
}
|
|
929
1199
|
|
|
1200
|
+
- (UIColor *)strikethroughColor
|
|
1201
|
+
{
|
|
1202
|
+
return _strikethroughColor;
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
- (void)setStrikethroughColor:(UIColor *)newValue
|
|
1206
|
+
{
|
|
1207
|
+
_strikethroughColor = newValue;
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
- (UIColor *)underlineColor
|
|
1211
|
+
{
|
|
1212
|
+
return _underlineColor;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
- (void)setUnderlineColor:(UIColor *)newValue
|
|
1216
|
+
{
|
|
1217
|
+
_underlineColor = newValue;
|
|
1218
|
+
}
|
|
1219
|
+
|
|
930
1220
|
- (UIColor *)codeColor
|
|
931
1221
|
{
|
|
932
1222
|
return _codeColor;
|
|
@@ -977,6 +1267,16 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
977
1267
|
_imageBorderRadius = newValue;
|
|
978
1268
|
}
|
|
979
1269
|
|
|
1270
|
+
- (CGFloat)imageMarginTop
|
|
1271
|
+
{
|
|
1272
|
+
return _imageMarginTop;
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
- (void)setImageMarginTop:(CGFloat)newValue
|
|
1276
|
+
{
|
|
1277
|
+
_imageMarginTop = newValue;
|
|
1278
|
+
}
|
|
1279
|
+
|
|
980
1280
|
- (CGFloat)imageMarginBottom
|
|
981
1281
|
{
|
|
982
1282
|
return _imageMarginBottom;
|
|
@@ -1041,6 +1341,16 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
1041
1341
|
_blockquoteColor = newValue;
|
|
1042
1342
|
}
|
|
1043
1343
|
|
|
1344
|
+
- (CGFloat)blockquoteMarginTop
|
|
1345
|
+
{
|
|
1346
|
+
return _blockquoteMarginTop;
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
- (void)setBlockquoteMarginTop:(CGFloat)newValue
|
|
1350
|
+
{
|
|
1351
|
+
_blockquoteMarginTop = newValue;
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1044
1354
|
- (CGFloat)blockquoteMarginBottom
|
|
1045
1355
|
{
|
|
1046
1356
|
return _blockquoteMarginBottom;
|
|
@@ -1053,6 +1363,9 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
1053
1363
|
|
|
1054
1364
|
- (CGFloat)blockquoteLineHeight
|
|
1055
1365
|
{
|
|
1366
|
+
if (_allowFontScaling && _blockquoteLineHeight > 0) {
|
|
1367
|
+
return _blockquoteLineHeight * RCTFontSizeMultiplierWithMax(_maxFontSizeMultiplier);
|
|
1368
|
+
}
|
|
1056
1369
|
return _blockquoteLineHeight;
|
|
1057
1370
|
}
|
|
1058
1371
|
|
|
@@ -1070,7 +1383,7 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
1070
1383
|
weight:normalizedFontWeight(_blockquoteFontWeight)
|
|
1071
1384
|
style:nil
|
|
1072
1385
|
variant:nil
|
|
1073
|
-
scaleMultiplier:
|
|
1386
|
+
scaleMultiplier:[self effectiveScaleMultiplierForFontSize:_blockquoteFontSize]];
|
|
1074
1387
|
_blockquoteFontNeedsRecreation = NO;
|
|
1075
1388
|
}
|
|
1076
1389
|
return _blockquoteFont;
|
|
@@ -1162,6 +1475,16 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
1162
1475
|
_listStyleColor = newValue;
|
|
1163
1476
|
}
|
|
1164
1477
|
|
|
1478
|
+
- (CGFloat)listStyleMarginTop
|
|
1479
|
+
{
|
|
1480
|
+
return _listStyleMarginTop;
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
- (void)setListStyleMarginTop:(CGFloat)newValue
|
|
1484
|
+
{
|
|
1485
|
+
_listStyleMarginTop = newValue;
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1165
1488
|
- (CGFloat)listStyleMarginBottom
|
|
1166
1489
|
{
|
|
1167
1490
|
return _listStyleMarginBottom;
|
|
@@ -1174,6 +1497,9 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
1174
1497
|
|
|
1175
1498
|
- (CGFloat)listStyleLineHeight
|
|
1176
1499
|
{
|
|
1500
|
+
if (_allowFontScaling && _listStyleLineHeight > 0) {
|
|
1501
|
+
return _listStyleLineHeight * RCTFontSizeMultiplierWithMax(_maxFontSizeMultiplier);
|
|
1502
|
+
}
|
|
1177
1503
|
return _listStyleLineHeight;
|
|
1178
1504
|
}
|
|
1179
1505
|
|
|
@@ -1252,7 +1578,7 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
1252
1578
|
weight:normalizedFontWeight(_listStyleMarkerFontWeight)
|
|
1253
1579
|
style:nil
|
|
1254
1580
|
variant:nil
|
|
1255
|
-
scaleMultiplier:
|
|
1581
|
+
scaleMultiplier:[self effectiveScaleMultiplierForFontSize:_listStyleFontSize]];
|
|
1256
1582
|
_listMarkerFontNeedsRecreation = NO;
|
|
1257
1583
|
}
|
|
1258
1584
|
return _listMarkerFont;
|
|
@@ -1267,7 +1593,7 @@ static inline NSString *normalizedFontWeight(NSString *fontWeight)
|
|
|
1267
1593
|
weight:normalizedFontWeight(_listStyleFontWeight)
|
|
1268
1594
|
style:nil
|
|
1269
1595
|
variant:nil
|
|
1270
|
-
scaleMultiplier:
|
|
1596
|
+
scaleMultiplier:[self effectiveScaleMultiplierForFontSize:_listStyleFontSize]];
|
|
1271
1597
|
_listStyleFontNeedsRecreation = NO;
|
|
1272
1598
|
}
|
|
1273
1599
|
return _listStyleFont;
|
|
@@ -1338,6 +1664,16 @@ static const CGFloat kDefaultMinGap = 4.0;
|
|
|
1338
1664
|
_codeBlockColor = newValue;
|
|
1339
1665
|
}
|
|
1340
1666
|
|
|
1667
|
+
- (CGFloat)codeBlockMarginTop
|
|
1668
|
+
{
|
|
1669
|
+
return _codeBlockMarginTop;
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
- (void)setCodeBlockMarginTop:(CGFloat)newValue
|
|
1673
|
+
{
|
|
1674
|
+
_codeBlockMarginTop = newValue;
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1341
1677
|
- (CGFloat)codeBlockMarginBottom
|
|
1342
1678
|
{
|
|
1343
1679
|
return _codeBlockMarginBottom;
|
|
@@ -1350,6 +1686,9 @@ static const CGFloat kDefaultMinGap = 4.0;
|
|
|
1350
1686
|
|
|
1351
1687
|
- (CGFloat)codeBlockLineHeight
|
|
1352
1688
|
{
|
|
1689
|
+
if (_allowFontScaling && _codeBlockLineHeight > 0) {
|
|
1690
|
+
return _codeBlockLineHeight * RCTFontSizeMultiplierWithMax(_maxFontSizeMultiplier);
|
|
1691
|
+
}
|
|
1353
1692
|
return _codeBlockLineHeight;
|
|
1354
1693
|
}
|
|
1355
1694
|
|
|
@@ -1417,7 +1756,7 @@ static const CGFloat kDefaultMinGap = 4.0;
|
|
|
1417
1756
|
weight:normalizedFontWeight(_codeBlockFontWeight)
|
|
1418
1757
|
style:nil
|
|
1419
1758
|
variant:nil
|
|
1420
|
-
scaleMultiplier:
|
|
1759
|
+
scaleMultiplier:[self effectiveScaleMultiplierForFontSize:_codeBlockFontSize]];
|
|
1421
1760
|
_codeBlockFontNeedsRecreation = NO;
|
|
1422
1761
|
}
|
|
1423
1762
|
return _codeBlockFont;
|