@tbvjaos510/react-native-paste-input 0.9.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/.circleci/config.yml +130 -0
- package/LICENSE +21 -0
- package/README.md +73 -0
- package/android/.project +17 -0
- package/android/.settings/org.eclipse.buildship.core.prefs +13 -0
- package/android/build.gradle +94 -0
- package/android/generated/java/com/facebook/react/viewmanagers/PasteTextInputManagerDelegate.java +236 -0
- package/android/generated/java/com/facebook/react/viewmanagers/PasteTextInputManagerInterface.java +84 -0
- package/android/generated/jni/CMakeLists.txt +36 -0
- package/android/generated/jni/PasteTextInputSpecs-generated.cpp +27 -0
- package/android/generated/jni/PasteTextInputSpecs.h +28 -0
- package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/ComponentDescriptors.cpp +22 -0
- package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/ComponentDescriptors.h +166 -0
- package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/EventEmitters.cpp +183 -0
- package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/EventEmitters.h +148 -0
- package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/PasteTextInputSpecsJSI-generated.cpp +17 -0
- package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/PasteTextInputSpecsJSI.h +19 -0
- package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/Props.cpp +640 -0
- package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/Props.h +144 -0
- package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/ShadowNodes.cpp +247 -0
- package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/ShadowNodes.h +95 -0
- package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/States.cpp +14 -0
- package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/States.h +19 -0
- package/android/gradle.properties +6 -0
- package/android/src/main/java/com/mattermost/pasteinputtext/IPasteInputListener.kt +8 -0
- package/android/src/main/java/com/mattermost/pasteinputtext/PasteInputActionCallback.kt +72 -0
- package/android/src/main/java/com/mattermost/pasteinputtext/PasteInputEditText.kt +60 -0
- package/android/src/main/java/com/mattermost/pasteinputtext/PasteInputFileFromUrl.kt +50 -0
- package/android/src/main/java/com/mattermost/pasteinputtext/PasteInputListener.kt +84 -0
- package/android/src/main/java/com/mattermost/pasteinputtext/PasteTextInputManager.kt +72 -0
- package/android/src/main/java/com/mattermost/pasteinputtext/PasteTextInputPackage.kt +14 -0
- package/android/src/main/java/com/mattermost/pasteinputtext/PasteTextInputPasteEvent.java +41 -0
- package/android/src/main/java/com/mattermost/pasteinputtext/RealPathUtil.kt +174 -0
- package/ios/NSData+MimeType.h +20 -0
- package/ios/NSData+MimeType.m +59 -0
- package/ios/PasteInput-Bridging-Header.h +1 -0
- package/ios/PasteInput.xcodeproj/project.pbxproj +319 -0
- package/ios/PasteInputTextView.h +20 -0
- package/ios/PasteInputTextView.m +68 -0
- package/ios/PasteInputView.h +18 -0
- package/ios/PasteInputView.m +96 -0
- package/ios/PasteTextInput.h +13 -0
- package/ios/PasteTextInput.mm +726 -0
- package/ios/PasteTextInputManager.mm +171 -0
- package/ios/Swime/MimeType.h +70 -0
- package/ios/Swime/MimeType.m +701 -0
- package/ios/Swime/Swime.h +14 -0
- package/ios/Swime/Swime.m +28 -0
- package/ios/Swime/SwimeProxy.h +18 -0
- package/ios/Swime/SwimeProxy.m +66 -0
- package/ios/Swime/SwimeUtils.h +12 -0
- package/ios/Swime/SwimeUtils.m +23 -0
- package/ios/UIImage+ImageEffects.h +112 -0
- package/ios/UIImage+ImageEffects.m +310 -0
- package/ios/UIImage+vImageScaling.h +16 -0
- package/ios/UIImage+vImageScaling.m +48 -0
- package/ios/UIPasteboard+GetImageInfo.h +19 -0
- package/ios/UIPasteboard+GetImageInfo.m +98 -0
- package/ios/generated/PasteTextInputSpecs/ComponentDescriptors.cpp +22 -0
- package/ios/generated/PasteTextInputSpecs/ComponentDescriptors.h +42 -0
- package/ios/generated/PasteTextInputSpecs/EventEmitters.cpp +41 -0
- package/ios/generated/PasteTextInputSpecs/EventEmitters.h +37 -0
- package/ios/generated/PasteTextInputSpecs/PasteTextInputSpecs-generated.mm +16 -0
- package/ios/generated/PasteTextInputSpecs/PasteTextInputSpecs.h +38 -0
- package/ios/generated/PasteTextInputSpecs/Props.cpp +142 -0
- package/ios/generated/PasteTextInputSpecs/Props.h +81 -0
- package/ios/generated/PasteTextInputSpecs/RCTComponentViewHelpers.h +106 -0
- package/ios/generated/PasteTextInputSpecs/ShadowNodes.cpp +127 -0
- package/ios/generated/PasteTextInputSpecs/ShadowNodes.h +85 -0
- package/ios/generated/PasteTextInputSpecs/States.cpp +16 -0
- package/ios/generated/PasteTextInputSpecs/States.h +53 -0
- package/ios/generated/PasteTextInputSpecsJSI-generated.cpp +17 -0
- package/ios/generated/PasteTextInputSpecsJSI.h +19 -0
- package/lib/commonjs/PasteTextInput.js +446 -0
- package/lib/commonjs/PasteTextInput.js.map +1 -0
- package/lib/commonjs/PasteTextInputNativeComponent.ts +277 -0
- package/lib/commonjs/index.js +25 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/module.d.js +2 -0
- package/lib/commonjs/module.d.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/types.js +6 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/PasteTextInput.js +440 -0
- package/lib/module/PasteTextInput.js.map +1 -0
- package/lib/module/PasteTextInputNativeComponent.ts +277 -0
- package/lib/module/index.js +9 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/module.d.js +2 -0
- package/lib/module/module.d.js.map +1 -0
- package/lib/module/types.js +4 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/src/PasteTextInput.d.ts +5 -0
- package/lib/typescript/src/PasteTextInput.d.ts.map +1 -0
- package/lib/typescript/src/PasteTextInputNativeComponent.d.ts +168 -0
- package/lib/typescript/src/PasteTextInputNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +6 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +56 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/package.json +140 -0
- package/react-native-paste-input.podspec +20 -0
- package/react-native.config.js +13 -0
- package/src/PasteTextInput.tsx +615 -0
- package/src/PasteTextInputNativeComponent.ts +277 -0
- package/src/index.ts +13 -0
- package/src/module.d.ts +4 -0
- package/src/types.ts +71 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
#import <React/RCTLog.h>
|
|
2
|
+
#import <React/RCTUIManager.h>
|
|
3
|
+
#import <React/RCTViewManager.h>
|
|
4
|
+
|
|
5
|
+
#import <React/RCTBaseTextInputShadowView.h>
|
|
6
|
+
#import <React/RCTBaseTextInputView.h>
|
|
7
|
+
#import <React/RCTConvert+Text.h>
|
|
8
|
+
|
|
9
|
+
#import <React/RCTUIManagerObserverCoordinator.h>
|
|
10
|
+
#import <React/RCTUIManagerUtils.h>
|
|
11
|
+
#import <React/RCTShadowView+Layout.h>
|
|
12
|
+
#import <React/RCTShadowView.h>
|
|
13
|
+
|
|
14
|
+
#import "PasteTextInput.h"
|
|
15
|
+
#import "PasteInputView.h"
|
|
16
|
+
|
|
17
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
18
|
+
@interface PasteTextInputManager : RCTViewManager
|
|
19
|
+
@end
|
|
20
|
+
#else
|
|
21
|
+
#import <React/RCTMultilineTextInputViewManager.h>
|
|
22
|
+
|
|
23
|
+
@interface PasteTextInputManager : RCTMultilineTextInputViewManager
|
|
24
|
+
|
|
25
|
+
@end
|
|
26
|
+
#endif
|
|
27
|
+
|
|
28
|
+
@implementation PasteTextInputManager {
|
|
29
|
+
NSHashTable<RCTBaseTextInputShadowView *> *_shadowViews;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
RCT_EXPORT_MODULE(PasteTextInput)
|
|
33
|
+
|
|
34
|
+
RCT_EXPORT_VIEW_PROPERTY(disableCopyPaste, BOOL)
|
|
35
|
+
RCT_EXPORT_VIEW_PROPERTY(smartPunctuation, NSString)
|
|
36
|
+
|
|
37
|
+
RCT_EXPORT_VIEW_PROPERTY(onPaste, RCTBubblingEventBlock)
|
|
38
|
+
|
|
39
|
+
#pragma mark - Unified <PasteTextInput> properties
|
|
40
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
41
|
+
RCT_REMAP_VIEW_PROPERTY(autoCapitalize, backedTextInputView.autocapitalizationType, UITextAutocapitalizationType)
|
|
42
|
+
RCT_REMAP_VIEW_PROPERTY(autoCorrect, backedTextInputView.autocorrectionType, UITextAutocorrectionType)
|
|
43
|
+
RCT_REMAP_VIEW_PROPERTY(contextMenuHidden, backedTextInputView.contextMenuHidden, BOOL)
|
|
44
|
+
RCT_REMAP_VIEW_PROPERTY(editable, backedTextInputView.editable, BOOL)
|
|
45
|
+
RCT_REMAP_VIEW_PROPERTY(enablesReturnKeyAutomatically, backedTextInputView.enablesReturnKeyAutomatically, BOOL)
|
|
46
|
+
RCT_REMAP_VIEW_PROPERTY(keyboardAppearance, backedTextInputView.keyboardAppearance, UIKeyboardAppearance)
|
|
47
|
+
RCT_REMAP_VIEW_PROPERTY(placeholder, backedTextInputView.placeholder, NSString)
|
|
48
|
+
RCT_REMAP_VIEW_PROPERTY(placeholderTextColor, backedTextInputView.placeholderColor, UIColor)
|
|
49
|
+
RCT_REMAP_VIEW_PROPERTY(returnKeyType, backedTextInputView.returnKeyType, UIReturnKeyType)
|
|
50
|
+
RCT_REMAP_VIEW_PROPERTY(selectionColor, backedTextInputView.tintColor, UIColor)
|
|
51
|
+
RCT_REMAP_VIEW_PROPERTY(spellCheck, backedTextInputView.spellCheckingType, UITextSpellCheckingType)
|
|
52
|
+
RCT_REMAP_VIEW_PROPERTY(caretHidden, backedTextInputView.caretHidden, BOOL)
|
|
53
|
+
RCT_REMAP_VIEW_PROPERTY(clearButtonMode, backedTextInputView.clearButtonMode, UITextFieldViewMode)
|
|
54
|
+
RCT_REMAP_VIEW_PROPERTY(scrollEnabled, backedTextInputView.scrollEnabled, BOOL)
|
|
55
|
+
RCT_REMAP_VIEW_PROPERTY(secureTextEntry, backedTextInputView.secureTextEntry, BOOL)
|
|
56
|
+
RCT_REMAP_VIEW_PROPERTY(smartInsertDelete, backedTextInputView.smartInsertDeleteType, UITextSmartInsertDeleteType)
|
|
57
|
+
RCT_EXPORT_VIEW_PROPERTY(autoFocus, BOOL)
|
|
58
|
+
RCT_EXPORT_VIEW_PROPERTY(submitBehavior, NSString)
|
|
59
|
+
RCT_EXPORT_VIEW_PROPERTY(clearTextOnFocus, BOOL)
|
|
60
|
+
RCT_EXPORT_VIEW_PROPERTY(keyboardType, UIKeyboardType)
|
|
61
|
+
RCT_EXPORT_VIEW_PROPERTY(showSoftInputOnFocus, BOOL)
|
|
62
|
+
RCT_EXPORT_VIEW_PROPERTY(maxLength, NSNumber)
|
|
63
|
+
RCT_EXPORT_VIEW_PROPERTY(selectTextOnFocus, BOOL)
|
|
64
|
+
RCT_EXPORT_VIEW_PROPERTY(selection, RCTTextSelection)
|
|
65
|
+
RCT_EXPORT_VIEW_PROPERTY(inputAccessoryViewID, NSString)
|
|
66
|
+
RCT_EXPORT_VIEW_PROPERTY(textContentType, NSString)
|
|
67
|
+
RCT_EXPORT_VIEW_PROPERTY(passwordRules, NSString)
|
|
68
|
+
|
|
69
|
+
RCT_EXPORT_VIEW_PROPERTY(onChange, RCTBubblingEventBlock)
|
|
70
|
+
RCT_EXPORT_VIEW_PROPERTY(onSelectionChange, RCTDirectEventBlock)
|
|
71
|
+
RCT_EXPORT_VIEW_PROPERTY(onScroll, RCTDirectEventBlock)
|
|
72
|
+
|
|
73
|
+
RCT_EXPORT_VIEW_PROPERTY(mostRecentEventCount, NSInteger)
|
|
74
|
+
|
|
75
|
+
RCT_EXPORT_SHADOW_PROPERTY(text, NSString)
|
|
76
|
+
RCT_EXPORT_SHADOW_PROPERTY(placeholder, NSString)
|
|
77
|
+
RCT_EXPORT_SHADOW_PROPERTY(onContentSizeChange, RCTDirectEventBlock)
|
|
78
|
+
|
|
79
|
+
RCT_CUSTOM_VIEW_PROPERTY(multiline, BOOL, UIView)
|
|
80
|
+
{
|
|
81
|
+
// No op.
|
|
82
|
+
// This View Manager doesn't use this prop but it must be exposed here via ViewConfig to enable Fabric component use
|
|
83
|
+
// it.
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
- (RCTShadowView *)shadowView
|
|
87
|
+
{
|
|
88
|
+
RCTBaseTextInputShadowView *shadowView = [[RCTBaseTextInputShadowView alloc] initWithBridge:self.bridge];
|
|
89
|
+
shadowView.textAttributes.fontSizeMultiplier =
|
|
90
|
+
[[[self.bridge moduleForName:@"AccessibilityManager"
|
|
91
|
+
lazilyLoadIfNecessary:YES] valueForKey:@"multiplier"] floatValue];
|
|
92
|
+
[_shadowViews addObject:shadowView];
|
|
93
|
+
return shadowView;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
RCT_EXPORT_METHOD(focus : (nonnull NSNumber *)viewTag)
|
|
97
|
+
{
|
|
98
|
+
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
99
|
+
UIView *view = viewRegistry[viewTag];
|
|
100
|
+
[view reactFocus];
|
|
101
|
+
}];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
RCT_EXPORT_METHOD(blur : (nonnull NSNumber *)viewTag)
|
|
105
|
+
{
|
|
106
|
+
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
107
|
+
UIView *view = viewRegistry[viewTag];
|
|
108
|
+
[view reactBlur];
|
|
109
|
+
}];
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
RCT_EXPORT_METHOD(setTextAndSelection
|
|
113
|
+
: (nonnull NSNumber *)viewTag mostRecentEventCount
|
|
114
|
+
: (NSInteger)mostRecentEventCount value
|
|
115
|
+
: (NSString *)value start
|
|
116
|
+
: (NSInteger)start end
|
|
117
|
+
: (NSInteger)end)
|
|
118
|
+
{
|
|
119
|
+
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
120
|
+
RCTBaseTextInputView *view = (RCTBaseTextInputView *)viewRegistry[viewTag];
|
|
121
|
+
NSInteger eventLag = view.nativeEventCount - mostRecentEventCount;
|
|
122
|
+
if (eventLag != 0) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
RCTExecuteOnUIManagerQueue(^{
|
|
126
|
+
RCTBaseTextInputShadowView *shadowView =
|
|
127
|
+
(RCTBaseTextInputShadowView *)[self.bridge.uiManager shadowViewForReactTag:viewTag];
|
|
128
|
+
if (value) {
|
|
129
|
+
[shadowView setText:value];
|
|
130
|
+
}
|
|
131
|
+
[self.bridge.uiManager setNeedsLayout];
|
|
132
|
+
RCTExecuteOnMainQueue(^{
|
|
133
|
+
[view setSelectionStart:start selectionEnd:end];
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
}];
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
#pragma mark - RCTUIManagerObserver
|
|
140
|
+
|
|
141
|
+
- (void)uiManagerWillPerformMounting:(__unused RCTUIManager *)uiManager
|
|
142
|
+
{
|
|
143
|
+
for (RCTBaseTextInputShadowView *shadowView in _shadowViews) {
|
|
144
|
+
[shadowView uiManagerWillPerformMounting];
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
#pragma mark - Font Size Multiplier
|
|
149
|
+
|
|
150
|
+
- (void)handleDidUpdateMultiplierNotification
|
|
151
|
+
{
|
|
152
|
+
CGFloat fontSizeMultiplier =
|
|
153
|
+
[[[self.bridge moduleForName:@"AccessibilityManager"] valueForKey:@"multiplier"] floatValue];
|
|
154
|
+
|
|
155
|
+
NSHashTable<RCTBaseTextInputShadowView *> *shadowViews = _shadowViews;
|
|
156
|
+
RCTExecuteOnUIManagerQueue(^{
|
|
157
|
+
for (RCTBaseTextInputShadowView *shadowView in shadowViews) {
|
|
158
|
+
shadowView.textAttributes.fontSizeMultiplier = fontSizeMultiplier;
|
|
159
|
+
[shadowView dirtyLayout];
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
[self.bridge.uiManager setNeedsLayout];
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
#else
|
|
166
|
+
- (UIView *)view
|
|
167
|
+
{
|
|
168
|
+
return [[PasteInputView alloc] initWithBridge:self.bridge];
|
|
169
|
+
}
|
|
170
|
+
#endif
|
|
171
|
+
@end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
#import "SwimeUtils.h"
|
|
3
|
+
|
|
4
|
+
// FileType enumeration
|
|
5
|
+
typedef NS_ENUM(NSInteger, FileType) {
|
|
6
|
+
FileTypeJPG,
|
|
7
|
+
FileTypePNG,
|
|
8
|
+
FileTypeGIF,
|
|
9
|
+
FileTypeWEBP,
|
|
10
|
+
FileTypeFLIF,
|
|
11
|
+
FileTypeCR2,
|
|
12
|
+
FileTypeTIF,
|
|
13
|
+
FileTypeBMP,
|
|
14
|
+
FileTypeJXR,
|
|
15
|
+
FileTypePSD,
|
|
16
|
+
FileTypeM4V,
|
|
17
|
+
FileTypeMID,
|
|
18
|
+
FileTypeMKV,
|
|
19
|
+
FileTypeWEBM,
|
|
20
|
+
FileTypeMOV,
|
|
21
|
+
FileTypeAVI,
|
|
22
|
+
FileTypeWMV,
|
|
23
|
+
FileTypeMPG,
|
|
24
|
+
FileTypeMP3,
|
|
25
|
+
FileTypeM4A,
|
|
26
|
+
FileTypeOPUS,
|
|
27
|
+
FileTypeOGG,
|
|
28
|
+
FileTypeFLAC,
|
|
29
|
+
FileTypeWAV,
|
|
30
|
+
FileTypeAMR,
|
|
31
|
+
FileTypePdf,
|
|
32
|
+
FileTypeExe,
|
|
33
|
+
FileTypeSwf,
|
|
34
|
+
FileTypeRtf,
|
|
35
|
+
FileTypeWoff,
|
|
36
|
+
FileTypeWoff2,
|
|
37
|
+
FileTypeEot,
|
|
38
|
+
FileTypeTtf,
|
|
39
|
+
FileTypeOtf,
|
|
40
|
+
FileTypeIco,
|
|
41
|
+
FileTypeFlv,
|
|
42
|
+
FileTypePs,
|
|
43
|
+
FileTypeXz,
|
|
44
|
+
FileTypeSqlite,
|
|
45
|
+
FileTypeNes,
|
|
46
|
+
FileTypeCrx,
|
|
47
|
+
FileTypeCab,
|
|
48
|
+
FileTypeDeb,
|
|
49
|
+
FileTypeAr,
|
|
50
|
+
FileTypeRpm,
|
|
51
|
+
FileTypeZ,
|
|
52
|
+
FileTypeLz,
|
|
53
|
+
FileTypeMsi,
|
|
54
|
+
FileTypeMxf
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
@interface MimeType : NSObject
|
|
58
|
+
|
|
59
|
+
@property (nonatomic, readonly) NSString *mime;
|
|
60
|
+
@property (nonatomic, readonly) NSString *ext;
|
|
61
|
+
@property (nonatomic, readonly) FileType type;
|
|
62
|
+
@property (nonatomic, readonly) NSInteger bytesCount;
|
|
63
|
+
//@property (nonatomic, copy) BOOL (^matches)(NSData *, id);
|
|
64
|
+
@property (nonatomic, copy) BOOL (^matches)(NSData *, SwimeUtils *);
|
|
65
|
+
|
|
66
|
+
- (BOOL)matchesBytes:(NSData *)bytes swime:(SwimeUtils *)swime;
|
|
67
|
+
|
|
68
|
+
+ (NSArray<MimeType *> *)all;
|
|
69
|
+
|
|
70
|
+
@end
|