react-native-enriched 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -2
- package/ReactNativeEnriched.podspec +5 -1
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedTextInputViewManagerDelegate.java +12 -0
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedTextInputViewManagerInterface.java +4 -0
- package/android/generated/jni/react/renderer/components/ReactNativeEnrichedSpec/EventEmitters.cpp +149 -0
- package/android/generated/jni/react/renderer/components/ReactNativeEnrichedSpec/EventEmitters.h +146 -0
- package/android/generated/jni/react/renderer/components/ReactNativeEnrichedSpec/Props.cpp +16 -1
- package/android/generated/jni/react/renderer/components/ReactNativeEnrichedSpec/Props.h +46 -0
- package/android/src/main/java/com/swmansion/enriched/common/GumboNormalizer.kt +5 -0
- package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedCheckboxListSpan.kt +3 -2
- package/android/src/main/java/com/swmansion/enriched/common/spans/EnrichedUnorderedListSpan.kt +2 -1
- package/android/src/main/java/com/swmansion/enriched/textinput/EnrichedTextInputView.kt +166 -20
- package/android/src/main/java/com/swmansion/enriched/textinput/EnrichedTextInputViewManager.kt +32 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/MeasurementStore.kt +19 -2
- package/android/src/main/java/com/swmansion/enriched/textinput/events/OnContextMenuItemPressEvent.kt +35 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedLineHeightSpan.kt +44 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/styles/ParagraphStyles.kt +19 -14
- package/android/src/main/java/com/swmansion/enriched/textinput/styles/ParametrizedStyles.kt +16 -0
- package/android/src/main/java/com/swmansion/enriched/textinput/utils/EnrichedSpanState.kt +18 -12
- package/android/src/main/new_arch/CMakeLists.txt +9 -13
- package/android/src/main/new_arch/GumboNormalizerJni.cpp +14 -0
- package/android/src/main/new_arch/react/renderer/components/ReactNativeEnrichedSpec/conversions.h +2 -21
- package/cpp/CMakeLists.txt +50 -0
- package/cpp/GumboParser/GumboParser.h +34043 -0
- package/cpp/README.md +59 -0
- package/cpp/parser/GumboNormalizer.c +915 -0
- package/cpp/parser/GumboParser.cpp +16 -0
- package/cpp/parser/GumboParser.hpp +23 -0
- package/cpp/tests/GumboParserTest.cpp +457 -0
- package/ios/EnrichedTextInputView.h +2 -0
- package/ios/EnrichedTextInputView.mm +160 -2
- package/ios/config/InputConfig.h +3 -0
- package/ios/config/InputConfig.mm +15 -0
- package/ios/extensions/LayoutManagerExtension.mm +34 -11
- package/ios/generated/ReactNativeEnrichedSpec/EventEmitters.cpp +149 -0
- package/ios/generated/ReactNativeEnrichedSpec/EventEmitters.h +146 -0
- package/ios/generated/ReactNativeEnrichedSpec/Props.cpp +16 -1
- package/ios/generated/ReactNativeEnrichedSpec/Props.h +46 -0
- package/ios/generated/ReactNativeEnrichedSpec/RCTComponentViewHelpers.h +29 -0
- package/ios/inputParser/InputParser.mm +27 -0
- package/ios/interfaces/ImageAttachment.mm +29 -0
- package/lib/module/EnrichedTextInput.js +43 -30
- package/lib/module/EnrichedTextInput.js.map +1 -1
- package/lib/module/spec/EnrichedTextInputNativeComponent.ts +118 -22
- package/lib/typescript/src/EnrichedTextInput.d.ts +24 -6
- package/lib/typescript/src/EnrichedTextInput.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/spec/EnrichedTextInputNativeComponent.d.ts +111 -21
- package/lib/typescript/src/spec/EnrichedTextInputNativeComponent.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/EnrichedTextInput.tsx +79 -40
- package/src/index.tsx +0 -1
- package/src/spec/EnrichedTextInputNativeComponent.ts +118 -22
|
@@ -124,28 +124,6 @@ export interface OnChangeStateEvent {
|
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
export interface OnChangeStateDeprecatedEvent {
|
|
128
|
-
isBold: boolean;
|
|
129
|
-
isItalic: boolean;
|
|
130
|
-
isUnderline: boolean;
|
|
131
|
-
isStrikeThrough: boolean;
|
|
132
|
-
isInlineCode: boolean;
|
|
133
|
-
isH1: boolean;
|
|
134
|
-
isH2: boolean;
|
|
135
|
-
isH3: boolean;
|
|
136
|
-
isH4: boolean;
|
|
137
|
-
isH5: boolean;
|
|
138
|
-
isH6: boolean;
|
|
139
|
-
isCodeBlock: boolean;
|
|
140
|
-
isBlockQuote: boolean;
|
|
141
|
-
isOrderedList: boolean;
|
|
142
|
-
isUnorderedList: boolean;
|
|
143
|
-
isCheckboxList: boolean;
|
|
144
|
-
isLink: boolean;
|
|
145
|
-
isImage: boolean;
|
|
146
|
-
isMention: boolean;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
127
|
export interface OnLinkDetected {
|
|
150
128
|
text: string;
|
|
151
129
|
url: string;
|
|
@@ -185,6 +163,114 @@ export interface OnKeyPressEvent {
|
|
|
185
163
|
key: string;
|
|
186
164
|
}
|
|
187
165
|
|
|
166
|
+
export interface ContextMenuItemConfig {
|
|
167
|
+
text: string;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export interface OnContextMenuItemPressEvent {
|
|
171
|
+
itemText: string;
|
|
172
|
+
selectedText: string;
|
|
173
|
+
selectionStart: Int32;
|
|
174
|
+
selectionEnd: Int32;
|
|
175
|
+
styleState: {
|
|
176
|
+
bold: {
|
|
177
|
+
isActive: boolean;
|
|
178
|
+
isConflicting: boolean;
|
|
179
|
+
isBlocking: boolean;
|
|
180
|
+
};
|
|
181
|
+
italic: {
|
|
182
|
+
isActive: boolean;
|
|
183
|
+
isConflicting: boolean;
|
|
184
|
+
isBlocking: boolean;
|
|
185
|
+
};
|
|
186
|
+
underline: {
|
|
187
|
+
isActive: boolean;
|
|
188
|
+
isConflicting: boolean;
|
|
189
|
+
isBlocking: boolean;
|
|
190
|
+
};
|
|
191
|
+
strikeThrough: {
|
|
192
|
+
isActive: boolean;
|
|
193
|
+
isConflicting: boolean;
|
|
194
|
+
isBlocking: boolean;
|
|
195
|
+
};
|
|
196
|
+
inlineCode: {
|
|
197
|
+
isActive: boolean;
|
|
198
|
+
isConflicting: boolean;
|
|
199
|
+
isBlocking: boolean;
|
|
200
|
+
};
|
|
201
|
+
h1: {
|
|
202
|
+
isActive: boolean;
|
|
203
|
+
isConflicting: boolean;
|
|
204
|
+
isBlocking: boolean;
|
|
205
|
+
};
|
|
206
|
+
h2: {
|
|
207
|
+
isActive: boolean;
|
|
208
|
+
isConflicting: boolean;
|
|
209
|
+
isBlocking: boolean;
|
|
210
|
+
};
|
|
211
|
+
h3: {
|
|
212
|
+
isActive: boolean;
|
|
213
|
+
isConflicting: boolean;
|
|
214
|
+
isBlocking: boolean;
|
|
215
|
+
};
|
|
216
|
+
h4: {
|
|
217
|
+
isActive: boolean;
|
|
218
|
+
isConflicting: boolean;
|
|
219
|
+
isBlocking: boolean;
|
|
220
|
+
};
|
|
221
|
+
h5: {
|
|
222
|
+
isActive: boolean;
|
|
223
|
+
isConflicting: boolean;
|
|
224
|
+
isBlocking: boolean;
|
|
225
|
+
};
|
|
226
|
+
h6: {
|
|
227
|
+
isActive: boolean;
|
|
228
|
+
isConflicting: boolean;
|
|
229
|
+
isBlocking: boolean;
|
|
230
|
+
};
|
|
231
|
+
codeBlock: {
|
|
232
|
+
isActive: boolean;
|
|
233
|
+
isConflicting: boolean;
|
|
234
|
+
isBlocking: boolean;
|
|
235
|
+
};
|
|
236
|
+
blockQuote: {
|
|
237
|
+
isActive: boolean;
|
|
238
|
+
isConflicting: boolean;
|
|
239
|
+
isBlocking: boolean;
|
|
240
|
+
};
|
|
241
|
+
orderedList: {
|
|
242
|
+
isActive: boolean;
|
|
243
|
+
isConflicting: boolean;
|
|
244
|
+
isBlocking: boolean;
|
|
245
|
+
};
|
|
246
|
+
unorderedList: {
|
|
247
|
+
isActive: boolean;
|
|
248
|
+
isConflicting: boolean;
|
|
249
|
+
isBlocking: boolean;
|
|
250
|
+
};
|
|
251
|
+
link: {
|
|
252
|
+
isActive: boolean;
|
|
253
|
+
isConflicting: boolean;
|
|
254
|
+
isBlocking: boolean;
|
|
255
|
+
};
|
|
256
|
+
image: {
|
|
257
|
+
isActive: boolean;
|
|
258
|
+
isConflicting: boolean;
|
|
259
|
+
isBlocking: boolean;
|
|
260
|
+
};
|
|
261
|
+
mention: {
|
|
262
|
+
isActive: boolean;
|
|
263
|
+
isConflicting: boolean;
|
|
264
|
+
isBlocking: boolean;
|
|
265
|
+
};
|
|
266
|
+
checkboxList: {
|
|
267
|
+
isActive: boolean;
|
|
268
|
+
isConflicting: boolean;
|
|
269
|
+
isBlocking: boolean;
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
|
|
188
274
|
interface TargetedEvent {
|
|
189
275
|
target: Int32;
|
|
190
276
|
}
|
|
@@ -273,6 +359,7 @@ export interface NativeProps extends ViewProps {
|
|
|
273
359
|
htmlStyle?: HtmlStyleInternal;
|
|
274
360
|
scrollEnabled?: boolean;
|
|
275
361
|
linkRegex?: LinkNativeRegex;
|
|
362
|
+
contextMenuItems?: ReadonlyArray<Readonly<ContextMenuItemConfig>>;
|
|
276
363
|
|
|
277
364
|
// event callbacks
|
|
278
365
|
onInputFocus?: DirectEventHandler<TargetedEvent>;
|
|
@@ -287,11 +374,13 @@ export interface NativeProps extends ViewProps {
|
|
|
287
374
|
onRequestHtmlResult?: DirectEventHandler<OnRequestHtmlResultEvent>;
|
|
288
375
|
onInputKeyPress?: DirectEventHandler<OnKeyPressEvent>;
|
|
289
376
|
onPasteImages?: DirectEventHandler<OnPasteImagesEvent>;
|
|
377
|
+
onContextMenuItemPress?: DirectEventHandler<OnContextMenuItemPressEvent>;
|
|
290
378
|
|
|
291
379
|
// Style related props - used for generating proper setters in component's manager
|
|
292
380
|
// These should not be passed as regular props
|
|
293
381
|
color?: ColorValue;
|
|
294
382
|
fontSize?: Float;
|
|
383
|
+
lineHeight?: Float;
|
|
295
384
|
fontFamily?: string;
|
|
296
385
|
fontWeight?: string;
|
|
297
386
|
fontStyle?: string;
|
|
@@ -303,6 +392,7 @@ export interface NativeProps extends ViewProps {
|
|
|
303
392
|
|
|
304
393
|
// Experimental
|
|
305
394
|
androidExperimentalSynchronousEvents: boolean;
|
|
395
|
+
useHtmlNormalizer: boolean;
|
|
306
396
|
}
|
|
307
397
|
|
|
308
398
|
type ComponentType = HostComponent<NativeProps>;
|
|
@@ -345,6 +435,11 @@ interface NativeCommands {
|
|
|
345
435
|
text: string,
|
|
346
436
|
url: string
|
|
347
437
|
) => void;
|
|
438
|
+
removeLink: (
|
|
439
|
+
viewRef: React.ElementRef<ComponentType>,
|
|
440
|
+
start: Int32,
|
|
441
|
+
end: Int32
|
|
442
|
+
) => void;
|
|
348
443
|
addImage: (
|
|
349
444
|
viewRef: React.ElementRef<ComponentType>,
|
|
350
445
|
uri: string,
|
|
@@ -393,6 +488,7 @@ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
|
|
|
393
488
|
'toggleUnorderedList',
|
|
394
489
|
'toggleCheckboxList',
|
|
395
490
|
'addLink',
|
|
491
|
+
'removeLink',
|
|
396
492
|
'addImage',
|
|
397
493
|
'startMention',
|
|
398
494
|
'addMention',
|