@expensify/react-native-live-markdown 0.1.243 → 0.1.245
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 +2 -2
- package/RNLiveMarkdown.podspec +4 -6
- package/android/build.gradle +5 -26
- package/android/src/main/java/com/expensify/livemarkdown/CustomFabricUIManager.java +0 -2
- package/android/src/main/java/com/expensify/livemarkdown/LiveMarkdownModule.java +3 -5
- package/android/src/reactNativeVersionPatch/CustomMountingManager/latest/com/expensify/livemarkdown/CustomMountingManager.java +0 -1
- package/apple/LiveMarkdownModule.h +2 -10
- package/apple/LiveMarkdownModule.mm +0 -14
- package/apple/MarkdownCommitHook.h +0 -3
- package/apple/MarkdownCommitHook.mm +0 -4
- package/apple/MarkdownTextInputDecoratorComponentView.h +0 -4
- package/apple/MarkdownTextInputDecoratorComponentView.mm +0 -3
- package/apple/MarkdownTextInputDecoratorView.mm +0 -29
- package/apple/MarkdownTextInputDecoratorViewManager.mm +0 -9
- package/apple/RCTMarkdownStyle.h +0 -6
- package/apple/RCTMarkdownStyle.mm +0 -49
- package/apple/RCTTextInputComponentView+Markdown.h +0 -5
- package/apple/RCTTextInputComponentView+Markdown.mm +0 -5
- package/lib/commonjs/MarkdownTextInput.js +1 -5
- package/lib/commonjs/MarkdownTextInput.js.map +1 -1
- package/lib/module/MarkdownTextInput.js +1 -5
- package/lib/module/MarkdownTextInput.js.map +1 -1
- package/lib/typescript/src/MarkdownTextInput.d.ts.map +1 -1
- package/package.json +5 -2
- package/src/MarkdownTextInput.tsx +1 -6
- package/android/src/oldarch/LiveMarkdownModuleSpec.java +0 -12
- package/android/src/oldarch/MarkdownTextInputDecoratorViewManagerSpec.java +0 -11
- package/android/src/oldarch/NativeLiveMarkdownModuleSpec.java +0 -37
- package/android/src/oldarch/NativeProxy.java +0 -9
- package/apple/RCTBaseTextInputView+Markdown.h +0 -18
- package/apple/RCTBaseTextInputView+Markdown.mm +0 -101
- /package/android/src/{newarch → main/java/com/expensify/livemarkdown}/LiveMarkdownModuleSpec.java +0 -0
- /package/android/src/{newarch → main/java/com/expensify/livemarkdown}/MarkdownTextInputDecoratorViewManagerSpec.java +0 -0
- /package/android/src/{newarch → main/java/com/expensify/livemarkdown}/NativeProxy.java +0 -0
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
- 🔧 Customizable logic
|
|
9
9
|
- 🎨 Customizable styles
|
|
10
10
|
- 🌐 Universal support (Android, iOS, web)
|
|
11
|
-
- 🏗️ Supports New Architecture
|
|
11
|
+
- 🏗️ Supports only the New Architecture
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
@@ -179,7 +179,7 @@ Currently, `react-native-live-markdown` supports only [ExpensiMark](https://gith
|
|
|
179
179
|
|
|
180
180
|
## Compatibility
|
|
181
181
|
|
|
182
|
-
`react-native-live-markdown` supports two latest React Native minor releases.
|
|
182
|
+
`react-native-live-markdown` supports two latest React Native minor releases with the New Architecture enabled.
|
|
183
183
|
|
|
184
184
|
| react-native | @expensify/react-native-live-markdown |
|
|
185
185
|
| :----------: | :-----------------------------------: |
|
package/RNLiveMarkdown.podspec
CHANGED
|
@@ -36,7 +36,7 @@ Pod::Spec.new do |s|
|
|
|
36
36
|
|
|
37
37
|
install_modules_dependencies(s)
|
|
38
38
|
|
|
39
|
-
if ENV['USE_FRAMEWORKS'] != nil
|
|
39
|
+
if ENV['USE_FRAMEWORKS'] != nil
|
|
40
40
|
add_dependency(s, "React-FabricComponents", :additional_framework_paths => [
|
|
41
41
|
"react/renderer/textlayoutmanager/platform/ios",
|
|
42
42
|
"react/renderer/components/textinput/platform/ios",
|
|
@@ -44,10 +44,8 @@ Pod::Spec.new do |s|
|
|
|
44
44
|
add_dependency(s, "React-rendererconsistency")
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
ss.header_dir = "RNLiveMarkdown"
|
|
51
|
-
end
|
|
47
|
+
s.subspec "newarch" do |ss|
|
|
48
|
+
ss.source_files = "cpp/**/*.{cpp,h}"
|
|
49
|
+
ss.header_dir = "RNLiveMarkdown"
|
|
52
50
|
end
|
|
53
51
|
end
|
package/android/build.gradle
CHANGED
|
@@ -18,15 +18,8 @@ def reactNativeArchitectures() {
|
|
|
18
18
|
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
def isNewArchitectureEnabled() {
|
|
22
|
-
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
23
|
-
}
|
|
24
|
-
|
|
25
21
|
apply plugin: "com.android.library"
|
|
26
|
-
|
|
27
|
-
if (isNewArchitectureEnabled()) {
|
|
28
|
-
apply plugin: "com.facebook.react"
|
|
29
|
-
}
|
|
22
|
+
apply plugin: "com.facebook.react"
|
|
30
23
|
|
|
31
24
|
def getExtOrDefault(name) {
|
|
32
25
|
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["LiveMarkdown_" + name]
|
|
@@ -93,7 +86,6 @@ android {
|
|
|
93
86
|
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
94
87
|
|
|
95
88
|
buildConfigField "int", "REACT_NATIVE_MINOR_VERSION", REACT_NATIVE_MINOR_VERSION.toString()
|
|
96
|
-
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
97
89
|
|
|
98
90
|
consumerProguardFiles "proguard-rules.pro"
|
|
99
91
|
|
|
@@ -129,15 +121,10 @@ android {
|
|
|
129
121
|
|
|
130
122
|
sourceSets {
|
|
131
123
|
main {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
"${project.buildDir}/generated/source/codegen/java"
|
|
137
|
-
]
|
|
138
|
-
} else {
|
|
139
|
-
java.srcDirs += ["src/oldarch"]
|
|
140
|
-
}
|
|
124
|
+
java.srcDirs += [
|
|
125
|
+
// This is needed to build Kotlin project with NewArch enabled
|
|
126
|
+
"${project.buildDir}/generated/source/codegen/java"
|
|
127
|
+
]
|
|
141
128
|
|
|
142
129
|
// TextLayoutManager
|
|
143
130
|
if (REACT_NATIVE_MINOR_VERSION <= 76 ) {
|
|
@@ -190,14 +177,6 @@ dependencies {
|
|
|
190
177
|
implementation project(":react-native-reanimated")
|
|
191
178
|
}
|
|
192
179
|
|
|
193
|
-
if (isNewArchitectureEnabled()) {
|
|
194
|
-
react {
|
|
195
|
-
jsRootDir = file("../src/")
|
|
196
|
-
libraryName = "LiveMarkdown"
|
|
197
|
-
codegenJavaPackageName = "com.expensify.livemarkdown"
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
180
|
// This fixes linking errors due to undefined symbols from libworklets.so.
|
|
202
181
|
// During Gradle Sync, Android Gradle Plugin runs Prefab and treats worklets
|
|
203
182
|
// like a header-only library. During build, config files are not regenerated
|
|
@@ -22,11 +22,9 @@ public class LiveMarkdownModule extends NativeLiveMarkdownModuleSpec {
|
|
|
22
22
|
|
|
23
23
|
@Override
|
|
24
24
|
public boolean install() {
|
|
25
|
-
|
|
26
|
-
FabricUIManager
|
|
27
|
-
|
|
28
|
-
mNativeProxy.createCommitHook(uiManager);
|
|
29
|
-
}
|
|
25
|
+
FabricUIManager uiManager =
|
|
26
|
+
(FabricUIManager) UIManagerHelper.getUIManager(getReactApplicationContext(), UIManagerType.FABRIC);
|
|
27
|
+
mNativeProxy.createCommitHook(uiManager);
|
|
30
28
|
|
|
31
29
|
long jsiRuntime = Objects.requireNonNull(getReactApplicationContext().getJavaScriptContextHolder(), "[react-native-live-markdown] JavaScriptContextHolder is null").get();
|
|
32
30
|
injectJSIBindings(jsiRuntime);
|
|
@@ -3,7 +3,6 @@ package com.expensify.livemarkdown;
|
|
|
3
3
|
import static com.facebook.react.views.text.TextAttributeProps.UNSET;
|
|
4
4
|
|
|
5
5
|
import android.content.Context;
|
|
6
|
-
import android.content.res.AssetManager;
|
|
7
6
|
import android.text.BoringLayout;
|
|
8
7
|
import android.text.Layout;
|
|
9
8
|
import android.text.Spannable;
|
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
2
1
|
#import <RNLiveMarkdownSpec/RNLiveMarkdownSpec.h>
|
|
3
|
-
#else
|
|
4
|
-
#import <React/RCTBridgeModule.h>
|
|
5
|
-
#endif // RCT_NEW_ARCH_ENABLED
|
|
6
2
|
|
|
7
3
|
#import <React/RCTEventEmitter.h>
|
|
8
4
|
|
|
9
5
|
// Without inheriting after RCTEventEmitter we don't get access to bridge
|
|
10
|
-
@interface LiveMarkdownModule : RCTEventEmitter
|
|
11
|
-
|
|
12
|
-
<NativeLiveMarkdownModuleSpec>
|
|
13
|
-
#else
|
|
14
|
-
<RCTBridgeModule>
|
|
15
|
-
#endif // RCT_NEW_ARCH_ENABLED
|
|
6
|
+
@interface LiveMarkdownModule : RCTEventEmitter <NativeLiveMarkdownModuleSpec>
|
|
7
|
+
|
|
16
8
|
@end
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
#import "LiveMarkdownModule.h"
|
|
2
2
|
|
|
3
3
|
#import <RNLiveMarkdown/RuntimeDecorator.h>
|
|
4
|
-
|
|
5
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
6
4
|
#import <RNLiveMarkdown/MarkdownCommitHook.h>
|
|
7
|
-
#endif // RCT_NEW_ARCH_ENABLED
|
|
8
5
|
|
|
9
6
|
#import <React/RCTBridge+Private.h>
|
|
10
|
-
|
|
11
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
12
7
|
#import <React/RCTScheduler.h>
|
|
13
8
|
#import <React/RCTSurfacePresenter.h>
|
|
14
|
-
#endif // RCT_NEW_ARCH_ENABLED
|
|
15
9
|
|
|
16
10
|
#import <jsi/jsi.h>
|
|
17
11
|
|
|
@@ -23,10 +17,8 @@ using namespace expensify::livemarkdown;
|
|
|
23
17
|
// actually register the hook
|
|
24
18
|
|
|
25
19
|
@implementation LiveMarkdownModule {
|
|
26
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
27
20
|
std::shared_ptr<MarkdownCommitHook> commitHook_;
|
|
28
21
|
__weak RCTSurfacePresenter *surfacePresenter_;
|
|
29
|
-
#endif // RCT_NEW_ARCH_ENABLED
|
|
30
22
|
}
|
|
31
23
|
|
|
32
24
|
RCT_EXPORT_MODULE()
|
|
@@ -37,16 +29,12 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install)
|
|
|
37
29
|
jsi::Runtime &rt = *(jsi::Runtime *)cxxBridge.runtime;
|
|
38
30
|
expensify::livemarkdown::injectJSIBindings(rt);
|
|
39
31
|
|
|
40
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
41
32
|
RCTScheduler *scheduler = [surfacePresenter_ scheduler];
|
|
42
33
|
commitHook_ = std::make_shared<MarkdownCommitHook>(scheduler.uiManager);
|
|
43
|
-
#endif // RCT_NEW_ARCH_ENABLED
|
|
44
34
|
|
|
45
35
|
return @(1);
|
|
46
36
|
}
|
|
47
37
|
|
|
48
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
49
|
-
|
|
50
38
|
- (void)handleJavaScriptDidLoadNotification:(NSNotification *)notification
|
|
51
39
|
{
|
|
52
40
|
surfacePresenter_ = self.bridge.surfacePresenter;
|
|
@@ -89,6 +77,4 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install)
|
|
|
89
77
|
[super invalidate];
|
|
90
78
|
}
|
|
91
79
|
|
|
92
|
-
#endif // RCT_NEW_ARCH_ENABLED
|
|
93
|
-
|
|
94
80
|
@end
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#pragma once
|
|
2
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
3
2
|
|
|
4
3
|
#include <react/renderer/components/iostextinput/TextInputShadowNode.h>
|
|
5
4
|
#include <react/renderer/uimanager/UIManager.h>
|
|
@@ -45,5 +44,3 @@ private:
|
|
|
45
44
|
|
|
46
45
|
} // namespace livemarkdown
|
|
47
46
|
} // namespace expensify
|
|
48
|
-
|
|
49
|
-
#endif // RCT_NEW_ARCH_ENABLED
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
2
|
-
|
|
3
1
|
#include <React/RCTUtils.h>
|
|
4
2
|
#include <react/renderer/core/ComponentDescriptor.h>
|
|
5
3
|
#include <react/renderer/textlayoutmanager/RCTAttributedTextUtils.h>
|
|
@@ -303,5 +301,3 @@ RootShadowNode::Unshared MarkdownCommitHook::shadowTreeWillCommit(
|
|
|
303
301
|
|
|
304
302
|
} // namespace livemarkdown
|
|
305
303
|
} // namespace expensify
|
|
306
|
-
|
|
307
|
-
#endif // RCT_NEW_ARCH_ENABLED
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// This guard prevent this file to be compiled in the old architecture.
|
|
2
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
3
1
|
#import <React/RCTViewComponentView.h>
|
|
4
2
|
|
|
5
3
|
NS_ASSUME_NONNULL_BEGIN
|
|
@@ -8,5 +6,3 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
8
6
|
@end
|
|
9
7
|
|
|
10
8
|
NS_ASSUME_NONNULL_END
|
|
11
|
-
|
|
12
|
-
#endif /* RCT_NEW_ARCH_ENABLED */
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// This guard prevent this file to be compiled in the old architecture.
|
|
2
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
3
1
|
#import <react/renderer/components/RNLiveMarkdownSpec/Props.h>
|
|
4
2
|
|
|
5
3
|
#import <RNLiveMarkdown/MarkdownTextInputDecoratorComponentView.h>
|
|
@@ -85,4 +83,3 @@ Class<RCTComponentViewProtocol> MarkdownTextInputDecoratorViewCls(void)
|
|
|
85
83
|
}
|
|
86
84
|
|
|
87
85
|
@end
|
|
88
|
-
#endif
|
|
@@ -6,11 +6,7 @@
|
|
|
6
6
|
#import <RNLiveMarkdown/RCTBackedTextFieldDelegateAdapter+Markdown.h>
|
|
7
7
|
#import <RNLiveMarkdown/RCTUITextView+Markdown.h>
|
|
8
8
|
|
|
9
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
10
9
|
#import <RNLiveMarkdown/RCTTextInputComponentView+Markdown.h>
|
|
11
|
-
#else
|
|
12
|
-
#import <RNLiveMarkdown/RCTBaseTextInputView+Markdown.h>
|
|
13
|
-
#endif /* RCT_NEW_ARCH_ENABLED */
|
|
14
10
|
|
|
15
11
|
#import <objc/runtime.h>
|
|
16
12
|
|
|
@@ -18,47 +14,26 @@
|
|
|
18
14
|
RCTMarkdownUtils *_markdownUtils;
|
|
19
15
|
RCTMarkdownStyle *_markdownStyle;
|
|
20
16
|
NSNumber *_parserId;
|
|
21
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
22
17
|
__weak RCTTextInputComponentView *_textInput;
|
|
23
|
-
#else
|
|
24
|
-
__weak RCTBaseTextInputView *_textInput;
|
|
25
|
-
#endif /* RCT_NEW_ARCH_ENABLED */
|
|
26
18
|
__weak UIView<RCTBackedTextInputViewProtocol> *_backedTextInputView;
|
|
27
19
|
__weak RCTBackedTextFieldDelegateAdapter *_adapter;
|
|
28
20
|
__weak RCTUITextView *_textView;
|
|
29
21
|
}
|
|
30
22
|
|
|
31
23
|
- (void)didMoveToWindow {
|
|
32
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
33
24
|
if (self.superview.superview == nil) {
|
|
34
25
|
return;
|
|
35
26
|
}
|
|
36
|
-
#else
|
|
37
|
-
if (self.superview == nil) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
#endif /* RCT_NEW_ARCH_ENABLED */
|
|
41
27
|
|
|
42
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
43
28
|
NSArray *viewsArray = self.superview.superview.subviews;
|
|
44
29
|
NSUInteger currentIndex = [viewsArray indexOfObject:self.superview];
|
|
45
|
-
#else
|
|
46
|
-
NSArray *viewsArray = self.superview.subviews;
|
|
47
|
-
NSUInteger currentIndex = [viewsArray indexOfObject:self];
|
|
48
|
-
#endif /* RCT_NEW_ARCH_ENABLED */
|
|
49
30
|
|
|
50
31
|
react_native_assert(currentIndex != 0 && currentIndex != NSNotFound && "Error while finding current component.");
|
|
51
32
|
UIView *view = [viewsArray objectAtIndex:currentIndex - 1];
|
|
52
33
|
|
|
53
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
54
34
|
react_native_assert([view isKindOfClass:[RCTTextInputComponentView class]] && "Previous sibling component is not an instance of RCTTextInputComponentView.");
|
|
55
35
|
_textInput = (RCTTextInputComponentView *)view;
|
|
56
36
|
_backedTextInputView = [_textInput valueForKey:@"_backedTextInputView"];
|
|
57
|
-
#else
|
|
58
|
-
react_native_assert([view isKindOfClass:[RCTBaseTextInputView class]] && "Previous sibling component is not an instance of RCTBaseTextInputView.");
|
|
59
|
-
_textInput = (RCTBaseTextInputView *)view;
|
|
60
|
-
_backedTextInputView = _textInput.backedTextInputView;
|
|
61
|
-
#endif /* RCT_NEW_ARCH_ENABLED */
|
|
62
37
|
|
|
63
38
|
_markdownUtils = [[RCTMarkdownUtils alloc] init];
|
|
64
39
|
react_native_assert(_markdownStyle != nil);
|
|
@@ -128,11 +103,7 @@
|
|
|
128
103
|
[_textView textDidChange];
|
|
129
104
|
} else {
|
|
130
105
|
// apply new styles
|
|
131
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
132
106
|
[_textInput _setAttributedString:_backedTextInputView.attributedText];
|
|
133
|
-
#else
|
|
134
|
-
[_textInput setAttributedText:_textInput.attributedText];
|
|
135
|
-
#endif /* RCT_NEW_ARCH_ENABLED */
|
|
136
107
|
}
|
|
137
108
|
}
|
|
138
109
|
|
|
@@ -12,21 +12,12 @@ RCT_EXPORT_MODULE(MarkdownTextInputDecoratorView)
|
|
|
12
12
|
|
|
13
13
|
RCT_CUSTOM_VIEW_PROPERTY(markdownStyle, NSDictionary, MarkdownTextInputDecoratorView)
|
|
14
14
|
{
|
|
15
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
16
15
|
// implemented in MarkdownTextInputDecoratorView updateProps:
|
|
17
|
-
#else
|
|
18
|
-
RCTMarkdownStyle *markdownStyle = [[RCTMarkdownStyle alloc] initWithDictionary:json];
|
|
19
|
-
[view setMarkdownStyle:markdownStyle];
|
|
20
|
-
#endif /* RCT_NEW_ARCH_ENABLED */
|
|
21
16
|
}
|
|
22
17
|
|
|
23
18
|
RCT_CUSTOM_VIEW_PROPERTY(parserId, NSNumber, MarkdownTextInputDecoratorView)
|
|
24
19
|
{
|
|
25
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
26
20
|
// implemented in MarkdownTextInputDecoratorView updateProps:
|
|
27
|
-
#else
|
|
28
|
-
[view setParserId:json];
|
|
29
|
-
#endif /* RCT_NEW_ARCH_ENABLED */
|
|
30
21
|
}
|
|
31
22
|
|
|
32
23
|
@end
|
package/apple/RCTMarkdownStyle.h
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
#import <UIKit/UIKit.h>
|
|
2
2
|
|
|
3
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
4
3
|
#import <react/renderer/components/RNLiveMarkdownSpec/Props.h>
|
|
5
|
-
#endif /* RCT_NEW_ARCH_ENABLED */
|
|
6
4
|
|
|
7
5
|
NS_ASSUME_NONNULL_BEGIN
|
|
8
6
|
|
|
@@ -31,11 +29,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
31
29
|
@property (nonatomic) UIColor *mentionReportColor;
|
|
32
30
|
@property (nonatomic) UIColor *mentionReportBackgroundColor;
|
|
33
31
|
|
|
34
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
35
32
|
- (instancetype)initWithStruct:(const facebook::react::MarkdownTextInputDecoratorViewMarkdownStyleStruct &)style;
|
|
36
|
-
#else
|
|
37
|
-
- (instancetype)initWithDictionary:(NSDictionary *)json;
|
|
38
|
-
#endif /* RCT_NEW_ARCH_ENABLED */
|
|
39
33
|
|
|
40
34
|
@end
|
|
41
35
|
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
#import <RNLiveMarkdown/RCTMarkdownStyle.h>
|
|
2
2
|
|
|
3
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
4
3
|
#import <React/RCTConversions.h>
|
|
5
|
-
#else
|
|
6
|
-
#import <React/RCTConvert.h>
|
|
7
|
-
#endif /* RCT_NEW_ARCH_ENABLED */
|
|
8
4
|
|
|
9
5
|
@implementation RCTMarkdownStyle
|
|
10
6
|
|
|
11
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
12
|
-
|
|
13
7
|
- (instancetype)initWithStruct:(const facebook::react::MarkdownTextInputDecoratorViewMarkdownStyleStruct &)style
|
|
14
8
|
{
|
|
15
9
|
if (self = [super init]) {
|
|
@@ -49,47 +43,4 @@
|
|
|
49
43
|
return self;
|
|
50
44
|
}
|
|
51
45
|
|
|
52
|
-
#else
|
|
53
|
-
|
|
54
|
-
- (instancetype)initWithDictionary:(NSDictionary *)json
|
|
55
|
-
{
|
|
56
|
-
if (self = [super init]) {
|
|
57
|
-
_syntaxColor = [RCTConvert UIColor:json[@"syntax"][@"color"]];
|
|
58
|
-
|
|
59
|
-
_linkColor = [RCTConvert UIColor:json[@"link"][@"color"]];
|
|
60
|
-
|
|
61
|
-
_h1FontSize = [RCTConvert CGFloat:json[@"h1"][@"fontSize"]];
|
|
62
|
-
|
|
63
|
-
_emojiFontSize = [RCTConvert CGFloat:json[@"emoji"][@"fontSize"]];
|
|
64
|
-
|
|
65
|
-
_blockquoteBorderColor = [RCTConvert UIColor:json[@"blockquote"][@"borderColor"]];
|
|
66
|
-
_blockquoteBorderWidth = [RCTConvert CGFloat:json[@"blockquote"][@"borderWidth"]];
|
|
67
|
-
_blockquoteMarginLeft = [RCTConvert CGFloat:json[@"blockquote"][@"marginLeft"]];
|
|
68
|
-
_blockquotePaddingLeft = [RCTConvert CGFloat:json[@"blockquote"][@"paddingLeft"]];
|
|
69
|
-
|
|
70
|
-
_codeFontFamily = [RCTConvert NSString:json[@"code"][@"fontFamily"]];
|
|
71
|
-
_codeFontSize = [RCTConvert CGFloat:json[@"code"][@"fontSize"]];
|
|
72
|
-
_codeColor = [RCTConvert UIColor:json[@"code"][@"color"]];
|
|
73
|
-
_codeBackgroundColor = [RCTConvert UIColor:json[@"code"][@"backgroundColor"]];
|
|
74
|
-
|
|
75
|
-
_preFontFamily = [RCTConvert NSString:json[@"pre"][@"fontFamily"]];
|
|
76
|
-
_preFontSize = [RCTConvert CGFloat:json[@"pre"][@"fontSize"]];
|
|
77
|
-
_preColor = [RCTConvert UIColor:json[@"pre"][@"color"]];
|
|
78
|
-
_preBackgroundColor = [RCTConvert UIColor:json[@"pre"][@"backgroundColor"]];
|
|
79
|
-
|
|
80
|
-
_mentionHereColor = [RCTConvert UIColor:json[@"mentionHere"][@"color"]];
|
|
81
|
-
_mentionHereBackgroundColor = [RCTConvert UIColor:json[@"mentionHere"][@"backgroundColor"]];
|
|
82
|
-
|
|
83
|
-
_mentionUserColor = [RCTConvert UIColor:json[@"mentionUser"][@"color"]];
|
|
84
|
-
_mentionUserBackgroundColor = [RCTConvert UIColor:json[@"mentionUser"][@"backgroundColor"]];
|
|
85
|
-
|
|
86
|
-
_mentionReportColor = [RCTConvert UIColor:json[@"mentionReport"][@"color"]];
|
|
87
|
-
_mentionReportBackgroundColor = [RCTConvert UIColor:json[@"mentionReport"][@"backgroundColor"]];
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return self;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
#endif /* RCT_NEW_ARCH_ENABLED */
|
|
94
|
-
|
|
95
46
|
@end
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
// This guard prevent this file to be compiled in the old architecture.
|
|
2
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
3
|
-
|
|
4
1
|
#import <React/RCTTextInputComponentView.h>
|
|
5
2
|
#import <RNLiveMarkdown/RCTMarkdownUtils.h>
|
|
6
3
|
|
|
@@ -19,5 +16,3 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
19
16
|
@end
|
|
20
17
|
|
|
21
18
|
NS_ASSUME_NONNULL_END
|
|
22
|
-
|
|
23
|
-
#endif /* RCT_NEW_ARCH_ENABLED */
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
// This guard prevent this file to be compiled in the old architecture.
|
|
2
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
3
|
-
|
|
4
1
|
#import <RNLiveMarkdown/RCTTextInputComponentView+Markdown.h>
|
|
5
2
|
#import <RNLiveMarkdown/RCTMarkdownUtils.h>
|
|
6
3
|
#import <React/RCTUITextField.h>
|
|
@@ -93,5 +90,3 @@ using namespace expensify::livemarkdown;
|
|
|
93
90
|
}
|
|
94
91
|
|
|
95
92
|
@end
|
|
96
|
-
|
|
97
|
-
#endif /* RCT_NEW_ARCH_ENABLED */
|
|
@@ -62,7 +62,6 @@ function processMarkdownStyle(input) {
|
|
|
62
62
|
return processColorsInMarkdownStyle((0, _styleUtils.mergeMarkdownStyleWithDefault)(input));
|
|
63
63
|
}
|
|
64
64
|
const MarkdownTextInput = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
65
|
-
const IS_FABRIC = 'nativeFabricUIManager' in global;
|
|
66
65
|
const markdownStyle = _react.default.useMemo(() => processMarkdownStyle(props.markdownStyle), [props.markdownStyle]);
|
|
67
66
|
if (props.parser === undefined) {
|
|
68
67
|
throw new Error('[react-native-live-markdown] `parser` is undefined');
|
|
@@ -82,15 +81,12 @@ const MarkdownTextInput = /*#__PURE__*/_react.default.forwardRef((props, ref) =>
|
|
|
82
81
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactNative.TextInput, _extends({}, props, {
|
|
83
82
|
ref: ref
|
|
84
83
|
})), /*#__PURE__*/_react.default.createElement(_MarkdownTextInputDecoratorViewNativeComponent.default, {
|
|
85
|
-
style:
|
|
84
|
+
style: styles.farAway,
|
|
86
85
|
markdownStyle: markdownStyle,
|
|
87
86
|
parserId: parserId
|
|
88
87
|
}));
|
|
89
88
|
});
|
|
90
89
|
const styles = _reactNative.StyleSheet.create({
|
|
91
|
-
displayNone: {
|
|
92
|
-
display: 'none'
|
|
93
|
-
},
|
|
94
90
|
farAway: {
|
|
95
91
|
position: 'absolute',
|
|
96
92
|
top: 1e8,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_react","_interopRequireDefault","_reactNativeReanimated","_MarkdownTextInputDecoratorViewNativeComponent","_NativeLiveMarkdownModule","_styleUtils","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","initialized","workletRuntime","getWorkletRuntime","undefined","Error","initializeLiveMarkdownIfNeeded","NativeLiveMarkdownModule","install","global","jsi_setMarkdownRuntime","createWorkletRuntime","registerParser","parser","shareableWorklet","makeShareableCloneRecursive","parserId","jsi_registerMarkdownWorklet","unregisterParser","jsi_unregisterMarkdownWorklet","processColorsInMarkdownStyle","input","output","JSON","parse","stringify","keys","forEach","key","obj","prop","endsWith","processColor","processMarkdownStyle","mergeMarkdownStyleWithDefault","MarkdownTextInput","React","forwardRef","props","ref","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_react","_interopRequireDefault","_reactNativeReanimated","_MarkdownTextInputDecoratorViewNativeComponent","_NativeLiveMarkdownModule","_styleUtils","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","initialized","workletRuntime","getWorkletRuntime","undefined","Error","initializeLiveMarkdownIfNeeded","NativeLiveMarkdownModule","install","global","jsi_setMarkdownRuntime","createWorkletRuntime","registerParser","parser","shareableWorklet","makeShareableCloneRecursive","parserId","jsi_registerMarkdownWorklet","unregisterParser","jsi_unregisterMarkdownWorklet","processColorsInMarkdownStyle","input","output","JSON","parse","stringify","keys","forEach","key","obj","prop","endsWith","processColor","processMarkdownStyle","mergeMarkdownStyleWithDefault","MarkdownTextInput","React","forwardRef","props","ref","markdownStyle","useMemo","workletHash","__workletHash","useEffect","createElement","Fragment","TextInput","style","styles","farAway","StyleSheet","create","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,sBAAA,GAAAH,OAAA;AAIA,IAAAI,8CAAA,GAAAF,sBAAA,CAAAF,OAAA;AAEA,IAAAK,yBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AAA2D,SAAAE,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,SAAA,WAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,CAAA,aAAAP,CAAA,MAAAA,CAAA,GAAAQ,SAAA,CAAAC,MAAA,EAAAT,CAAA,UAAAU,CAAA,GAAAF,SAAA,CAAAR,CAAA,YAAAW,CAAA,IAAAD,CAAA,OAAAE,cAAA,CAAAC,IAAA,CAAAH,CAAA,EAAAC,CAAA,MAAAJ,CAAA,CAAAI,CAAA,IAAAD,CAAA,CAAAC,CAAA,aAAAJ,CAAA,KAAAJ,QAAA,CAAAW,KAAA,OAAAN,SAAA;AAa3D,IAAIO,WAAW,GAAG,KAAK;AACvB,IAAIC,cAA0C;AAE9C,SAASC,iBAAiBA,CAAA,EAAmB;EAC3C,IAAID,cAAc,KAAKE,SAAS,EAAE;IAChC,MAAM,IAAIC,KAAK,CACb,qNACF,CAAC;EACH;EACA,OAAOH,cAAc;AACvB;AA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D,aAAA,CAAC9D,8CAAA,CAAAK,OAA6C;IAC5C4D,KAAK,EAAEC,MAAM,CAACC,OAAQ;IACtBV,aAAa,EAAEA,aAAc;IAC7BxB,QAAQ,EAAEA;EAAS,CACpB,CACD,CAAC;AAEP,CAAC,CAAC;AAEF,MAAMiC,MAAM,GAAGE,uBAAU,CAACC,MAAM,CAAC;EAC/BF,OAAO,EAAE;IACPG,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAE,GAAG;IACRC,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAArE,OAAA,GAIY+C,iBAAiB","ignoreList":[]}
|
|
@@ -54,7 +54,6 @@ function processMarkdownStyle(input) {
|
|
|
54
54
|
return processColorsInMarkdownStyle(mergeMarkdownStyleWithDefault(input));
|
|
55
55
|
}
|
|
56
56
|
const MarkdownTextInput = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
57
|
-
const IS_FABRIC = 'nativeFabricUIManager' in global;
|
|
58
57
|
const markdownStyle = React.useMemo(() => processMarkdownStyle(props.markdownStyle), [props.markdownStyle]);
|
|
59
58
|
if (props.parser === undefined) {
|
|
60
59
|
throw new Error('[react-native-live-markdown] `parser` is undefined');
|
|
@@ -74,15 +73,12 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
74
73
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TextInput, _extends({}, props, {
|
|
75
74
|
ref: ref
|
|
76
75
|
})), /*#__PURE__*/React.createElement(MarkdownTextInputDecoratorViewNativeComponent, {
|
|
77
|
-
style:
|
|
76
|
+
style: styles.farAway,
|
|
78
77
|
markdownStyle: markdownStyle,
|
|
79
78
|
parserId: parserId
|
|
80
79
|
}));
|
|
81
80
|
});
|
|
82
81
|
const styles = StyleSheet.create({
|
|
83
|
-
displayNone: {
|
|
84
|
-
display: 'none'
|
|
85
|
-
},
|
|
86
82
|
farAway: {
|
|
87
83
|
position: 'absolute',
|
|
88
84
|
top: 1e8,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["StyleSheet","TextInput","processColor","React","createWorkletRuntime","makeShareableCloneRecursive","MarkdownTextInputDecoratorViewNativeComponent","NativeLiveMarkdownModule","mergeMarkdownStyleWithDefault","initialized","workletRuntime","getWorkletRuntime","undefined","Error","initializeLiveMarkdownIfNeeded","install","global","jsi_setMarkdownRuntime","registerParser","parser","shareableWorklet","parserId","jsi_registerMarkdownWorklet","unregisterParser","jsi_unregisterMarkdownWorklet","processColorsInMarkdownStyle","input","output","JSON","parse","stringify","Object","keys","forEach","key","obj","prop","endsWith","processMarkdownStyle","MarkdownTextInput","forwardRef","props","ref","
|
|
1
|
+
{"version":3,"names":["StyleSheet","TextInput","processColor","React","createWorkletRuntime","makeShareableCloneRecursive","MarkdownTextInputDecoratorViewNativeComponent","NativeLiveMarkdownModule","mergeMarkdownStyleWithDefault","initialized","workletRuntime","getWorkletRuntime","undefined","Error","initializeLiveMarkdownIfNeeded","install","global","jsi_setMarkdownRuntime","registerParser","parser","shareableWorklet","parserId","jsi_registerMarkdownWorklet","unregisterParser","jsi_unregisterMarkdownWorklet","processColorsInMarkdownStyle","input","output","JSON","parse","stringify","Object","keys","forEach","key","obj","prop","endsWith","processMarkdownStyle","MarkdownTextInput","forwardRef","props","ref","markdownStyle","useMemo","workletHash","__workletHash","useEffect","createElement","Fragment","_extends","style","styles","farAway","create","position","top","left"],"sourceRoot":"../../src","sources":["MarkdownTextInput.tsx"],"mappings":";AAAA,SAAQA,UAAU,EAAEC,SAAS,EAAEC,YAAY,QAAO,cAAc;AAChE,OAAOC,KAAK,MAAM,OAAO;AAEzB,SAAQC,oBAAoB,EAAEC,2BAA2B,QAAO,yBAAyB;AAIzF,OAAOC,6CAA6C,MAAM,iDAAiD;AAE3G,OAAOC,wBAAwB,MAAM,4BAA4B;AACjE,SAAQC,6BAA6B,QAAO,cAAc;AAa1D,IAAIC,WAAW,GAA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CAAC,gBAAgB,EAAE,YAAY,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC;IAExH,IAAI,6BAA6B,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/D;AAKD,iBAAS,iBAAiB,IAAI,cAAc,CAO3C;AA4BD,UAAU,sBAAuB,SAAQ,cAAc,EAAE,sBAAsB;IAC7E,aAAa,CAAC,EAAE,oBAAoB,CAAC;IACrC,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,KAAK,qBAAqB,CAAC;IAC/H,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,aAAa,EAAE,CAAC;CAC5C;AAED,KAAK,qBAAqB,GAAG;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,KAAK,iBAAiB,GAAG,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAC;AAuB7E,QAAA,MAAM,iBAAiB,kGAkCrB,CAAC;AAUH,YAAY,EAAC,oBAAoB,IAAI,aAAa,EAAE,sBAAsB,EAAC,CAAC;AAE5E,eAAe,iBAAiB,CAAC;AAEjC,OAAO,EAAC,iBAAiB,EAAC,CAAC"}
|
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.245",
|
|
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",
|
|
@@ -165,6 +165,9 @@
|
|
|
165
165
|
"codegenConfig": {
|
|
166
166
|
"name": "RNLiveMarkdownSpec",
|
|
167
167
|
"type": "all",
|
|
168
|
-
"jsSrcsDir": "src"
|
|
168
|
+
"jsSrcsDir": "src",
|
|
169
|
+
"android": {
|
|
170
|
+
"javaPackageName": "com.expensify.livemarkdown"
|
|
171
|
+
}
|
|
169
172
|
}
|
|
170
173
|
}
|
|
@@ -94,8 +94,6 @@ function processMarkdownStyle(input: PartialMarkdownStyle | undefined): Markdown
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
const MarkdownTextInput = React.forwardRef<MarkdownTextInput, MarkdownTextInputProps>((props, ref) => {
|
|
97
|
-
const IS_FABRIC = 'nativeFabricUIManager' in global;
|
|
98
|
-
|
|
99
97
|
const markdownStyle = React.useMemo(() => processMarkdownStyle(props.markdownStyle), [props.markdownStyle]);
|
|
100
98
|
|
|
101
99
|
if (props.parser === undefined) {
|
|
@@ -123,7 +121,7 @@ const MarkdownTextInput = React.forwardRef<MarkdownTextInput, MarkdownTextInputP
|
|
|
123
121
|
ref={ref}
|
|
124
122
|
/>
|
|
125
123
|
<MarkdownTextInputDecoratorViewNativeComponent
|
|
126
|
-
style={
|
|
124
|
+
style={styles.farAway}
|
|
127
125
|
markdownStyle={markdownStyle}
|
|
128
126
|
parserId={parserId}
|
|
129
127
|
/>
|
|
@@ -132,9 +130,6 @@ const MarkdownTextInput = React.forwardRef<MarkdownTextInput, MarkdownTextInputP
|
|
|
132
130
|
});
|
|
133
131
|
|
|
134
132
|
const styles = StyleSheet.create({
|
|
135
|
-
displayNone: {
|
|
136
|
-
display: 'none',
|
|
137
|
-
},
|
|
138
133
|
farAway: {
|
|
139
134
|
position: 'absolute',
|
|
140
135
|
top: 1e8,
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
package com.expensify.livemarkdown;
|
|
2
|
-
|
|
3
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
4
|
-
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
5
|
-
|
|
6
|
-
abstract class LiveMarkdownModuleSpec extends ReactContextBaseJavaModule {
|
|
7
|
-
LiveMarkdownModuleSpec(ReactApplicationContext context) {
|
|
8
|
-
super(context);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
public abstract boolean install();
|
|
12
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
package com.expensify.livemarkdown;
|
|
2
|
-
|
|
3
|
-
import android.view.View;
|
|
4
|
-
|
|
5
|
-
import com.facebook.react.bridge.ReadableMap;
|
|
6
|
-
import com.facebook.react.uimanager.SimpleViewManager;
|
|
7
|
-
|
|
8
|
-
public abstract class MarkdownTextInputDecoratorViewManagerSpec<T extends View> extends SimpleViewManager<T> {
|
|
9
|
-
public abstract void setMarkdownStyle(T view, ReadableMap value);
|
|
10
|
-
public abstract void setParserId(T view, int value);
|
|
11
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
-
*
|
|
5
|
-
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
-
* once the code is regenerated.
|
|
7
|
-
*
|
|
8
|
-
* @generated by codegen project: GenerateModuleJavaSpec.js
|
|
9
|
-
*
|
|
10
|
-
* @nolint
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
package com.expensify.livemarkdown;
|
|
14
|
-
|
|
15
|
-
import com.facebook.proguard.annotations.DoNotStrip;
|
|
16
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
17
|
-
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
18
|
-
import com.facebook.react.bridge.ReactMethod;
|
|
19
|
-
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
|
|
20
|
-
import javax.annotation.Nonnull;
|
|
21
|
-
|
|
22
|
-
public abstract class NativeLiveMarkdownModuleSpec extends ReactContextBaseJavaModule implements TurboModule {
|
|
23
|
-
public static final String NAME = "LiveMarkdownModule";
|
|
24
|
-
|
|
25
|
-
public NativeLiveMarkdownModuleSpec(ReactApplicationContext reactContext) {
|
|
26
|
-
super(reactContext);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
@Override
|
|
30
|
-
public @Nonnull String getName() {
|
|
31
|
-
return NAME;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
35
|
-
@DoNotStrip
|
|
36
|
-
public abstract boolean install();
|
|
37
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
#import <React/RCTBaseTextInputView.h>
|
|
2
|
-
#import <RNLiveMarkdown/RCTMarkdownUtils.h>
|
|
3
|
-
|
|
4
|
-
NS_ASSUME_NONNULL_BEGIN
|
|
5
|
-
|
|
6
|
-
@interface RCTBaseTextInputView (Markdown)
|
|
7
|
-
|
|
8
|
-
@property(nonatomic, nullable, getter=getMarkdownUtils) RCTMarkdownUtils *markdownUtils;
|
|
9
|
-
|
|
10
|
-
- (void)markdown_setAttributedText:(NSAttributedString *)attributedText;
|
|
11
|
-
|
|
12
|
-
- (BOOL)markdown_textOf:(NSAttributedString *)newText equals:(NSAttributedString *)oldText;
|
|
13
|
-
|
|
14
|
-
- (void)markdown_updateLocalData;
|
|
15
|
-
|
|
16
|
-
@end
|
|
17
|
-
|
|
18
|
-
NS_ASSUME_NONNULL_END
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
#import <RNLiveMarkdown/RCTBaseTextInputView+Markdown.h>
|
|
2
|
-
#import <RNLiveMarkdown/RCTMarkdownUtils.h>
|
|
3
|
-
#import <objc/message.h>
|
|
4
|
-
|
|
5
|
-
@implementation RCTBaseTextInputView (Markdown)
|
|
6
|
-
|
|
7
|
-
- (void)setMarkdownUtils:(RCTMarkdownUtils *)markdownUtils {
|
|
8
|
-
objc_setAssociatedObject(self, @selector(getMarkdownUtils), markdownUtils, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
- (RCTMarkdownUtils *)getMarkdownUtils {
|
|
12
|
-
return objc_getAssociatedObject(self, @selector(getMarkdownUtils));
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
- (void)markdown_setAttributedText:(NSAttributedString *)attributedText
|
|
16
|
-
{
|
|
17
|
-
RCTMarkdownUtils *markdownUtils = [self getMarkdownUtils];
|
|
18
|
-
if (markdownUtils != nil) {
|
|
19
|
-
attributedText = [markdownUtils parseMarkdown:attributedText withDefaultTextAttributes:self.backedTextInputView.defaultTextAttributes];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// Call the original method
|
|
23
|
-
[self markdown_setAttributedText:attributedText];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
- (BOOL)markdown_textOf:(NSAttributedString *)newText equals:(NSAttributedString *)oldText
|
|
27
|
-
{
|
|
28
|
-
RCTMarkdownUtils *markdownUtils = [self getMarkdownUtils];
|
|
29
|
-
if (markdownUtils != nil) {
|
|
30
|
-
// Emoji characters are automatically assigned an AppleColorEmoji NSFont and the original font is moved to NSOriginalFont
|
|
31
|
-
// We need to remove these attributes before comparison
|
|
32
|
-
NSMutableAttributedString *newTextCopy = [newText mutableCopy];
|
|
33
|
-
NSMutableAttributedString *oldTextCopy = [oldText mutableCopy];
|
|
34
|
-
[newTextCopy removeAttribute:@"NSFont" range:NSMakeRange(0, newTextCopy.length)];
|
|
35
|
-
[oldTextCopy removeAttribute:@"NSFont" range:NSMakeRange(0, oldTextCopy.length)];
|
|
36
|
-
[oldTextCopy removeAttribute:@"NSOriginalFont" range:NSMakeRange(0, oldTextCopy.length)];
|
|
37
|
-
return [newTextCopy isEqualToAttributedString:oldTextCopy];
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return [self markdown_textOf:newText equals:oldText];
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
- (void)markdown_updateLocalData
|
|
44
|
-
{
|
|
45
|
-
RCTMarkdownUtils *markdownUtils = [self getMarkdownUtils];
|
|
46
|
-
if (markdownUtils != nil) {
|
|
47
|
-
id<RCTBackedTextInputViewProtocol> backedTextInputView = self.backedTextInputView;
|
|
48
|
-
NSAttributedString *oldAttributedText = backedTextInputView.attributedText;
|
|
49
|
-
NSAttributedString *newAttributedText = [markdownUtils parseMarkdown:oldAttributedText withDefaultTextAttributes:backedTextInputView.defaultTextAttributes];
|
|
50
|
-
UITextRange *range = backedTextInputView.selectedTextRange;
|
|
51
|
-
|
|
52
|
-
// update attributed text without emitting onSelectionChange event
|
|
53
|
-
id<RCTBackedTextInputDelegate> delegate = backedTextInputView.textInputDelegate;
|
|
54
|
-
backedTextInputView.textInputDelegate = nil;
|
|
55
|
-
[backedTextInputView setAttributedText:newAttributedText];
|
|
56
|
-
backedTextInputView.textInputDelegate = delegate;
|
|
57
|
-
|
|
58
|
-
// restore original selection and emit onSelectionChange event
|
|
59
|
-
[backedTextInputView setSelectedTextRange:range notifyDelegate:YES];
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// Call the original method
|
|
63
|
-
[self markdown_updateLocalData];
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
+ (void)load
|
|
67
|
-
{
|
|
68
|
-
static dispatch_once_t onceToken;
|
|
69
|
-
dispatch_once(&onceToken, ^{
|
|
70
|
-
Class cls = [self class];
|
|
71
|
-
|
|
72
|
-
{
|
|
73
|
-
// swizzle setAttributedText
|
|
74
|
-
SEL originalSelector = @selector(setAttributedText:);
|
|
75
|
-
SEL swizzledSelector = @selector(markdown_setAttributedText:);
|
|
76
|
-
Method originalMethod = class_getInstanceMethod(cls, originalSelector);
|
|
77
|
-
Method swizzledMethod = class_getInstanceMethod(cls, swizzledSelector);
|
|
78
|
-
method_exchangeImplementations(originalMethod, swizzledMethod);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
{
|
|
82
|
-
// swizzle updateLocalData
|
|
83
|
-
SEL originalSelector = @selector(updateLocalData);
|
|
84
|
-
SEL swizzledSelector = @selector(markdown_updateLocalData);
|
|
85
|
-
Method originalMethod = class_getInstanceMethod(cls, originalSelector);
|
|
86
|
-
Method swizzledMethod = class_getInstanceMethod(cls, swizzledSelector);
|
|
87
|
-
method_exchangeImplementations(originalMethod, swizzledMethod);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
{
|
|
91
|
-
// swizzle textOf
|
|
92
|
-
SEL originalSelector = @selector(textOf:equals:);
|
|
93
|
-
SEL swizzledSelector = @selector(markdown_textOf:equals:);
|
|
94
|
-
Method originalMethod = class_getInstanceMethod(cls, originalSelector);
|
|
95
|
-
Method swizzledMethod = class_getInstanceMethod(cls, swizzledSelector);
|
|
96
|
-
method_exchangeImplementations(originalMethod, swizzledMethod);
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
@end
|
/package/android/src/{newarch → main/java/com/expensify/livemarkdown}/LiveMarkdownModuleSpec.java
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|