From 779fbb387a0944f77729477d14f261142d31a0c8 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Wed, 21 Aug 2024 10:56:28 +0800 Subject: [PATCH 1/4] update to fix autolink doesn't work if put before img markdown --- ios/Podfile.lock | 8 ++++---- package-lock.json | 16 ++++++++-------- package.json | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index e665278197b6..0b1847863a3f 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1871,7 +1871,7 @@ PODS: - RNGoogleSignin (10.0.1): - GoogleSignIn (~> 7.0) - React-Core - - RNLiveMarkdown (0.1.113): + - RNLiveMarkdown (0.1.116): - glog - hermes-engine - RCT-Folly (= 2022.05.16.00) @@ -1889,9 +1889,9 @@ PODS: - React-utils - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - - RNLiveMarkdown/common (= 0.1.113) + - RNLiveMarkdown/common (= 0.1.116) - Yoga - - RNLiveMarkdown/common (0.1.113): + - RNLiveMarkdown/common (0.1.116): - glog - hermes-engine - RCT-Folly (= 2022.05.16.00) @@ -2614,7 +2614,7 @@ SPEC CHECKSUMS: RNFS: 4ac0f0ea233904cb798630b3c077808c06931688 RNGestureHandler: 74b7b3d06d667ba0bbf41da7718f2607ae0dfe8f RNGoogleSignin: ccaa4a81582cf713eea562c5dd9dc1961a715fd0 - RNLiveMarkdown: 235376cd828014e8bad6949ea5bb202688fa5bb0 + RNLiveMarkdown: 19b5b73960ca70a47582c9376bb20e6dc52f021e RNLocalize: d4b8af4e442d4bcca54e68fc687a2129b4d71a81 rnmapbox-maps: df8fe93dbd251f25022f4023d31bc04160d4d65c RNPermissions: d2392b754e67bc14491f5b12588bef2864e783f3 diff --git a/package-lock.json b/package-lock.json index 4c0b1948c009..47ed9331a4bc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@babel/plugin-proposal-private-methods": "^7.18.6", "@babel/plugin-proposal-private-property-in-object": "^7.21.11", "@dotlottie/react-player": "^1.6.3", - "@expensify/react-native-live-markdown": "^0.1.113", + "@expensify/react-native-live-markdown": "^0.1.115", "@expo/metro-runtime": "~3.1.1", "@formatjs/intl-datetimeformat": "^6.10.0", "@formatjs/intl-listformat": "^7.2.2", @@ -55,7 +55,7 @@ "date-fns-tz": "^2.0.0", "dom-serializer": "^0.2.2", "domhandler": "^4.3.0", - "expensify-common": "2.0.72", + "expensify-common": "2.0.76", "expo": "^50.0.3", "expo-av": "~13.10.4", "expo-image": "1.11.0", @@ -3952,9 +3952,9 @@ } }, "node_modules/@expensify/react-native-live-markdown": { - "version": "0.1.113", - "resolved": "https://registry.npmjs.org/@expensify/react-native-live-markdown/-/react-native-live-markdown-0.1.113.tgz", - "integrity": "sha512-MeZTqW1Dd2oUAVmedaU6p/TE+mmhWibSkcz8VC10PyCn6HkwO7ZykaSXMjsJHoUyvx9vYaG/4iF9enWXe4+h5w==", + "version": "0.1.116", + "resolved": "https://registry.npmjs.org/@expensify/react-native-live-markdown/-/react-native-live-markdown-0.1.116.tgz", + "integrity": "sha512-+l3SarKLyHUaeRWl+FU/Hrjk0iz5Caeps+aBfQgR5T1XQITDYtpSAruy4ZCw0R0wC6l7c44z8tDU7g5Biniq+A==", "workspaces": [ "parser", "example", @@ -26135,9 +26135,9 @@ } }, "node_modules/expensify-common": { - "version": "2.0.72", - "resolved": "https://registry.npmjs.org/expensify-common/-/expensify-common-2.0.72.tgz", - "integrity": "sha512-/mrlSic8y3D7pbbGMe3ZtDhHOS+WmrqgBEy3P/o9qW6CFpczs9cqjp9DfF8L53qvGtiD7cm5au4tapj01Yas/g==", + "version": "2.0.76", + "resolved": "https://registry.npmjs.org/expensify-common/-/expensify-common-2.0.76.tgz", + "integrity": "sha512-nCM6laaj25kurdiD9rhAXmQKhi8eciIFlshN8P4A7gsjFIScXnRG8fwXM5tX+8ET0vqAOA2SACeNVTT3vGUUsQ==", "dependencies": { "awesome-phonenumber": "^5.4.0", "classnames": "2.5.0", diff --git a/package.json b/package.json index 679ca1793b2d..179e3162c214 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,7 @@ "@babel/plugin-proposal-private-methods": "^7.18.6", "@babel/plugin-proposal-private-property-in-object": "^7.21.11", "@dotlottie/react-player": "^1.6.3", - "@expensify/react-native-live-markdown": "^0.1.113", + "@expensify/react-native-live-markdown": "^0.1.115", "@expo/metro-runtime": "~3.1.1", "@formatjs/intl-datetimeformat": "^6.10.0", "@formatjs/intl-listformat": "^7.2.2", @@ -111,7 +111,7 @@ "date-fns-tz": "^2.0.0", "dom-serializer": "^0.2.2", "domhandler": "^4.3.0", - "expensify-common": "2.0.72", + "expensify-common": "2.0.76", "expo": "^50.0.3", "expo-av": "~13.10.4", "expo-image": "1.11.0", From 7c045ab7b966a05d6a8063f9f5c5bd3fffd62941 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Wed, 21 Aug 2024 10:56:38 +0800 Subject: [PATCH 2/4] pass alt to the image --- .../HTMLEngineProvider/HTMLRenderers/ImageRenderer.tsx | 2 ++ src/components/ImageWithSizeCalculation.tsx | 6 +++++- src/components/ThumbnailImage.tsx | 5 +++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.tsx b/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.tsx index 1e73cce1630f..5eb7290fa3aa 100644 --- a/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.tsx +++ b/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.tsx @@ -57,6 +57,7 @@ function ImageRenderer({tnode}: ImageRendererProps) { const previewSource = tryResolveUrlFromApiRoot(htmlAttribs.src); const source = tryResolveUrlFromApiRoot(isAttachmentOrReceipt ? attachmentSourceAttribute : htmlAttribs.src); + const alt = htmlAttribs.alt const imageWidth = (htmlAttribs['data-expensify-width'] && parseInt(htmlAttribs['data-expensify-width'], 10)) || undefined; const imageHeight = (htmlAttribs['data-expensify-height'] && parseInt(htmlAttribs['data-expensify-height'], 10)) || undefined; const imagePreviewModalDisabled = htmlAttribs['data-expensify-preview-modal-disabled'] === 'true'; @@ -71,6 +72,7 @@ function ImageRenderer({tnode}: ImageRendererProps) { fallbackIcon={fallbackIcon} imageWidth={imageWidth} imageHeight={imageHeight} + altText={alt} /> ); diff --git a/src/components/ImageWithSizeCalculation.tsx b/src/components/ImageWithSizeCalculation.tsx index 3d940103715d..c25ce07f44be 100644 --- a/src/components/ImageWithSizeCalculation.tsx +++ b/src/components/ImageWithSizeCalculation.tsx @@ -25,6 +25,9 @@ type ImageWithSizeCalculationProps = { /** Url for image to display */ url: string | ImageSourcePropType; + /** alt text for the image */ + altText: string; + /** Any additional styles to apply */ style?: StyleProp; @@ -46,7 +49,7 @@ type ImageWithSizeCalculationProps = { * performing some calculation on a network image after fetching dimensions so * it can be appropriately resized. */ -function ImageWithSizeCalculation({url, style, onMeasure, onLoadFailure, isAuthTokenRequired, objectPosition = CONST.IMAGE_OBJECT_POSITION.INITIAL}: ImageWithSizeCalculationProps) { +function ImageWithSizeCalculation({url, altText, style, onMeasure, onLoadFailure, isAuthTokenRequired, objectPosition = CONST.IMAGE_OBJECT_POSITION.INITIAL}: ImageWithSizeCalculationProps) { const styles = useThemeStyles(); const isLoadedRef = useRef(null); const [isImageCached, setIsImageCached] = useState(true); @@ -97,6 +100,7 @@ function ImageWithSizeCalculation({url, style, onMeasure, onLoadFailure, isAuthT { diff --git a/src/components/ThumbnailImage.tsx b/src/components/ThumbnailImage.tsx index 04d0200ea228..d457d0ae5dd7 100644 --- a/src/components/ThumbnailImage.tsx +++ b/src/components/ThumbnailImage.tsx @@ -23,6 +23,9 @@ type ThumbnailImageProps = { /** Source URL for the preview image */ previewSourceURL: string | ImageSourcePropType; + /** alt text for the image */ + altText: string; + /** Any additional styles to apply */ style?: StyleProp; @@ -61,6 +64,7 @@ type UpdateImageSizeParams = { function ThumbnailImage({ previewSourceURL, + altText, style, isAuthTokenRequired, imageWidth = 200, @@ -132,6 +136,7 @@ function ThumbnailImage({ setFailedToLoad(true)} isAuthTokenRequired={isAuthTokenRequired} From f830c70838c4164de83335479f2c5d764935e4cb Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Wed, 21 Aug 2024 11:06:12 +0800 Subject: [PATCH 3/4] prettier --- .../HTMLEngineProvider/HTMLRenderers/ImageRenderer.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.tsx b/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.tsx index 5eb7290fa3aa..12e2f11d943a 100644 --- a/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.tsx +++ b/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.tsx @@ -57,7 +57,7 @@ function ImageRenderer({tnode}: ImageRendererProps) { const previewSource = tryResolveUrlFromApiRoot(htmlAttribs.src); const source = tryResolveUrlFromApiRoot(isAttachmentOrReceipt ? attachmentSourceAttribute : htmlAttribs.src); - const alt = htmlAttribs.alt + const alt = htmlAttribs.alt; const imageWidth = (htmlAttribs['data-expensify-width'] && parseInt(htmlAttribs['data-expensify-width'], 10)) || undefined; const imageHeight = (htmlAttribs['data-expensify-height'] && parseInt(htmlAttribs['data-expensify-height'], 10)) || undefined; const imagePreviewModalDisabled = htmlAttribs['data-expensify-preview-modal-disabled'] === 'true'; From cdf7fc70daa9983ca23c4aaf0db97c102b3dbc62 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Wed, 21 Aug 2024 11:12:56 +0800 Subject: [PATCH 4/4] typing --- src/components/ImageWithSizeCalculation.tsx | 2 +- src/components/ThumbnailImage.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/ImageWithSizeCalculation.tsx b/src/components/ImageWithSizeCalculation.tsx index c25ce07f44be..ebea1a90efca 100644 --- a/src/components/ImageWithSizeCalculation.tsx +++ b/src/components/ImageWithSizeCalculation.tsx @@ -26,7 +26,7 @@ type ImageWithSizeCalculationProps = { url: string | ImageSourcePropType; /** alt text for the image */ - altText: string; + altText?: string; /** Any additional styles to apply */ style?: StyleProp; diff --git a/src/components/ThumbnailImage.tsx b/src/components/ThumbnailImage.tsx index d457d0ae5dd7..cea528e4537c 100644 --- a/src/components/ThumbnailImage.tsx +++ b/src/components/ThumbnailImage.tsx @@ -24,7 +24,7 @@ type ThumbnailImageProps = { previewSourceURL: string | ImageSourcePropType; /** alt text for the image */ - altText: string; + altText?: string; /** Any additional styles to apply */ style?: StyleProp;