react-native-enriched-markdown-scaffold 0.6.0-scaffold.8 → 0.7.4-scaffold.2
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/ReactNativeEnrichedMarkdown.podspec +62 -11
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownManagerDelegate.java +3 -0
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownManagerInterface.java +1 -0
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownTextInputManagerDelegate.java +9 -0
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownTextInputManagerInterface.java +3 -0
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownTextManagerDelegate.java +3 -0
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownTextManagerInterface.java +1 -0
- package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/Props.cpp +20 -0
- package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/Props.h +744 -0
- package/android/src/main/baseline-prof.txt +75 -2
- package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdown.kt +62 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownInternalText.kt +10 -2
- package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownManager.kt +10 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownText.kt +9 -2
- package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownTextManager.kt +10 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/accessibility/AccessibilityLabels.kt +15 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/accessibility/MarkdownAccessibilityHelper.kt +44 -7
- package/android/src/main/java/com/swmansion/enriched/markdown/input/EnrichedMarkdownTextInputManager.kt +52 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/EnrichedMarkdownTextInputView.kt +89 -11
- package/android/src/main/java/com/swmansion/enriched/markdown/input/formatting/FormattingStore.kt +19 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/formatting/InputParser.kt +22 -3
- package/android/src/main/java/com/swmansion/enriched/markdown/input/formatting/InputRemend.kt +1 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/layout/InputMeasurementStore.kt +7 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/input/toolbar/InputContextMenu.kt +54 -13
- package/android/src/main/java/com/swmansion/enriched/markdown/parser/MarkdownASTNode.kt +17 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/SpanStyleCache.kt +4 -4
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/MarkdownViewManagerUtils.kt +30 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/view/LinkEvents.kt +22 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/view/SelectionActionMode.kt +36 -7
- package/android/src/main/java/com/swmansion/enriched/markdown/views/TableContainerView.kt +73 -3
- package/android/src/main/jni/CMakeLists.txt +15 -1
- package/android/src/math/java/com/swmansion/enriched/markdown/views/MathContainerView.kt +24 -2
- package/app.plugin.js +2 -1
- package/cpp/parser/MD4CParser.cpp +1 -1
- package/cpp/wasm/build.sh +9 -9
- package/docs/ACCESSIBILITY.md +172 -0
- package/docs/API_REFERENCE.md +948 -0
- package/docs/COPY_OPTIONS.md +127 -0
- package/docs/ELEMENTS_STRUCTURE.md +112 -0
- package/docs/IMAGE_CACHING.md +25 -0
- package/docs/INPUT.md +233 -0
- package/docs/LATEX_MATH.md +136 -0
- package/docs/MACOS.md +19 -0
- package/docs/MARKDOWN_STREAMING.md +36 -0
- package/docs/MENTIONS.md +97 -0
- package/docs/RTL.md +82 -0
- package/docs/STYLES.md +519 -0
- package/docs/TEXT.md +110 -0
- package/docs/WEB.md +49 -0
- package/ios/EnrichedMarkdown.mm +82 -25
- package/ios/EnrichedMarkdownText.mm +37 -5
- package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/Props.cpp +20 -0
- package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/Props.h +744 -0
- package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/RCTComponentViewHelpers.h +15 -0
- package/ios/input/ENRMFormattingStore.h +5 -0
- package/ios/input/ENRMFormattingStore.mm +34 -0
- package/ios/input/ENRMInputTextView.h +2 -0
- package/ios/input/ENRMInputTextView.mm +8 -17
- package/ios/input/ENRMMarkdownSerializer.mm +1 -1
- package/ios/input/EnrichedMarkdownTextInput+ContextMenu.mm +71 -53
- package/ios/input/EnrichedMarkdownTextInput+Internal.h +26 -0
- package/ios/input/EnrichedMarkdownTextInput.h +1 -0
- package/ios/input/EnrichedMarkdownTextInput.mm +230 -29
- package/ios/input/styles/ENRMBoldStyleHandler.mm +3 -2
- package/ios/input/styles/ENRMItalicStyleHandler.mm +3 -2
- package/ios/renderer/AttributedRenderer.m +51 -6
- package/ios/renderer/ENRMMathInlineRenderer.m +5 -1
- package/ios/styles/ENRMFontSlot.h +1 -1
- package/ios/utils/ENRMAccessibilityLabels.h +36 -0
- package/ios/utils/ENRMAccessibilityLabels.m +5 -0
- package/ios/utils/EditMenuUtils+macOS.m +4 -5
- package/ios/utils/EditMenuUtils.h +70 -0
- package/ios/utils/EditMenuUtils.m +14 -11
- package/ios/utils/LastElementUtils.h +39 -2
- package/ios/utils/MarkdownAccessibilityElementBuilder.h +18 -16
- package/ios/utils/MarkdownAccessibilityElementBuilder.m +64 -32
- package/ios/utils/ParagraphStyleUtils.m +21 -2
- package/ios/views/ENRMMathContainerView.h +8 -0
- package/ios/views/ENRMMathContainerView.m +7 -5
- package/ios/views/ENRMTableIOSGridView.h +40 -0
- package/ios/views/ENRMTableIOSGridView.m +216 -0
- package/ios/views/EnrichedMarkdownInternalText.h +2 -0
- package/ios/views/EnrichedMarkdownInternalText.m +2 -0
- package/ios/views/TableContainerView.h +8 -0
- package/ios/views/TableContainerView.m +72 -128
- package/lib/module/EnrichedMarkdownNativeComponent.ts +37 -0
- package/lib/module/EnrichedMarkdownTextInput.js +48 -1
- package/lib/module/EnrichedMarkdownTextInput.js.map +1 -1
- package/lib/module/EnrichedMarkdownTextInputNativeComponent.ts +35 -0
- package/lib/module/EnrichedMarkdownTextNativeComponent.ts +37 -0
- package/lib/module/accessibilityLabelDefaults.js +64 -0
- package/lib/module/accessibilityLabelDefaults.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/native/EnrichedMarkdownText.js +72 -4
- package/lib/module/native/EnrichedMarkdownText.js.map +1 -1
- package/lib/module/normalizeMenuItem.js +38 -0
- package/lib/module/normalizeMenuItem.js.map +1 -0
- package/lib/module/types/AccessibilityLabels.js +2 -0
- package/lib/module/types/AccessibilityLabels.js.map +1 -0
- package/lib/typescript/src/EnrichedMarkdownNativeComponent.d.ts +34 -0
- package/lib/typescript/src/EnrichedMarkdownNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/EnrichedMarkdownTextInput.d.ts +55 -1
- package/lib/typescript/src/EnrichedMarkdownTextInput.d.ts.map +1 -1
- package/lib/typescript/src/EnrichedMarkdownTextInputNativeComponent.d.ts +30 -0
- package/lib/typescript/src/EnrichedMarkdownTextInputNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/EnrichedMarkdownTextNativeComponent.d.ts +34 -0
- package/lib/typescript/src/EnrichedMarkdownTextNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/accessibilityLabelDefaults.d.ts +16 -0
- package/lib/typescript/src/accessibilityLabelDefaults.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/native/EnrichedMarkdownText.d.ts +3 -3
- package/lib/typescript/src/native/EnrichedMarkdownText.d.ts.map +1 -1
- package/lib/typescript/src/normalizeMenuItem.d.ts +7 -0
- package/lib/typescript/src/normalizeMenuItem.d.ts.map +1 -0
- package/lib/typescript/src/types/AccessibilityLabels.d.ts +114 -0
- package/lib/typescript/src/types/AccessibilityLabels.d.ts.map +1 -0
- package/lib/typescript/src/types/MarkdownTextProps.d.ts +78 -9
- package/lib/typescript/src/types/MarkdownTextProps.d.ts.map +1 -1
- package/package.json +4 -2
- package/plugin/build/withAndroidMath.js +19 -0
- package/plugin/build/withIosMath.js +28 -0
- package/plugin/build/withReactNativeEnrichedMarkdown.js +11 -0
- package/plugin/tsconfig.build.json +16 -0
- package/src/EnrichedMarkdownNativeComponent.ts +37 -0
- package/src/EnrichedMarkdownTextInput.tsx +117 -1
- package/src/EnrichedMarkdownTextInputNativeComponent.ts +35 -0
- package/src/EnrichedMarkdownTextNativeComponent.ts +37 -0
- package/src/accessibilityLabelDefaults.ts +83 -0
- package/src/index.tsx +11 -0
- package/src/native/EnrichedMarkdownText.tsx +120 -6
- package/src/normalizeMenuItem.ts +52 -0
- package/src/types/AccessibilityLabels.ts +118 -0
- package/src/types/MarkdownTextProps.ts +74 -9
- package/lib/module/plugin/withAndroidMath.js +0 -20
- package/lib/module/plugin/withAndroidMath.js.map +0 -1
- package/lib/module/plugin/withIosMath.js +0 -23
- package/lib/module/plugin/withIosMath.js.map +0 -1
- package/lib/module/plugin/withReactNativeEnrichedMarkdown.js +0 -16
- package/lib/module/plugin/withReactNativeEnrichedMarkdown.js.map +0 -1
- package/lib/typescript/src/plugin/withAndroidMath.d.ts +0 -5
- package/lib/typescript/src/plugin/withAndroidMath.d.ts.map +0 -1
- package/lib/typescript/src/plugin/withIosMath.d.ts +0 -5
- package/lib/typescript/src/plugin/withIosMath.d.ts.map +0 -1
- package/lib/typescript/src/plugin/withReactNativeEnrichedMarkdown.d.ts +0 -6
- package/lib/typescript/src/plugin/withReactNativeEnrichedMarkdown.d.ts.map +0 -1
- /package/{src/plugin → plugin/src}/withAndroidMath.ts +0 -0
- /package/{src/plugin → plugin/src}/withIosMath.ts +0 -0
- /package/{src/plugin → plugin/src}/withReactNativeEnrichedMarkdown.ts +0 -0
package/ios/EnrichedMarkdown.mm
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#import "EnrichedMarkdown.h"
|
|
2
2
|
#import "ContextMenuUtils.h"
|
|
3
|
+
#import "ENRMAccessibilityLabels.h"
|
|
3
4
|
#import "ENRMAsyncRenderCoordinator.h"
|
|
4
5
|
#import "ENRMImageAttachment.h"
|
|
5
6
|
#import "ENRMMarkdownParser.h"
|
|
@@ -106,6 +107,8 @@ static char kENRMSegmentFadeAnimatorKey;
|
|
|
106
107
|
NSArray<NSString *> *_contextMenuItemTexts;
|
|
107
108
|
NSArray<NSString *> *_contextMenuItemIcons;
|
|
108
109
|
ENRMSelectionMenuConfig _selectionMenuConfig;
|
|
110
|
+
ENRMAccessibilityLabels *_accessibilityLabels;
|
|
111
|
+
ENRMSelectionMenuLabels _selectionMenuLabels;
|
|
109
112
|
|
|
110
113
|
ENRMSpoilerOverlay _spoilerOverlay;
|
|
111
114
|
|
|
@@ -388,6 +391,43 @@ static char kENRMSegmentFadeAnimatorKey;
|
|
|
388
391
|
}
|
|
389
392
|
}
|
|
390
393
|
|
|
394
|
+
- (void)pushAccessibilityLabelsToSegments
|
|
395
|
+
{
|
|
396
|
+
for (RCTUIView *segment in _segmentViews) {
|
|
397
|
+
if ([segment isKindOfClass:[EnrichedMarkdownInternalText class]]) {
|
|
398
|
+
((EnrichedMarkdownInternalText *)segment).accessibilityLabels = _accessibilityLabels;
|
|
399
|
+
} else if ([segment isKindOfClass:[TableContainerView class]]) {
|
|
400
|
+
((TableContainerView *)segment).accessibilityLabels = _accessibilityLabels;
|
|
401
|
+
}
|
|
402
|
+
#if ENRICHED_MARKDOWN_MATH
|
|
403
|
+
else if ([segment isKindOfClass:[ENRMMathContainerView class]]) {
|
|
404
|
+
((ENRMMathContainerView *)segment).accessibilityLabels = _accessibilityLabels;
|
|
405
|
+
}
|
|
406
|
+
#endif
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
// Table and math views cache the copy labels at creation time, so re-push them
|
|
411
|
+
// on prop updates (e.g. a language change without a remount) to avoid stale
|
|
412
|
+
// labels. Only the copy/copy-as-markdown labels apply to these block menus.
|
|
413
|
+
- (void)pushSelectionMenuLabelsToSegments
|
|
414
|
+
{
|
|
415
|
+
for (RCTUIView *segment in _segmentViews) {
|
|
416
|
+
if ([segment isKindOfClass:[TableContainerView class]]) {
|
|
417
|
+
TableContainerView *tableView = (TableContainerView *)segment;
|
|
418
|
+
tableView.copyLabel = _selectionMenuLabels.copyLabel;
|
|
419
|
+
tableView.copyAsMarkdownLabel = _selectionMenuLabels.copyAsMarkdownLabel;
|
|
420
|
+
}
|
|
421
|
+
#if ENRICHED_MARKDOWN_MATH
|
|
422
|
+
else if ([segment isKindOfClass:[ENRMMathContainerView class]]) {
|
|
423
|
+
ENRMMathContainerView *mathView = (ENRMMathContainerView *)segment;
|
|
424
|
+
mathView.copyLabel = _selectionMenuLabels.copyLabel;
|
|
425
|
+
mathView.copyAsMarkdownLabel = _selectionMenuLabels.copyAsMarkdownLabel;
|
|
426
|
+
}
|
|
427
|
+
#endif
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
|
|
391
431
|
- (void)requestHeightUpdate
|
|
392
432
|
{
|
|
393
433
|
ENRMRequestHeightUpdate<EnrichedMarkdownState>(_state, _heightUpdateCounter, self);
|
|
@@ -549,6 +589,7 @@ static char kENRMSegmentFadeAnimatorKey;
|
|
|
549
589
|
view.allowTrailingMargin = _allowTrailingMargin;
|
|
550
590
|
view.lastElementMarginBottom = segment.lastElementMarginBottom;
|
|
551
591
|
view.accessibilityInfo = segment.accessibilityInfo;
|
|
592
|
+
view.accessibilityLabels = _accessibilityLabels;
|
|
552
593
|
view.textView.selectable = _selectable;
|
|
553
594
|
[view applyAttributedText:segment.attributedText context:segment.context];
|
|
554
595
|
|
|
@@ -599,6 +640,9 @@ static char kENRMSegmentFadeAnimatorKey;
|
|
|
599
640
|
tableView.enableLinkPreview = _enableLinkPreview;
|
|
600
641
|
tableView.writingDirectionMode = _writingDirectionMode;
|
|
601
642
|
tableView.resolvedLayoutDirection = _resolvedLayoutDirection;
|
|
643
|
+
tableView.accessibilityLabels = _accessibilityLabels;
|
|
644
|
+
tableView.copyLabel = _selectionMenuLabels.copyLabel;
|
|
645
|
+
tableView.copyAsMarkdownLabel = _selectionMenuLabels.copyAsMarkdownLabel;
|
|
602
646
|
|
|
603
647
|
__weak EnrichedMarkdown *weakSelf = self;
|
|
604
648
|
|
|
@@ -635,6 +679,9 @@ static char kENRMSegmentFadeAnimatorKey;
|
|
|
635
679
|
- (ENRMMathContainerView *)createMathViewForSegment:(ENRMMathSegment *)mathSegment
|
|
636
680
|
{
|
|
637
681
|
ENRMMathContainerView *mathView = [[ENRMMathContainerView alloc] initWithConfig:_config];
|
|
682
|
+
mathView.accessibilityLabels = _accessibilityLabels;
|
|
683
|
+
mathView.copyLabel = _selectionMenuLabels.copyLabel;
|
|
684
|
+
mathView.copyAsMarkdownLabel = _selectionMenuLabels.copyAsMarkdownLabel;
|
|
638
685
|
[mathView applyLatex:mathSegment.latex];
|
|
639
686
|
return mathView;
|
|
640
687
|
}
|
|
@@ -787,10 +834,38 @@ static char kENRMSegmentFadeAnimatorKey;
|
|
|
787
834
|
_contextMenuItemIcons = ENRMContextMenuIconsFromItems(newViewProps.contextMenuItems);
|
|
788
835
|
}
|
|
789
836
|
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
837
|
+
_selectionMenuLabels = ENRMParseSelectionMenuLabels(newViewProps.selectionMenuConfig);
|
|
838
|
+
_selectionMenuConfig =
|
|
839
|
+
ENRMBuildSelectionMenuConfig(_selectionMenuLabels, newViewProps.selectionMenuConfig.copyAsMarkdown,
|
|
840
|
+
newViewProps.selectionMenuConfig.copyImageUrl);
|
|
841
|
+
[self pushSelectionMenuLabelsToSegments];
|
|
842
|
+
|
|
843
|
+
if (ENRMAccessibilityLabelsChanged(oldViewProps.accessibilityLabels, newViewProps.accessibilityLabels)) {
|
|
844
|
+
_accessibilityLabels = [[ENRMAccessibilityLabels alloc] init];
|
|
845
|
+
_accessibilityLabels.bulletPoint =
|
|
846
|
+
[[NSString alloc] initWithUTF8String:newViewProps.accessibilityLabels.list.bulletPoint.c_str()];
|
|
847
|
+
_accessibilityLabels.nestedBulletPoint =
|
|
848
|
+
[[NSString alloc] initWithUTF8String:newViewProps.accessibilityLabels.list.nestedBulletPoint.c_str()];
|
|
849
|
+
_accessibilityLabels.orderedItem =
|
|
850
|
+
[[NSString alloc] initWithUTF8String:newViewProps.accessibilityLabels.list.orderedItem.c_str()];
|
|
851
|
+
_accessibilityLabels.nestedOrderedItem =
|
|
852
|
+
[[NSString alloc] initWithUTF8String:newViewProps.accessibilityLabels.list.nestedOrderedItem.c_str()];
|
|
853
|
+
_accessibilityLabels.blockquote =
|
|
854
|
+
[[NSString alloc] initWithUTF8String:newViewProps.accessibilityLabels.blockquote.quote.c_str()];
|
|
855
|
+
_accessibilityLabels.nestedBlockquote =
|
|
856
|
+
[[NSString alloc] initWithUTF8String:newViewProps.accessibilityLabels.blockquote.nestedQuote.c_str()];
|
|
857
|
+
_accessibilityLabels.tableRow =
|
|
858
|
+
[[NSString alloc] initWithUTF8String:newViewProps.accessibilityLabels.table.row.c_str()];
|
|
859
|
+
_accessibilityLabels.mathEquation =
|
|
860
|
+
[[NSString alloc] initWithUTF8String:newViewProps.accessibilityLabels.math.equation.c_str()];
|
|
861
|
+
_accessibilityLabels.rotorHeadings =
|
|
862
|
+
[[NSString alloc] initWithUTF8String:newViewProps.accessibilityLabels.rotor.headings.c_str()];
|
|
863
|
+
_accessibilityLabels.rotorLinks =
|
|
864
|
+
[[NSString alloc] initWithUTF8String:newViewProps.accessibilityLabels.rotor.links.c_str()];
|
|
865
|
+
_accessibilityLabels.rotorImages =
|
|
866
|
+
[[NSString alloc] initWithUTF8String:newViewProps.accessibilityLabels.rotor.images.c_str()];
|
|
867
|
+
[self pushAccessibilityLabelsToSegments];
|
|
868
|
+
}
|
|
794
869
|
|
|
795
870
|
if (newViewProps.spoilerOverlay != oldViewProps.spoilerOverlay) {
|
|
796
871
|
NSString *modeStr = [[NSString alloc] initWithUTF8String:newViewProps.spoilerOverlay.c_str()];
|
|
@@ -1070,26 +1145,7 @@ Class<RCTComponentViewProtocol> EnrichedMarkdownCls(void)
|
|
|
1070
1145
|
|
|
1071
1146
|
- (NSArray *)accessibilityElements
|
|
1072
1147
|
{
|
|
1073
|
-
|
|
1074
|
-
for (RCTUIView *segment in _segmentViews) {
|
|
1075
|
-
if ([segment isKindOfClass:[EnrichedMarkdownInternalText class]]) {
|
|
1076
|
-
NSArray *elements = [(EnrichedMarkdownInternalText *)segment accessibilityElements];
|
|
1077
|
-
if (elements) {
|
|
1078
|
-
[allElements addObjectsFromArray:elements];
|
|
1079
|
-
}
|
|
1080
|
-
} else if ([segment isKindOfClass:[TableContainerView class]]) {
|
|
1081
|
-
NSArray *elements = [(TableContainerView *)segment accessibilityElements];
|
|
1082
|
-
if (elements) {
|
|
1083
|
-
[allElements addObjectsFromArray:elements];
|
|
1084
|
-
}
|
|
1085
|
-
}
|
|
1086
|
-
#if ENRICHED_MARKDOWN_MATH
|
|
1087
|
-
else if ([segment isKindOfClass:[ENRMMathContainerView class]]) {
|
|
1088
|
-
[allElements addObject:segment];
|
|
1089
|
-
}
|
|
1090
|
-
#endif
|
|
1091
|
-
}
|
|
1092
|
-
return allElements;
|
|
1148
|
+
return _segmentViews;
|
|
1093
1149
|
}
|
|
1094
1150
|
|
|
1095
1151
|
- (NSInteger)accessibilityElementCount
|
|
@@ -1114,7 +1170,8 @@ Class<RCTComponentViewProtocol> EnrichedMarkdownCls(void)
|
|
|
1114
1170
|
#if !TARGET_OS_OSX
|
|
1115
1171
|
- (NSArray<UIAccessibilityCustomRotor *> *)accessibilityCustomRotors
|
|
1116
1172
|
{
|
|
1117
|
-
return [MarkdownAccessibilityElementBuilder buildRotorsFromElements:[self accessibilityElements]
|
|
1173
|
+
return [MarkdownAccessibilityElementBuilder buildRotorsFromElements:[self accessibilityElements]
|
|
1174
|
+
labels:_accessibilityLabels];
|
|
1118
1175
|
}
|
|
1119
1176
|
#endif
|
|
1120
1177
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#import "EnrichedMarkdownText.h"
|
|
2
2
|
#import "CodeBlockBackground.h"
|
|
3
3
|
#import "ContextMenuUtils.h"
|
|
4
|
+
#import "ENRMAccessibilityLabels.h"
|
|
4
5
|
#import "ENRMAsyncRenderCoordinator.h"
|
|
5
6
|
#import "ENRMContextMenuTextView+macOS.h"
|
|
6
7
|
#import "ENRMImageAttachment.h"
|
|
@@ -88,6 +89,7 @@ typedef NS_OPTIONS(NSUInteger, ENRMDirtyFlags) {
|
|
|
88
89
|
ENRMTailFadeInAnimator *_fadeAnimator;
|
|
89
90
|
|
|
90
91
|
AccessibilityInfo *_accessibilityInfo;
|
|
92
|
+
ENRMAccessibilityLabels *_accessibilityLabels;
|
|
91
93
|
#if !TARGET_OS_OSX
|
|
92
94
|
NSMutableArray<UIAccessibilityElement *> *_accessibilityElements;
|
|
93
95
|
#else
|
|
@@ -98,6 +100,7 @@ typedef NS_OPTIONS(NSUInteger, ENRMDirtyFlags) {
|
|
|
98
100
|
NSArray<NSString *> *_contextMenuItemTexts;
|
|
99
101
|
NSArray<NSString *> *_contextMenuItemIcons;
|
|
100
102
|
ENRMSelectionMenuConfig _selectionMenuConfig;
|
|
103
|
+
ENRMSelectionMenuLabels _selectionMenuLabels;
|
|
101
104
|
|
|
102
105
|
ENRMSpoilerOverlayManager *_spoilerManager;
|
|
103
106
|
|
|
@@ -534,10 +537,37 @@ typedef NS_OPTIONS(NSUInteger, ENRMDirtyFlags) {
|
|
|
534
537
|
_contextMenuItemIcons = ENRMContextMenuIconsFromItems(newViewProps.contextMenuItems);
|
|
535
538
|
}
|
|
536
539
|
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
540
|
+
_selectionMenuLabels = ENRMParseSelectionMenuLabels(newViewProps.selectionMenuConfig);
|
|
541
|
+
_selectionMenuConfig =
|
|
542
|
+
ENRMBuildSelectionMenuConfig(_selectionMenuLabels, newViewProps.selectionMenuConfig.copyAsMarkdown,
|
|
543
|
+
newViewProps.selectionMenuConfig.copyImageUrl);
|
|
544
|
+
|
|
545
|
+
if (ENRMAccessibilityLabelsChanged(oldViewProps.accessibilityLabels, newViewProps.accessibilityLabels)) {
|
|
546
|
+
_accessibilityLabels = [[ENRMAccessibilityLabels alloc] init];
|
|
547
|
+
_accessibilityLabels.bulletPoint =
|
|
548
|
+
[[NSString alloc] initWithUTF8String:newViewProps.accessibilityLabels.list.bulletPoint.c_str()];
|
|
549
|
+
_accessibilityLabels.nestedBulletPoint =
|
|
550
|
+
[[NSString alloc] initWithUTF8String:newViewProps.accessibilityLabels.list.nestedBulletPoint.c_str()];
|
|
551
|
+
_accessibilityLabels.orderedItem =
|
|
552
|
+
[[NSString alloc] initWithUTF8String:newViewProps.accessibilityLabels.list.orderedItem.c_str()];
|
|
553
|
+
_accessibilityLabels.nestedOrderedItem =
|
|
554
|
+
[[NSString alloc] initWithUTF8String:newViewProps.accessibilityLabels.list.nestedOrderedItem.c_str()];
|
|
555
|
+
_accessibilityLabels.blockquote =
|
|
556
|
+
[[NSString alloc] initWithUTF8String:newViewProps.accessibilityLabels.blockquote.quote.c_str()];
|
|
557
|
+
_accessibilityLabels.nestedBlockquote =
|
|
558
|
+
[[NSString alloc] initWithUTF8String:newViewProps.accessibilityLabels.blockquote.nestedQuote.c_str()];
|
|
559
|
+
_accessibilityLabels.tableRow =
|
|
560
|
+
[[NSString alloc] initWithUTF8String:newViewProps.accessibilityLabels.table.row.c_str()];
|
|
561
|
+
_accessibilityLabels.mathEquation =
|
|
562
|
+
[[NSString alloc] initWithUTF8String:newViewProps.accessibilityLabels.math.equation.c_str()];
|
|
563
|
+
_accessibilityLabels.rotorHeadings =
|
|
564
|
+
[[NSString alloc] initWithUTF8String:newViewProps.accessibilityLabels.rotor.headings.c_str()];
|
|
565
|
+
_accessibilityLabels.rotorLinks =
|
|
566
|
+
[[NSString alloc] initWithUTF8String:newViewProps.accessibilityLabels.rotor.links.c_str()];
|
|
567
|
+
_accessibilityLabels.rotorImages =
|
|
568
|
+
[[NSString alloc] initWithUTF8String:newViewProps.accessibilityLabels.rotor.images.c_str()];
|
|
569
|
+
_accessibilityNeedsRebuild = YES;
|
|
570
|
+
}
|
|
541
571
|
|
|
542
572
|
if (newViewProps.streamingAnimation != oldViewProps.streamingAnimation) {
|
|
543
573
|
_streamingAnimation = newViewProps.streamingAnimation;
|
|
@@ -753,6 +783,7 @@ Class<RCTComponentViewProtocol> EnrichedMarkdownTextCls(void)
|
|
|
753
783
|
#if !TARGET_OS_OSX
|
|
754
784
|
_accessibilityElements = [MarkdownAccessibilityElementBuilder buildElementsForTextView:_textView
|
|
755
785
|
info:_accessibilityInfo
|
|
786
|
+
labels:_accessibilityLabels
|
|
756
787
|
container:self];
|
|
757
788
|
#else
|
|
758
789
|
_accessibilityElements = [NSMutableArray array];
|
|
@@ -795,7 +826,8 @@ Class<RCTComponentViewProtocol> EnrichedMarkdownTextCls(void)
|
|
|
795
826
|
- (NSArray<UIAccessibilityCustomRotor *> *)accessibilityCustomRotors
|
|
796
827
|
{
|
|
797
828
|
[self rebuildAccessibilityElementsIfNeeded];
|
|
798
|
-
return [MarkdownAccessibilityElementBuilder buildRotorsFromElements:_accessibilityElements
|
|
829
|
+
return [MarkdownAccessibilityElementBuilder buildRotorsFromElements:_accessibilityElements
|
|
830
|
+
labels:_accessibilityLabels];
|
|
799
831
|
}
|
|
800
832
|
#endif
|
|
801
833
|
|
|
@@ -34,6 +34,7 @@ EnrichedMarkdownProps::EnrichedMarkdownProps(
|
|
|
34
34
|
spoilerOverlay(convertRawProp(context, rawProps, "spoilerOverlay", sourceProps.spoilerOverlay, {std::string{"particles"}})),
|
|
35
35
|
contextMenuItems(convertRawProp(context, rawProps, "contextMenuItems", sourceProps.contextMenuItems, {})),
|
|
36
36
|
selectionMenuConfig(convertRawProp(context, rawProps, "selectionMenuConfig", sourceProps.selectionMenuConfig, {})),
|
|
37
|
+
accessibilityLabels(convertRawProp(context, rawProps, "accessibilityLabels", sourceProps.accessibilityLabels, {})),
|
|
37
38
|
textBreakStrategy(convertRawProp(context, rawProps, "textBreakStrategy", sourceProps.textBreakStrategy, {std::string{"highQuality"}})),
|
|
38
39
|
lineBreakStrategyIOS(convertRawProp(context, rawProps, "lineBreakStrategyIOS", sourceProps.lineBreakStrategyIOS, {std::string{"none"}})),
|
|
39
40
|
writingDirection(convertRawProp(context, rawProps, "writingDirection", sourceProps.writingDirection, {std::string{"first-strong"}})) {}
|
|
@@ -114,6 +115,10 @@ folly::dynamic EnrichedMarkdownProps::getDiffProps(
|
|
|
114
115
|
result["selectionMenuConfig"] = toDynamic(selectionMenuConfig);
|
|
115
116
|
}
|
|
116
117
|
|
|
118
|
+
if (accessibilityLabels != oldProps->accessibilityLabels) {
|
|
119
|
+
result["accessibilityLabels"] = toDynamic(accessibilityLabels);
|
|
120
|
+
}
|
|
121
|
+
|
|
117
122
|
if (textBreakStrategy != oldProps->textBreakStrategy) {
|
|
118
123
|
result["textBreakStrategy"] = textBreakStrategy;
|
|
119
124
|
}
|
|
@@ -151,6 +156,8 @@ EnrichedMarkdownTextInputProps::EnrichedMarkdownTextInputProps(
|
|
|
151
156
|
fontWeight(convertRawProp(context, rawProps, "fontWeight", sourceProps.fontWeight, {})),
|
|
152
157
|
isOnChangeMarkdownSet(convertRawProp(context, rawProps, "isOnChangeMarkdownSet", sourceProps.isOnChangeMarkdownSet, {false})),
|
|
153
158
|
contextMenuItems(convertRawProp(context, rawProps, "contextMenuItems", sourceProps.contextMenuItems, {})),
|
|
159
|
+
selectionMenuConfig(convertRawProp(context, rawProps, "selectionMenuConfig", sourceProps.selectionMenuConfig, {})),
|
|
160
|
+
formatMenuConfig(convertRawProp(context, rawProps, "formatMenuConfig", sourceProps.formatMenuConfig, {})),
|
|
154
161
|
linkRegex(convertRawProp(context, rawProps, "linkRegex", sourceProps.linkRegex, {})),
|
|
155
162
|
mentionIndicators(convertRawProp(context, rawProps, "mentionIndicators", sourceProps.mentionIndicators, {})),
|
|
156
163
|
writingDirection(convertRawProp(context, rawProps, "writingDirection", sourceProps.writingDirection, {std::string{"first-strong"}})) {}
|
|
@@ -243,6 +250,14 @@ folly::dynamic EnrichedMarkdownTextInputProps::getDiffProps(
|
|
|
243
250
|
result["contextMenuItems"] = toDynamic(contextMenuItems);
|
|
244
251
|
}
|
|
245
252
|
|
|
253
|
+
if (selectionMenuConfig != oldProps->selectionMenuConfig) {
|
|
254
|
+
result["selectionMenuConfig"] = toDynamic(selectionMenuConfig);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
if (formatMenuConfig != oldProps->formatMenuConfig) {
|
|
258
|
+
result["formatMenuConfig"] = toDynamic(formatMenuConfig);
|
|
259
|
+
}
|
|
260
|
+
|
|
246
261
|
if (linkRegex != oldProps->linkRegex) {
|
|
247
262
|
result["linkRegex"] = toDynamic(linkRegex);
|
|
248
263
|
}
|
|
@@ -277,6 +292,7 @@ EnrichedMarkdownTextProps::EnrichedMarkdownTextProps(
|
|
|
277
292
|
spoilerOverlay(convertRawProp(context, rawProps, "spoilerOverlay", sourceProps.spoilerOverlay, {std::string{"particles"}})),
|
|
278
293
|
contextMenuItems(convertRawProp(context, rawProps, "contextMenuItems", sourceProps.contextMenuItems, {})),
|
|
279
294
|
selectionMenuConfig(convertRawProp(context, rawProps, "selectionMenuConfig", sourceProps.selectionMenuConfig, {})),
|
|
295
|
+
accessibilityLabels(convertRawProp(context, rawProps, "accessibilityLabels", sourceProps.accessibilityLabels, {})),
|
|
280
296
|
textBreakStrategy(convertRawProp(context, rawProps, "textBreakStrategy", sourceProps.textBreakStrategy, {std::string{"highQuality"}})),
|
|
281
297
|
lineBreakStrategyIOS(convertRawProp(context, rawProps, "lineBreakStrategyIOS", sourceProps.lineBreakStrategyIOS, {std::string{"none"}})),
|
|
282
298
|
writingDirection(convertRawProp(context, rawProps, "writingDirection", sourceProps.writingDirection, {std::string{"first-strong"}})) {}
|
|
@@ -357,6 +373,10 @@ folly::dynamic EnrichedMarkdownTextProps::getDiffProps(
|
|
|
357
373
|
result["selectionMenuConfig"] = toDynamic(selectionMenuConfig);
|
|
358
374
|
}
|
|
359
375
|
|
|
376
|
+
if (accessibilityLabels != oldProps->accessibilityLabels) {
|
|
377
|
+
result["accessibilityLabels"] = toDynamic(accessibilityLabels);
|
|
378
|
+
}
|
|
379
|
+
|
|
360
380
|
if (textBreakStrategy != oldProps->textBreakStrategy) {
|
|
361
381
|
result["textBreakStrategy"] = textBreakStrategy;
|
|
362
382
|
}
|