From 51db8c99e7129b9efd4562e2ca1114040bac9900 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ska=C5=82ka?= Date: Wed, 2 Oct 2024 12:11:57 +0200 Subject: [PATCH 01/11] Bump react-native-live-markdown version to 0.1.159 --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 63289b8fe09e..d8c7d66c37c8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "license": "MIT", "dependencies": { "@dotlottie/react-player": "^1.6.3", - "@expensify/react-native-live-markdown": "0.1.143", + "@expensify/react-native-live-markdown": "0.1.159", "@expo/metro-runtime": "~3.2.3", "@firebase/app": "^0.10.10", "@firebase/performance": "^0.6.8", @@ -3634,9 +3634,9 @@ } }, "node_modules/@expensify/react-native-live-markdown": { - "version": "0.1.143", - "resolved": "https://registry.npmjs.org/@expensify/react-native-live-markdown/-/react-native-live-markdown-0.1.143.tgz", - "integrity": "sha512-hZXYjKyTl/b2p7Ig9qhoB7cfVtTTcoE2cWvea8NJT3f5ZYckdyHDAgHI4pg0S0N68jP205Sk5pzqlltZUpZk5w==", + "version": "0.1.159", + "resolved": "https://registry.npmjs.org/@expensify/react-native-live-markdown/-/react-native-live-markdown-0.1.159.tgz", + "integrity": "sha512-UKjEdERbaG7FMH2+r6lSjnSoic1f3UL2r37qkuJ8vV5UKyG3Nw/akoZwt6kBuRKrM9DGzK6Yc2b9HGhR0/wUMA==", "workspaces": [ "parser", "example", diff --git a/package.json b/package.json index 4a27764c33ee..33b07d304aef 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ }, "dependencies": { "@dotlottie/react-player": "^1.6.3", - "@expensify/react-native-live-markdown": "0.1.143", + "@expensify/react-native-live-markdown": "0.1.159", "@expo/metro-runtime": "~3.2.3", "@firebase/app": "^0.10.10", "@firebase/performance": "^0.6.8", From 91dc1ed8e0eb293ff4f9ef3086ce2b6a730097e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ska=C5=82ka?= Date: Wed, 2 Oct 2024 12:17:25 +0200 Subject: [PATCH 02/11] Add styles for inline images --- src/hooks/useMarkdownStyle.ts | 13 +++++++++++++ src/styles/variables.ts | 3 +++ 2 files changed, 16 insertions(+) diff --git a/src/hooks/useMarkdownStyle.ts b/src/hooks/useMarkdownStyle.ts index c7e9bf2c0218..2006ca85dd13 100644 --- a/src/hooks/useMarkdownStyle.ts +++ b/src/hooks/useMarkdownStyle.ts @@ -75,6 +75,19 @@ function useMarkdownStyle(message: string | null = null, excludeStyles: Array Date: Wed, 2 Oct 2024 12:22:49 +0200 Subject: [PATCH 03/11] Fix mention suggestion box position --- src/components/Composer/index.tsx | 121 ++++++++++-------------------- 1 file changed, 38 insertions(+), 83 deletions(-) diff --git a/src/components/Composer/index.tsx b/src/components/Composer/index.tsx index 72116a346c00..347287045849 100755 --- a/src/components/Composer/index.tsx +++ b/src/components/Composer/index.tsx @@ -2,13 +2,11 @@ import type {MarkdownStyle} from '@expensify/react-native-live-markdown'; import lodashDebounce from 'lodash/debounce'; import type {BaseSyntheticEvent, ForwardedRef} from 'react'; import React, {useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState} from 'react'; -import {flushSync} from 'react-dom'; // eslint-disable-next-line no-restricted-imports -import type {NativeSyntheticEvent, Text as RNText, TextInput, TextInputKeyPressEventData, TextInputSelectionChangeEventData, ViewStyle} from 'react-native'; -import {DeviceEventEmitter, StyleSheet, View} from 'react-native'; +import type {NativeSyntheticEvent, TextInput, TextInputKeyPressEventData, TextInputSelectionChangeEventData} from 'react-native'; +import {DeviceEventEmitter, StyleSheet} from 'react-native'; import type {AnimatedMarkdownTextInputRef} from '@components/RNMarkdownTextInput'; import RNMarkdownTextInput from '@components/RNMarkdownTextInput'; -import Text from '@components/Text'; import useHtmlPaste from '@hooks/useHtmlPaste'; import useIsScrollBarVisible from '@hooks/useIsScrollBarVisible'; import useMarkdownStyle from '@hooks/useMarkdownStyle'; @@ -23,29 +21,6 @@ import isEnterWhileComposition from '@libs/KeyboardShortcut/isEnterWhileComposit import CONST from '@src/CONST'; import type {ComposerProps} from './types'; -/** - * Retrieves the characters from the specified cursor position up to the next space or new line. - * - * @param inputString - The input string. - * @param cursorPosition - The position of the cursor within the input string. - * @returns - The substring from the cursor position up to the next space or new line. - * If no space or new line is found, returns the substring from the cursor position to the end of the input string. - */ -const getNextChars = (inputString: string, cursorPosition: number): string => { - // Get the substring starting from the cursor position - const subString = inputString.substring(cursorPosition); - - // Find the index of the next space or new line character - const spaceIndex = subString.search(/[ \n]/); - - if (spaceIndex === -1) { - return subString; - } - - // If there is a space or new line, return the substring up to the space or new line - return subString.substring(0, spaceIndex); -}; - const excludeNoStyles: Array = []; const excludeReportMentionStyle: Array = ['mentionReport']; @@ -82,7 +57,6 @@ function Composer( const styles = useThemeStyles(); const markdownStyle = useMarkdownStyle(value, !isGroupPolicyReport ? excludeReportMentionStyle : excludeNoStyles); const StyleUtils = useStyleUtils(); - const textRef = useRef(null); const textInput = useRef(null); const [selection, setSelection] = useState< | { @@ -96,9 +70,6 @@ function Composer( start: selectionProp.start, end: selectionProp.end, }); - const [caretContent, setCaretContent] = useState(''); - const [valueBeforeCaret, setValueBeforeCaret] = useState(''); - const [textInputWidth, setTextInputWidth] = useState(''); const [isRendered, setIsRendered] = useState(false); const isScrollBarVisible = useIsScrollBarVisible(textInput, value ?? ''); const [prevScroll, setPrevScroll] = useState(); @@ -117,17 +88,25 @@ function Composer( */ const addCursorPositionToSelectionChange = (event: NativeSyntheticEvent) => { const webEvent = event as BaseSyntheticEvent; - if (shouldCalculateCaretPosition && isRendered) { - // we do flushSync to make sure that the valueBeforeCaret is updated before we calculate the caret position to receive a proper position otherwise we will calculate position for the previous state - flushSync(() => { - setValueBeforeCaret((webEvent.target as HTMLInputElement).value.slice(0, webEvent.nativeEvent.selection.start)); - setCaretContent(getNextChars(value ?? '', webEvent.nativeEvent.selection.start)); - }); + const sel = window.getSelection(); + if (shouldCalculateCaretPosition && isRendered && sel) { + const range = sel.getRangeAt(0).cloneRange(); + range.collapse(true); + const rect = range.getClientRects()[0]; + const containerRect = textInput.current?.getBoundingClientRect(); + + let x = 0; + let y = 0; + if (rect && containerRect) { + x = rect.left - containerRect.left; + y = rect.top - containerRect.top - rect.height / 2; + } + const selectionValue = { start: webEvent.nativeEvent.selection.start, end: webEvent.nativeEvent.selection.end, - positionX: (textRef.current?.offsetLeft ?? 0) - CONST.SPACE_CHARACTER_WIDTH, - positionY: textRef.current?.offsetTop, + positionX: x - CONST.SPACE_CHARACTER_WIDTH, + positionY: y, }; onSelectionChange({ @@ -334,26 +313,6 @@ function Composer( [onKeyPress], ); - const renderElementForCaretPosition = ( - - - {`${valueBeforeCaret} `} - - {`${caretContent}`} - - - - ); - const scrollStyleMemo = useMemo(() => { if (shouldContainScroll) { return isScrollBarVisible ? [styles.overflowScroll, styles.overscrollBehaviorContain] : styles.overflowHidden; @@ -376,30 +335,26 @@ function Composer( ); return ( - <> - (textInput.current = el)} - selection={selection} - style={[inputStyleMemo]} - markdownStyle={markdownStyle} - value={value} - defaultValue={defaultValue} - autoFocus={autoFocus} - /* eslint-disable-next-line react/jsx-props-no-spreading */ - {...props} - onSelectionChange={addCursorPositionToSelectionChange} - onContentSizeChange={(e) => { - setTextInputWidth(`${e.nativeEvent.contentSize.width}px`); - updateIsFullComposerAvailable({maxLines, isComposerFullSize, isDisabled, setIsFullComposerAvailable}, e, styles); - }} - disabled={isDisabled} - onKeyPress={handleKeyPress} - /> - {shouldCalculateCaretPosition && renderElementForCaretPosition} - + (textInput.current = el)} + selection={selection} + style={[inputStyleMemo]} + markdownStyle={markdownStyle} + value={value} + defaultValue={defaultValue} + autoFocus={autoFocus} + /* eslint-disable-next-line react/jsx-props-no-spreading */ + {...props} + onSelectionChange={addCursorPositionToSelectionChange} + onContentSizeChange={(e) => { + updateIsFullComposerAvailable({maxLines, isComposerFullSize, isDisabled, setIsFullComposerAvailable}, e, styles); + }} + disabled={isDisabled} + onKeyPress={handleKeyPress} + /> ); } From 9aa424dfe3e2d9873443ffde3ddacf2eda3e81cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ska=C5=82ka?= Date: Wed, 2 Oct 2024 12:53:04 +0200 Subject: [PATCH 04/11] Update Podfile --- ios/Podfile.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 64f8e0365423..860e5bde9642 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1968,7 +1968,7 @@ PODS: - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - Yoga - - react-native-view-shot (4.0.0-alpha.3): + - react-native-view-shot (3.8.0): - React-Core - react-native-webview (13.8.6): - DoubleConversion @@ -2382,7 +2382,7 @@ PODS: - RNGoogleSignin (10.0.1): - GoogleSignIn (~> 7.0) - React-Core - - RNLiveMarkdown (0.1.143): + - RNLiveMarkdown (0.1.159): - DoubleConversion - glog - hermes-engine @@ -2402,9 +2402,9 @@ PODS: - ReactCodegen - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - - RNLiveMarkdown/common (= 0.1.143) + - RNLiveMarkdown/common (= 0.1.159) - Yoga - - RNLiveMarkdown/common (0.1.143): + - RNLiveMarkdown/common (0.1.159): - DoubleConversion - glog - hermes-engine @@ -3218,7 +3218,7 @@ SPEC CHECKSUMS: react-native-quick-sqlite: 7c793c9f5834e756b336257a8d8b8239b7ceb451 react-native-release-profiler: 131ec5e4145d900b2be2a8d6641e2ce0dd784259 react-native-safe-area-context: 38fdd9b3c5561de7cabae64bd0cd2ce05d2768a1 - react-native-view-shot: ee44129a7c470310d3c7e67085834fc8cc077655 + react-native-view-shot: 6b7ed61d77d88580fed10954d45fad0eb2d47688 react-native-webview: ad29375839c9aa0409ce8e8693291b42bdc067a4 React-nativeconfig: 57781b79e11d5af7573e6f77cbf1143b71802a6d React-NativeModulesApple: 7ff2e2cfb2e5fa5bdedcecf28ce37e696c6ef1e1 @@ -3259,7 +3259,7 @@ SPEC CHECKSUMS: RNFS: 4ac0f0ea233904cb798630b3c077808c06931688 RNGestureHandler: 8781e2529230a1bc3ea8d75e5c3cd071b6c6aed7 RNGoogleSignin: ccaa4a81582cf713eea562c5dd9dc1961a715fd0 - RNLiveMarkdown: e44918843c2638692348f39eafc275698baf0444 + RNLiveMarkdown: 2d97e3f4952c642cdd31bc05555e44dc5edcdba1 RNLocalize: d4b8af4e442d4bcca54e68fc687a2129b4d71a81 rnmapbox-maps: 460d6ff97ae49c7d5708c3212c6521697c36a0c4 RNPermissions: 0b1429b55af59d1d08b75a8be2459f65a8ac3f28 @@ -3276,7 +3276,7 @@ SPEC CHECKSUMS: SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d Turf: aa2ede4298009639d10db36aba1a7ebaad072a5e VisionCamera: c6c8aa4b028501fc87644550fbc35a537d4da3fb - Yoga: 2a45d7e59592db061217551fd3bbe2dd993817ae + Yoga: a1d7895431387402a674fd0d1c04ec85e87909b8 PODFILE CHECKSUM: 15e2f095b9c80d658459723edf84005a6867debf From ab3429a3476a6a5e576d3854e84bf5bb30fd5d0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ska=C5=82ka?= Date: Thu, 3 Oct 2024 10:50:28 +0200 Subject: [PATCH 05/11] Fix mention suggestion box position when input is scrollable --- src/components/Composer/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Composer/index.tsx b/src/components/Composer/index.tsx index 347287045849..5e9fa77e6dfc 100755 --- a/src/components/Composer/index.tsx +++ b/src/components/Composer/index.tsx @@ -99,7 +99,7 @@ function Composer( let y = 0; if (rect && containerRect) { x = rect.left - containerRect.left; - y = rect.top - containerRect.top - rect.height / 2; + y = rect.top - containerRect.top - rect.height / 2 + (textInput?.current?.scrollTop ?? 0); } const selectionValue = { From 8c0c879ab0c608640ff9b123e88216697e8c6b60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ska=C5=82ka?= Date: Thu, 3 Oct 2024 10:50:39 +0200 Subject: [PATCH 06/11] Bump react-native-live-markdown version to 0.1.163 --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index b534a8eab44d..8ec84b3ecd6d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "license": "MIT", "dependencies": { "@dotlottie/react-player": "^1.6.3", - "@expensify/react-native-live-markdown": "0.1.159", + "@expensify/react-native-live-markdown": "0.1.163", "@expo/metro-runtime": "~3.2.3", "@firebase/app": "^0.10.10", "@firebase/performance": "^0.6.8", @@ -3634,9 +3634,9 @@ } }, "node_modules/@expensify/react-native-live-markdown": { - "version": "0.1.159", - "resolved": "https://registry.npmjs.org/@expensify/react-native-live-markdown/-/react-native-live-markdown-0.1.159.tgz", - "integrity": "sha512-UKjEdERbaG7FMH2+r6lSjnSoic1f3UL2r37qkuJ8vV5UKyG3Nw/akoZwt6kBuRKrM9DGzK6Yc2b9HGhR0/wUMA==", + "version": "0.1.163", + "resolved": "https://registry.npmjs.org/@expensify/react-native-live-markdown/-/react-native-live-markdown-0.1.163.tgz", + "integrity": "sha512-kIVWxKPHbXrLJ28TmI4sOndFjo8LktoytSiea4tS/GhVQXkbzZdtyTzNVfrQPSsJq+ITUbg701aC5XNqDhIAnQ==", "workspaces": [ "parser", "example", diff --git a/package.json b/package.json index d2f954043d4e..2f148b1c7059 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ }, "dependencies": { "@dotlottie/react-player": "^1.6.3", - "@expensify/react-native-live-markdown": "0.1.159", + "@expensify/react-native-live-markdown": "0.1.163", "@expo/metro-runtime": "~3.2.3", "@firebase/app": "^0.10.10", "@firebase/performance": "^0.6.8", From 7899bc82cd500907149e81a934ea9b99564ac0e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ska=C5=82ka?= Date: Thu, 3 Oct 2024 10:52:22 +0200 Subject: [PATCH 07/11] Update Podfile --- ios/Podfile.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 69989797ecb2..be0e84f31ddc 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -2360,7 +2360,7 @@ PODS: - RNGoogleSignin (10.0.1): - GoogleSignIn (~> 7.0) - React-Core - - RNLiveMarkdown (0.1.159): + - RNLiveMarkdown (0.1.163): - DoubleConversion - glog - hermes-engine @@ -2380,9 +2380,9 @@ PODS: - ReactCodegen - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - - RNLiveMarkdown/common (= 0.1.159) + - RNLiveMarkdown/newarch (= 0.1.163) - Yoga - - RNLiveMarkdown/common (0.1.159): + - RNLiveMarkdown/newarch (0.1.163): - DoubleConversion - glog - hermes-engine @@ -3229,7 +3229,7 @@ SPEC CHECKSUMS: RNFS: 4ac0f0ea233904cb798630b3c077808c06931688 RNGestureHandler: 8781e2529230a1bc3ea8d75e5c3cd071b6c6aed7 RNGoogleSignin: ccaa4a81582cf713eea562c5dd9dc1961a715fd0 - RNLiveMarkdown: 2d97e3f4952c642cdd31bc05555e44dc5edcdba1 + RNLiveMarkdown: 1bcdf94e8295a4be0fd2f6d8bb333cf9fa3232fa RNLocalize: d4b8af4e442d4bcca54e68fc687a2129b4d71a81 rnmapbox-maps: 460d6ff97ae49c7d5708c3212c6521697c36a0c4 RNPermissions: 0b1429b55af59d1d08b75a8be2459f65a8ac3f28 From a754fc435814bb2a12142125cd11da7489bc0b15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ska=C5=82ka?= Date: Thu, 3 Oct 2024 12:19:02 +0200 Subject: [PATCH 08/11] Fix getting cursor position y --- src/components/Composer/index.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/Composer/index.tsx b/src/components/Composer/index.tsx index 5e9fa77e6dfc..46c2b01f21af 100755 --- a/src/components/Composer/index.tsx +++ b/src/components/Composer/index.tsx @@ -92,14 +92,15 @@ function Composer( if (shouldCalculateCaretPosition && isRendered && sel) { const range = sel.getRangeAt(0).cloneRange(); range.collapse(true); - const rect = range.getClientRects()[0]; + const currentElement = (range.startContainer.nodeType === Node.TEXT_NODE ? range.startContainer.parentElement : range.startContainer) as HTMLElement; + const rect = currentElement.getClientRects()[0]; const containerRect = textInput.current?.getBoundingClientRect(); let x = 0; let y = 0; if (rect && containerRect) { x = rect.left - containerRect.left; - y = rect.top - containerRect.top - rect.height / 2 + (textInput?.current?.scrollTop ?? 0); + y = rect.top - containerRect.top + (textInput?.current?.scrollTop ?? 0) - rect.height / 2; } const selectionValue = { From 4f04d3d578cef6b71d3d58d3ec8fcf64ad0bb9f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ska=C5=82ka?= Date: Thu, 3 Oct 2024 12:28:23 +0200 Subject: [PATCH 09/11] Fix getting cursor position while typing text --- src/components/Composer/index.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/Composer/index.tsx b/src/components/Composer/index.tsx index 46c2b01f21af..c71159d8f410 100755 --- a/src/components/Composer/index.tsx +++ b/src/components/Composer/index.tsx @@ -92,8 +92,7 @@ function Composer( if (shouldCalculateCaretPosition && isRendered && sel) { const range = sel.getRangeAt(0).cloneRange(); range.collapse(true); - const currentElement = (range.startContainer.nodeType === Node.TEXT_NODE ? range.startContainer.parentElement : range.startContainer) as HTMLElement; - const rect = currentElement.getClientRects()[0]; + const rect = range.getClientRects()[0] || range.startContainer.parentElement?.getClientRects()[0]; const containerRect = textInput.current?.getBoundingClientRect(); let x = 0; From 37d6baed0f631552a258efb67f0a17b052fd435c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ska=C5=82ka?= Date: Fri, 4 Oct 2024 10:38:33 +0200 Subject: [PATCH 10/11] Bump react-native-live-markdown version to 0.1.164 and add image previews with aut token support --- ios/Podfile.lock | 8 ++++---- package-lock.json | 8 ++++---- package.json | 2 +- src/components/Composer/index.tsx | 3 +++ 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index be0e84f31ddc..2161ca52c618 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -2360,7 +2360,7 @@ PODS: - RNGoogleSignin (10.0.1): - GoogleSignIn (~> 7.0) - React-Core - - RNLiveMarkdown (0.1.163): + - RNLiveMarkdown (0.1.164): - DoubleConversion - glog - hermes-engine @@ -2380,9 +2380,9 @@ PODS: - ReactCodegen - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - - RNLiveMarkdown/newarch (= 0.1.163) + - RNLiveMarkdown/newarch (= 0.1.164) - Yoga - - RNLiveMarkdown/newarch (0.1.163): + - RNLiveMarkdown/newarch (0.1.164): - DoubleConversion - glog - hermes-engine @@ -3229,7 +3229,7 @@ SPEC CHECKSUMS: RNFS: 4ac0f0ea233904cb798630b3c077808c06931688 RNGestureHandler: 8781e2529230a1bc3ea8d75e5c3cd071b6c6aed7 RNGoogleSignin: ccaa4a81582cf713eea562c5dd9dc1961a715fd0 - RNLiveMarkdown: 1bcdf94e8295a4be0fd2f6d8bb333cf9fa3232fa + RNLiveMarkdown: b2bd97a6f1206be16cf6536c092fe39f986aca34 RNLocalize: d4b8af4e442d4bcca54e68fc687a2129b4d71a81 rnmapbox-maps: 460d6ff97ae49c7d5708c3212c6521697c36a0c4 RNPermissions: 0b1429b55af59d1d08b75a8be2459f65a8ac3f28 diff --git a/package-lock.json b/package-lock.json index 87e6d11c5829..64e6b5708bfe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "license": "MIT", "dependencies": { "@dotlottie/react-player": "^1.6.3", - "@expensify/react-native-live-markdown": "0.1.163", + "@expensify/react-native-live-markdown": "0.1.164", "@expo/metro-runtime": "~3.2.3", "@firebase/app": "^0.10.10", "@firebase/performance": "^0.6.8", @@ -3634,9 +3634,9 @@ } }, "node_modules/@expensify/react-native-live-markdown": { - "version": "0.1.163", - "resolved": "https://registry.npmjs.org/@expensify/react-native-live-markdown/-/react-native-live-markdown-0.1.163.tgz", - "integrity": "sha512-kIVWxKPHbXrLJ28TmI4sOndFjo8LktoytSiea4tS/GhVQXkbzZdtyTzNVfrQPSsJq+ITUbg701aC5XNqDhIAnQ==", + "version": "0.1.164", + "resolved": "https://registry.npmjs.org/@expensify/react-native-live-markdown/-/react-native-live-markdown-0.1.164.tgz", + "integrity": "sha512-x1/Oa+I1AI82xWEFYd2kSkSj4rZ1q2JG4aEDomUHSqcNjuQetQPw9kVFN5DaLHt0Iu0iKEUrXIhy5LpMSHJQLg==", "workspaces": [ "parser", "example", diff --git a/package.json b/package.json index 07ddc3ad6371..53f5ca916965 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ }, "dependencies": { "@dotlottie/react-player": "^1.6.3", - "@expensify/react-native-live-markdown": "0.1.163", + "@expensify/react-native-live-markdown": "0.1.164", "@expo/metro-runtime": "~3.2.3", "@firebase/app": "^0.10.10", "@firebase/performance": "^0.6.8", diff --git a/src/components/Composer/index.tsx b/src/components/Composer/index.tsx index c71159d8f410..0f2014e5abb9 100755 --- a/src/components/Composer/index.tsx +++ b/src/components/Composer/index.tsx @@ -13,6 +13,7 @@ import useMarkdownStyle from '@hooks/useMarkdownStyle'; import useStyleUtils from '@hooks/useStyleUtils'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; +import addEncryptedAuthTokenToURL from '@libs/addEncryptedAuthTokenToURL'; import * as Browser from '@libs/Browser'; import updateIsFullComposerAvailable from '@libs/ComposerUtils/updateIsFullComposerAvailable'; import * as EmojiUtils from '@libs/EmojiUtils'; @@ -354,6 +355,8 @@ function Composer( }} disabled={isDisabled} onKeyPress={handleKeyPress} + addAuthTokenToImageURLCallback={addEncryptedAuthTokenToURL} + imagePreviewAuthRequiredURLs={[CONST.EXPENSIFY_URL, CONST.STAGING_EXPENSIFY_URL]} /> ); } From 8521ff5a1227af67860abf3aec3b0445a57d99ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ska=C5=82ka?= Date: Fri, 4 Oct 2024 14:26:41 +0200 Subject: [PATCH 11/11] Fix selection shortcuts --- src/components/Composer/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/Composer/index.tsx b/src/components/Composer/index.tsx index 0f2014e5abb9..181b1b5d69ee 100755 --- a/src/components/Composer/index.tsx +++ b/src/components/Composer/index.tsx @@ -24,6 +24,7 @@ import type {ComposerProps} from './types'; const excludeNoStyles: Array = []; const excludeReportMentionStyle: Array = ['mentionReport']; +const imagePreviewAuthRequiredURLs = [CONST.EXPENSIFY_URL, CONST.STAGING_EXPENSIFY_URL]; // Enable Markdown parsing. // On web we like to have the Text Input field always focused so the user can easily type a new chat @@ -356,7 +357,7 @@ function Composer( disabled={isDisabled} onKeyPress={handleKeyPress} addAuthTokenToImageURLCallback={addEncryptedAuthTokenToURL} - imagePreviewAuthRequiredURLs={[CONST.EXPENSIFY_URL, CONST.STAGING_EXPENSIFY_URL]} + imagePreviewAuthRequiredURLs={imagePreviewAuthRequiredURLs} /> ); }