@expensify/react-native-live-markdown 0.1.44 → 0.1.46
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/RNLiveMarkdown.podspec +13 -0
- package/android/build.gradle +12 -0
- package/android/proguard-rules.pro +1 -0
- package/android/src/main/java/com/expensify/livemarkdown/CustomFabricUIManager.java +47 -0
- package/android/src/main/java/com/expensify/livemarkdown/CustomMountingManager.java +248 -0
- package/android/src/main/java/com/expensify/livemarkdown/LiveMarkdownModule.java +27 -0
- package/android/src/main/java/com/expensify/livemarkdown/LiveMarkdownPackage.java +30 -3
- package/android/src/main/java/com/expensify/livemarkdown/MarkdownFontFamilySpan.java +7 -1
- package/android/src/main/java/com/expensify/livemarkdown/MarkdownFontSizeSpan.java +3 -1
- package/android/src/main/java/com/expensify/livemarkdown/MarkdownUtils.java +2 -6
- package/android/src/main/new_arch/CMakeLists.txt +82 -0
- package/android/src/main/new_arch/MarkdownCommitHook.cpp +173 -0
- package/android/src/main/new_arch/MarkdownCommitHook.h +52 -0
- package/android/src/main/new_arch/NativeProxy.cpp +38 -0
- package/android/src/main/new_arch/NativeProxy.h +37 -0
- package/android/src/main/new_arch/OnLoad.cpp +8 -0
- package/android/src/main/new_arch/RNLiveMarkdownSpec.cpp +44 -0
- package/android/src/main/new_arch/RNLiveMarkdownSpec.h +37 -0
- package/android/src/newarch/NativeProxy.java +24 -0
- package/android/src/oldarch/NativeLiveMarkdownModuleSpec.java +37 -0
- package/android/src/oldarch/NativeProxy.java +9 -0
- package/cpp/react/renderer/components/RNLiveMarkdownSpec/MarkdownShadowFamilyRegistry.cpp +58 -0
- package/cpp/react/renderer/components/RNLiveMarkdownSpec/MarkdownShadowFamilyRegistry.h +35 -0
- package/cpp/react/renderer/components/RNLiveMarkdownSpec/MarkdownTextInputDecoratorShadowNode.cpp +38 -0
- package/cpp/react/renderer/components/RNLiveMarkdownSpec/MarkdownTextInputDecoratorShadowNode.h +48 -0
- package/cpp/react/renderer/components/RNLiveMarkdownSpec/MarkdownTextInputDecoratorState.h +34 -0
- package/cpp/react/renderer/components/RNLiveMarkdownSpec/MarkdownTextInputDecoratorViewComponentDescriptor.h +17 -0
- package/ios/MarkdownCommitHook.h +42 -0
- package/ios/MarkdownCommitHook.mm +195 -0
- package/ios/MarkdownTextInputDecoratorComponentView.mm +24 -1
- package/ios/MarkdownTextInputDecoratorView.mm +5 -1
- package/ios/RCTBackedTextFieldDelegateAdapter+Markdown.m +1 -1
- package/ios/RCTBaseTextInputView+Markdown.m +2 -2
- package/ios/RCTLiveMarkdownModule.h +12 -0
- package/ios/RCTLiveMarkdownModule.mm +48 -0
- package/ios/RCTMarkdownUtils.h +1 -3
- package/ios/RCTMarkdownUtils.mm +129 -136
- package/ios/RCTTextInputComponentView+Markdown.mm +18 -4
- package/ios/RCTUITextView+Markdown.mm +1 -1
- package/lib/commonjs/MarkdownTextInput.js +4 -0
- package/lib/commonjs/MarkdownTextInput.js.map +1 -1
- package/lib/commonjs/MarkdownTextInputDecoratorViewNativeComponent.js +3 -1
- package/lib/commonjs/MarkdownTextInputDecoratorViewNativeComponent.js.map +1 -1
- package/lib/commonjs/NativeLiveMarkdownModule.js +9 -0
- package/lib/commonjs/NativeLiveMarkdownModule.js.map +1 -0
- package/lib/module/MarkdownTextInput.js +4 -0
- package/lib/module/MarkdownTextInput.js.map +1 -1
- package/lib/module/MarkdownTextInputDecoratorViewNativeComponent.js +3 -1
- package/lib/module/MarkdownTextInputDecoratorViewNativeComponent.js.map +1 -1
- package/lib/module/NativeLiveMarkdownModule.js +3 -0
- package/lib/module/NativeLiveMarkdownModule.js.map +1 -0
- package/lib/typescript/src/MarkdownTextInput.d.ts.map +1 -1
- package/lib/typescript/src/MarkdownTextInputDecoratorViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/NativeLiveMarkdownModule.d.ts +7 -0
- package/lib/typescript/src/NativeLiveMarkdownModule.d.ts.map +1 -0
- package/package.json +3 -2
- package/react-native.config.js +12 -0
- package/src/MarkdownTextInput.tsx +5 -0
- package/src/MarkdownTextInputDecoratorViewNativeComponent.ts +3 -1
- package/src/NativeLiveMarkdownModule.ts +8 -0
package/ios/RCTMarkdownUtils.mm
CHANGED
|
@@ -11,145 +11,138 @@
|
|
|
11
11
|
__weak RCTMarkdownStyle *_prevMarkdownStyle;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
- (
|
|
14
|
+
- (NSAttributedString *)parseMarkdown:(nullable NSAttributedString *)input withAttributes:(nullable NSDictionary<NSAttributedStringKey,id> *)attributes
|
|
15
15
|
{
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
16
|
+
@synchronized (self) {
|
|
17
|
+
if (input == nil) {
|
|
18
|
+
return nil;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
NSString *inputString = [input string];
|
|
22
|
+
if ([inputString isEqualToString:_prevInputString] && [attributes isEqualToDictionary:_prevTextAttributes] && [_markdownStyle isEqual:_prevMarkdownStyle]) {
|
|
23
|
+
return _prevAttributedString;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static JSContext *ctx = nil;
|
|
27
|
+
static JSValue *function = nil;
|
|
28
|
+
if (ctx == nil) {
|
|
29
|
+
NSString *path = [[NSBundle mainBundle] pathForResource:@"react-native-live-markdown-parser" ofType:@"js"];
|
|
30
|
+
assert(path != nil && "[react-native-live-markdown] Markdown parser bundle not found");
|
|
31
|
+
NSString *content = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:NULL];
|
|
32
|
+
assert(content != nil && "[react-native-live-markdown] Markdown parser bundle is empty");
|
|
33
|
+
ctx = [[JSContext alloc] init];
|
|
34
|
+
[ctx evaluateScript:content];
|
|
35
|
+
function = ctx[@"parseExpensiMarkToRanges"];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
JSValue *result = [function callWithArguments:@[inputString]];
|
|
39
|
+
NSArray *ranges = [result toArray];
|
|
40
|
+
|
|
41
|
+
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:inputString attributes:attributes];
|
|
42
|
+
[attributedString beginEditing];
|
|
43
|
+
|
|
44
|
+
// If the attributed string ends with underlined text, blurring the single-line input imprints the underline style across the whole string.
|
|
45
|
+
// It looks like a bug in iOS, as there is no underline style to be found in the attributed string, especially after formatting.
|
|
46
|
+
// This is a workaround that applies the NSUnderlineStyleNone to the string before iterating over ranges which resolves this problem.
|
|
47
|
+
[attributedString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleNone] range:NSMakeRange(0, attributedString.length)];
|
|
48
|
+
|
|
49
|
+
_blockquoteRangesAndLevels = [NSMutableArray new];
|
|
50
|
+
|
|
51
|
+
[ranges enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
52
|
+
NSDictionary *item = obj;
|
|
53
|
+
NSString *type = [item valueForKey:@"type"];
|
|
54
|
+
NSInteger location = [[item valueForKey:@"start"] unsignedIntegerValue];
|
|
55
|
+
NSInteger length = [[item valueForKey:@"length"] unsignedIntegerValue];
|
|
56
|
+
NSInteger depth = [[item valueForKey:@"depth"] unsignedIntegerValue] ?: 1;
|
|
57
|
+
NSRange range = NSMakeRange(location, length);
|
|
58
|
+
|
|
59
|
+
if ([type isEqualToString:@"bold"] || [type isEqualToString:@"italic"] || [type isEqualToString:@"code"] || [type isEqualToString:@"pre"] || [type isEqualToString:@"h1"] || [type isEqualToString:@"emoji"]) {
|
|
60
|
+
UIFont *font = [attributedString attribute:NSFontAttributeName atIndex:location effectiveRange:NULL];
|
|
61
|
+
if ([type isEqualToString:@"bold"]) {
|
|
62
|
+
font = [RCTFont updateFont:font withWeight:@"bold"];
|
|
63
|
+
} else if ([type isEqualToString:@"italic"]) {
|
|
64
|
+
font = [RCTFont updateFont:font withStyle:@"italic"];
|
|
65
|
+
} else if ([type isEqualToString:@"code"]) {
|
|
66
|
+
font = [RCTFont updateFont:font withFamily:_markdownStyle.codeFontFamily
|
|
67
|
+
size:[NSNumber numberWithFloat:_markdownStyle.codeFontSize]
|
|
68
|
+
weight:nil
|
|
69
|
+
style:nil
|
|
70
|
+
variant:nil
|
|
71
|
+
scaleMultiplier:0];
|
|
72
|
+
} else if ([type isEqualToString:@"pre"]) {
|
|
73
|
+
font = [RCTFont updateFont:font withFamily:_markdownStyle.preFontFamily
|
|
74
|
+
size:[NSNumber numberWithFloat:_markdownStyle.preFontSize]
|
|
75
|
+
weight:nil
|
|
76
|
+
style:nil
|
|
77
|
+
variant:nil
|
|
78
|
+
scaleMultiplier:0];
|
|
79
|
+
} else if ([type isEqualToString:@"h1"]) {
|
|
80
|
+
font = [RCTFont updateFont:font withFamily:nil
|
|
81
|
+
size:[NSNumber numberWithFloat:_markdownStyle.h1FontSize]
|
|
82
|
+
weight:@"bold"
|
|
83
|
+
style:nil
|
|
84
|
+
variant:nil
|
|
85
|
+
scaleMultiplier:0];
|
|
86
|
+
} else if ([type isEqualToString:@"emoji"]) {
|
|
87
|
+
font = [RCTFont updateFont:font withFamily:nil
|
|
88
|
+
size:[NSNumber numberWithFloat:_markdownStyle.emojiFontSize]
|
|
89
|
+
weight:nil
|
|
90
|
+
style:nil
|
|
91
|
+
variant:nil
|
|
92
|
+
scaleMultiplier:0];
|
|
93
|
+
}
|
|
94
|
+
[attributedString addAttribute:NSFontAttributeName value:font range:range];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if ([type isEqualToString:@"syntax"]) {
|
|
98
|
+
[attributedString addAttribute:NSForegroundColorAttributeName value:_markdownStyle.syntaxColor range:range];
|
|
99
|
+
} else if ([type isEqualToString:@"strikethrough"]) {
|
|
100
|
+
[attributedString addAttribute:NSStrikethroughStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:range];
|
|
101
|
+
} else if ([type isEqualToString:@"code"]) {
|
|
102
|
+
[attributedString addAttribute:NSForegroundColorAttributeName value:_markdownStyle.codeColor range:range];
|
|
103
|
+
[attributedString addAttribute:NSBackgroundColorAttributeName value:_markdownStyle.codeBackgroundColor range:range];
|
|
104
|
+
} else if ([type isEqualToString:@"mention-here"]) {
|
|
105
|
+
[attributedString addAttribute:NSForegroundColorAttributeName value:_markdownStyle.mentionHereColor range:range];
|
|
106
|
+
[attributedString addAttribute:NSBackgroundColorAttributeName value:_markdownStyle.mentionHereBackgroundColor range:range];
|
|
107
|
+
} else if ([type isEqualToString:@"mention-user"]) {
|
|
108
|
+
// TODO: change mention color when it mentions current user
|
|
109
|
+
[attributedString addAttribute:NSForegroundColorAttributeName value:_markdownStyle.mentionUserColor range:range];
|
|
110
|
+
[attributedString addAttribute:NSBackgroundColorAttributeName value:_markdownStyle.mentionUserBackgroundColor range:range];
|
|
111
|
+
} else if ([type isEqualToString:@"link"]) {
|
|
112
|
+
[attributedString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:range];
|
|
113
|
+
[attributedString addAttribute:NSForegroundColorAttributeName value:_markdownStyle.linkColor range:range];
|
|
114
|
+
} else if ([type isEqualToString:@"blockquote"]) {
|
|
115
|
+
CGFloat indent = (_markdownStyle.blockquoteMarginLeft + _markdownStyle.blockquoteBorderWidth + _markdownStyle.blockquotePaddingLeft) * depth;
|
|
116
|
+
NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new];
|
|
117
|
+
paragraphStyle.firstLineHeadIndent = indent;
|
|
118
|
+
paragraphStyle.headIndent = indent;
|
|
119
|
+
[attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:range];
|
|
120
|
+
[_blockquoteRangesAndLevels addObject:@{
|
|
121
|
+
@"range": [NSValue valueWithRange:range],
|
|
122
|
+
@"depth": @(depth)
|
|
123
|
+
}];
|
|
124
|
+
} else if ([type isEqualToString:@"pre"]) {
|
|
125
|
+
[attributedString addAttribute:NSForegroundColorAttributeName value:_markdownStyle.preColor range:range];
|
|
126
|
+
NSRange rangeForBackground = [inputString characterAtIndex:range.location] == '\n' ? NSMakeRange(range.location + 1, range.length - 1) : range;
|
|
127
|
+
[attributedString addAttribute:NSBackgroundColorAttributeName value:_markdownStyle.preBackgroundColor range:rangeForBackground];
|
|
128
|
+
// TODO: pass background color and ranges to layout manager
|
|
129
|
+
} else if ([type isEqualToString:@"h1"]) {
|
|
130
|
+
NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new];
|
|
131
|
+
NSRange rangeWithHashAndSpace = NSMakeRange(range.location - 2, range.length + 2); // we also need to include prepending "# "
|
|
132
|
+
[attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:rangeWithHashAndSpace];
|
|
133
|
+
}
|
|
134
|
+
}];
|
|
135
|
+
|
|
136
|
+
[attributedString endEditing];
|
|
137
|
+
|
|
138
|
+
_prevInputString = inputString;
|
|
139
|
+
_prevAttributedString = attributedString;
|
|
140
|
+
_prevTextAttributes = attributes;
|
|
141
|
+
_prevMarkdownStyle = _markdownStyle;
|
|
142
|
+
|
|
143
|
+
return attributedString;
|
|
105
144
|
|
|
106
|
-
if ([type isEqualToString:@"syntax"]) {
|
|
107
|
-
[attributedString addAttribute:NSForegroundColorAttributeName value:_markdownStyle.syntaxColor range:range];
|
|
108
|
-
} else if ([type isEqualToString:@"strikethrough"]) {
|
|
109
|
-
[attributedString addAttribute:NSStrikethroughStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:range];
|
|
110
|
-
} else if ([type isEqualToString:@"code"]) {
|
|
111
|
-
[attributedString addAttribute:NSForegroundColorAttributeName value:_markdownStyle.codeColor range:range];
|
|
112
|
-
[attributedString addAttribute:NSBackgroundColorAttributeName value:_markdownStyle.codeBackgroundColor range:range];
|
|
113
|
-
} else if ([type isEqualToString:@"mention-here"]) {
|
|
114
|
-
[attributedString addAttribute:NSForegroundColorAttributeName value:_markdownStyle.mentionHereColor range:range];
|
|
115
|
-
[attributedString addAttribute:NSBackgroundColorAttributeName value:_markdownStyle.mentionHereBackgroundColor range:range];
|
|
116
|
-
} else if ([type isEqualToString:@"mention-user"]) {
|
|
117
|
-
// TODO: change mention color when it mentions current user
|
|
118
|
-
[attributedString addAttribute:NSForegroundColorAttributeName value:_markdownStyle.mentionUserColor range:range];
|
|
119
|
-
[attributedString addAttribute:NSBackgroundColorAttributeName value:_markdownStyle.mentionUserBackgroundColor range:range];
|
|
120
|
-
} else if ([type isEqualToString:@"link"]) {
|
|
121
|
-
[attributedString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:range];
|
|
122
|
-
[attributedString addAttribute:NSForegroundColorAttributeName value:_markdownStyle.linkColor range:range];
|
|
123
|
-
} else if ([type isEqualToString:@"blockquote"]) {
|
|
124
|
-
CGFloat indent = (_markdownStyle.blockquoteMarginLeft + _markdownStyle.blockquoteBorderWidth + _markdownStyle.blockquotePaddingLeft) * depth;
|
|
125
|
-
NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new];
|
|
126
|
-
paragraphStyle.firstLineHeadIndent = indent;
|
|
127
|
-
paragraphStyle.headIndent = indent;
|
|
128
|
-
[attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:range];
|
|
129
|
-
[_blockquoteRangesAndLevels addObject:@{
|
|
130
|
-
@"range": [NSValue valueWithRange:range],
|
|
131
|
-
@"depth": @(depth)
|
|
132
|
-
}];
|
|
133
|
-
} else if ([type isEqualToString:@"pre"]) {
|
|
134
|
-
[attributedString addAttribute:NSForegroundColorAttributeName value:_markdownStyle.preColor range:range];
|
|
135
|
-
NSRange rangeForBackground = [inputString characterAtIndex:range.location] == '\n' ? NSMakeRange(range.location + 1, range.length - 1) : range;
|
|
136
|
-
[attributedString addAttribute:NSBackgroundColorAttributeName value:_markdownStyle.preBackgroundColor range:rangeForBackground];
|
|
137
|
-
// TODO: pass background color and ranges to layout manager
|
|
138
|
-
} else if ([type isEqualToString:@"h1"]) {
|
|
139
|
-
NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new];
|
|
140
|
-
NSRange rangeWithHashAndSpace = NSMakeRange(range.location - 2, range.length + 2); // we also need to include prepending "# "
|
|
141
|
-
[attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:rangeWithHashAndSpace];
|
|
142
145
|
}
|
|
143
|
-
}];
|
|
144
|
-
|
|
145
|
-
[attributedString endEditing];
|
|
146
|
-
|
|
147
|
-
_prevInputString = inputString;
|
|
148
|
-
_prevAttributedString = attributedString;
|
|
149
|
-
_prevTextAttributes = _backedTextInputView.defaultTextAttributes;
|
|
150
|
-
_prevMarkdownStyle = _markdownStyle;
|
|
151
|
-
|
|
152
|
-
return attributedString;
|
|
153
146
|
}
|
|
154
147
|
|
|
155
148
|
@end
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
#import <React/RCTUITextField.h>
|
|
7
7
|
#import <objc/message.h>
|
|
8
8
|
|
|
9
|
+
#import "MarkdownShadowFamilyRegistry.h"
|
|
10
|
+
|
|
9
11
|
@implementation RCTTextInputComponentView (Markdown)
|
|
10
12
|
|
|
11
13
|
- (void)setMarkdownUtils:(RCTMarkdownUtils *)markdownUtils {
|
|
@@ -13,8 +15,8 @@
|
|
|
13
15
|
|
|
14
16
|
if (markdownUtils != nil) {
|
|
15
17
|
// force Markdown formatting on first render because `_setAttributedText` is called before `setMarkdownUtils`
|
|
16
|
-
RCTUITextField *backedTextInputView = [self
|
|
17
|
-
backedTextInputView.attributedText = [markdownUtils parseMarkdown:backedTextInputView.attributedText];
|
|
18
|
+
RCTUITextField *backedTextInputView = [self getBackedTextInputView];
|
|
19
|
+
backedTextInputView.attributedText = [markdownUtils parseMarkdown:backedTextInputView.attributedText withAttributes:backedTextInputView.defaultTextAttributes];
|
|
18
20
|
}
|
|
19
21
|
}
|
|
20
22
|
|
|
@@ -22,11 +24,23 @@
|
|
|
22
24
|
return objc_getAssociatedObject(self, @selector(getMarkdownUtils));
|
|
23
25
|
}
|
|
24
26
|
|
|
27
|
+
- (RCTUITextField *)getBackedTextInputView {
|
|
28
|
+
RCTUITextField *backedTextInputView = [self valueForKey:@"_backedTextInputView"];
|
|
29
|
+
return backedTextInputView;
|
|
30
|
+
}
|
|
31
|
+
|
|
25
32
|
- (void)markdown__setAttributedString:(NSAttributedString *)attributedString
|
|
26
33
|
{
|
|
27
34
|
RCTMarkdownUtils *markdownUtils = [self getMarkdownUtils];
|
|
28
|
-
|
|
29
|
-
|
|
35
|
+
RCTUITextField *backedTextInputView = [self getBackedTextInputView];
|
|
36
|
+
if (markdownUtils != nil && backedTextInputView != nil) {
|
|
37
|
+
attributedString = [markdownUtils parseMarkdown:attributedString withAttributes:backedTextInputView.defaultTextAttributes];
|
|
38
|
+
} else {
|
|
39
|
+
// If markdownUtils is undefined, the text input hasn't been mounted yet. It will
|
|
40
|
+
// update its state with the unformatted attributed string, we want to prevent displaying
|
|
41
|
+
// this state by applying markdown in the commit hook where we can read markdown styles
|
|
42
|
+
// from decorator props.
|
|
43
|
+
MarkdownShadowFamilyRegistry::forceNextStateUpdate((facebook::react::Tag)self.tag);
|
|
30
44
|
}
|
|
31
45
|
|
|
32
46
|
// Call the original method
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
RCTMarkdownUtils *markdownUtils = [self getMarkdownUtils];
|
|
18
18
|
if (markdownUtils != nil) {
|
|
19
19
|
UITextRange *range = self.selectedTextRange;
|
|
20
|
-
super.attributedText = [markdownUtils parseMarkdown:self.attributedText];
|
|
20
|
+
super.attributedText = [markdownUtils parseMarkdown:self.attributedText withAttributes:self.defaultTextAttributes];
|
|
21
21
|
[super setSelectedTextRange:range]; // prevents cursor from jumping at the end when typing in the middle of the text
|
|
22
22
|
self.typingAttributes = self.defaultTextAttributes; // removes indent in new line when typing after blockquote
|
|
23
23
|
}
|
|
@@ -7,11 +7,15 @@ exports.default = void 0;
|
|
|
7
7
|
var _reactNative = require("react-native");
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _MarkdownTextInputDecoratorViewNativeComponent = _interopRequireDefault(require("./MarkdownTextInputDecoratorViewNativeComponent"));
|
|
10
|
+
var _NativeLiveMarkdownModule = _interopRequireDefault(require("./NativeLiveMarkdownModule"));
|
|
10
11
|
var StyleUtils = _interopRequireWildcard(require("./styleUtils"));
|
|
11
12
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
13
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
15
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
16
|
+
if (_NativeLiveMarkdownModule.default) {
|
|
17
|
+
_NativeLiveMarkdownModule.default.install();
|
|
18
|
+
}
|
|
15
19
|
function processColorsInMarkdownStyle(input) {
|
|
16
20
|
const output = JSON.parse(JSON.stringify(input));
|
|
17
21
|
Object.keys(output).forEach(key => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_react","_interopRequireDefault","_MarkdownTextInputDecoratorViewNativeComponent","StyleUtils","_interopRequireWildcard","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","obj","_extends","assign","bind","target","arguments","length","source","key","apply","processColorsInMarkdownStyle","input","output","JSON","parse","stringify","keys","forEach","prop","endsWith","processColor","processMarkdownStyle","mergeMarkdownStyleWithDefault","MarkdownTextInput","React","forwardRef","props","ref","IS_FABRIC","global","markdownStyle","useMemo","createElement","Fragment","TextInput","style","styles","farAway","displayNone","StyleSheet","create","display","position","top","left","_default","exports"],"sourceRoot":"../../src","sources":["MarkdownTextInput.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,8CAAA,GAAAD,sBAAA,CAAAF,OAAA;
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_react","_interopRequireDefault","_MarkdownTextInputDecoratorViewNativeComponent","_NativeLiveMarkdownModule","StyleUtils","_interopRequireWildcard","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","obj","_extends","assign","bind","target","arguments","length","source","key","apply","NativeLiveMarkdownModule","install","processColorsInMarkdownStyle","input","output","JSON","parse","stringify","keys","forEach","prop","endsWith","processColor","processMarkdownStyle","mergeMarkdownStyleWithDefault","MarkdownTextInput","React","forwardRef","props","ref","IS_FABRIC","global","markdownStyle","useMemo","createElement","Fragment","TextInput","style","styles","farAway","displayNone","StyleSheet","create","display","position","top","left","_default","exports"],"sourceRoot":"../../src","sources":["MarkdownTextInput.tsx"],"mappings":"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"}
|
|
@@ -6,5 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _codegenNativeComponent = _interopRequireDefault(require("react-native/Libraries/Utilities/codegenNativeComponent"));
|
|
8
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
-
var _default = exports.default = (0, _codegenNativeComponent.default)('MarkdownTextInputDecoratorView'
|
|
9
|
+
var _default = exports.default = (0, _codegenNativeComponent.default)('MarkdownTextInputDecoratorView', {
|
|
10
|
+
interfaceOnly: true
|
|
11
|
+
});
|
|
10
12
|
//# sourceMappingURL=MarkdownTextInputDecoratorViewNativeComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_codegenNativeComponent","_interopRequireDefault","require","obj","__esModule","default","_default","exports","codegenNativeComponent"],"sourceRoot":"../../src","sources":["MarkdownTextInputDecoratorViewNativeComponent.ts"],"mappings":";;;;;;AAGA,IAAAA,uBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA6F,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GA+C9E,IAAAG,+BAAsB,EAAc,gCAAgC,CAAC"}
|
|
1
|
+
{"version":3,"names":["_codegenNativeComponent","_interopRequireDefault","require","obj","__esModule","default","_default","exports","codegenNativeComponent","interfaceOnly"],"sourceRoot":"../../src","sources":["MarkdownTextInputDecoratorViewNativeComponent.ts"],"mappings":";;;;;;AAGA,IAAAA,uBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA6F,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GA+C9E,IAAAG,+BAAsB,EAAc,gCAAgC,EAAE;EACnFC,aAAa,EAAE;AACjB,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _default = exports.default = _reactNative.TurboModuleRegistry.get('LiveMarkdownModule');
|
|
9
|
+
//# sourceMappingURL=NativeLiveMarkdownModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","get"],"sourceRoot":"../../src","sources":["NativeLiveMarkdownModule.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAiD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAMlCC,gCAAmB,CAACC,GAAG,CAAO,oBAAoB,CAAC"}
|
|
@@ -2,7 +2,11 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
2
2
|
import { StyleSheet, TextInput, processColor } from 'react-native';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import MarkdownTextInputDecoratorViewNativeComponent from './MarkdownTextInputDecoratorViewNativeComponent';
|
|
5
|
+
import NativeLiveMarkdownModule from './NativeLiveMarkdownModule';
|
|
5
6
|
import * as StyleUtils from './styleUtils';
|
|
7
|
+
if (NativeLiveMarkdownModule) {
|
|
8
|
+
NativeLiveMarkdownModule.install();
|
|
9
|
+
}
|
|
6
10
|
function processColorsInMarkdownStyle(input) {
|
|
7
11
|
const output = JSON.parse(JSON.stringify(input));
|
|
8
12
|
Object.keys(output).forEach(key => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["StyleSheet","TextInput","processColor","React","MarkdownTextInputDecoratorViewNativeComponent","StyleUtils","processColorsInMarkdownStyle","input","output","JSON","parse","stringify","Object","keys","forEach","key","obj","prop","endsWith","processMarkdownStyle","mergeMarkdownStyleWithDefault","MarkdownTextInput","forwardRef","props","ref","IS_FABRIC","global","markdownStyle","useMemo","createElement","Fragment","_extends","style","styles","farAway","displayNone","create","display","position","top","left"],"sourceRoot":"../../src","sources":["MarkdownTextInput.tsx"],"mappings":";AAAA,SAAQA,UAAU,EAAEC,SAAS,EAAEC,YAAY,QAAO,cAAc;AAChE,OAAOC,KAAK,MAAM,OAAO;AAEzB,OAAOC,6CAA6C,MAAM,iDAAiD;
|
|
1
|
+
{"version":3,"names":["StyleSheet","TextInput","processColor","React","MarkdownTextInputDecoratorViewNativeComponent","NativeLiveMarkdownModule","StyleUtils","install","processColorsInMarkdownStyle","input","output","JSON","parse","stringify","Object","keys","forEach","key","obj","prop","endsWith","processMarkdownStyle","mergeMarkdownStyleWithDefault","MarkdownTextInput","forwardRef","props","ref","IS_FABRIC","global","markdownStyle","useMemo","createElement","Fragment","_extends","style","styles","farAway","displayNone","create","display","position","top","left"],"sourceRoot":"../../src","sources":["MarkdownTextInput.tsx"],"mappings":";AAAA,SAAQA,UAAU,EAAEC,SAAS,EAAEC,YAAY,QAAO,cAAc;AAChE,OAAOC,KAAK,MAAM,OAAO;AAEzB,OAAOC,6CAA6C,MAAM,iDAAiD;AAC3G,OAAOC,wBAAwB,MAAM,4BAA4B;AAEjE,OAAO,KAAKC,UAAU,MAAM,cAAc;AAG1C,IAAID,wBAAwB,EAAE;EAC5BA,wBAAwB,CAACE,OAAO,CAAC,CAAC;AACpC;AASA,SAASC,4BAA4BA,CAACC,KAAoB,EAAiB;EACzE,MAAMC,MAAM,GAAGC,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,SAAS,CAACJ,KAAK,CAAC,CAAC;EAEhDK,MAAM,CAACC,IAAI,CAACL,MAAM,CAAC,CAACM,OAAO,CAAEC,GAAG,IAAK;IACnC,MAAMC,GAAG,GAAGR,MAAM,CAACO,GAAG,CAAC;IACvBH,MAAM,CAACC,IAAI,CAACG,GAAG,CAAC,CAACF,OAAO,CAAEG,IAAI,IAAK;MACjC;MACA,IAAI,EAAEA,IAAI,KAAK,OAAO,IAAIA,IAAI,CAACC,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE;QACjD;MACF;MACAF,GAAG,CAACC,IAAI,CAAC,GAAGjB,YAAY,CAACgB,GAAG,CAACC,IAAI,CAAC,CAAC;IACrC,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,OAAOT,MAAM;AACf;AAEA,SAASW,oBAAoBA,CAACZ,KAAuC,EAAiB;EACpF,OAAOD,4BAA4B,CAACF,UAAU,CAACgB,6BAA6B,CAACb,KAAK,CAAC,CAAC;AACtF;AAEA,MAAMc,iBAAiB,gBAAGpB,KAAK,CAACqB,UAAU,CAAoC,CAACC,KAAK,EAAEC,GAAG,KAAK;EAC5F,MAAMC,SAAS,IAAG,uBAAuB,IAAIC,MAAM;EAEnD,MAAMC,aAAa,GAAG1B,KAAK,CAAC2B,OAAO,CAAC,MAAMT,oBAAoB,CAACI,KAAK,CAACI,aAAa,CAAC,EAAE,CAACJ,KAAK,CAACI,aAAa,CAAC,CAAC;EAE3G,oBACE1B,KAAA,CAAA4B,aAAA,CAAA5B,KAAA,CAAA6B,QAAA,qBACE7B,KAAA,CAAA4B,aAAA,CAAC9B,SAAS,EAAAgC,QAAA,KACJR,KAAK;IACTC,GAAG,EAAEA;EAAI,EACV,CAAC,eACFvB,KAAA,CAAA4B,aAAA,CAAC3B,6CAA6C;IAC5C8B,KAAK,EAAEP,SAAS,GAAGQ,MAAM,CAACC,OAAO,GAAGD,MAAM,CAACE,WAAY;IACvDR,aAAa,EAAEA;EAAc,CAC9B,CACD,CAAC;AAEP,CAAC,CAAC;AAEF,MAAMM,MAAM,GAAGnC,UAAU,CAACsC,MAAM,CAAC;EAC/BD,WAAW,EAAE;IACXE,OAAO,EAAE;EACX,CAAC;EACDH,OAAO,EAAE;IACPI,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAE,GAAG;IACRC,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAIF,eAAenB,iBAAiB"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
2
|
-
export default codegenNativeComponent('MarkdownTextInputDecoratorView'
|
|
2
|
+
export default codegenNativeComponent('MarkdownTextInputDecoratorView', {
|
|
3
|
+
interfaceOnly: true
|
|
4
|
+
});
|
|
3
5
|
//# sourceMappingURL=MarkdownTextInputDecoratorViewNativeComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["codegenNativeComponent"],"sourceRoot":"../../src","sources":["MarkdownTextInputDecoratorViewNativeComponent.ts"],"mappings":"AAGA,OAAOA,sBAAsB,MAAM,yDAAyD;AA+C5F,eAAeA,sBAAsB,CAAc,gCAAgC,CAAC"}
|
|
1
|
+
{"version":3,"names":["codegenNativeComponent","interfaceOnly"],"sourceRoot":"../../src","sources":["MarkdownTextInputDecoratorViewNativeComponent.ts"],"mappings":"AAGA,OAAOA,sBAAsB,MAAM,yDAAyD;AA+C5F,eAAeA,sBAAsB,CAAc,gCAAgC,EAAE;EACnFC,aAAa,EAAE;AACjB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","get"],"sourceRoot":"../../src","sources":["NativeLiveMarkdownModule.ts"],"mappings":"AACA,SAAQA,mBAAmB,QAAO,cAAc;AAMhD,eAAeA,mBAAmB,CAACC,GAAG,CAAO,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownTextInput.d.ts","sourceRoot":"","sources":["../../../src/MarkdownTextInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,SAAS,EAAe,MAAM,cAAc,CAAC;AACjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"MarkdownTextInput.d.ts","sourceRoot":"","sources":["../../../src/MarkdownTextInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,SAAS,EAAe,MAAM,cAAc,CAAC;AACjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,cAAc,CAAC;AAKjD,OAAO,KAAK,KAAK,eAAe,MAAM,cAAc,CAAC;AAMrD,KAAK,oBAAoB,GAAG,eAAe,CAAC,oBAAoB,CAAC;AAGjE,UAAU,sBAAuB,SAAQ,cAAc;IACrD,aAAa,CAAC,EAAE,oBAAoB,CAAC;CACtC;AAuBD,QAAA,MAAM,iBAAiB,0FAiBrB,CAAC;AAaH,YAAY,EAAC,oBAAoB,IAAI,aAAa,EAAE,sBAAsB,EAAC,CAAC;AAE5E,eAAe,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownTextInputDecoratorViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/MarkdownTextInputDecoratorViewNativeComponent.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AAExD,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,2CAA2C,CAAC;AAGrE,UAAU,aAAa;IACrB,MAAM,EAAE;QACN,KAAK,EAAE,UAAU,CAAC;KACnB,CAAC;IACF,KAAK,EAAE;QACL,QAAQ,EAAE,KAAK,CAAC;KACjB,CAAC;IACF,IAAI,EAAE;QACJ,KAAK,EAAE,UAAU,CAAC;KACnB,CAAC;IACF,EAAE,EAAE;QACF,QAAQ,EAAE,KAAK,CAAC;KACjB,CAAC;IACF,UAAU,EAAE;QACV,WAAW,EAAE,UAAU,CAAC;QACxB,WAAW,EAAE,KAAK,CAAC;QACnB,UAAU,EAAE,KAAK,CAAC;QAClB,WAAW,EAAE,KAAK,CAAC;KACpB,CAAC;IACF,IAAI,EAAE;QACJ,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,KAAK,CAAC;QAChB,KAAK,EAAE,UAAU,CAAC;QAClB,eAAe,EAAE,UAAU,CAAC;KAC7B,CAAC;IACF,GAAG,EAAE;QACH,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,KAAK,CAAC;QAChB,KAAK,EAAE,UAAU,CAAC;QAClB,eAAe,EAAE,UAAU,CAAC;KAC7B,CAAC;IACF,WAAW,EAAE;QACX,KAAK,EAAE,UAAU,CAAC;QAClB,eAAe,EAAE,UAAU,CAAC;KAC7B,CAAC;IACF,WAAW,EAAE;QACX,KAAK,EAAE,UAAU,CAAC;QAClB,eAAe,EAAE,UAAU,CAAC;KAC7B,CAAC;CACH;AAED,UAAU,WAAY,SAAQ,SAAS;IACrC,aAAa,EAAE,aAAa,CAAC;CAC9B;;AAED,
|
|
1
|
+
{"version":3,"file":"MarkdownTextInputDecoratorViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/MarkdownTextInputDecoratorViewNativeComponent.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AAExD,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,2CAA2C,CAAC;AAGrE,UAAU,aAAa;IACrB,MAAM,EAAE;QACN,KAAK,EAAE,UAAU,CAAC;KACnB,CAAC;IACF,KAAK,EAAE;QACL,QAAQ,EAAE,KAAK,CAAC;KACjB,CAAC;IACF,IAAI,EAAE;QACJ,KAAK,EAAE,UAAU,CAAC;KACnB,CAAC;IACF,EAAE,EAAE;QACF,QAAQ,EAAE,KAAK,CAAC;KACjB,CAAC;IACF,UAAU,EAAE;QACV,WAAW,EAAE,UAAU,CAAC;QACxB,WAAW,EAAE,KAAK,CAAC;QACnB,UAAU,EAAE,KAAK,CAAC;QAClB,WAAW,EAAE,KAAK,CAAC;KACpB,CAAC;IACF,IAAI,EAAE;QACJ,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,KAAK,CAAC;QAChB,KAAK,EAAE,UAAU,CAAC;QAClB,eAAe,EAAE,UAAU,CAAC;KAC7B,CAAC;IACF,GAAG,EAAE;QACH,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,KAAK,CAAC;QAChB,KAAK,EAAE,UAAU,CAAC;QAClB,eAAe,EAAE,UAAU,CAAC;KAC7B,CAAC;IACF,WAAW,EAAE;QACX,KAAK,EAAE,UAAU,CAAC;QAClB,eAAe,EAAE,UAAU,CAAC;KAC7B,CAAC;IACF,WAAW,EAAE;QACX,KAAK,EAAE,UAAU,CAAC;QAClB,eAAe,EAAE,UAAU,CAAC;KAC7B,CAAC;CACH;AAED,UAAU,WAAY,SAAQ,SAAS;IACrC,aAAa,EAAE,aAAa,CAAC;CAC9B;;AAED,wBAEG;AAEH,YAAY,EAAC,aAAa,EAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeLiveMarkdownModule.d.ts","sourceRoot":"","sources":["../../../src/NativeLiveMarkdownModule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,cAAc,CAAC;AAG9C,UAAU,IAAK,SAAQ,WAAW;IAChC,OAAO,EAAE,MAAM,OAAO,CAAC;CACxB;;AAED,wBAAmE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expensify/react-native-live-markdown",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.46",
|
|
4
4
|
"description": "Drop-in replacement for React Native's TextInput component with Markdown formatting.",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"ios",
|
|
16
16
|
"cpp",
|
|
17
17
|
"*.podspec",
|
|
18
|
+
"react-native.config.js",
|
|
18
19
|
"!ios/build",
|
|
19
20
|
"!android/build",
|
|
20
21
|
"!android/gradle",
|
|
@@ -156,7 +157,7 @@
|
|
|
156
157
|
},
|
|
157
158
|
"codegenConfig": {
|
|
158
159
|
"name": "RNLiveMarkdownSpec",
|
|
159
|
-
"type": "
|
|
160
|
+
"type": "all",
|
|
160
161
|
"jsSrcsDir": "src"
|
|
161
162
|
}
|
|
162
163
|
}
|
|
@@ -2,10 +2,15 @@ import {StyleSheet, TextInput, processColor} from 'react-native';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import type {TextInputProps} from 'react-native';
|
|
4
4
|
import MarkdownTextInputDecoratorViewNativeComponent from './MarkdownTextInputDecoratorViewNativeComponent';
|
|
5
|
+
import NativeLiveMarkdownModule from './NativeLiveMarkdownModule';
|
|
5
6
|
import type * as MarkdownTextInputDecoratorViewNativeComponentTypes from './MarkdownTextInputDecoratorViewNativeComponent';
|
|
6
7
|
import * as StyleUtils from './styleUtils';
|
|
7
8
|
import type * as StyleUtilsTypes from './styleUtils';
|
|
8
9
|
|
|
10
|
+
if (NativeLiveMarkdownModule) {
|
|
11
|
+
NativeLiveMarkdownModule.install();
|
|
12
|
+
}
|
|
13
|
+
|
|
9
14
|
type PartialMarkdownStyle = StyleUtilsTypes.PartialMarkdownStyle;
|
|
10
15
|
type MarkdownStyle = MarkdownTextInputDecoratorViewNativeComponentTypes.MarkdownStyle;
|
|
11
16
|
|
|
@@ -48,6 +48,8 @@ interface NativeProps extends ViewProps {
|
|
|
48
48
|
markdownStyle: MarkdownStyle;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
export default codegenNativeComponent<NativeProps>('MarkdownTextInputDecoratorView'
|
|
51
|
+
export default codegenNativeComponent<NativeProps>('MarkdownTextInputDecoratorView', {
|
|
52
|
+
interfaceOnly: true,
|
|
53
|
+
});
|
|
52
54
|
|
|
53
55
|
export type {MarkdownStyle};
|