From 2828112cfc8d0f24b5c44a91a6e0827805bbd564 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Mon, 24 Jun 2024 18:12:37 +0200 Subject: [PATCH 01/42] add patch --- patches/react-native+0.73.4+017.patch | 137 ++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 patches/react-native+0.73.4+017.patch diff --git a/patches/react-native+0.73.4+017.patch b/patches/react-native+0.73.4+017.patch new file mode 100644 index 000000000000..aad2700391ed --- /dev/null +++ b/patches/react-native+0.73.4+017.patch @@ -0,0 +1,137 @@ +diff --git a/node_modules/react-native/Libraries/Components/TextInput/TextInput.d.ts b/node_modules/react-native/Libraries/Components/TextInput/TextInput.d.ts +index 2c0c099..472877a 100644 +--- a/node_modules/react-native/Libraries/Components/TextInput/TextInput.d.ts ++++ b/node_modules/react-native/Libraries/Components/TextInput/TextInput.d.ts +@@ -451,6 +451,9 @@ export interface TextInputKeyPressEventData { + export interface TextInputChangeEventData extends TargetedEvent { + eventCount: number; + text: string; ++ before: number; ++ start: number; ++ count: number; + } + + /** +diff --git a/node_modules/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm b/node_modules/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +index 7ce04da..b7c3b6f 100644 +--- a/node_modules/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm ++++ b/node_modules/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +@@ -55,6 +55,10 @@ @implementation RCTTextInputComponentView { + */ + BOOL _comingFromJS; + BOOL _didMoveToWindow; ++ ++ NSInteger changeStart; ++ NSInteger changeBefore; ++ NSInteger changeCount; + } + + #pragma mark - UIView overrides +@@ -344,6 +348,10 @@ - (NSString *)textInputShouldChangeText:(NSString *)text inRange:(NSRange)range + { + const auto &props = static_cast(*_props); + ++ changeStart = range.location; ++ changeBefore = range.length; ++ changeCount = text.length; ++ + if (!_backedTextInputView.textWasPasted) { + if (_eventEmitter) { + KeyPressMetrics keyPressMetrics; +@@ -540,6 +548,9 @@ - (TextInputMetrics)_textInputMetrics + metrics.text = RCTStringFromNSString(_backedTextInputView.attributedText.string); + metrics.selectionRange = [self _selectionRange]; + metrics.eventCount = _mostRecentEventCount; ++ metrics.count = static_cast(changeCount); ++ metrics.before = static_cast(changeBefore); ++ metrics.start = static_cast(changeStart); + + CGPoint contentOffset = _backedTextInputView.contentOffset; + metrics.contentOffset = {contentOffset.x, contentOffset.y}; +diff --git a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextChangedEvent.java b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextChangedEvent.java +index 4540b90..c44a11f 100644 +--- a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextChangedEvent.java ++++ b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextChangedEvent.java +@@ -23,16 +23,23 @@ public class ReactTextChangedEvent extends Event { + + private String mText; + private int mEventCount; ++ // See https://developer.android.com/reference/android/text/TextWatcher#onTextChanged(java.lang.CharSequence,%20int,%20int,%20int) ++ private int mStart; ++ private int mCount; ++ private int mBefore; + + @Deprecated +- public ReactTextChangedEvent(int viewId, String text, int eventCount) { +- this(ViewUtil.NO_SURFACE_ID, viewId, text, eventCount); ++ public ReactTextChangedEvent(int viewId, String text, int eventCount, int start, int count, int before) { ++ this(ViewUtil.NO_SURFACE_ID, viewId, text, eventCount, start, count, before); + } + +- public ReactTextChangedEvent(int surfaceId, int viewId, String text, int eventCount) { ++ public ReactTextChangedEvent(int surfaceId, int viewId, String text, int eventCount, int start, int count, int before) { + super(surfaceId, viewId); + mText = text; + mEventCount = eventCount; ++ mStart = start; ++ mCount = count; ++ mBefore = before; + } + + @Override +@@ -47,6 +54,9 @@ public class ReactTextChangedEvent extends Event { + eventData.putString("text", mText); + eventData.putInt("eventCount", mEventCount); + eventData.putInt("target", getViewTag()); ++ eventData.putInt("start", mStart); ++ eventData.putInt("count", mCount); ++ eventData.putInt("before", mBefore); + return eventData; + } + } +diff --git a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java +index 8496a7d..fd5076b 100644 +--- a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java ++++ b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java +@@ -1068,7 +1068,12 @@ public class ReactTextInputManager extends BaseViewManager Date: Mon, 24 Jun 2024 18:20:23 +0200 Subject: [PATCH 02/42] wip --- .../ComposerWithSuggestions/ComposerWithSuggestions.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index 699df4c76f8b..54e6ed9715b2 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -410,7 +410,10 @@ function ComposerWithSuggestions( const updateComment = useCallback( (commentValue: string, shouldDebounceSaveComment?: boolean) => { raiseIsScrollLikelyLayoutTriggered(); + // TODO: refactor update comment, to not use findNewlyAddedChars, but to get these info from onChange + // TODO: Check if findNewlyAddedChars can be removed entirely, or if there are edge use cases (updateComment is called from many different places) that need to be supported const {startIndex, endIndex, diff} = findNewlyAddedChars(lastTextRef.current, commentValue); + const isEmojiInserted = diff.length && endIndex > startIndex && diff.trim() === diff && EmojiUtils.containsOnlyEmojis(diff); const commentWithSpaceInserted = isEmojiInserted ? ComposerUtils.insertWhiteSpaceAtIndex(commentValue, endIndex) : commentValue; const {text: newComment, emojis, cursorPosition} = EmojiUtils.replaceAndExtractEmojis(commentWithSpaceInserted, preferredSkinTone, preferredLocale); @@ -429,6 +432,7 @@ function ComposerWithSuggestions( const isNewCommentEmpty = !!newCommentConverted.match(/^(\s)*$/); const isPrevCommentEmpty = !!commentRef.current.match(/^(\s)*$/); + // TODO: why would we handle this as a separate state, instead of just using the value of the comment? /** Only update isCommentEmpty state if it's different from previous one */ if (isNewCommentEmpty !== isPrevCommentEmpty) { setIsCommentEmpty(isNewCommentEmpty); @@ -794,6 +798,9 @@ function ComposerWithSuggestions( placeholder={inputPlaceholder} placeholderTextColor={theme.placeholderText} onChangeText={onChangeText} + onChange={({nativeEvent}) => { + console.log('onChange', nativeEvent); + }} onKeyPress={triggerHotkeyActions} textAlignVertical="top" style={[styles.textInputCompose, isComposerFullSize ? styles.textInputFullCompose : styles.textInputCollapseCompose]} From cf0ad39865e064c0b64e3c8b1513f4cbe3330229 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Tue, 25 Jun 2024 14:59:50 +0200 Subject: [PATCH 03/42] wip --- .../ComposerWithSuggestions.tsx | 41 ++++++++++++------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index 54e6ed9715b2..19f6c1bf22ea 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -7,6 +7,7 @@ import type { MeasureInWindowOnSuccessCallback, NativeSyntheticEvent, TextInput, + TextInputChangeEventData, TextInputFocusEventData, TextInputKeyPressEventData, TextInputScrollEventData, @@ -46,7 +47,7 @@ import updateMultilineInputRange from '@libs/updateMultilineInputRange'; import willBlurTextInputOnTapOutsideFunc from '@libs/willBlurTextInputOnTapOutside'; import getCursorPosition from '@pages/home/report/ReportActionCompose/getCursorPosition'; import getScrollPosition from '@pages/home/report/ReportActionCompose/getScrollPosition'; -import type {ComposerRef, SuggestionsRef} from '@pages/home/report/ReportActionCompose/ReportActionCompose'; +import type {SuggestionsRef} from '@pages/home/report/ReportActionCompose/ReportActionCompose'; import SilentCommentUpdater from '@pages/home/report/ReportActionCompose/SilentCommentUpdater'; import Suggestions from '@pages/home/report/ReportActionCompose/Suggestions'; import * as EmojiPickerActions from '@userActions/EmojiPickerAction'; @@ -126,9 +127,6 @@ type ComposerWithSuggestionsProps = ComposerWithSuggestionsOnyxProps & /** Function to set whether the full composer is available */ setIsFullComposerAvailable: (isFullComposerAvailable: boolean) => void; - /** Function to set whether the comment is empty */ - setIsCommentEmpty: (isCommentEmpty: boolean) => void; - /** Function to handle sending a message */ handleSendMessage: () => void; @@ -179,6 +177,14 @@ type ComposerWithSuggestionsProps = ComposerWithSuggestionsOnyxProps & policyID: string; }; +type ComposerRef = { + blur: () => void; + focus: (shouldDelay?: boolean) => void; + replaceSelectionWithText: EmojiPickerActions.OnEmojiSelected; + prepareCommentAndResetComposer: () => string; + isFocused: () => boolean; +}; + type SwitchToCurrentReportProps = { preexistingReportID: string; callback: () => void; @@ -246,7 +252,6 @@ function ComposerWithSuggestions( disabled, isFullComposerAvailable, setIsFullComposerAvailable, - setIsCommentEmpty, handleSendMessage, shouldShowComposeInput, measureParentContainer = () => {}, @@ -429,14 +434,6 @@ function ComposerWithSuggestions( } } const newCommentConverted = convertToLTRForComposer(newComment); - const isNewCommentEmpty = !!newCommentConverted.match(/^(\s)*$/); - const isPrevCommentEmpty = !!commentRef.current.match(/^(\s)*$/); - - // TODO: why would we handle this as a separate state, instead of just using the value of the comment? - /** Only update isCommentEmpty state if it's different from previous one */ - if (isNewCommentEmpty !== isPrevCommentEmpty) { - setIsCommentEmpty(isNewCommentEmpty); - } emojisPresentBefore.current = emojis; setValue(newCommentConverted); if (commentValue !== newComment) { @@ -471,7 +468,6 @@ function ComposerWithSuggestions( preferredLocale, preferredSkinTone, reportID, - setIsCommentEmpty, suggestionsRef, raiseIsScrollLikelyLayoutTriggered, debouncedSaveReportComment, @@ -573,6 +569,20 @@ function ComposerWithSuggestions( [updateComment], ); + const onChange = useCallback(({nativeEvent}: NativeSyntheticEvent) => { + const {count, start, before, text: fullNewText, eventCount} = nativeEvent; + setValue((previousText) => { + // This method is called to notify you that, within s, the count characters beginning at start have just + // replaced old text that had length before. + const newText = fullNewText.substring(start, start + count); + // Replace newText in the original text: + const updatedText = previousText.substring(0, start) + newText + previousText.substring(start + before); + + console.log('setting text state to:', updatedText, eventCount); + return updatedText; + }); + }, []); + const onSelectionChange = useCallback( (e: CustomSelectionChangeEvent) => { if (!textInputRef.current?.isFocused()) { @@ -746,6 +756,7 @@ function ComposerWithSuggestions( ); const onClear = useCallback(() => { + mobileInputScrollPosition.current = 0; setTextInputShouldClear(false); // eslint-disable-next-line react-hooks/exhaustive-deps }, []); @@ -881,4 +892,4 @@ export default withOnyx Date: Tue, 25 Jun 2024 17:01:35 +0200 Subject: [PATCH 04/42] wip: fix typing comment --- .../ComposerWithSuggestions.tsx | 165 +++++++++--------- .../SilentCommentUpdater/index.tsx | 4 +- .../SilentCommentUpdater/types.ts | 3 - 3 files changed, 87 insertions(+), 85 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index 19f6c1bf22ea..2dc3b75f2ea2 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -124,6 +124,9 @@ type ComposerWithSuggestionsProps = ComposerWithSuggestionsOnyxProps & /** Whether the full composer is available */ isFullComposerAvailable: boolean; + /** Function to set whether the comment is empty */ + setIsCommentEmpty: (isCommentEmpty: boolean) => void; + /** Function to set whether the full composer is available */ setIsFullComposerAvailable: (isFullComposerAvailable: boolean) => void; @@ -252,6 +255,7 @@ function ComposerWithSuggestions( disabled, isFullComposerAvailable, setIsFullComposerAvailable, + setIsCommentEmpty, handleSendMessage, shouldShowComposeInput, measureParentContainer = () => {}, @@ -287,8 +291,8 @@ function ComposerWithSuggestions( } return draftComment; }); - const commentRef = useRef(value); - const lastTextRef = useRef(value); + const valueRef = useRef(value); + valueRef.current = value; const {isSmallScreenWidth} = useWindowDimensions(); const maxComposerLines = isSmallScreenWidth ? CONST.COMPOSER.MAX_LINES_SMALL_SCREEN : CONST.COMPOSER.MAX_LINES; @@ -301,9 +305,6 @@ function ComposerWithSuggestions( (shouldFocusInputOnScreenFocus || (isEmptyChat && !ReportActionsUtils.isTransactionThread(parentReportAction))) && shouldShowComposeInput; - const valueRef = useRef(value); - valueRef.current = value; - const [selection, setSelection] = useState(() => ({start: 0, end: 0, positionX: 0, positionY: 0})); const [composerHeight, setComposerHeight] = useState(0); @@ -357,11 +358,11 @@ function ComposerWithSuggestions( useEffect(() => { const switchToCurrentReport = DeviceEventEmitter.addListener(`switchToPreExistingReport_${reportID}`, ({preexistingReportID, callback}: SwitchToCurrentReportProps) => { - if (!commentRef.current) { + if (!valueRef.current) { callback(); return; } - Report.saveReportDraftComment(preexistingReportID, commentRef.current, callback); + Report.saveReportDraftComment(preexistingReportID, valueRef.current, callback); }); return () => { @@ -414,53 +415,53 @@ function ComposerWithSuggestions( */ const updateComment = useCallback( (commentValue: string, shouldDebounceSaveComment?: boolean) => { - raiseIsScrollLikelyLayoutTriggered(); - // TODO: refactor update comment, to not use findNewlyAddedChars, but to get these info from onChange - // TODO: Check if findNewlyAddedChars can be removed entirely, or if there are edge use cases (updateComment is called from many different places) that need to be supported - const {startIndex, endIndex, diff} = findNewlyAddedChars(lastTextRef.current, commentValue); - - const isEmojiInserted = diff.length && endIndex > startIndex && diff.trim() === diff && EmojiUtils.containsOnlyEmojis(diff); - const commentWithSpaceInserted = isEmojiInserted ? ComposerUtils.insertWhiteSpaceAtIndex(commentValue, endIndex) : commentValue; - const {text: newComment, emojis, cursorPosition} = EmojiUtils.replaceAndExtractEmojis(commentWithSpaceInserted, preferredSkinTone, preferredLocale); - if (emojis.length) { - const newEmojis = EmojiUtils.getAddedEmojis(emojis, emojisPresentBefore.current); - if (newEmojis.length) { - // Ensure emoji suggestions are hidden after inserting emoji even when the selection is not changed - if (suggestionsRef.current) { - suggestionsRef.current.resetSuggestions(); - } - insertedEmojisRef.current = [...insertedEmojisRef.current, ...newEmojis]; - debouncedUpdateFrequentlyUsedEmojis(); - } - } - const newCommentConverted = convertToLTRForComposer(newComment); - emojisPresentBefore.current = emojis; - setValue(newCommentConverted); - if (commentValue !== newComment) { - const position = Math.max((selection.end ?? 0) + (newComment.length - commentRef.current.length), cursorPosition ?? 0); - - if (commentWithSpaceInserted !== newComment && isIOSNative) { - syncSelectionWithOnChangeTextRef.current = {position, value: newComment}; - } - - setSelection((prevSelection) => ({ - start: position, - end: position, - positionX: prevSelection.positionX, - positionY: prevSelection.positionY, - })); - } - - commentRef.current = newCommentConverted; - if (shouldDebounceSaveComment) { - isCommentPendingSaved.current = true; - debouncedSaveReportComment(reportID, newCommentConverted); - } else { - Report.saveReportDraftComment(reportID, newCommentConverted); - } - if (newCommentConverted) { - debouncedBroadcastUserIsTyping(reportID); - } + // raiseIsScrollLikelyLayoutTriggered(); + // // TODO: refactor update comment, to not use findNewlyAddedChars, but to get these info from onChange + // // TODO: Check if findNewlyAddedChars can be removed entirely, or if there are edge use cases (updateComment is called from many different places) that need to be supported + // const {startIndex, endIndex, diff} = findNewlyAddedChars(lastTextRef.current, commentValue); + + // const isEmojiInserted = diff.length && endIndex > startIndex && diff.trim() === diff && EmojiUtils.containsOnlyEmojis(diff); + // const commentWithSpaceInserted = isEmojiInserted ? ComposerUtils.insertWhiteSpaceAtIndex(commentValue, endIndex) : commentValue; + // const {text: newComment, emojis, cursorPosition} = EmojiUtils.replaceAndExtractEmojis(commentWithSpaceInserted, preferredSkinTone, preferredLocale); + // if (emojis.length) { + // const newEmojis = EmojiUtils.getAddedEmojis(emojis, emojisPresentBefore.current); + // if (newEmojis.length) { + // // Ensure emoji suggestions are hidden after inserting emoji even when the selection is not changed + // if (suggestionsRef.current) { + // suggestionsRef.current.resetSuggestions(); + // } + // insertedEmojisRef.current = [...insertedEmojisRef.current, ...newEmojis]; + // debouncedUpdateFrequentlyUsedEmojis(); + // } + // } + // const newCommentConverted = convertToLTRForComposer(newComment); + // emojisPresentBefore.current = emojis; + // setValue(newCommentConverted); + // if (commentValue !== newComment) { + // const position = Math.max((selection.end ?? 0) + (newComment.length - commentRef.current.length), cursorPosition ?? 0); + + // if (commentWithSpaceInserted !== newComment && isIOSNative) { + // syncSelectionWithOnChangeTextRef.current = {position, value: newComment}; + // } + + // setSelection((prevSelection) => ({ + // start: position, + // end: position, + // positionX: prevSelection.positionX, + // positionY: prevSelection.positionY, + // })); + // } + + // commentRef.current = newCommentConverted; + // if (shouldDebounceSaveComment) { + // isCommentPendingSaved.current = true; + // debouncedSaveReportComment(reportID, newCommentConverted); + // } else { + // Report.saveReportDraftComment(reportID, newCommentConverted); + // } + // if (newCommentConverted) { + // debouncedBroadcastUserIsTyping(reportID); + // } }, [ debouncedUpdateFrequentlyUsedEmojis, @@ -476,7 +477,7 @@ function ComposerWithSuggestions( ); const prepareCommentAndResetComposer = useCallback((): string => { - const trimmedComment = commentRef.current.trim(); + const trimmedComment = valueRef.current.trim(); const commentLength = ReportUtils.getCommentLength(trimmedComment, {reportID}); // Don't submit empty comments or comments that exceed the character limit @@ -491,14 +492,14 @@ function ComposerWithSuggestions( isCommentPendingSaved.current = false; setSelection({start: 0, end: 0, positionX: 0, positionY: 0}); - updateComment(''); + setValue(''); setTextInputShouldClear(true); if (isComposerFullSize) { Report.setIsComposerFullSize(reportID, false); } setIsFullComposerAvailable(false); return trimmedComment; - }, [updateComment, setTextInputShouldClear, isComposerFullSize, setIsFullComposerAvailable, reportID, debouncedSaveReportComment]); + }, [setTextInputShouldClear, isComposerFullSize, setIsFullComposerAvailable, reportID, debouncedSaveReportComment]); /** * Callback to add whatever text is chosen into the main input (used f.e as callback for the emoji picker) @@ -507,7 +508,7 @@ function ComposerWithSuggestions( (text: string) => { // selection replacement should be debounced to avoid conflicts with text typing // (f.e. when emoji is being picked and 1 second still did not pass after user finished typing) - updateComment(ComposerUtils.insertText(commentRef.current, selection, text), true); + updateComment(ComposerUtils.insertText(valueRef.current, selection, text), true); }, [selection, updateComment], ); @@ -570,18 +571,29 @@ function ComposerWithSuggestions( ); const onChange = useCallback(({nativeEvent}: NativeSyntheticEvent) => { - const {count, start, before, text: fullNewText, eventCount} = nativeEvent; - setValue((previousText) => { - // This method is called to notify you that, within s, the count characters beginning at start have just - // replaced old text that had length before. - const newText = fullNewText.substring(start, start + count); - // Replace newText in the original text: - const updatedText = previousText.substring(0, start) + newText + previousText.substring(start + before); - - console.log('setting text state to:', updatedText, eventCount); - return updatedText; - }); - }, []); + const {count, start, before, text: fullNewText} = nativeEvent; + // This method is called to notify you that, within "fullNewText", the "count" characters + // beginning at "start" have just replaced old text that had length "before". + const newText = fullNewText.substring(start, start + count); + // Replace newText in the original text: + const currentText = valueRef.current; + const updatedText = currentText.substring(0, start) + newText + currentText.substring(start + before); + + // Make LTR compatible if needed + const newCommentConverted = convertToLTRForComposer(updatedText); + + // Update state + setValue(newCommentConverted); + // TODO: this could be done in a useEffect + const isCommentEmpty = !!newCommentConverted.match(/^(\s)*$/); + setIsCommentEmpty(isCommentEmpty); + + // Update onyx related state: + Report.saveReportDraftComment(reportID, newCommentConverted); + if (newCommentConverted) { + debouncedBroadcastUserIsTyping(reportID); + } + }, [reportID, setIsCommentEmpty]); const onSelectionChange = useCallback( (e: CustomSelectionChangeEvent) => { @@ -735,11 +747,6 @@ function ComposerWithSuggestions( }), [blur, focus, prepareCommentAndResetComposer, replaceSelectionWithText], ); - - useEffect(() => { - lastTextRef.current = value; - }, [value]); - useEffect(() => { onValueChange(value); }, [onValueChange, value]); @@ -808,10 +815,8 @@ function ComposerWithSuggestions( ref={setTextInputRef} placeholder={inputPlaceholder} placeholderTextColor={theme.placeholderText} - onChangeText={onChangeText} - onChange={({nativeEvent}) => { - console.log('onChange', nativeEvent); - }} + // onChangeText={onChangeText} + onChange={onChange} onKeyPress={triggerHotkeyActions} textAlignVertical="top" style={[styles.textInputCompose, isComposerFullSize ? styles.textInputFullCompose : styles.textInputCollapseCompose]} @@ -859,7 +864,7 @@ function ComposerWithSuggestions( reportID={reportID} value={value} updateComment={updateComment} - commentRef={commentRef} + commentRef={valueRef} isCommentPendingSaved={isCommentPendingSaved} /> )} diff --git a/src/pages/home/report/ReportActionCompose/SilentCommentUpdater/index.tsx b/src/pages/home/report/ReportActionCompose/SilentCommentUpdater/index.tsx index e1185e17722d..f83f13e7002d 100644 --- a/src/pages/home/report/ReportActionCompose/SilentCommentUpdater/index.tsx +++ b/src/pages/home/report/ReportActionCompose/SilentCommentUpdater/index.tsx @@ -10,7 +10,7 @@ import type {SilentCommentUpdaterOnyxProps, SilentCommentUpdaterProps} from './t * It is connected to the actual draft comment in onyx. The comment in onyx might updates multiple times, and we want to avoid * re-rendering a UI component for that. That's why the side effect was moved down to a separate component. */ -function SilentCommentUpdater({comment, commentRef, reportID, value, updateComment, isCommentPendingSaved}: SilentCommentUpdaterProps) { +function SilentCommentUpdater({comment, reportID, value, updateComment, isCommentPendingSaved}: SilentCommentUpdaterProps) { const prevCommentProp = usePrevious(comment); const prevReportId = usePrevious(reportID); const {preferredLocale} = useLocalize(); @@ -34,7 +34,7 @@ function SilentCommentUpdater({comment, commentRef, reportID, value, updateComme } updateComment(comment ?? ''); - }, [prevCommentProp, prevPreferredLocale, prevReportId, comment, preferredLocale, reportID, updateComment, value, commentRef, isCommentPendingSaved]); + }, [prevCommentProp, prevPreferredLocale, prevReportId, comment, preferredLocale, reportID, updateComment, value, isCommentPendingSaved]); return null; } diff --git a/src/pages/home/report/ReportActionCompose/SilentCommentUpdater/types.ts b/src/pages/home/report/ReportActionCompose/SilentCommentUpdater/types.ts index 6f9e8b8a6d42..87ccb57b8d21 100644 --- a/src/pages/home/report/ReportActionCompose/SilentCommentUpdater/types.ts +++ b/src/pages/home/report/ReportActionCompose/SilentCommentUpdater/types.ts @@ -15,9 +15,6 @@ type SilentCommentUpdaterProps = SilentCommentUpdaterOnyxProps & { /** The value of the comment */ value: string; - /** The ref of the comment */ - commentRef: React.RefObject; - /** The ref to check whether the comment saving is in progress */ isCommentPendingSaved: React.RefObject; }; From 6aa7df568b40c3aa07897bf12f25741aeda294d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Wed, 26 Jun 2024 13:49:11 +0200 Subject: [PATCH 05/42] minor cleanup --- src/components/Composer/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Composer/index.tsx b/src/components/Composer/index.tsx index 3a8a4e724948..330f555d78d0 100755 --- a/src/components/Composer/index.tsx +++ b/src/components/Composer/index.tsx @@ -334,14 +334,14 @@ function Composer( autoCorrect={!Browser.isMobileSafari()} placeholderTextColor={theme.placeholderText} ref={(el) => (textInput.current = el)} - selection={selection} - style={[inputStyleMemo]} + style={inputStyleMemo} markdownStyle={markdownStyle} value={value} defaultValue={defaultValue} autoFocus={autoFocus} /* eslint-disable-next-line react/jsx-props-no-spreading */ {...props} + selection={selection} onSelectionChange={addCursorPositionToSelectionChange} onContentSizeChange={(e) => { setTextInputWidth(`${e.nativeEvent.contentSize.width}px`); From add1df636b6ce57d2459a8fc50fc10c568de333f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Wed, 26 Jun 2024 14:36:45 +0200 Subject: [PATCH 06/42] wip: restore functionality, but broken: - emoji with colon is broken - emoji picker is broken - selecting text when it contains an emoji is broken --- .../ComposerWithSuggestions.tsx | 107 +++++++++++++----- 1 file changed, 78 insertions(+), 29 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index 2dc3b75f2ea2..c04cb6139218 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -419,7 +419,6 @@ function ComposerWithSuggestions( // // TODO: refactor update comment, to not use findNewlyAddedChars, but to get these info from onChange // // TODO: Check if findNewlyAddedChars can be removed entirely, or if there are edge use cases (updateComment is called from many different places) that need to be supported // const {startIndex, endIndex, diff} = findNewlyAddedChars(lastTextRef.current, commentValue); - // const isEmojiInserted = diff.length && endIndex > startIndex && diff.trim() === diff && EmojiUtils.containsOnlyEmojis(diff); // const commentWithSpaceInserted = isEmojiInserted ? ComposerUtils.insertWhiteSpaceAtIndex(commentValue, endIndex) : commentValue; // const {text: newComment, emojis, cursorPosition} = EmojiUtils.replaceAndExtractEmojis(commentWithSpaceInserted, preferredSkinTone, preferredLocale); @@ -439,11 +438,9 @@ function ComposerWithSuggestions( // setValue(newCommentConverted); // if (commentValue !== newComment) { // const position = Math.max((selection.end ?? 0) + (newComment.length - commentRef.current.length), cursorPosition ?? 0); - // if (commentWithSpaceInserted !== newComment && isIOSNative) { // syncSelectionWithOnChangeTextRef.current = {position, value: newComment}; // } - // setSelection((prevSelection) => ({ // start: position, // end: position, @@ -451,7 +448,6 @@ function ComposerWithSuggestions( // positionY: prevSelection.positionY, // })); // } - // commentRef.current = newCommentConverted; // if (shouldDebounceSaveComment) { // isCommentPendingSaved.current = true; @@ -570,30 +566,82 @@ function ComposerWithSuggestions( [updateComment], ); - const onChange = useCallback(({nativeEvent}: NativeSyntheticEvent) => { - const {count, start, before, text: fullNewText} = nativeEvent; - // This method is called to notify you that, within "fullNewText", the "count" characters - // beginning at "start" have just replaced old text that had length "before". - const newText = fullNewText.substring(start, start + count); - // Replace newText in the original text: - const currentText = valueRef.current; - const updatedText = currentText.substring(0, start) + newText + currentText.substring(start + before); - - // Make LTR compatible if needed - const newCommentConverted = convertToLTRForComposer(updatedText); - - // Update state - setValue(newCommentConverted); - // TODO: this could be done in a useEffect - const isCommentEmpty = !!newCommentConverted.match(/^(\s)*$/); - setIsCommentEmpty(isCommentEmpty); - - // Update onyx related state: - Report.saveReportDraftComment(reportID, newCommentConverted); - if (newCommentConverted) { - debouncedBroadcastUserIsTyping(reportID); - } - }, [reportID, setIsCommentEmpty]); + const onChange = useCallback( + ({nativeEvent}: NativeSyntheticEvent) => { + const {count, start, before, text: fullNewText} = nativeEvent; + + if (fullNewText === valueRef.current) { + return; + } + console.log(nativeEvent); + + // This method is called to notify you that, within "fullNewText", the "count" characters + // beginning at "start" have just replaced old text that had length "before". + const newText = fullNewText.substring(start, start + count); + // Replace newText in the original text: + const currentText = valueRef.current; + const updatedText = currentText.substring(0, start) + newText + currentText.substring(start + before); + + // Check for emojis + const isEmojiInserted = newText.trim() === newText && EmojiUtils.containsOnlyEmojis(newText); + const commentWithSpaceInserted = isEmojiInserted ? ComposerUtils.insertWhiteSpaceAtIndex(updatedText, start + count) : updatedText; + const {text: newComment, emojis, cursorPosition} = EmojiUtils.replaceAndExtractEmojis(commentWithSpaceInserted, preferredSkinTone, preferredLocale); + if (emojis.length) { + // TODO: This could be all moved to debouncedUpdateFrequentlyUsedEmojis, and the insertedEmojisRef could be removed + const newEmojis = EmojiUtils.getAddedEmojis(emojis, emojisPresentBefore.current); + if (newEmojis.length) { + // Ensure emoji suggestions are hidden after inserting emoji even when the selection is not changed + if (suggestionsRef.current) { + suggestionsRef.current.resetSuggestions(); + } + insertedEmojisRef.current = [...insertedEmojisRef.current, ...newEmojis]; + debouncedUpdateFrequentlyUsedEmojis(); + } + } + + // Make LTR compatible if needed + const newCommentConverted = convertToLTRForComposer(newComment); + + // Update state + setValue(newCommentConverted); + // TODO: this could be done in a useEffect + const isCommentEmpty = !!newCommentConverted.match(/^(\s)*$/); + setIsCommentEmpty(isCommentEmpty); + + // Update selection + const position = Math.max((selection.end ?? 0) + (newComment.length - valueRef.current.length), cursorPosition ?? 0); + if (commentWithSpaceInserted !== newComment && isIOSNative) { + syncSelectionWithOnChangeTextRef.current = {position, value: newComment}; + } + setSelection((prevSelection) => ({ + start: position, + end: position, + positionX: prevSelection.positionX, + positionY: prevSelection.positionY, + })); + + // Update onyx related state: + // Report.saveReportDraftComment(reportID, newCommentConverted); + debouncedSaveReportComment(reportID, newCommentConverted); + if (newCommentConverted) { + debouncedBroadcastUserIsTyping(reportID); + } + + // From onChangeText: + if (isIOSNative && syncSelectionWithOnChangeTextRef.current) { + const positionSnapshot = syncSelectionWithOnChangeTextRef.current.position; + syncSelectionWithOnChangeTextRef.current = null; + + // ensure that selection is set imperatively after all state changes are effective + InteractionManager.runAfterInteractions(() => { + // note: this implementation is only available on non-web RN, thus the wrapping + // 'if' block contains a redundant (since the ref is only used on iOS) platform check + textInputRef.current?.setSelection(positionSnapshot, positionSnapshot); + }); + } + }, + [debouncedSaveReportComment, debouncedUpdateFrequentlyUsedEmojis, preferredLocale, preferredSkinTone, reportID, selection.end, setIsCommentEmpty, suggestionsRef], + ); const onSelectionChange = useCallback( (e: CustomSelectionChangeEvent) => { @@ -808,6 +856,7 @@ function ComposerWithSuggestions( return ( <> + {/* */} )} From d9f197e624a94b3e6fae22173aff23b3d7adbb43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Wed, 26 Jun 2024 18:00:56 +0200 Subject: [PATCH 07/42] fix inserting emojis via colon is broken --- .../ComposerWithSuggestions.tsx | 106 +++++++++--------- 1 file changed, 52 insertions(+), 54 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index c04cb6139218..5c9d0c9f975c 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -312,8 +312,6 @@ function ComposerWithSuggestions( const textInputRef = useRef(null); const insertedEmojisRef = useRef([]); - const syncSelectionWithOnChangeTextRef = useRef(null); - // The ref to check whether the comment saving is in progress const isCommentPendingSaved = useRef(false); @@ -547,44 +545,51 @@ function ComposerWithSuggestions( [isSmallScreenWidth, isKeyboardShown, suggestionsRef, includeChronos, handleSendMessage, lastReportAction, reportID], ); - const onChangeText = useCallback( - (commentValue: string) => { - updateComment(commentValue, true); - - if (isIOSNative && syncSelectionWithOnChangeTextRef.current) { - const positionSnapshot = syncSelectionWithOnChangeTextRef.current.position; - syncSelectionWithOnChangeTextRef.current = null; - - // ensure that selection is set imperatively after all state changes are effective - InteractionManager.runAfterInteractions(() => { - // note: this implementation is only available on non-web RN, thus the wrapping - // 'if' block contains a redundant (since the ref is only used on iOS) platform check - textInputRef.current?.setSelection(positionSnapshot, positionSnapshot); - }); - } - }, - [updateComment], - ); - + // const onChangeText = useCallback( + // (commentValue: string) => { + // updateComment(commentValue, true); + + // if (isIOSNative && syncSelectionWithOnChangeTextRef.current) { + // const positionSnapshot = syncSelectionWithOnChangeTextRef.current.position; + // syncSelectionWithOnChangeTextRef.current = null; + + // // ensure that selection is set imperatively after all state changes are effective + // InteractionManager.runAfterInteractions(() => { + // // note: this implementation is only available on non-web RN, thus the wrapping + // // 'if' block contains a redundant (since the ref is only used on iOS) platform check + // textInputRef.current?.setSelection(positionSnapshot, positionSnapshot); + // }); + // } + // }, + // [updateComment], + // ); + + // This contains the previous value that we receive directly from the native text input (not our formatted value) + const prevNativeTextRef = useRef(value); const onChange = useCallback( ({nativeEvent}: NativeSyntheticEvent) => { const {count, start, before, text: fullNewText} = nativeEvent; + const previousNativeText = prevNativeTextRef.current; + prevNativeTextRef.current = fullNewText; - if (fullNewText === valueRef.current) { + if (fullNewText === valueRef.current || fullNewText === previousNativeText) { + // The text hasn't changed (note: the handler gets called for selection changes as well) return; } - console.log(nativeEvent); // This method is called to notify you that, within "fullNewText", the "count" characters // beginning at "start" have just replaced old text that had length "before". - const newText = fullNewText.substring(start, start + count); + const diffText = fullNewText.substring(start, start + count); // Replace newText in the original text: const currentText = valueRef.current; - const updatedText = currentText.substring(0, start) + newText + currentText.substring(start + before); - - // Check for emojis - const isEmojiInserted = newText.trim() === newText && EmojiUtils.containsOnlyEmojis(newText); - const commentWithSpaceInserted = isEmojiInserted ? ComposerUtils.insertWhiteSpaceAtIndex(updatedText, start + count) : updatedText; + const newText = currentText.substring(0, start) + diffText + currentText.substring(start + before); + + // Check for emojis: + // - Either add a whitespace if the user typed an emoji + // - Or insert an emoji when the user types :emojiCode: + // - Extract all emojis from the updated text and update the frequently used emojis + const isEmojiInserted = diffText.trim() === diffText && EmojiUtils.containsOnlyEmojis(diffText); + const commentWithSpaceInserted = isEmojiInserted ? ComposerUtils.insertWhiteSpaceAtIndex(newText, start + count) : newText; const {text: newComment, emojis, cursorPosition} = EmojiUtils.replaceAndExtractEmojis(commentWithSpaceInserted, preferredSkinTone, preferredLocale); if (emojis.length) { // TODO: This could be all moved to debouncedUpdateFrequentlyUsedEmojis, and the insertedEmojisRef could be removed @@ -598,6 +603,7 @@ function ComposerWithSuggestions( debouncedUpdateFrequentlyUsedEmojis(); } } + emojisPresentBefore.current = emojis; // Make LTR compatible if needed const newCommentConverted = convertToLTRForComposer(newComment); @@ -608,37 +614,30 @@ function ComposerWithSuggestions( const isCommentEmpty = !!newCommentConverted.match(/^(\s)*$/); setIsCommentEmpty(isCommentEmpty); - // Update selection - const position = Math.max((selection.end ?? 0) + (newComment.length - valueRef.current.length), cursorPosition ?? 0); - if (commentWithSpaceInserted !== newComment && isIOSNative) { - syncSelectionWithOnChangeTextRef.current = {position, value: newComment}; + // Update selection eventually + if (newComment !== newText) { + const position = Math.max((selection.end ?? 0) + (newComment.length - valueRef.current.length), cursorPosition ?? 0); + setSelection((prevSelection) => ({ + start: position, + end: position, + positionX: prevSelection.positionX, + positionY: prevSelection.positionY, + })); + if (isIOSNative) { + // ensure that selection is set imperatively after all state changes are effective + InteractionManager.runAfterInteractions(() => { + // note: this implementation is only available on non-web RN, thus the wrapping + // 'if' block contains a redundant (since the ref is only used on iOS) platform check + textInputRef.current?.setSelection(position, position); + }); + } } - setSelection((prevSelection) => ({ - start: position, - end: position, - positionX: prevSelection.positionX, - positionY: prevSelection.positionY, - })); // Update onyx related state: - // Report.saveReportDraftComment(reportID, newCommentConverted); debouncedSaveReportComment(reportID, newCommentConverted); if (newCommentConverted) { debouncedBroadcastUserIsTyping(reportID); } - - // From onChangeText: - if (isIOSNative && syncSelectionWithOnChangeTextRef.current) { - const positionSnapshot = syncSelectionWithOnChangeTextRef.current.position; - syncSelectionWithOnChangeTextRef.current = null; - - // ensure that selection is set imperatively after all state changes are effective - InteractionManager.runAfterInteractions(() => { - // note: this implementation is only available on non-web RN, thus the wrapping - // 'if' block contains a redundant (since the ref is only used on iOS) platform check - textInputRef.current?.setSelection(positionSnapshot, positionSnapshot); - }); - } }, [debouncedSaveReportComment, debouncedUpdateFrequentlyUsedEmojis, preferredLocale, preferredSkinTone, reportID, selection.end, setIsCommentEmpty, suggestionsRef], ); @@ -864,7 +863,6 @@ function ComposerWithSuggestions( ref={setTextInputRef} placeholder={inputPlaceholder} placeholderTextColor={theme.placeholderText} - // onChangeText={onChangeText} onChange={onChange} onKeyPress={triggerHotkeyActions} textAlignVertical="top" From 87a286ede77884569d917c854ecb7b6f505b100c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Wed, 26 Jun 2024 18:06:13 +0200 Subject: [PATCH 08/42] add todo --- .../ComposerWithSuggestions/ComposerWithSuggestions.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index 5c9d0c9f975c..7762d8d050bd 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -320,6 +320,7 @@ function ComposerWithSuggestions( * API is not called too often. */ const debouncedUpdateFrequentlyUsedEmojis = useCallback(() => { + // TODO: this function isn't even debounced if you look closely... User.updateFrequentlyUsedEmojis(EmojiUtils.getFrequentlyUsedEmojis(insertedEmojisRef.current)); insertedEmojisRef.current = []; }, []); From 5b89d052128f4d25090b7475291d07bd4d72bcd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Wed, 26 Jun 2024 18:06:50 +0200 Subject: [PATCH 09/42] removed migrated onTextChange --- .../ComposerWithSuggestions.tsx | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index 7762d8d050bd..39110e0c2520 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -546,25 +546,6 @@ function ComposerWithSuggestions( [isSmallScreenWidth, isKeyboardShown, suggestionsRef, includeChronos, handleSendMessage, lastReportAction, reportID], ); - // const onChangeText = useCallback( - // (commentValue: string) => { - // updateComment(commentValue, true); - - // if (isIOSNative && syncSelectionWithOnChangeTextRef.current) { - // const positionSnapshot = syncSelectionWithOnChangeTextRef.current.position; - // syncSelectionWithOnChangeTextRef.current = null; - - // // ensure that selection is set imperatively after all state changes are effective - // InteractionManager.runAfterInteractions(() => { - // // note: this implementation is only available on non-web RN, thus the wrapping - // // 'if' block contains a redundant (since the ref is only used on iOS) platform check - // textInputRef.current?.setSelection(positionSnapshot, positionSnapshot); - // }); - // } - // }, - // [updateComment], - // ); - // This contains the previous value that we receive directly from the native text input (not our formatted value) const prevNativeTextRef = useRef(value); const onChange = useCallback( From d8fdf335bf53f928d6a19f28ef918a2273d7678f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Wed, 26 Jun 2024 18:07:32 +0200 Subject: [PATCH 10/42] rename to handleInputChange --- .../ComposerWithSuggestions/ComposerWithSuggestions.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index 39110e0c2520..156a567e002a 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -548,7 +548,7 @@ function ComposerWithSuggestions( // This contains the previous value that we receive directly from the native text input (not our formatted value) const prevNativeTextRef = useRef(value); - const onChange = useCallback( + const handleInputChange = useCallback( ({nativeEvent}: NativeSyntheticEvent) => { const {count, start, before, text: fullNewText} = nativeEvent; const previousNativeText = prevNativeTextRef.current; @@ -845,7 +845,7 @@ function ComposerWithSuggestions( ref={setTextInputRef} placeholder={inputPlaceholder} placeholderTextColor={theme.placeholderText} - onChange={onChange} + onChange={handleInputChange} onKeyPress={triggerHotkeyActions} textAlignVertical="top" style={[styles.textInputCompose, isComposerFullSize ? styles.textInputFullCompose : styles.textInputCollapseCompose]} From da9d7b200adb94bf9da5342fb55cb9a2570924a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Wed, 26 Jun 2024 18:47:57 +0200 Subject: [PATCH 11/42] update isCommentEmpty from effect --- .../ComposerWithSuggestions.tsx | 105 +----------------- 1 file changed, 4 insertions(+), 101 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index 156a567e002a..885d12816209 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -369,107 +369,10 @@ function ComposerWithSuggestions( }; }, [reportID]); - /** - * Find the newly added characters between the previous text and the new text based on the selection. - * - * @param prevText - The previous text. - * @param newText - The new text. - * @returns An object containing information about the newly added characters. - * @property startIndex - The start index of the newly added characters in the new text. - * @property endIndex - The end index of the newly added characters in the new text. - * @property diff - The newly added characters. - */ - const findNewlyAddedChars = useCallback( - (prevText: string, newText: string): NewlyAddedChars => { - let startIndex = -1; - let endIndex = -1; - let currentIndex = 0; - - // Find the first character mismatch with newText - while (currentIndex < newText.length && prevText.charAt(currentIndex) === newText.charAt(currentIndex) && selection.start > currentIndex) { - currentIndex++; - } - - if (currentIndex < newText.length) { - startIndex = currentIndex; - const commonSuffixLength = ComposerUtils.findCommonSuffixLength(prevText, newText, selection?.end ?? 0); - // if text is getting pasted over find length of common suffix and subtract it from new text length - if (commonSuffixLength > 0 || (selection?.end ?? 0) - selection.start > 0) { - endIndex = newText.length - commonSuffixLength; - } else { - endIndex = currentIndex + newText.length; - } - } - return { - startIndex, - endIndex, - diff: newText.substring(startIndex, endIndex), - }; - }, - [selection.start, selection.end], - ); - - /** - * Update the value of the comment in Onyx - */ - const updateComment = useCallback( - (commentValue: string, shouldDebounceSaveComment?: boolean) => { - // raiseIsScrollLikelyLayoutTriggered(); - // // TODO: refactor update comment, to not use findNewlyAddedChars, but to get these info from onChange - // // TODO: Check if findNewlyAddedChars can be removed entirely, or if there are edge use cases (updateComment is called from many different places) that need to be supported - // const {startIndex, endIndex, diff} = findNewlyAddedChars(lastTextRef.current, commentValue); - // const isEmojiInserted = diff.length && endIndex > startIndex && diff.trim() === diff && EmojiUtils.containsOnlyEmojis(diff); - // const commentWithSpaceInserted = isEmojiInserted ? ComposerUtils.insertWhiteSpaceAtIndex(commentValue, endIndex) : commentValue; - // const {text: newComment, emojis, cursorPosition} = EmojiUtils.replaceAndExtractEmojis(commentWithSpaceInserted, preferredSkinTone, preferredLocale); - // if (emojis.length) { - // const newEmojis = EmojiUtils.getAddedEmojis(emojis, emojisPresentBefore.current); - // if (newEmojis.length) { - // // Ensure emoji suggestions are hidden after inserting emoji even when the selection is not changed - // if (suggestionsRef.current) { - // suggestionsRef.current.resetSuggestions(); - // } - // insertedEmojisRef.current = [...insertedEmojisRef.current, ...newEmojis]; - // debouncedUpdateFrequentlyUsedEmojis(); - // } - // } - // const newCommentConverted = convertToLTRForComposer(newComment); - // emojisPresentBefore.current = emojis; - // setValue(newCommentConverted); - // if (commentValue !== newComment) { - // const position = Math.max((selection.end ?? 0) + (newComment.length - commentRef.current.length), cursorPosition ?? 0); - // if (commentWithSpaceInserted !== newComment && isIOSNative) { - // syncSelectionWithOnChangeTextRef.current = {position, value: newComment}; - // } - // setSelection((prevSelection) => ({ - // start: position, - // end: position, - // positionX: prevSelection.positionX, - // positionY: prevSelection.positionY, - // })); - // } - // commentRef.current = newCommentConverted; - // if (shouldDebounceSaveComment) { - // isCommentPendingSaved.current = true; - // debouncedSaveReportComment(reportID, newCommentConverted); - // } else { - // Report.saveReportDraftComment(reportID, newCommentConverted); - // } - // if (newCommentConverted) { - // debouncedBroadcastUserIsTyping(reportID); - // } - }, - [ - debouncedUpdateFrequentlyUsedEmojis, - findNewlyAddedChars, - preferredLocale, - preferredSkinTone, - reportID, - suggestionsRef, - raiseIsScrollLikelyLayoutTriggered, - debouncedSaveReportComment, - selection.end, - ], - ); + useEffect(() => { + const isCommentEmpty = !!value.match(/^(\s)*$/); + setIsCommentEmpty(isCommentEmpty); + }, [setIsCommentEmpty, value]); const prepareCommentAndResetComposer = useCallback((): string => { const trimmedComment = valueRef.current.trim(); From d4927cb09e88b17d1075ed19adcfa60c5cb91f4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Wed, 26 Jun 2024 18:56:00 +0200 Subject: [PATCH 12/42] fix: remove unused setValue props from Suggestions --- .../ComposerWithSuggestions/ComposerWithSuggestions.tsx | 1 - src/pages/home/report/ReportActionCompose/Suggestions.tsx | 5 ----- 2 files changed, 6 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index 885d12816209..160c833fd3eb 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -785,7 +785,6 @@ function ComposerWithSuggestions( policyID={policyID} // Input value={value} - setValue={setValue} selection={selection} setSelection={setSelection} resetKeyboardInput={resetKeyboardInput} diff --git a/src/pages/home/report/ReportActionCompose/Suggestions.tsx b/src/pages/home/report/ReportActionCompose/Suggestions.tsx index f82b38c3e154..4ced94075710 100644 --- a/src/pages/home/report/ReportActionCompose/Suggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/Suggestions.tsx @@ -14,9 +14,6 @@ type SuggestionProps = { /** The current input value */ value: string; - /** Callback to update the current input value */ - setValue: (newValue: string) => void; - /** The current selection value */ selection: TextSelection; @@ -56,7 +53,6 @@ type SuggestionProps = { function Suggestions( { value, - setValue, selection, setSelection, updateComment, @@ -147,7 +143,6 @@ function Suggestions( const baseProps = { value, - setValue, setSelection, selection, updateComment, From 6715b4808fb11ffeb138c861d3d66b22772ec442 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Wed, 26 Jun 2024 18:56:39 +0200 Subject: [PATCH 13/42] fix updateComment in SilentCommentUpdater to update text input directly --- .../ComposerWithSuggestions/ComposerWithSuggestions.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index 160c833fd3eb..1e51c8ce55fe 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -794,9 +794,11 @@ function ComposerWithSuggestions( )} From 6c49d98bc0f1775e987402e1f8bf8bd0fa2bca82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Wed, 26 Jun 2024 19:09:27 +0200 Subject: [PATCH 14/42] fix use case of replaceSelectionWithText --- .../ComposerWithSuggestions.tsx | 173 ++++++++++-------- 1 file changed, 101 insertions(+), 72 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index 1e51c8ce55fe..361cdb82c434 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -399,18 +399,6 @@ function ComposerWithSuggestions( return trimmedComment; }, [setTextInputShouldClear, isComposerFullSize, setIsFullComposerAvailable, reportID, debouncedSaveReportComment]); - /** - * Callback to add whatever text is chosen into the main input (used f.e as callback for the emoji picker) - */ - const replaceSelectionWithText = useCallback( - (text: string) => { - // selection replacement should be debounced to avoid conflicts with text typing - // (f.e. when emoji is being picked and 1 second still did not pass after user finished typing) - updateComment(ComposerUtils.insertText(valueRef.current, selection, text), true); - }, - [selection, updateComment], - ); - const triggerHotkeyActions = useCallback( (event: NativeSyntheticEvent) => { const webEvent = event as unknown as KeyboardEvent; @@ -449,82 +437,123 @@ function ComposerWithSuggestions( [isSmallScreenWidth, isKeyboardShown, suggestionsRef, includeChronos, handleSendMessage, lastReportAction, reportID], ); + const todoGiveThisAProperName = useCallback(({ + fullNewText, + diffText, + endPositionOfNewAddedText, + shouldDebounceSaveComment, + }: { + fullNewText: string; + diffText: string; + endPositionOfNewAddedText: number; + shouldDebounceSaveComment: boolean; + }) => { + raiseIsScrollLikelyLayoutTriggered(); + // Check for emojis: + // - Either add a whitespace if the user typed an emoji + // - Or insert an emoji when the user types :emojiCode: + // - Extract all emojis from the updated text and update the frequently used emojis + const isEmojiInserted = diffText.trim() === diffText && EmojiUtils.containsOnlyEmojis(diffText); + const commentWithSpaceInserted = isEmojiInserted ? ComposerUtils.insertWhiteSpaceAtIndex(fullNewText, endPositionOfNewAddedText) : fullNewText; + const {text: newComment, emojis, cursorPosition} = EmojiUtils.replaceAndExtractEmojis(commentWithSpaceInserted, preferredSkinTone, preferredLocale); + if (emojis.length) { + const newEmojis = EmojiUtils.getAddedEmojis(emojis, emojisPresentBefore.current); + if (newEmojis.length) { + // Ensure emoji suggestions are hidden after inserting emoji even when the selection is not changed + if (suggestionsRef.current) { + suggestionsRef.current.resetSuggestions(); + } + insertedEmojisRef.current = [...insertedEmojisRef.current, ...newEmojis]; + debouncedUpdateFrequentlyUsedEmojis(); + } + } + emojisPresentBefore.current = emojis; + + // Make LTR compatible if needed + const newCommentConverted = convertToLTRForComposer(newComment); + + // Update state + setValue(newCommentConverted); + + // Update selection eventually + if (newComment !== fullNewText) { + const position = Math.max((selection.end ?? 0) + (newComment.length - valueRef.current.length), cursorPosition ?? 0); + setSelection((prevSelection) => ({ + start: position, + end: position, + positionX: prevSelection.positionX, + positionY: prevSelection.positionY, + })); + if (isIOSNative) { + // ensure that selection is set imperatively after all state changes are effective + InteractionManager.runAfterInteractions(() => { + // note: this implementation is only available on non-web RN, thus the wrapping + // 'if' block contains a redundant (since the ref is only used on iOS) platform check + textInputRef.current?.setSelection(position, position); + }); + } + } + + // Update onyx related state: + if (shouldDebounceSaveComment) { + isCommentPendingSaved.current = true; + debouncedSaveReportComment(reportID, newCommentConverted); + } else { + Report.saveReportDraftComment(reportID, newCommentConverted); + } + if (newCommentConverted) { + debouncedBroadcastUserIsTyping(reportID); + } + }, [debouncedSaveReportComment, debouncedUpdateFrequentlyUsedEmojis, preferredLocale, preferredSkinTone, raiseIsScrollLikelyLayoutTriggered, reportID, selection.end, suggestionsRef]) + // This contains the previous value that we receive directly from the native text input (not our formatted value) const prevNativeTextRef = useRef(value); const handleInputChange = useCallback( ({nativeEvent}: NativeSyntheticEvent) => { - const {count, start, before, text: fullNewText} = nativeEvent; + const {count, start, before, text: nativeText} = nativeEvent; const previousNativeText = prevNativeTextRef.current; - prevNativeTextRef.current = fullNewText; + prevNativeTextRef.current = nativeText; - if (fullNewText === valueRef.current || fullNewText === previousNativeText) { + if (nativeText === valueRef.current || nativeText === previousNativeText) { // The text hasn't changed (note: the handler gets called for selection changes as well) return; } // This method is called to notify you that, within "fullNewText", the "count" characters // beginning at "start" have just replaced old text that had length "before". - const diffText = fullNewText.substring(start, start + count); + const endPosition = start + count; + const diffText = nativeText.substring(start, endPosition); // Replace newText in the original text: const currentText = valueRef.current; - const newText = currentText.substring(0, start) + diffText + currentText.substring(start + before); - - // Check for emojis: - // - Either add a whitespace if the user typed an emoji - // - Or insert an emoji when the user types :emojiCode: - // - Extract all emojis from the updated text and update the frequently used emojis - const isEmojiInserted = diffText.trim() === diffText && EmojiUtils.containsOnlyEmojis(diffText); - const commentWithSpaceInserted = isEmojiInserted ? ComposerUtils.insertWhiteSpaceAtIndex(newText, start + count) : newText; - const {text: newComment, emojis, cursorPosition} = EmojiUtils.replaceAndExtractEmojis(commentWithSpaceInserted, preferredSkinTone, preferredLocale); - if (emojis.length) { - // TODO: This could be all moved to debouncedUpdateFrequentlyUsedEmojis, and the insertedEmojisRef could be removed - const newEmojis = EmojiUtils.getAddedEmojis(emojis, emojisPresentBefore.current); - if (newEmojis.length) { - // Ensure emoji suggestions are hidden after inserting emoji even when the selection is not changed - if (suggestionsRef.current) { - suggestionsRef.current.resetSuggestions(); - } - insertedEmojisRef.current = [...insertedEmojisRef.current, ...newEmojis]; - debouncedUpdateFrequentlyUsedEmojis(); - } - } - emojisPresentBefore.current = emojis; - - // Make LTR compatible if needed - const newCommentConverted = convertToLTRForComposer(newComment); - - // Update state - setValue(newCommentConverted); - // TODO: this could be done in a useEffect - const isCommentEmpty = !!newCommentConverted.match(/^(\s)*$/); - setIsCommentEmpty(isCommentEmpty); - - // Update selection eventually - if (newComment !== newText) { - const position = Math.max((selection.end ?? 0) + (newComment.length - valueRef.current.length), cursorPosition ?? 0); - setSelection((prevSelection) => ({ - start: position, - end: position, - positionX: prevSelection.positionX, - positionY: prevSelection.positionY, - })); - if (isIOSNative) { - // ensure that selection is set imperatively after all state changes are effective - InteractionManager.runAfterInteractions(() => { - // note: this implementation is only available on non-web RN, thus the wrapping - // 'if' block contains a redundant (since the ref is only used on iOS) platform check - textInputRef.current?.setSelection(position, position); - }); - } - } + const fullNewText = currentText.substring(0, start) + diffText + currentText.substring(start + before); + + todoGiveThisAProperName({ + fullNewText, + diffText, + endPositionOfNewAddedText: endPosition, + shouldDebounceSaveComment: true, + }) + }, + [todoGiveThisAProperName], + ); - // Update onyx related state: - debouncedSaveReportComment(reportID, newCommentConverted); - if (newCommentConverted) { - debouncedBroadcastUserIsTyping(reportID); - } + /** + * Callback to add whatever text is chosen into the main input (used f.e as callback for the emoji picker) + */ + const replaceSelectionWithText = useCallback( + (text: string) => { + const newFullText = ComposerUtils.insertText(valueRef.current, selection, text) + const endPositionOfNewAddedText = selection.start + text.length; + todoGiveThisAProperName({ + fullNewText: newFullText, + diffText: text, + endPositionOfNewAddedText, + // selection replacement should be debounced to avoid conflicts with text typing + // (f.e. when emoji is being picked and 1 second still did not pass after user finished typing) + shouldDebounceSaveComment: true, + }); }, - [debouncedSaveReportComment, debouncedUpdateFrequentlyUsedEmojis, preferredLocale, preferredSkinTone, reportID, selection.end, setIsCommentEmpty, suggestionsRef], + [selection, todoGiveThisAProperName], ); const onSelectionChange = useCallback( From d8f81472df59352b80c4fda3ee2ad6bdf118d72e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Wed, 26 Jun 2024 19:12:04 +0200 Subject: [PATCH 15/42] rename to handleComposerUpdate --- .../ComposerWithSuggestions.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index 361cdb82c434..72783386e4ae 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -437,7 +437,7 @@ function ComposerWithSuggestions( [isSmallScreenWidth, isKeyboardShown, suggestionsRef, includeChronos, handleSendMessage, lastReportAction, reportID], ); - const todoGiveThisAProperName = useCallback(({ + const handleComposerUpdate = useCallback(({ fullNewText, diffText, endPositionOfNewAddedText, @@ -527,14 +527,14 @@ function ComposerWithSuggestions( const currentText = valueRef.current; const fullNewText = currentText.substring(0, start) + diffText + currentText.substring(start + before); - todoGiveThisAProperName({ + handleComposerUpdate({ fullNewText, diffText, endPositionOfNewAddedText: endPosition, shouldDebounceSaveComment: true, }) }, - [todoGiveThisAProperName], + [handleComposerUpdate], ); /** @@ -544,7 +544,7 @@ function ComposerWithSuggestions( (text: string) => { const newFullText = ComposerUtils.insertText(valueRef.current, selection, text) const endPositionOfNewAddedText = selection.start + text.length; - todoGiveThisAProperName({ + handleComposerUpdate({ fullNewText: newFullText, diffText: text, endPositionOfNewAddedText, @@ -553,7 +553,7 @@ function ComposerWithSuggestions( shouldDebounceSaveComment: true, }); }, - [selection, todoGiveThisAProperName], + [selection, handleComposerUpdate], ); const onSelectionChange = useCallback( From 97ef3bb30e04a2ebb550de68fd2b8d7545a52ff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Wed, 26 Jun 2024 19:13:56 +0200 Subject: [PATCH 16/42] explain it a bit better --- .../ComposerWithSuggestions/ComposerWithSuggestions.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index 72783386e4ae..61cc04f03489 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -519,8 +519,7 @@ function ComposerWithSuggestions( return; } - // This method is called to notify you that, within "fullNewText", the "count" characters - // beginning at "start" have just replaced old text that had length "before". + // Within "nativeText", the "count" characters beginning at "start" have just replaced old text (valueRef.current) that had length "before". const endPosition = start + count; const diffText = nativeText.substring(start, endPosition); // Replace newText in the original text: From fd5b913cf25cbcd9ea3e11ac58b6332f63bfdf7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Wed, 26 Jun 2024 20:06:15 +0200 Subject: [PATCH 17/42] migrated Suggestions to new composer API using handleComposerUpdate --- src/libs/SuggestionUtils.ts | 24 ++++++++++++++- .../ComposerWithSuggestions.tsx | 30 ++++++++++--------- .../ReportActionCompose/SuggestionEmoji.tsx | 10 ++++--- .../ReportActionCompose/SuggestionMention.tsx | 10 +++++-- .../ReportActionCompose/Suggestions.tsx | 3 +- 5 files changed, 54 insertions(+), 23 deletions(-) diff --git a/src/libs/SuggestionUtils.ts b/src/libs/SuggestionUtils.ts index 96379ce49ef3..a561646dd1ba 100644 --- a/src/libs/SuggestionUtils.ts +++ b/src/libs/SuggestionUtils.ts @@ -1,3 +1,5 @@ +import type { TextSelection } from '@components/Composer/types'; +import type { HandleComposerUpdateArgs } from '@pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions'; import CONST from '@src/CONST'; /** @@ -20,4 +22,24 @@ function hasEnoughSpaceForLargeSuggestionMenu(listHeight: number, composerHeight return availableHeight > menuHeight; } -export {trimLeadingSpace, hasEnoughSpaceForLargeSuggestionMenu}; +/** + * Replaces the selection range in currentText with the insert value + */ +function getComposerUpdateArgsForSuggestionToInsert(currentText: string, insert: string, selection: TextSelection): HandleComposerUpdateArgs { + const textBefore = currentText.slice(0, selection.start); + const textAfter = currentText.slice(selection.end); + + const newText = `${insert} `; + const firstPart = textBefore + newText; + const fullNewText = firstPart + trimLeadingSpace(textAfter); + const endPosition = firstPart.length; + + return { + diffText: newText, + fullNewText, + endPositionOfNewAddedText: endPosition, + shouldDebounceSaveComment: true, + }; +} + +export {trimLeadingSpace, hasEnoughSpaceForLargeSuggestionMenu, getComposerUpdateArgsForSuggestionToInsert}; diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index 61cc04f03489..560261766974 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -60,14 +60,20 @@ import ONYXKEYS from '@src/ONYXKEYS'; import type * as OnyxTypes from '@src/types/onyx'; import type ChildrenProps from '@src/types/utils/ChildrenProps'; -type SyncSelection = { - position: number; - value: string; -}; +type HandleComposerUpdateArgs = { + // The full new text you'd like to display in the composer + fullNewText: string; + // The difference between the new text and the previous text + diffText: string; + // The position of the end of the newly added text + endPositionOfNewAddedText: number; + // Whether to debounce the saving of the comment + shouldDebounceSaveComment: boolean; +} -type AnimatedRef = ReturnType; +type HandleComposerUpdateCallback = (args: HandleComposerUpdateArgs) => void; -type NewlyAddedChars = {startIndex: number; endIndex: number; diff: string}; +type AnimatedRef = ReturnType; type ComposerWithSuggestionsOnyxProps = { /** The parent report actions for the report */ @@ -437,16 +443,11 @@ function ComposerWithSuggestions( [isSmallScreenWidth, isKeyboardShown, suggestionsRef, includeChronos, handleSendMessage, lastReportAction, reportID], ); - const handleComposerUpdate = useCallback(({ + const handleComposerUpdate: HandleComposerUpdateCallback = useCallback(({ fullNewText, diffText, endPositionOfNewAddedText, shouldDebounceSaveComment, - }: { - fullNewText: string; - diffText: string; - endPositionOfNewAddedText: number; - shouldDebounceSaveComment: boolean; }) => { raiseIsScrollLikelyLayoutTriggered(); // Check for emojis: @@ -569,6 +570,7 @@ function ComposerWithSuggestions( const hideSuggestionMenu = useCallback( (e: NativeSyntheticEvent) => { + console.log('hideSuggestionMenu'); mobileInputScrollPosition.current = e?.nativeEvent?.contentOffset?.y ?? 0; if (!suggestionsRef.current || isScrollLikelyLayoutTriggered.current) { return; @@ -807,7 +809,7 @@ function ComposerWithSuggestions( { - const commentBeforeColon = value.slice(0, suggestionValues.colonIndex); const emojiObject = suggestionValues.suggestedEmojis[highlightedEmojiIndexInner]; const emojiCode = emojiObject.types?.[preferredSkinTone] ? emojiObject.types[preferredSkinTone] : emojiObject.code; - const commentAfterColonWithEmojiNameRemoved = value.slice(selection.end); - - updateComment(`${commentBeforeColon}${emojiCode} ${SuggestionsUtils.trimLeadingSpace(commentAfterColonWithEmojiNameRemoved)}`, true); + + const updateCommentArgs = SuggestionsUtils.getComposerUpdateArgsForSuggestionToInsert(value, emojiCode, { + start: suggestionValues.colonIndex, + end: selection.end, + }); + updateComment(updateCommentArgs); // In some Android phones keyboard, the text to search for the emoji is not cleared // will be added after the user starts typing again on the keyboard. This package is diff --git a/src/pages/home/report/ReportActionCompose/SuggestionMention.tsx b/src/pages/home/report/ReportActionCompose/SuggestionMention.tsx index 129c8c822d74..30c395ee0a08 100644 --- a/src/pages/home/report/ReportActionCompose/SuggestionMention.tsx +++ b/src/pages/home/report/ReportActionCompose/SuggestionMention.tsx @@ -165,12 +165,16 @@ function SuggestionMention( */ const insertSelectedMention = useCallback( (highlightedMentionIndexInner: number) => { - const commentBeforeAtSign = value.slice(0, suggestionValues.atSignIndex); const mentionObject = suggestionValues.suggestedMentions[highlightedMentionIndexInner]; const mentionCode = getMentionCode(mentionObject, suggestionValues.prefixType); - const commentAfterMention = value.slice(suggestionValues.atSignIndex + suggestionValues.mentionPrefix.length + 1); - updateComment(`${commentBeforeAtSign}${mentionCode} ${SuggestionsUtils.trimLeadingSpace(commentAfterMention)}`, true); + const replaceUntil = suggestionValues.atSignIndex + suggestionValues.mentionPrefix.length + 1 + const updateCommentArgs = SuggestionsUtils.getComposerUpdateArgsForSuggestionToInsert(value, mentionCode, { + start: suggestionValues.atSignIndex, + end: replaceUntil, + }); + updateComment(updateCommentArgs); + const selectionPosition = suggestionValues.atSignIndex + mentionCode.length + CONST.SPACE_LENGTH; setSelection({ start: selectionPosition, diff --git a/src/pages/home/report/ReportActionCompose/Suggestions.tsx b/src/pages/home/report/ReportActionCompose/Suggestions.tsx index 4ced94075710..16d89301f798 100644 --- a/src/pages/home/report/ReportActionCompose/Suggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/Suggestions.tsx @@ -9,6 +9,7 @@ import usePrevious from '@hooks/usePrevious'; import type {SuggestionsRef} from './ReportActionCompose'; import SuggestionEmoji from './SuggestionEmoji'; import SuggestionMention from './SuggestionMention'; +import type { HandleComposerUpdateCallback } from './ComposerWithSuggestions/ComposerWithSuggestions'; type SuggestionProps = { /** The current input value */ @@ -21,7 +22,7 @@ type SuggestionProps = { setSelection: (newSelection: TextSelection) => void; /** Callback to update the comment draft */ - updateComment: (newComment: string, shouldDebounceSaveComment?: boolean) => void; + updateComment: HandleComposerUpdateCallback; /** Measures the parent container's position and dimensions. Also add cursor coordinates */ measureParentContainerAndReportCursor: (callback: MeasureParentContainerAndCursorCallback) => void; From bc3add26e33efaba545efde8a7af66759729af63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Wed, 26 Jun 2024 20:13:13 +0200 Subject: [PATCH 18/42] cleanup --- src/libs/SuggestionUtils.ts | 2 +- .../ComposerWithSuggestions.tsx | 19 +++---------------- .../ComposerWithSuggestions/types.tsx | 15 +++++++++++++++ .../ReportActionCompose/SuggestionEmoji.tsx | 6 +++--- .../ReportActionCompose/SuggestionMention.tsx | 6 +++--- .../ReportActionCompose/Suggestions.tsx | 8 ++++---- 6 files changed, 29 insertions(+), 27 deletions(-) create mode 100644 src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/types.tsx diff --git a/src/libs/SuggestionUtils.ts b/src/libs/SuggestionUtils.ts index a561646dd1ba..811910d1bfab 100644 --- a/src/libs/SuggestionUtils.ts +++ b/src/libs/SuggestionUtils.ts @@ -1,5 +1,5 @@ import type { TextSelection } from '@components/Composer/types'; -import type { HandleComposerUpdateArgs } from '@pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions'; +import type { HandleComposerUpdateArgs } from '@pages/home/report/ReportActionCompose/ComposerWithSuggestions/types'; import CONST from '@src/CONST'; /** diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index 560261766974..b78a7acea888 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -59,19 +59,7 @@ import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type * as OnyxTypes from '@src/types/onyx'; import type ChildrenProps from '@src/types/utils/ChildrenProps'; - -type HandleComposerUpdateArgs = { - // The full new text you'd like to display in the composer - fullNewText: string; - // The difference between the new text and the previous text - diffText: string; - // The position of the end of the newly added text - endPositionOfNewAddedText: number; - // Whether to debounce the saving of the comment - shouldDebounceSaveComment: boolean; -} - -type HandleComposerUpdateCallback = (args: HandleComposerUpdateArgs) => void; +import type { HandleComposerUpdateCallback } from './types'; type AnimatedRef = ReturnType; @@ -570,7 +558,6 @@ function ComposerWithSuggestions( const hideSuggestionMenu = useCallback( (e: NativeSyntheticEvent) => { - console.log('hideSuggestionMenu'); mobileInputScrollPosition.current = e?.nativeEvent?.contentOffset?.y ?? 0; if (!suggestionsRef.current || isScrollLikelyLayoutTriggered.current) { return; @@ -809,7 +796,7 @@ function ComposerWithSuggestions( void; + +export type {HandleComposerUpdateArgs, HandleComposerUpdateCallback}; + diff --git a/src/pages/home/report/ReportActionCompose/SuggestionEmoji.tsx b/src/pages/home/report/ReportActionCompose/SuggestionEmoji.tsx index 4ab817e56e11..333c610d5995 100644 --- a/src/pages/home/report/ReportActionCompose/SuggestionEmoji.tsx +++ b/src/pages/home/report/ReportActionCompose/SuggestionEmoji.tsx @@ -51,7 +51,7 @@ function SuggestionEmoji( value, selection, setSelection, - updateComment, + updateComposer, isAutoSuggestionPickerLarge, resetKeyboardInput, measureParentContainerAndReportCursor, @@ -87,7 +87,7 @@ function SuggestionEmoji( start: suggestionValues.colonIndex, end: selection.end, }); - updateComment(updateCommentArgs); + updateComposer(updateCommentArgs); // In some Android phones keyboard, the text to search for the emoji is not cleared // will be added after the user starts typing again on the keyboard. This package is @@ -100,7 +100,7 @@ function SuggestionEmoji( }); setSuggestionValues((prevState) => ({...prevState, suggestedEmojis: []})); }, - [preferredSkinTone, resetKeyboardInput, selection.end, setSelection, suggestionValues.colonIndex, suggestionValues.suggestedEmojis, updateComment, value], + [preferredSkinTone, resetKeyboardInput, selection.end, setSelection, suggestionValues.colonIndex, suggestionValues.suggestedEmojis, updateComposer, value], ); /** diff --git a/src/pages/home/report/ReportActionCompose/SuggestionMention.tsx b/src/pages/home/report/ReportActionCompose/SuggestionMention.tsx index 30c395ee0a08..0d752d7651e8 100644 --- a/src/pages/home/report/ReportActionCompose/SuggestionMention.tsx +++ b/src/pages/home/report/ReportActionCompose/SuggestionMention.tsx @@ -57,7 +57,7 @@ type SuggestionPersonalDetailsList = Record< >; function SuggestionMention( - {value, selection, setSelection, updateComment, isAutoSuggestionPickerLarge, measureParentContainerAndReportCursor, isComposerFocused, isGroupPolicyReport, policyID}: SuggestionProps, + {value, selection, setSelection, updateComposer, isAutoSuggestionPickerLarge, measureParentContainerAndReportCursor, isComposerFocused, isGroupPolicyReport, policyID}: SuggestionProps, ref: ForwardedRef, ) { const personalDetails = usePersonalDetails() ?? CONST.EMPTY_OBJECT; @@ -173,7 +173,7 @@ function SuggestionMention( start: suggestionValues.atSignIndex, end: replaceUntil, }); - updateComment(updateCommentArgs); + updateComposer(updateCommentArgs); const selectionPosition = suggestionValues.atSignIndex + mentionCode.length + CONST.SPACE_LENGTH; setSelection({ @@ -194,7 +194,7 @@ function SuggestionMention( suggestionValues.prefixType, suggestionValues.mentionPrefix.length, getMentionCode, - updateComment, + updateComposer, setSelection, ], ); diff --git a/src/pages/home/report/ReportActionCompose/Suggestions.tsx b/src/pages/home/report/ReportActionCompose/Suggestions.tsx index 16d89301f798..e9ee888abdb0 100644 --- a/src/pages/home/report/ReportActionCompose/Suggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/Suggestions.tsx @@ -9,7 +9,7 @@ import usePrevious from '@hooks/usePrevious'; import type {SuggestionsRef} from './ReportActionCompose'; import SuggestionEmoji from './SuggestionEmoji'; import SuggestionMention from './SuggestionMention'; -import type { HandleComposerUpdateCallback } from './ComposerWithSuggestions/ComposerWithSuggestions'; +import type { HandleComposerUpdateCallback } from './ComposerWithSuggestions/types'; type SuggestionProps = { /** The current input value */ @@ -22,7 +22,7 @@ type SuggestionProps = { setSelection: (newSelection: TextSelection) => void; /** Callback to update the comment draft */ - updateComment: HandleComposerUpdateCallback; + updateComposer: HandleComposerUpdateCallback; /** Measures the parent container's position and dimensions. Also add cursor coordinates */ measureParentContainerAndReportCursor: (callback: MeasureParentContainerAndCursorCallback) => void; @@ -56,7 +56,7 @@ function Suggestions( value, selection, setSelection, - updateComment, + updateComposer, resetKeyboardInput, measureParentContainerAndReportCursor, isAutoSuggestionPickerLarge = true, @@ -146,7 +146,7 @@ function Suggestions( value, setSelection, selection, - updateComment, + updateComposer, isAutoSuggestionPickerLarge, measureParentContainerAndReportCursor, isComposerFocused, From 33bfda50c00021c8bab9f715cb87f4ae7db290c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Wed, 26 Jun 2024 20:15:41 +0200 Subject: [PATCH 19/42] remove debug code --- .../ComposerWithSuggestions/ComposerWithSuggestions.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index b78a7acea888..54442a1b9f0c 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -757,7 +757,6 @@ function ComposerWithSuggestions( return ( <> - {/* */} Date: Thu, 27 Jun 2024 14:02:43 +0200 Subject: [PATCH 20/42] fix bug: type, send, text reappears --- .../ComposerWithSuggestions.tsx | 12 ++++++++---- .../ReportActionCompose/ReportActionCompose.tsx | 13 +++++-------- .../home/report/ReportActionCompose/SendButton.tsx | 3 ++- .../SilentCommentUpdater/index.tsx | 1 + 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index 54442a1b9f0c..7f2322ccb4f0 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -279,14 +279,17 @@ function ComposerWithSuggestions( const cursorPositionValue = useSharedValue({x: 0, y: 0}); const tag = useSharedValue(-1); const draftComment = getDraftComment(reportID) ?? ''; - const [value, setValue] = useState(() => { + const [value, setValueInternal] = useState(() => { if (draftComment) { emojisPresentBefore.current = EmojiUtils.extractEmojis(draftComment); } return draftComment; }); const valueRef = useRef(value); - valueRef.current = value; + const setValue = useCallback((newValue: string) => { + valueRef.current = newValue; + setValueInternal(newValue); + }, []); const {isSmallScreenWidth} = useWindowDimensions(); const maxComposerLines = isSmallScreenWidth ? CONST.COMPOSER.MAX_LINES_SMALL_SCREEN : CONST.COMPOSER.MAX_LINES; @@ -384,6 +387,7 @@ function ComposerWithSuggestions( isCommentPendingSaved.current = false; setSelection({start: 0, end: 0, positionX: 0, positionY: 0}); + // inputRef.current?.clear(); // I think there is no use doing that here, if JS lags behind this will have no effect anyway setValue(''); setTextInputShouldClear(true); if (isComposerFullSize) { @@ -391,7 +395,7 @@ function ComposerWithSuggestions( } setIsFullComposerAvailable(false); return trimmedComment; - }, [setTextInputShouldClear, isComposerFullSize, setIsFullComposerAvailable, reportID, debouncedSaveReportComment]); + }, [reportID, debouncedSaveReportComment, setValue, setTextInputShouldClear, isComposerFullSize, setIsFullComposerAvailable]); const triggerHotkeyActions = useCallback( (event: NativeSyntheticEvent) => { @@ -493,7 +497,7 @@ function ComposerWithSuggestions( if (newCommentConverted) { debouncedBroadcastUserIsTyping(reportID); } - }, [debouncedSaveReportComment, debouncedUpdateFrequentlyUsedEmojis, preferredLocale, preferredSkinTone, raiseIsScrollLikelyLayoutTriggered, reportID, selection.end, suggestionsRef]) + }, [debouncedSaveReportComment, debouncedUpdateFrequentlyUsedEmojis, preferredLocale, preferredSkinTone, raiseIsScrollLikelyLayoutTriggered, reportID, selection.end, setValue, suggestionsRef]) // This contains the previous value that we receive directly from the native text input (not our formatted value) const prevNativeTextRef = useRef(value); diff --git a/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx b/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx index 32ed282f9331..38c0a7497ea7 100644 --- a/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx +++ b/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx @@ -4,7 +4,7 @@ import type {MeasureInWindowOnSuccessCallback, NativeSyntheticEvent, TextInputFo import {View} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; import {withOnyx} from 'react-native-onyx'; -import {runOnJS, setNativeProps, useAnimatedRef} from 'react-native-reanimated'; +import {useAnimatedRef} from 'react-native-reanimated'; import type {Emoji} from '@assets/emojis/types'; import type {FileObject} from '@components/AttachmentModal'; import AttachmentModal from '@components/AttachmentModal'; @@ -356,18 +356,15 @@ function ReportActionCompose({ const isSendDisabled = isCommentEmpty || isBlockedFromConcierge || !!disabled || hasExceededMaxCommentLength; const handleSendMessage = useCallback(() => { - 'worklet'; - if (isSendDisabled || !isReportReadyForDisplay) { return; } // We are setting the isCommentEmpty flag to true so the status of it will be in sync of the native text input state - runOnJS(setIsCommentEmpty)(true); - runOnJS(resetFullComposerSize)(); - setNativeProps(animatedRef, {text: ''}); // clears native text input on the UI thread - runOnJS(submitForm)(); - }, [isSendDisabled, resetFullComposerSize, submitForm, animatedRef, isReportReadyForDisplay]); + setIsCommentEmpty(true); + resetFullComposerSize(); + submitForm(); + }, [isSendDisabled, resetFullComposerSize, submitForm, isReportReadyForDisplay]); const emojiShiftVertical = useMemo(() => { const chatItemComposeSecondaryRowHeight = styles.chatItemComposeSecondaryRow.height + styles.chatItemComposeSecondaryRow.marginTop + styles.chatItemComposeSecondaryRow.marginBottom; diff --git a/src/pages/home/report/ReportActionCompose/SendButton.tsx b/src/pages/home/report/ReportActionCompose/SendButton.tsx index 4b902e2c6246..5be4b11dc944 100644 --- a/src/pages/home/report/ReportActionCompose/SendButton.tsx +++ b/src/pages/home/report/ReportActionCompose/SendButton.tsx @@ -10,6 +10,7 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import CONST from '@src/CONST'; +import { runOnJS } from 'react-native-reanimated'; type SendButtonProps = { /** Whether the button is disabled */ @@ -25,7 +26,7 @@ function SendButton({isDisabled: isDisabledProp, handleSendMessage}: SendButtonP const {translate} = useLocalize(); const {isSmallScreenWidth} = useResponsiveLayout(); const Tap = Gesture.Tap().onEnd(() => { - handleSendMessage(); + runOnJS(handleSendMessage)(); }); return ( diff --git a/src/pages/home/report/ReportActionCompose/SilentCommentUpdater/index.tsx b/src/pages/home/report/ReportActionCompose/SilentCommentUpdater/index.tsx index f83f13e7002d..6c8733343250 100644 --- a/src/pages/home/report/ReportActionCompose/SilentCommentUpdater/index.tsx +++ b/src/pages/home/report/ReportActionCompose/SilentCommentUpdater/index.tsx @@ -34,6 +34,7 @@ function SilentCommentUpdater({comment, reportID, value, updateComment, isCommen } updateComment(comment ?? ''); + console.log('SilentCommentUpdater: Comment updated', comment); }, [prevCommentProp, prevPreferredLocale, prevReportId, comment, preferredLocale, reportID, updateComment, value, isCommentPendingSaved]); return null; From 130a41a42a67c8e1b1b1ea690bb5fdea350859f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Thu, 27 Jun 2024 14:17:06 +0200 Subject: [PATCH 21/42] fix draft comment not being cleared when sending --- .../ComposerWithSuggestions/ComposerWithSuggestions.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index 7f2322ccb4f0..397f65a0422f 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -278,8 +278,8 @@ function ComposerWithSuggestions( const mobileInputScrollPosition = useRef(0); const cursorPositionValue = useSharedValue({x: 0, y: 0}); const tag = useSharedValue(-1); - const draftComment = getDraftComment(reportID) ?? ''; const [value, setValueInternal] = useState(() => { + const draftComment = getDraftComment(reportID) ?? ''; if (draftComment) { emojisPresentBefore.current = EmojiUtils.extractEmojis(draftComment); } @@ -387,13 +387,14 @@ function ComposerWithSuggestions( isCommentPendingSaved.current = false; setSelection({start: 0, end: 0, positionX: 0, positionY: 0}); - // inputRef.current?.clear(); // I think there is no use doing that here, if JS lags behind this will have no effect anyway setValue(''); setTextInputShouldClear(true); if (isComposerFullSize) { Report.setIsComposerFullSize(reportID, false); } setIsFullComposerAvailable(false); + Report.saveReportDraftComment(reportID, ''); + return trimmedComment; }, [reportID, debouncedSaveReportComment, setValue, setTextInputShouldClear, isComposerFullSize, setIsFullComposerAvailable]); @@ -810,7 +811,7 @@ function ComposerWithSuggestions( resetKeyboardInput={resetKeyboardInput} /> - {ReportUtils.isValidReportIDFromPath(reportID) && ( + {/* {ReportUtils.isValidReportIDFromPath(reportID) && ( - )} + )} */} {/* Only used for testing so far */} {children} From eca86779d922b31ec6b090e716afe6369f62ab40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Thu, 27 Jun 2024 17:18:44 +0200 Subject: [PATCH 22/42] provide web patch --- ...ve-live-markdown+0.1.88+001+initial.patch} | 0 ...ive-markdown+0.1.88+addMissingEvents.patch | 61 +++++++++++++++++++ 2 files changed, 61 insertions(+) rename patches/{@expensify+react-native-live-markdown+0.1.85.patch => @expensify+react-native-live-markdown+0.1.88+001+initial.patch} (100%) create mode 100644 patches/@expensify+react-native-live-markdown+0.1.88+addMissingEvents.patch diff --git a/patches/@expensify+react-native-live-markdown+0.1.85.patch b/patches/@expensify+react-native-live-markdown+0.1.88+001+initial.patch similarity index 100% rename from patches/@expensify+react-native-live-markdown+0.1.85.patch rename to patches/@expensify+react-native-live-markdown+0.1.88+001+initial.patch diff --git a/patches/@expensify+react-native-live-markdown+0.1.88+addMissingEvents.patch b/patches/@expensify+react-native-live-markdown+0.1.88+addMissingEvents.patch new file mode 100644 index 000000000000..94eb8294f844 --- /dev/null +++ b/patches/@expensify+react-native-live-markdown+0.1.88+addMissingEvents.patch @@ -0,0 +1,61 @@ +diff --git a/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js b/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js +index 7be4e5c..87d53f5 100644 +--- a/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js ++++ b/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js +@@ -218,6 +218,7 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ + const newSelection = predefinedSelection || CursorUtils.getCurrentCursorPosition(divRef.current); + if (newSelection && (!contentSelection.current || contentSelection.current.start !== newSelection.start || contentSelection.current.end !== newSelection.end)) { + updateRefSelectionVariables(newSelection); ++ console.log('updateSelection', newSelection); + contentSelection.current = newSelection; + if (e) { + handleSelectionChange(e); +@@ -245,6 +246,8 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ + }); + } + }, [multiline, onContentSizeChange]); ++ ++ const prevTextRef = useRef(''); + const handleOnChangeText = useCallback(e => { + if (!divRef.current || !(e.target instanceof HTMLElement)) { + return; +@@ -255,6 +258,7 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ + compositionRef.current = false; + return; + } ++ + let text = ''; + const nativeEvent = e.nativeEvent; + switch (nativeEvent.inputType) { +@@ -275,6 +279,8 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ + default: + text = parseText(divRef.current, changedText, processedMarkdownStyle).text; + } ++ const normalizedText = normalizeValue(text); ++ + if (pasteRef !== null && pasteRef !== void 0 && pasteRef.current) { + pasteRef.current = false; + updateSelection(e); +@@ -283,10 +289,21 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ + if (onChange) { + const event = e; + setEventProps(event); ++ ++ const prevText = prevTextRef.current; ++ prevTextRef.current = normalizedText; ++ ++ const start = contentSelection.current ? contentSelection.current.start : 0; ++ const before = contentSelection.current.end - contentSelection.current.start; ++ const count = normalizedText.length - prevText.length; ++ ++ event.nativeEvent.start = start; ++ event.nativeEvent.before = before; ++ event.nativeEvent.count = count; ++ event.nativeEvent.text = normalizedText; + onChange(event); + } + if (onChangeText) { +- const normalizedText = normalizeValue(text); + onChangeText(normalizedText); + } + handleContentSizeChange(); From 0904ac649d5a890301b8e39f64db575f75012783 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Fri, 28 Jun 2024 09:34:12 +0200 Subject: [PATCH 23/42] fix: pressing send not working on web --- .../report/ReportActionCompose/SendButton.tsx | 51 +++++++------------ 1 file changed, 19 insertions(+), 32 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose/SendButton.tsx b/src/pages/home/report/ReportActionCompose/SendButton.tsx index 5be4b11dc944..9928795d9ba3 100644 --- a/src/pages/home/report/ReportActionCompose/SendButton.tsx +++ b/src/pages/home/report/ReportActionCompose/SendButton.tsx @@ -1,16 +1,13 @@ import React, {memo} from 'react'; import {View} from 'react-native'; -import {Gesture, GestureDetector} from 'react-native-gesture-handler'; import Icon from '@components/Icon'; import * as Expensicons from '@components/Icon/Expensicons'; import PressableWithFeedback from '@components/Pressable/PressableWithFeedback'; import Tooltip from '@components/Tooltip'; import useLocalize from '@hooks/useLocalize'; -import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import CONST from '@src/CONST'; -import { runOnJS } from 'react-native-reanimated'; type SendButtonProps = { /** Whether the button is disabled */ @@ -24,10 +21,6 @@ function SendButton({isDisabled: isDisabledProp, handleSendMessage}: SendButtonP const theme = useTheme(); const styles = useThemeStyles(); const {translate} = useLocalize(); - const {isSmallScreenWidth} = useResponsiveLayout(); - const Tap = Gesture.Tap().onEnd(() => { - runOnJS(handleSendMessage)(); - }); return ( e.preventDefault()} > - - - [ - styles.chatItemSubmitButton, - isDisabledProp || pressed || isDisabled ? undefined : styles.buttonSuccess, - isDisabledProp ? styles.cursorDisabled : undefined, - ]} - role={CONST.ROLE.BUTTON} - accessibilityLabel={translate('common.send')} - > - {({pressed}) => ( - - )} - - - + + [ + styles.chatItemSubmitButton, + isDisabledProp || pressed || isDisabled ? undefined : styles.buttonSuccess, + isDisabledProp ? styles.cursorDisabled : undefined, + ]} + role={CONST.ROLE.BUTTON} + accessibilityLabel={translate('common.send')} + > + {({pressed}) => ( + + )} + + ); } From 1bc30e664e0536b705e315579dfaf2d2d7b3c606 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Fri, 28 Jun 2024 09:38:55 +0200 Subject: [PATCH 24/42] add comment updater back --- .../ComposerWithSuggestions/ComposerWithSuggestions.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index 397f65a0422f..bd09ab41ee2e 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -811,7 +811,7 @@ function ComposerWithSuggestions( resetKeyboardInput={resetKeyboardInput} /> - {/* {ReportUtils.isValidReportIDFromPath(reportID) && ( + {ReportUtils.isValidReportIDFromPath(reportID) && ( - )} */} + )} {/* Only used for testing so far */} {children} From a27219d6ee8a94d541db32ffca10f8fbb121bfc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Mon, 1 Jul 2024 14:31:31 +0200 Subject: [PATCH 25/42] fix bugs during deleting/replacing on web --- ...markdown+0.1.88+002+addMissingEvents.patch | 64 +++++++++++++++++++ ...ive-markdown+0.1.88+addMissingEvents.patch | 61 ------------------ .../ComposerWithSuggestions.tsx | 11 +++- 3 files changed, 73 insertions(+), 63 deletions(-) create mode 100644 patches/@expensify+react-native-live-markdown+0.1.88+002+addMissingEvents.patch delete mode 100644 patches/@expensify+react-native-live-markdown+0.1.88+addMissingEvents.patch diff --git a/patches/@expensify+react-native-live-markdown+0.1.88+002+addMissingEvents.patch b/patches/@expensify+react-native-live-markdown+0.1.88+002+addMissingEvents.patch new file mode 100644 index 000000000000..2ffba030fb5e --- /dev/null +++ b/patches/@expensify+react-native-live-markdown+0.1.88+002+addMissingEvents.patch @@ -0,0 +1,64 @@ +diff --git a/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js b/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js +index 7be4e5c..27ca7cf 100644 +--- a/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js ++++ b/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js +@@ -245,16 +245,19 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ + }); + } + }, [multiline, onContentSizeChange]); ++ + const handleOnChangeText = useCallback(e => { + if (!divRef.current || !(e.target instanceof HTMLElement)) { + return; + } ++ const prevSelection = contentSelection.current; + const changedText = e.target.innerText; + if (compositionRef.current && !BrowserUtils.isMobile) { + updateTextColor(divRef.current, changedText); + compositionRef.current = false; + return; + } ++ + let text = ''; + const nativeEvent = e.nativeEvent; + switch (nativeEvent.inputType) { +@@ -275,6 +278,8 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ + default: + text = parseText(divRef.current, changedText, processedMarkdownStyle).text; + } ++ const normalizedText = normalizeValue(text); ++ + if (pasteRef !== null && pasteRef !== void 0 && pasteRef.current) { + pasteRef.current = false; + updateSelection(e); +@@ -283,10 +288,29 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ + if (onChange) { + const event = e; + setEventProps(event); ++ ++ const newSelection = CursorUtils.getCurrentCursorPosition(divRef.current); ++ // The new text is between the prev start selection and the new end selection ++ const maybeAddedtext = normalizedText.slice(prevSelection.start, newSelection.end); ++ // The length of the text that replaced the before text ++ const count = maybeAddedtext.length; ++ // The start index of the replacement operation ++ const start = prevSelection.start; ++ ++ // The length the deleted text had before ++ let before = prevSelection.end - prevSelection.start; ++ if (before === 0 && (event.inputType === 'deleteContentBackward' || event.inputType === 'deleteContentForward')) { ++ // its possible the user pressed a delete key without a selection range, so we need to adjust the before value ++ before = 1; ++ } ++ ++ nativeEvent.count = count; ++ nativeEvent.before = before; ++ nativeEvent.start = start; ++ + onChange(event); + } + if (onChangeText) { +- const normalizedText = normalizeValue(text); + onChangeText(normalizedText); + } + handleContentSizeChange(); diff --git a/patches/@expensify+react-native-live-markdown+0.1.88+addMissingEvents.patch b/patches/@expensify+react-native-live-markdown+0.1.88+addMissingEvents.patch deleted file mode 100644 index 94eb8294f844..000000000000 --- a/patches/@expensify+react-native-live-markdown+0.1.88+addMissingEvents.patch +++ /dev/null @@ -1,61 +0,0 @@ -diff --git a/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js b/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js -index 7be4e5c..87d53f5 100644 ---- a/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js -+++ b/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js -@@ -218,6 +218,7 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ - const newSelection = predefinedSelection || CursorUtils.getCurrentCursorPosition(divRef.current); - if (newSelection && (!contentSelection.current || contentSelection.current.start !== newSelection.start || contentSelection.current.end !== newSelection.end)) { - updateRefSelectionVariables(newSelection); -+ console.log('updateSelection', newSelection); - contentSelection.current = newSelection; - if (e) { - handleSelectionChange(e); -@@ -245,6 +246,8 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ - }); - } - }, [multiline, onContentSizeChange]); -+ -+ const prevTextRef = useRef(''); - const handleOnChangeText = useCallback(e => { - if (!divRef.current || !(e.target instanceof HTMLElement)) { - return; -@@ -255,6 +258,7 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ - compositionRef.current = false; - return; - } -+ - let text = ''; - const nativeEvent = e.nativeEvent; - switch (nativeEvent.inputType) { -@@ -275,6 +279,8 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ - default: - text = parseText(divRef.current, changedText, processedMarkdownStyle).text; - } -+ const normalizedText = normalizeValue(text); -+ - if (pasteRef !== null && pasteRef !== void 0 && pasteRef.current) { - pasteRef.current = false; - updateSelection(e); -@@ -283,10 +289,21 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ - if (onChange) { - const event = e; - setEventProps(event); -+ -+ const prevText = prevTextRef.current; -+ prevTextRef.current = normalizedText; -+ -+ const start = contentSelection.current ? contentSelection.current.start : 0; -+ const before = contentSelection.current.end - contentSelection.current.start; -+ const count = normalizedText.length - prevText.length; -+ -+ event.nativeEvent.start = start; -+ event.nativeEvent.before = before; -+ event.nativeEvent.count = count; -+ event.nativeEvent.text = normalizedText; - onChange(event); - } - if (onChangeText) { -- const normalizedText = normalizeValue(text); - onChangeText(normalizedText); - } - handleContentSizeChange(); diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index bd09ab41ee2e..5a60e73a1aa3 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -503,8 +503,15 @@ function ComposerWithSuggestions( // This contains the previous value that we receive directly from the native text input (not our formatted value) const prevNativeTextRef = useRef(value); const handleInputChange = useCallback( - ({nativeEvent}: NativeSyntheticEvent) => { - const {count, start, before, text: nativeText} = nativeEvent; + ({nativeEvent, target}: NativeSyntheticEvent) => { + const {count, start, before} = nativeEvent; + let nativeText = nativeEvent.text; + if (nativeText === undefined) { + // Assume we are on a platform where the text is stored in another field called value (e.g. web) + // @ts-expect-error Not properly typed + nativeText = target.value; + } + const previousNativeText = prevNativeTextRef.current; prevNativeTextRef.current = nativeText; From b933802b5566604d5b2b7b91402ddb85e48a56aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Mon, 1 Jul 2024 15:20:21 +0200 Subject: [PATCH 26/42] fix backwards delete --- ...e-live-markdown+0.1.88+002+addMissingEvents.patch | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/patches/@expensify+react-native-live-markdown+0.1.88+002+addMissingEvents.patch b/patches/@expensify+react-native-live-markdown+0.1.88+002+addMissingEvents.patch index 2ffba030fb5e..19d696ccb442 100644 --- a/patches/@expensify+react-native-live-markdown+0.1.88+002+addMissingEvents.patch +++ b/patches/@expensify+react-native-live-markdown+0.1.88+002+addMissingEvents.patch @@ -1,5 +1,5 @@ diff --git a/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js b/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js -index 7be4e5c..27ca7cf 100644 +index 7be4e5c..686df84 100644 --- a/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js +++ b/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js @@ -245,16 +245,19 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ @@ -31,7 +31,7 @@ index 7be4e5c..27ca7cf 100644 if (pasteRef !== null && pasteRef !== void 0 && pasteRef.current) { pasteRef.current = false; updateSelection(e); -@@ -283,10 +288,29 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ +@@ -283,10 +288,33 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ if (onChange) { const event = e; setEventProps(event); @@ -42,14 +42,18 @@ index 7be4e5c..27ca7cf 100644 + // The length of the text that replaced the before text + const count = maybeAddedtext.length; + // The start index of the replacement operation -+ const start = prevSelection.start; ++ let start = prevSelection.start; + + // The length the deleted text had before + let before = prevSelection.end - prevSelection.start; -+ if (before === 0 && (event.inputType === 'deleteContentBackward' || event.inputType === 'deleteContentForward')) { ++ if (before === 0 && (nativeEvent.inputType === 'deleteContentBackward' || nativeEvent.inputType === 'deleteContentForward')) { + // its possible the user pressed a delete key without a selection range, so we need to adjust the before value + before = 1; + } ++ if (nativeEvent.inputType === 'deleteContentBackward') { ++ // if the user pressed backspace, we need to adjust the start index ++ start -= 1; ++ } + + nativeEvent.count = count; + nativeEvent.before = before; From c3a40d635569212ae2b95fbe3a2e37837a359aed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Mon, 1 Jul 2024 15:34:18 +0200 Subject: [PATCH 27/42] web: fix deleting all content --- ...act-native-live-markdown+0.1.88+002+addMissingEvents.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patches/@expensify+react-native-live-markdown+0.1.88+002+addMissingEvents.patch b/patches/@expensify+react-native-live-markdown+0.1.88+002+addMissingEvents.patch index 19d696ccb442..a647da9b5fda 100644 --- a/patches/@expensify+react-native-live-markdown+0.1.88+002+addMissingEvents.patch +++ b/patches/@expensify+react-native-live-markdown+0.1.88+002+addMissingEvents.patch @@ -1,5 +1,5 @@ diff --git a/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js b/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js -index 7be4e5c..686df84 100644 +index 7be4e5c..594bd06 100644 --- a/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js +++ b/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js @@ -245,16 +245,19 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ @@ -50,7 +50,7 @@ index 7be4e5c..686df84 100644 + // its possible the user pressed a delete key without a selection range, so we need to adjust the before value + before = 1; + } -+ if (nativeEvent.inputType === 'deleteContentBackward') { ++ if (nativeEvent.inputType === 'deleteContentBackward' && start > 0) { + // if the user pressed backspace, we need to adjust the start index + start -= 1; + } From 2285a536d818aa446678e6ca30ccc500fdadea4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Mon, 1 Jul 2024 16:16:14 +0200 Subject: [PATCH 28/42] fix deleting not working properly --- ...-markdown+0.1.88+002+addMissingEvents.patch | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/patches/@expensify+react-native-live-markdown+0.1.88+002+addMissingEvents.patch b/patches/@expensify+react-native-live-markdown+0.1.88+002+addMissingEvents.patch index a647da9b5fda..e2c0eb5a3b49 100644 --- a/patches/@expensify+react-native-live-markdown+0.1.88+002+addMissingEvents.patch +++ b/patches/@expensify+react-native-live-markdown+0.1.88+002+addMissingEvents.patch @@ -1,5 +1,5 @@ diff --git a/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js b/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js -index 7be4e5c..594bd06 100644 +index 7be4e5c..b0892f8 100644 --- a/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js +++ b/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js @@ -245,16 +245,19 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ @@ -31,7 +31,7 @@ index 7be4e5c..594bd06 100644 if (pasteRef !== null && pasteRef !== void 0 && pasteRef.current) { pasteRef.current = false; updateSelection(e); -@@ -283,10 +288,33 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ +@@ -283,10 +288,35 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ if (onChange) { const event = e; setEventProps(event); @@ -44,16 +44,18 @@ index 7be4e5c..594bd06 100644 + // The start index of the replacement operation + let start = prevSelection.start; + ++ const prevSelectionRange = prevSelection.end - prevSelection.start; ++ if (nativeEvent.inputType === 'deleteContentBackward' && start > 0 && prevSelectionRange === 0) { ++ // if the user pressed backspace, we need to adjust the start index to be before the selection ++ start -= 1; ++ } ++ + // The length the deleted text had before -+ let before = prevSelection.end - prevSelection.start; -+ if (before === 0 && (nativeEvent.inputType === 'deleteContentBackward' || nativeEvent.inputType === 'deleteContentForward')) { ++ let before = prevSelectionRange; ++ if (prevSelectionRange === 0 && (nativeEvent.inputType === 'deleteContentBackward' || nativeEvent.inputType === 'deleteContentForward')) { + // its possible the user pressed a delete key without a selection range, so we need to adjust the before value + before = 1; + } -+ if (nativeEvent.inputType === 'deleteContentBackward' && start > 0) { -+ // if the user pressed backspace, we need to adjust the start index -+ start -= 1; -+ } + + nativeEvent.count = count; + nativeEvent.before = before; From f3251b87e3c8df4549085069f4f9645a9564c1c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Mon, 1 Jul 2024 17:10:24 +0200 Subject: [PATCH 29/42] fix web inserting emojis selection was off --- .../ComposerWithSuggestions/ComposerWithSuggestions.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index 5a60e73a1aa3..21cb21a1f166 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -471,7 +471,7 @@ function ComposerWithSuggestions( // Update selection eventually if (newComment !== fullNewText) { - const position = Math.max((selection.end ?? 0) + (newComment.length - valueRef.current.length), cursorPosition ?? 0); + const position = Math.max((endPositionOfNewAddedText ?? 0) + (newComment.length - fullNewText.length), cursorPosition ?? 0); setSelection((prevSelection) => ({ start: position, end: position, From 5b327325a2f8c588360a057c2abba7ba1c2d55cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Mon, 1 Jul 2024 17:55:22 +0200 Subject: [PATCH 30/42] remove unused dep --- .../ComposerWithSuggestions/ComposerWithSuggestions.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index 21cb21a1f166..b38107acceca 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -498,7 +498,7 @@ function ComposerWithSuggestions( if (newCommentConverted) { debouncedBroadcastUserIsTyping(reportID); } - }, [debouncedSaveReportComment, debouncedUpdateFrequentlyUsedEmojis, preferredLocale, preferredSkinTone, raiseIsScrollLikelyLayoutTriggered, reportID, selection.end, setValue, suggestionsRef]) + }, [debouncedSaveReportComment, debouncedUpdateFrequentlyUsedEmojis, preferredLocale, preferredSkinTone, raiseIsScrollLikelyLayoutTriggered, reportID, setValue, suggestionsRef]) // This contains the previous value that we receive directly from the native text input (not our formatted value) const prevNativeTextRef = useRef(value); From 5417cfb52b60cadd8ce3017057c50a9ed6d45fd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Tue, 2 Jul 2024 10:03:49 +0200 Subject: [PATCH 31/42] web: fix deleting multi-character glyphs --- ...markdown+0.1.88+002+addMissingEvents.patch | 47 ++++++++++++++----- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/patches/@expensify+react-native-live-markdown+0.1.88+002+addMissingEvents.patch b/patches/@expensify+react-native-live-markdown+0.1.88+002+addMissingEvents.patch index e2c0eb5a3b49..450310be33d1 100644 --- a/patches/@expensify+react-native-live-markdown+0.1.88+002+addMissingEvents.patch +++ b/patches/@expensify+react-native-live-markdown+0.1.88+002+addMissingEvents.patch @@ -1,8 +1,8 @@ diff --git a/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js b/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js -index 7be4e5c..b0892f8 100644 +index 7be4e5c..0dbeb05 100644 --- a/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js +++ b/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js -@@ -245,16 +245,19 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ +@@ -245,16 +245,20 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ }); } }, [multiline, onContentSizeChange]); @@ -12,6 +12,7 @@ index 7be4e5c..b0892f8 100644 return; } + const prevSelection = contentSelection.current; ++ const prevTextLength = CursorUtils.getPrevTextLength() const changedText = e.target.innerText; if (compositionRef.current && !BrowserUtils.isMobile) { updateTextColor(divRef.current, changedText); @@ -22,7 +23,7 @@ index 7be4e5c..b0892f8 100644 let text = ''; const nativeEvent = e.nativeEvent; switch (nativeEvent.inputType) { -@@ -275,6 +278,8 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ +@@ -275,6 +279,8 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ default: text = parseText(divRef.current, changedText, processedMarkdownStyle).text; } @@ -31,7 +32,7 @@ index 7be4e5c..b0892f8 100644 if (pasteRef !== null && pasteRef !== void 0 && pasteRef.current) { pasteRef.current = false; updateSelection(e); -@@ -283,10 +288,35 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ +@@ -283,10 +289,36 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ if (onChange) { const event = e; setEventProps(event); @@ -45,16 +46,17 @@ index 7be4e5c..b0892f8 100644 + let start = prevSelection.start; + + const prevSelectionRange = prevSelection.end - prevSelection.start; -+ if (nativeEvent.inputType === 'deleteContentBackward' && start > 0 && prevSelectionRange === 0) { -+ // if the user pressed backspace, we need to adjust the start index to be before the selection -+ start -= 1; -+ } -+ + // The length the deleted text had before + let before = prevSelectionRange; + if (prevSelectionRange === 0 && (nativeEvent.inputType === 'deleteContentBackward' || nativeEvent.inputType === 'deleteContentForward')) { -+ // its possible the user pressed a delete key without a selection range, so we need to adjust the before value -+ before = 1; ++ // its possible the user pressed a delete key without a selection range, so we need to adjust the before value to have the length of the deleted text ++ before = prevTextLength - normalizedText.length; ++ } ++ ++ if (nativeEvent.inputType === 'deleteContentBackward') { ++ // When the user does a backspace delete he expects the content before the cursor to be removed. ++ // For this the start value needs to be adjusted (its as if the selection was before the text that we want to delete) ++ start -= before + } + + nativeEvent.count = count; @@ -68,3 +70,26 @@ index 7be4e5c..b0892f8 100644 onChangeText(normalizedText); } handleContentSizeChange(); +@@ -418,6 +450,7 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ + } + divRef.current = r; + }; ++ // Sync the input with the user provided value + useClientEffect(function parseAndStyleValue() { + if (!divRef.current || processedValue === divRef.current.innerText) { + return; +diff --git a/node_modules/@expensify/react-native-live-markdown/lib/module/web/cursorUtils.js b/node_modules/@expensify/react-native-live-markdown/lib/module/web/cursorUtils.js +index 6a4b510..4907967 100644 +--- a/node_modules/@expensify/react-native-live-markdown/lib/module/web/cursorUtils.js ++++ b/node_modules/@expensify/react-native-live-markdown/lib/module/web/cursorUtils.js +@@ -136,5 +136,8 @@ function scrollCursorIntoView(target) { + target.scrollTo(0, topToCaret + target.scrollTop + inputOffset); + } + } +-export { getCurrentCursorPosition, moveCursorToEnd, setCursorPosition, setPrevText, removeSelection, scrollCursorIntoView }; ++function getPrevTextLength() { ++ return prevTextLength; ++} ++export { getCurrentCursorPosition, moveCursorToEnd, setCursorPosition, setPrevText, removeSelection, scrollCursorIntoView, getPrevTextLength }; + //# sourceMappingURL=cursorUtils.js.map +\ No newline at end of file From a982d2ffa57be9eabaccff8ade3aa9f9f4c86ba1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Tue, 2 Jul 2024 10:04:09 +0200 Subject: [PATCH 32/42] remove debug log --- .../report/ReportActionCompose/SilentCommentUpdater/index.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/home/report/ReportActionCompose/SilentCommentUpdater/index.tsx b/src/pages/home/report/ReportActionCompose/SilentCommentUpdater/index.tsx index 6c8733343250..f83f13e7002d 100644 --- a/src/pages/home/report/ReportActionCompose/SilentCommentUpdater/index.tsx +++ b/src/pages/home/report/ReportActionCompose/SilentCommentUpdater/index.tsx @@ -34,7 +34,6 @@ function SilentCommentUpdater({comment, reportID, value, updateComment, isCommen } updateComment(comment ?? ''); - console.log('SilentCommentUpdater: Comment updated', comment); }, [prevCommentProp, prevPreferredLocale, prevReportId, comment, preferredLocale, reportID, updateComment, value, isCommentPendingSaved]); return null; From b929348a7fc9c75adcc991785990ce7d28345e79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Tue, 2 Jul 2024 10:08:30 +0200 Subject: [PATCH 33/42] remove half-bakes cosmetic changes --- .../ComposerWithSuggestions.tsx | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index b38107acceca..b2a615be2f5d 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -47,7 +47,7 @@ import updateMultilineInputRange from '@libs/updateMultilineInputRange'; import willBlurTextInputOnTapOutsideFunc from '@libs/willBlurTextInputOnTapOutside'; import getCursorPosition from '@pages/home/report/ReportActionCompose/getCursorPosition'; import getScrollPosition from '@pages/home/report/ReportActionCompose/getScrollPosition'; -import type {SuggestionsRef} from '@pages/home/report/ReportActionCompose/ReportActionCompose'; +import type {ComposerRef, SuggestionsRef} from '@pages/home/report/ReportActionCompose/ReportActionCompose'; import SilentCommentUpdater from '@pages/home/report/ReportActionCompose/SilentCommentUpdater'; import Suggestions from '@pages/home/report/ReportActionCompose/Suggestions'; import * as EmojiPickerActions from '@userActions/EmojiPickerAction'; @@ -118,12 +118,12 @@ type ComposerWithSuggestionsProps = ComposerWithSuggestionsOnyxProps & /** Whether the full composer is available */ isFullComposerAvailable: boolean; - /** Function to set whether the comment is empty */ - setIsCommentEmpty: (isCommentEmpty: boolean) => void; - /** Function to set whether the full composer is available */ setIsFullComposerAvailable: (isFullComposerAvailable: boolean) => void; + /** Function to set whether the comment is empty */ + setIsCommentEmpty: (isCommentEmpty: boolean) => void; + /** Function to handle sending a message */ handleSendMessage: () => void; @@ -174,14 +174,6 @@ type ComposerWithSuggestionsProps = ComposerWithSuggestionsOnyxProps & policyID: string; }; -type ComposerRef = { - blur: () => void; - focus: (shouldDelay?: boolean) => void; - replaceSelectionWithText: EmojiPickerActions.OnEmojiSelected; - prepareCommentAndResetComposer: () => string; - isFocused: () => boolean; -}; - type SwitchToCurrentReportProps = { preexistingReportID: string; callback: () => void; @@ -858,4 +850,4 @@ export default withOnyx Date: Tue, 2 Jul 2024 10:16:23 +0200 Subject: [PATCH 34/42] add comments + prettier format --- .../ComposerWithSuggestions.tsx | 129 +++++++++--------- 1 file changed, 67 insertions(+), 62 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index b2a615be2f5d..e434e0316e42 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -59,7 +59,7 @@ import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type * as OnyxTypes from '@src/types/onyx'; import type ChildrenProps from '@src/types/utils/ChildrenProps'; -import type { HandleComposerUpdateCallback } from './types'; +import type {HandleComposerUpdateCallback} from './types'; type AnimatedRef = ReturnType; @@ -428,72 +428,77 @@ function ComposerWithSuggestions( [isSmallScreenWidth, isKeyboardShown, suggestionsRef, includeChronos, handleSendMessage, lastReportAction, reportID], ); - const handleComposerUpdate: HandleComposerUpdateCallback = useCallback(({ - fullNewText, - diffText, - endPositionOfNewAddedText, - shouldDebounceSaveComment, - }) => { - raiseIsScrollLikelyLayoutTriggered(); - // Check for emojis: - // - Either add a whitespace if the user typed an emoji - // - Or insert an emoji when the user types :emojiCode: - // - Extract all emojis from the updated text and update the frequently used emojis - const isEmojiInserted = diffText.trim() === diffText && EmojiUtils.containsOnlyEmojis(diffText); - const commentWithSpaceInserted = isEmojiInserted ? ComposerUtils.insertWhiteSpaceAtIndex(fullNewText, endPositionOfNewAddedText) : fullNewText; - const {text: newComment, emojis, cursorPosition} = EmojiUtils.replaceAndExtractEmojis(commentWithSpaceInserted, preferredSkinTone, preferredLocale); - if (emojis.length) { - const newEmojis = EmojiUtils.getAddedEmojis(emojis, emojisPresentBefore.current); - if (newEmojis.length) { - // Ensure emoji suggestions are hidden after inserting emoji even when the selection is not changed - if (suggestionsRef.current) { - suggestionsRef.current.resetSuggestions(); + /** + * Composer updates are partial text updates. Meaning if a event occurs (such as inserting an emoji, or the user pressing a character on their keyboard), + * we only append/insert the text that has changed. This is to avoid descynchronization issues where text updates are coming from another thread (RN), see issue #37896. + */ + const handleComposerUpdate: HandleComposerUpdateCallback = useCallback( + ({fullNewText, diffText, endPositionOfNewAddedText, shouldDebounceSaveComment}) => { + raiseIsScrollLikelyLayoutTriggered(); + // Check for emojis: + // - Either add a whitespace if the user typed an emoji + // - Or insert an emoji when the user types :emojiCode: + // - Extract all emojis from the updated text and update the frequently used emojis + const isEmojiInserted = diffText.trim() === diffText && EmojiUtils.containsOnlyEmojis(diffText); + const commentWithSpaceInserted = isEmojiInserted ? ComposerUtils.insertWhiteSpaceAtIndex(fullNewText, endPositionOfNewAddedText) : fullNewText; + const {text: newComment, emojis, cursorPosition} = EmojiUtils.replaceAndExtractEmojis(commentWithSpaceInserted, preferredSkinTone, preferredLocale); + if (emojis.length) { + const newEmojis = EmojiUtils.getAddedEmojis(emojis, emojisPresentBefore.current); + if (newEmojis.length) { + // Ensure emoji suggestions are hidden after inserting emoji even when the selection is not changed + if (suggestionsRef.current) { + suggestionsRef.current.resetSuggestions(); + } + insertedEmojisRef.current = [...insertedEmojisRef.current, ...newEmojis]; + debouncedUpdateFrequentlyUsedEmojis(); } - insertedEmojisRef.current = [...insertedEmojisRef.current, ...newEmojis]; - debouncedUpdateFrequentlyUsedEmojis(); } - } - emojisPresentBefore.current = emojis; - - // Make LTR compatible if needed - const newCommentConverted = convertToLTRForComposer(newComment); - - // Update state - setValue(newCommentConverted); - - // Update selection eventually - if (newComment !== fullNewText) { - const position = Math.max((endPositionOfNewAddedText ?? 0) + (newComment.length - fullNewText.length), cursorPosition ?? 0); - setSelection((prevSelection) => ({ - start: position, - end: position, - positionX: prevSelection.positionX, - positionY: prevSelection.positionY, - })); - if (isIOSNative) { - // ensure that selection is set imperatively after all state changes are effective - InteractionManager.runAfterInteractions(() => { - // note: this implementation is only available on non-web RN, thus the wrapping - // 'if' block contains a redundant (since the ref is only used on iOS) platform check - textInputRef.current?.setSelection(position, position); - }); + emojisPresentBefore.current = emojis; + + // Make LTR compatible if needed + const newCommentConverted = convertToLTRForComposer(newComment); + + // Update state + setValue(newCommentConverted); + + // Update selection eventually + if (newComment !== fullNewText) { + const position = Math.max((endPositionOfNewAddedText ?? 0) + (newComment.length - fullNewText.length), cursorPosition ?? 0); + setSelection((prevSelection) => ({ + start: position, + end: position, + positionX: prevSelection.positionX, + positionY: prevSelection.positionY, + })); + if (isIOSNative) { + // ensure that selection is set imperatively after all state changes are effective + InteractionManager.runAfterInteractions(() => { + // note: this implementation is only available on non-web RN, thus the wrapping + // 'if' block contains a redundant (since the ref is only used on iOS) platform check + textInputRef.current?.setSelection(position, position); + }); + } } - } - // Update onyx related state: - if (shouldDebounceSaveComment) { - isCommentPendingSaved.current = true; - debouncedSaveReportComment(reportID, newCommentConverted); - } else { - Report.saveReportDraftComment(reportID, newCommentConverted); - } - if (newCommentConverted) { - debouncedBroadcastUserIsTyping(reportID); - } - }, [debouncedSaveReportComment, debouncedUpdateFrequentlyUsedEmojis, preferredLocale, preferredSkinTone, raiseIsScrollLikelyLayoutTriggered, reportID, setValue, suggestionsRef]) + // Update onyx related state: + if (shouldDebounceSaveComment) { + isCommentPendingSaved.current = true; + debouncedSaveReportComment(reportID, newCommentConverted); + } else { + Report.saveReportDraftComment(reportID, newCommentConverted); + } + if (newCommentConverted) { + debouncedBroadcastUserIsTyping(reportID); + } + }, + [debouncedSaveReportComment, debouncedUpdateFrequentlyUsedEmojis, preferredLocale, preferredSkinTone, raiseIsScrollLikelyLayoutTriggered, reportID, setValue, suggestionsRef], + ); // This contains the previous value that we receive directly from the native text input (not our formatted value) const prevNativeTextRef = useRef(value); + /** + * This is called by the input when the input value changes. It prepares the diff update for calling handleComposerUpdate. + */ const handleInputChange = useCallback( ({nativeEvent, target}: NativeSyntheticEvent) => { const {count, start, before} = nativeEvent; @@ -524,7 +529,7 @@ function ComposerWithSuggestions( diffText, endPositionOfNewAddedText: endPosition, shouldDebounceSaveComment: true, - }) + }); }, [handleComposerUpdate], ); @@ -534,7 +539,7 @@ function ComposerWithSuggestions( */ const replaceSelectionWithText = useCallback( (text: string) => { - const newFullText = ComposerUtils.insertText(valueRef.current, selection, text) + const newFullText = ComposerUtils.insertText(valueRef.current, selection, text); const endPositionOfNewAddedText = selection.start + text.length; handleComposerUpdate({ fullNewText: newFullText, From a1d1aa9cd063f62bea21a0f501b0867fb04ef38b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Tue, 2 Jul 2024 10:17:09 +0200 Subject: [PATCH 35/42] ran prettier --- src/libs/SuggestionUtils.ts | 4 ++-- .../ReportActionCompose/ComposerWithSuggestions/types.tsx | 1 - src/pages/home/report/ReportActionCompose/SuggestionEmoji.tsx | 2 +- .../home/report/ReportActionCompose/SuggestionMention.tsx | 2 +- src/pages/home/report/ReportActionCompose/Suggestions.tsx | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/libs/SuggestionUtils.ts b/src/libs/SuggestionUtils.ts index 811910d1bfab..2e2b1fbedbf4 100644 --- a/src/libs/SuggestionUtils.ts +++ b/src/libs/SuggestionUtils.ts @@ -1,5 +1,5 @@ -import type { TextSelection } from '@components/Composer/types'; -import type { HandleComposerUpdateArgs } from '@pages/home/report/ReportActionCompose/ComposerWithSuggestions/types'; +import type {TextSelection} from '@components/Composer/types'; +import type {HandleComposerUpdateArgs} from '@pages/home/report/ReportActionCompose/ComposerWithSuggestions/types'; import CONST from '@src/CONST'; /** diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/types.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/types.tsx index 587d860505c9..e2b7378af4df 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/types.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/types.tsx @@ -12,4 +12,3 @@ type HandleComposerUpdateArgs = { type HandleComposerUpdateCallback = (args: HandleComposerUpdateArgs) => void; export type {HandleComposerUpdateArgs, HandleComposerUpdateCallback}; - diff --git a/src/pages/home/report/ReportActionCompose/SuggestionEmoji.tsx b/src/pages/home/report/ReportActionCompose/SuggestionEmoji.tsx index 333c610d5995..2441d7848f34 100644 --- a/src/pages/home/report/ReportActionCompose/SuggestionEmoji.tsx +++ b/src/pages/home/report/ReportActionCompose/SuggestionEmoji.tsx @@ -82,7 +82,7 @@ function SuggestionEmoji( (highlightedEmojiIndexInner: number) => { const emojiObject = suggestionValues.suggestedEmojis[highlightedEmojiIndexInner]; const emojiCode = emojiObject.types?.[preferredSkinTone] ? emojiObject.types[preferredSkinTone] : emojiObject.code; - + const updateCommentArgs = SuggestionsUtils.getComposerUpdateArgsForSuggestionToInsert(value, emojiCode, { start: suggestionValues.colonIndex, end: selection.end, diff --git a/src/pages/home/report/ReportActionCompose/SuggestionMention.tsx b/src/pages/home/report/ReportActionCompose/SuggestionMention.tsx index 0d752d7651e8..b2ac1f2a5f72 100644 --- a/src/pages/home/report/ReportActionCompose/SuggestionMention.tsx +++ b/src/pages/home/report/ReportActionCompose/SuggestionMention.tsx @@ -168,7 +168,7 @@ function SuggestionMention( const mentionObject = suggestionValues.suggestedMentions[highlightedMentionIndexInner]; const mentionCode = getMentionCode(mentionObject, suggestionValues.prefixType); - const replaceUntil = suggestionValues.atSignIndex + suggestionValues.mentionPrefix.length + 1 + const replaceUntil = suggestionValues.atSignIndex + suggestionValues.mentionPrefix.length + 1; const updateCommentArgs = SuggestionsUtils.getComposerUpdateArgsForSuggestionToInsert(value, mentionCode, { start: suggestionValues.atSignIndex, end: replaceUntil, diff --git a/src/pages/home/report/ReportActionCompose/Suggestions.tsx b/src/pages/home/report/ReportActionCompose/Suggestions.tsx index e9ee888abdb0..000320a8f8de 100644 --- a/src/pages/home/report/ReportActionCompose/Suggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/Suggestions.tsx @@ -6,10 +6,10 @@ import type {MeasureParentContainerAndCursorCallback} from '@components/AutoComp import type {TextSelection} from '@components/Composer/types'; import {DragAndDropContext} from '@components/DragAndDrop/Provider'; import usePrevious from '@hooks/usePrevious'; +import type {HandleComposerUpdateCallback} from './ComposerWithSuggestions/types'; import type {SuggestionsRef} from './ReportActionCompose'; import SuggestionEmoji from './SuggestionEmoji'; import SuggestionMention from './SuggestionMention'; -import type { HandleComposerUpdateCallback } from './ComposerWithSuggestions/types'; type SuggestionProps = { /** The current input value */ From ea2889cc347a29b7e08279e9eae81975fdc5a949 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Fri, 5 Jul 2024 13:47:02 +0200 Subject: [PATCH 36/42] fix: deleting text then writing is buggy --- ...markdown+0.1.88+002+addMissingEvents.patch | 215 ++++++++++++++---- 1 file changed, 173 insertions(+), 42 deletions(-) diff --git a/patches/@expensify+react-native-live-markdown+0.1.88+002+addMissingEvents.patch b/patches/@expensify+react-native-live-markdown+0.1.88+002+addMissingEvents.patch index 450310be33d1..a896cafd65d7 100644 --- a/patches/@expensify+react-native-live-markdown+0.1.88+002+addMissingEvents.patch +++ b/patches/@expensify+react-native-live-markdown+0.1.88+002+addMissingEvents.patch @@ -1,68 +1,127 @@ diff --git a/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js b/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js -index 7be4e5c..0dbeb05 100644 +index 7be4e5c..345f50c 100644 --- a/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js +++ b/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js -@@ -245,16 +245,20 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ - }); - } - }, [multiline, onContentSizeChange]); -+ - const handleOnChangeText = useCallback(e => { +@@ -114,7 +114,8 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ + style = {}, + value, + autoFocus = false, +- onContentSizeChange ++ onContentSizeChange, ++ id + }, ref) => { + const compositionRef = useRef(false); + const pasteRef = useRef(false); +@@ -169,16 +170,26 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ + caretColor: flattenedStyle.color || 'black' + }, disabled && styles.disabledInputStyles, createReactDOMStyle(preprocessStyle(flattenedStyle))]), [flattenedStyle, disabled]); + const undo = useCallback(target => { +- if (!history.current) return ''; ++ if (!history.current) { ++ return { ++ text: '', ++ cursorPosition: 0 ++ }; ++ } + const item = history.current.undo(); + const undoValue = item ? denormalizeValue(item.text) : null; +- return parseText(target, undoValue, processedMarkdownStyle, item ? item.cursorPosition : null, false).text; ++ return parseText(target, undoValue, processedMarkdownStyle, item ? item.cursorPosition : null, false); + }, [parseText, processedMarkdownStyle]); + const redo = useCallback(target => { +- if (!history.current) return ''; ++ if (!history.current) { ++ return { ++ text: '', ++ cursorPosition: 0 ++ }; ++ } + const item = history.current.redo(); + const redoValue = item ? denormalizeValue(item.text) : null; +- return parseText(target, redoValue, processedMarkdownStyle, item ? item.cursorPosition : null, false).text; ++ return parseText(target, redoValue, processedMarkdownStyle, item ? item.cursorPosition : null, false); + }, [parseText, processedMarkdownStyle]); + + // We have to process value property since contentEditable div adds one additional '\n' at the end of the text if we are entering new line +@@ -249,32 +260,43 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ if (!divRef.current || !(e.target instanceof HTMLElement)) { return; } -+ const prevSelection = contentSelection.current; -+ const prevTextLength = CursorUtils.getPrevTextLength() ++ const prevSelection = contentSelection.current ?? { ++ start: 0, ++ end: 0 ++ }; ++ const prevTextLength = CursorUtils.getPrevTextLength() ?? 0; const changedText = e.target.innerText; if (compositionRef.current && !BrowserUtils.isMobile) { updateTextColor(divRef.current, changedText); compositionRef.current = false; return; } -+ - let text = ''; +- let text = ''; ++ let newInputUpdate; const nativeEvent = e.nativeEvent; - switch (nativeEvent.inputType) { -@@ -275,6 +279,8 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ +- switch (nativeEvent.inputType) { ++ const inputType = nativeEvent.inputType; ++ switch (inputType) { + case 'historyUndo': +- text = undo(divRef.current); ++ newInputUpdate = undo(divRef.current); + break; + case 'historyRedo': +- text = redo(divRef.current); ++ newInputUpdate = redo(divRef.current); + break; + case 'insertFromPaste': + // if there is no newline at the end of the copied text, contentEditable adds invisible
tag at the end of the text, so we need to normalize it + if (changedText.length > 2 && changedText[changedText.length - 2] !== '\n' && changedText[changedText.length - 1] === '\n') { +- text = parseText(divRef.current, normalizeValue(changedText), processedMarkdownStyle).text; ++ newInputUpdate = parseText(divRef.current, normalizeValue(changedText), processedMarkdownStyle); + break; + } +- text = parseText(divRef.current, changedText, processedMarkdownStyle).text; ++ newInputUpdate = parseText(divRef.current, changedText, processedMarkdownStyle); + break; default: - text = parseText(divRef.current, changedText, processedMarkdownStyle).text; +- text = parseText(divRef.current, changedText, processedMarkdownStyle).text; ++ newInputUpdate = parseText(divRef.current, changedText, processedMarkdownStyle); } ++ const { ++ text, ++ cursorPosition ++ } = newInputUpdate; + const normalizedText = normalizeValue(text); -+ if (pasteRef !== null && pasteRef !== void 0 && pasteRef.current) { pasteRef.current = false; updateSelection(e); -@@ -283,10 +289,36 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ +@@ -283,10 +305,33 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ if (onChange) { const event = e; setEventProps(event); + -+ const newSelection = CursorUtils.getCurrentCursorPosition(divRef.current); -+ // The new text is between the prev start selection and the new end selection -+ const maybeAddedtext = normalizedText.slice(prevSelection.start, newSelection.end); ++ // The new text is between the prev start selection and the new end selection, can be empty ++ const addedText = normalizedText.slice(prevSelection.start, cursorPosition ?? 0); + // The length of the text that replaced the before text -+ const count = maybeAddedtext.length; ++ const count = addedText.length; + // The start index of the replacement operation + let start = prevSelection.start; -+ + const prevSelectionRange = prevSelection.end - prevSelection.start; + // The length the deleted text had before + let before = prevSelectionRange; -+ if (prevSelectionRange === 0 && (nativeEvent.inputType === 'deleteContentBackward' || nativeEvent.inputType === 'deleteContentForward')) { ++ if (prevSelectionRange === 0 && (inputType === 'deleteContentBackward' || inputType === 'deleteContentForward')) { + // its possible the user pressed a delete key without a selection range, so we need to adjust the before value to have the length of the deleted text + before = prevTextLength - normalizedText.length; + } -+ -+ if (nativeEvent.inputType === 'deleteContentBackward') { ++ if (inputType === 'deleteContentBackward') { + // When the user does a backspace delete he expects the content before the cursor to be removed. + // For this the start value needs to be adjusted (its as if the selection was before the text that we want to delete) -+ start -= before ++ start = Math.max(start - before, 0); + } ++ event.nativeEvent.count = count; ++ event.nativeEvent.before = before; ++ event.nativeEvent.start = start; + -+ nativeEvent.count = count; -+ nativeEvent.before = before; -+ nativeEvent.start = start; -+ ++ // @ts-expect-error TODO: Remove once react native PR merged https://github.com/facebook/react-native/pull/45248 onChange(event); } if (onChangeText) { @@ -70,26 +129,98 @@ index 7be4e5c..0dbeb05 100644 onChangeText(normalizedText); } handleContentSizeChange(); -@@ -418,6 +450,7 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ - } - divRef.current = r; - }; -+ // Sync the input with the user provided value - useClientEffect(function parseAndStyleValue() { - if (!divRef.current || processedValue === divRef.current.innerText) { - return; +@@ -389,8 +434,12 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ + e.target.value = normalizeValue(divRef.current.innerText || ''); + onClick(e); + }, [onClick, updateSelection]); +- const handlePaste = useCallback(() => { ++ const handlePaste = useCallback(e => { + pasteRef.current = true; ++ e.preventDefault(); ++ const clipboardData = e.clipboardData; ++ const text = clipboardData.getData('text/plain'); ++ document.execCommand('insertText', false, text); + }, []); + const startComposition = useCallback(() => { + compositionRef.current = true; +@@ -468,6 +517,7 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ + /*#__PURE__*/ + // eslint-disable-next-line jsx-a11y/no-static-element-interactions + React.createElement("div", { ++ id: id, + ref: setRef, + contentEditable: !disabled, + style: inputStyles, +diff --git a/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js.map b/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js.map +index a44a5fa..5ddc80a 100644 +--- a/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js.map ++++ b/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js.map +@@ -1 +1 @@ +-{"version":3,"names":["React","useEffect","useRef","useCallback","useMemo","useLayoutEffect","StyleSheet","ParseUtils","CursorUtils","StyleUtils","BrowserUtils","InputHistory","require","useClientEffect","window","createReactDOMStyle","default","e","Error","preprocessStyle","dangerousStyleValue","focusTimeout","normalizeValue","value","replace","denormalizeValue","endsWith","isEventComposing","nativeEvent","isComposing","keyCode","ZERO_WIDTH_SPACE","getPlaceholderValue","placeholder","length","processUnitsInMarkdownStyle","input","output","JSON","parse","stringify","Object","keys","forEach","key","obj","prop","processMarkdownStyle","mergeMarkdownStyleWithDefault","getElementHeight","node","styles","numberOfLines","tempElement","document","createElement","setAttribute","assign","style","innerText","Array","fill","join","parentElement","appendChild","height","clientHeight","removeChild","MarkdownTextInput","forwardRef","accessibilityLabel","accessibilityLabelledBy","accessibilityRole","autoCapitalize","autoCorrect","blurOnSubmit","clearTextOnFocus","dir","disabled","multiline","markdownStyle","onBlur","onChange","onChangeText","onClick","onFocus","onKeyPress","onSelectionChange","onSubmitEditing","placeholderTextColor","selectTextOnFocus","spellCheck","selection","autoFocus","onContentSizeChange","ref","compositionRef","pasteRef","divRef","currentlyFocusedField","contentSelection","className","history","dimensions","current","flattenedStyle","flatten","heightSafePlaceholder","setEventProps","text","target","parseText","customMarkdownStyles","cursorPosition","shouldAddToHistory","parsedText","throttledAdd","processedMarkdownStyle","newMarkdownStyle","inputStyles","defaultInputStyles","caretColor","color","disabledInputStyles","undo","item","undoValue","redo","redoValue","processedValue","updateTextColor","String","handleSelectionChange","event","updateRefSelectionVariables","newSelection","start","end","markdownHTMLInput","selectionStart","selectionEnd","updateSelection","predefinedSelection","getCurrentCursorPosition","handleContentSizeChange","_dimensions$current","offsetWidth","newWidth","offsetHeight","newHeight","width","contentSize","handleOnChangeText","HTMLElement","changedText","isMobile","inputType","normalizedText","handleKeyPress","hostNode","stopPropagation","metaKey","preventDefault","shiftKey","blurOnSubmitDefault","shouldBlurOnSubmit","isDefaultPrevented","execCommand","scrollCursorIntoView","setTimeout","blur","handleFocus","setCursorPosition","valueLength","clearTimeout","handleBlur","removeSelection","handleClick","handlePaste","startComposition","setRef","currentRef","r","isFocused","activeElement","clear","undefined","parseAndStyleValue","adjustHeight","elementHeight","maxHeight","focus","contentEditable","role","onKeyDown","onCompositionStart","onKeyUp","onInput","onPaste","create","borderColor","borderWidth","borderStyle","fontFamily","boxSizing","whiteSpace","overflowY","overflowX","overflowWrap","opacity","cursor"],"sourceRoot":"../../src","sources":["MarkdownTextInput.web.tsx"],"mappings":"AAAA;;AAYA,OAAOA,KAAK,IAAGC,SAAS,EAAEC,MAAM,EAAEC,WAAW,EAAEC,OAAO,EAAEC,eAAe,QAAO,OAAO;AAErF,SAAQC,UAAU,QAAO,cAAc;AACvC,OAAO,KAAKC,UAAU,MAAM,mBAAmB;AAC/C,OAAO,KAAKC,WAAW,MAAM,mBAAmB;AAChD,OAAO,KAAKC,UAAU,MAAM,cAAc;AAC1C,OAAO,KAAKC,YAAY,MAAM,oBAAoB;AAElD,OAAO,6BAA6B;AACpC,OAAOC,YAAY,MAAM,oBAAoB;AAE7CC,OAAO,CAAC,gDAAgD,CAAC;AAEzD,MAAMC,eAAe,GAAG,OAAOC,MAAM,KAAK,WAAW,GAAGb,SAAS,GAAGI,eAAe;AAEnF,IAAIU,mBAAwC;AAC5C,IAAI;EACFA,mBAAmB;EACjB;EACAH,OAAO,CAAC,uEAAuE,CAAC,CAACI,OAAO;AAC5F,CAAC,CAAC,OAAOC,CAAC,EAAE;EACV,MAAM,IAAIC,KAAK,CAAC,kKAAkK,CAAC;AACrL;AAEA,IAAIC,eAAoC;AACxC,IAAI;EACFA,eAAe;EACb;EACAP,OAAO,CAAC,qDAAqD,CAAC,CAACI,OAAO;AAC1E,CAAC,CAAC,OAAOC,CAAC,EAAE;EACV,M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W;MACnBuB,OAAO,EAAEpB,WAAY;MACrBjJ,WAAW,EAAE0E,qBAAsB;MACnChB,UAAU,EAAEA,UAAW;MACvBd,GAAG,EAAEA;IAAI,CACV;EAAC;AAEN,CACF,CAAC;AAED,MAAM1B,MAAM,GAAG7C,UAAU,CAACiM,MAAM,CAAC;EAC/B/E,kBAAkB,EAAE;IAClBgF,WAAW,EAAE,OAAO;IACpBC,WAAW,EAAE,CAAC;IACdC,WAAW,EAAE,OAAO;IACpBC,UAAU,EAAE,YAAY;IACxB;IACAC,SAAS,EAAE,YAAY;IACvBC,UAAU,EAAE,UAAU;IACtBC,SAAS,EAAE,MAAM;IACjBC,SAAS,EAAE,MAAM;IACjBC,YAAY,EAAE;EAChB,CAAC;EACDrF,mBAAmB,EAAE;IACnBsF,OAAO,EAAE,IAAI;IACbC,MAAM,EAAE;EACV;AACF,CAAC,CAAC;AAEF,eAAe9I,iBAAiB"} +\ No newline at end of file ++{"version":3,"names":["React","useEffect","useRef","useCallback","useMemo","useLayoutEffect","StyleSheet","ParseUtils","CursorUtils","StyleUtils","BrowserUtils","InputHistory","require","useClientEffect","window","createReactDOMStyle","default","e","Error","preprocessStyle","dangerousStyleValue","focusTimeout","normalizeValue","value","replace","denormalizeValue","endsWith","isEventComposing","nativeEvent","isComposing","keyCode","ZERO_WIDTH_SPACE","getPlaceholderValue","placeholder","length","processUnitsInMarkdownStyle","input","output","JSON","parse","stringify","Object","keys","forEach","key","obj","prop","processMarkdownStyle","mergeMarkdownStyleWithDefault","getElementHeight","node","styles","numberOfLines","tempElement","document","createElement","setAttribute","assign","style","innerText","Array","fill","join","parentElement","appendChild","height","clientHeight","removeChild","MarkdownTextInput","forwardRef","accessibilityLabel","accessibilityLabelledBy","accessibilityRole","autoCapitalize","autoCorrect","blurOnSubmit","clearTextOnFocus","dir","disabled","multiline","markdownStyle","onBlur","onChange","onChangeText","onClick","onFocus","onKeyPress","onSelectionChange","onSubmitEditing","placeholderTextColor","selectTextOnFocus","spellCheck","selection","autoFocus","onContentSizeChange","id","ref","compositionRef","pasteRef","divRef","currentlyFocusedField","contentSelection","className","history","dimensions","current","flattenedStyle","flatten","heightSafePlaceholder","setEventProps","text","target","parseText","customMarkdownStyles","cursorPosition","shouldAddToHistory","parsedText","throttledAdd","processedMarkdownStyle","newMarkdownStyle","inputStyles","defaultInputStyles","caretColor","color","disabledInputStyles","undo","item","undoValue","redo","redoValue","processedValue","updateTextColor","String","handleSelectionChange","event","updateRefSelectionVariables","newSelection","start","end","markdownHTMLInput","selectionStart","selectionEnd","updateSelection","predefinedSelection","getCurrentCursorPosition","handleContentSizeChange","_dimensions$current","offsetWidth","newWidth","offsetHeight","newHeight","width","contentSize","handleOnChangeText","HTMLElement","prevSelection","prevTextLength","getPrevTextLength","changedText","isMobile","newInputUpdate","inputType","normalizedText","addedText","slice","count","prevSelectionRange","before","handleKeyPress","hostNode","stopPropagation","metaKey","preventDefault","shiftKey","blurOnSubmitDefault","shouldBlurOnSubmit","isDefaultPrevented","execCommand","scrollCursorIntoView","setTimeout","blur","handleFocus","setCursorPosition","valueLength","clearTimeout","handleBlur","removeSelection","handleClick","handlePaste","clipboardData","getData","startComposition","setRef","currentRef","r","isFocused","activeElement","clear","undefined","parseAndStyleValue","adjustHeight","elementHeight","maxHeight","focus","contentEditable","role","onKeyDown","onCompositionStart","onKeyUp","onInput","onPaste","create","borderColor","borderWidth","borderStyle","fontFamily","boxSizing","whiteSpace","overflowY","overflowX","overflowWrap","opacity","cursor"],"sourceRoot":"../../src","sources":["MarkdownTextInput.web.tsx"],"mappings":"AAAA;;AAYA,OAAOA,KAAK,IAAGC,SAAS,EAAEC,MAAM,EAAEC,WAAW,EAAEC,OAAO,EAAEC,eAAe,QAAO,OAAO;AAErF,SAAQC,UAAU,QAAO,cAAc;AACvC,OAAO,KAAKC,UAAU,MAAM,mBAAmB;AAC/C,OAAO,KAAKC,WAAW,MAAM,mBAAmB;AAChD,OAAO,KAAKC,UAAU,MAAM,cAAc;AAC1C,OA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AiB"} +\ No newline at end of file diff --git a/node_modules/@expensify/react-native-live-markdown/lib/module/web/cursorUtils.js b/node_modules/@expensify/react-native-live-markdown/lib/module/web/cursorUtils.js -index 6a4b510..4907967 100644 +index 6a4b510..fbab71b 100644 --- a/node_modules/@expensify/react-native-live-markdown/lib/module/web/cursorUtils.js +++ b/node_modules/@expensify/react-native-live-markdown/lib/module/web/cursorUtils.js -@@ -136,5 +136,8 @@ function scrollCursorIntoView(target) { +@@ -1,5 +1,8 @@ + import * as BrowserUtils from './browserUtils'; + let prevTextLength; ++function getPrevTextLength() { ++ return prevTextLength; ++} + function findTextNodes(textNodes, node) { + if (node.nodeType === Node.TEXT_NODE) { + textNodes.push(node); +@@ -53,7 +56,7 @@ function setCursorPosition(target, start, end = null) { + // 3. Caret at the end of whole input, when pressing enter + // 4. All other placements + if (prevChar === '\n' && prevTextLength !== undefined && prevTextLength < textCharacters.length) { +- if (nextChar !== '\n' && i !== n - 1 && nextChar) { ++ if (nextChar && nextChar !== '\n' && i !== n - 1) { + range.setStart(textNodes[i + 1], 0); + } else if (i !== textNodes.length - 1) { + range.setStart(textNodes[i], 1); +@@ -136,5 +139,5 @@ function scrollCursorIntoView(target) { target.scrollTo(0, topToCaret + target.scrollTop + inputOffset); } } -export { getCurrentCursorPosition, moveCursorToEnd, setCursorPosition, setPrevText, removeSelection, scrollCursorIntoView }; -+function getPrevTextLength() { -+ return prevTextLength; -+} +export { getCurrentCursorPosition, moveCursorToEnd, setCursorPosition, setPrevText, removeSelection, scrollCursorIntoView, getPrevTextLength }; //# sourceMappingURL=cursorUtils.js.map \ No newline at end of file +diff --git a/node_modules/@expensify/react-native-live-markdown/lib/module/web/cursorUtils.js.map b/node_modules/@expensify/react-native-live-markdown/lib/module/web/cursorUtils.js.map +index 4ab44be..05849b4 100644 +--- a/node_modules/@expensify/react-native-live-markdown/lib/module/web/cursorUtils.js.map ++++ b/node_modules/@expensify/react-native-live-markdown/lib/module/web/cursorUtils.js.map +@@ -1 +1 @@ +-{"version":3,"names":["BrowserUtils","prevTextLength","findTextNodes","textNodes","node","nodeType","Node","TEXT_NODE","push","i","length","childNodes","childNode","setPrevText","target","_textNodes$map","text","map","e","nodeValue","join","split","setCursorPosition","start","end","_textNodes$map2","document","activeElement","range","createRange","selectNodeContents","textCharacters","prevChar","nextChar","charCount","startNode","endNode","n","textNode","nextCharCount","undefined","setStart","setEnd","collapse","selection","window","getSelection","setBaseAndExtent","startContainer","startOffset","endContainer","endOffset","scrollCursorIntoView","moveCursorToEnd","getCurrentCursorPosition","rangeCount","getRangeAt","preSelectionRange","cloneRange","toString","removeSelection","removeAllRanges","selectionStart","value","isFirefox","caretRect","getClientRects","editableRect","getBoundingClientRect","paddingTop","parseFloat","getComputedStyle","borderTop","borderTopWidth","top","bottom","topToCaret","inputHeight","height","inputOffset","isChromium","scrollTo","scrollTop"],"sourceRoot":"../../../src","sources":["web/cursorUtils.ts"],"mappings":"AAAA,OAAO,KAAKA,YAAY,MAAM,gBAAgB;AAE9C,IAAIC,cAAkC;AAEtC,SAASC,aAAaA,CAACC,SAAiB,EAAEC,IAAe,EAAE;EACzD,IAAIA,IAAI,CAACC,QAAQ,KAAKC,IAAI,CAACC,SAAS,EAAE;IACpCJ,SAAS,CAACK,IAAI,CAACJ,IAAY,CAAC;EAC9B,CAAC,MAAM;IACL,KAAK,IAAIK,CAAC,GAAG,CAAC,EAAEC,MAAM,GAAGN,IAAI,CAACO,UAAU,CAACD,MAAM,EAAED,CAAC,GAAGC,MAAM,EAAE,EAAED,CAAC,EAAE;MAChE,MAAMG,SAAS,GAAGR,IAAI,CAACO,UAAU,CAACF,CAAC,CAAC;MACpC,IAAIG,SAAS,EAAE;QACbV,aAAa,CAACC,SAAS,EAAES,SAAS,CAAC;MACrC;IACF;EACF;AACF;AAEA,SAASC,WAAWA,CAACC,MAAmB,EAAE;EAAA,IAAAC,cAAA;EACxC,IAAIC,IAAI,GAAG,EAAE;EACb,MAAMb,SAAiB,GAAG,EAAE;EAC5BD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AC,CAACuD,UAAU,CAAC;EACzE,MAAMG,SAAS,GAAGF,UAAU,CAACzB,MAAM,CAAC0B,gBAAgB,CAACzD,MAAM,CAAC,CAAC2D,cAAc,CAAC;EAE5E,IAAIR,SAAS,IAAI,EAAEA,SAAS,CAACS,GAAG,IAAIP,YAAY,CAACO,GAAG,GAAGL,UAAU,GAAGG,SAAS,IAAIP,SAAS,CAACU,MAAM,IAAIR,YAAY,CAACQ,MAAM,GAAG,CAAC,IAAIN,UAAU,GAAGG,SAAS,CAAC,CAAC,EAAE;IACxJ,MAAMI,UAAU,GAAGX,SAAS,CAACS,GAAG,GAAGP,YAAY,CAACO,GAAG;IACnD,MAAMG,WAAW,GAAGV,YAAY,CAACW,MAAM;IACvC;IACA,MAAMC,WAAW,GAAGd,SAAS,CAACa,MAAM,GAAGD,WAAW,GAAGR,UAAU,GAAGG,SAAS,IAAIxE,YAAY,CAACgF,UAAU,GAAG,CAAC,GAAG,CAAC,IAAIX,UAAU,GAAGG,SAAS,CAAC,CAAC;IAE1I1D,MAAM,CAACmE,QAAQ,CAAC,CAAC,EAAEL,UAAU,GAAG9D,MAAM,CAACoE,SAAS,GAAGH,WAAW,CAAC;EACjE;AACF;AAEA,SAAQzB,wBAAwB,EAAED,eAAe,EAAE/B,iBAAiB,EAAET,WAAW,EAAE+C,eAAe,EAAER,oBAAoB"} +\ No newline at end of file ++{"version":3,"names":["BrowserUtils","prevTextLength","getPrevTextLength","findTextNodes","textNodes","node","nodeType","Node","TEXT_NODE","push","i","length","childNodes","childNode","setPrevText","target","_textNodes$map","text","map","e","nodeValue","join","split","setCursorPosition","start","end","_textNodes$map2","document","activeElement","range","createRange","selectNodeContents","textCharacters","prevChar","nextChar","charCount","startNode","endNode","n","textNode","nextCharCount","undefined","setStart","setEnd","collapse","selection","window","getSelection","setBaseAndExtent","startContainer","startOffset","endContainer","endOffset","scrollCursorIntoView","moveCursorToEnd","getCurrentCursorPosition","rangeCount","getRangeAt","preSelectionRange","cloneRange","toString","removeSelection","removeAllRanges","selectionStart","value","isFirefox","caretRect","getClientRects","editableRect","getBoundingClientRect","paddingTop","parseFloat","getComputedStyle","borderTop","borderTopWidth","top","bottom","topToCaret","inputHeight","height","inputOffset","isChromium","scrollTo","scrollTop"],"sourceRoot":"../../../src","sources":["web/cursorUtils.ts"],"mappings":"AAAA,OAAO,KAAKA,YAAY,MAAM,gBAAgB;AAE9C,IAAIC,cAAkC;AAEtC,SAASC,iBAAiBA,CAAA,EAAG;EAC3B,OAAOD,cAAc;AACvB;AAEA,SAASE,aAAaA,CAACC,SAAiB,EAAEC,IAAe,EAAE;EACzD,IAAIA,IAAI,CAACC,QAAQ,KAAKC,IAAI,CAACC,SAAS,EAAE;IACpCJ,SAAS,CAACK,IAAI,CAACJ,IAAY,CAAC;EAC9B,CAAC,MAAM;IACL,KAAK,IAAIK,CAAC,GAAG,CAAC,EAAEC,MAAM,GAAGN,IAAI,CAACO,UAAU,CAACD,MAAM,EAAED,CAAC,GAAGC,MAAM,EAAE,EAAED,CAAC,EAAE;MAChE,MAAMG,SAAS,GAAGR,IAAI,CAACO,UAAU,CAACF,CAAC,CAAC;MACpC,IAAIG,SAAS,EAAE;QACbV,aAAa,CAACC,SAAS,EAAES,SAAS,CAAC;MACrC;IACF;EACF;AACF;AAEA,SAASC,WAAWA,CAACC,MAAmB,EAAE;EAAA,IAAAC,cAAA;EACxC,IAAIC,IAAI,GAAG,EAAE;EACb,MAAMb,SAAiB,GAAG,EAAE;EAC5BD,aAAa,CAACC,SAAS,EAAEW,MAAM,CAAC;EAChCE,IAAI,IAAAD,cAAA,GAAGZ,SAAS,CACbc,GAAG,CAAEC,CAAC,IAAKA,CAAC,CAACC,SAAS,IAAI,EAAE,CAAC,cAAAJ,cAAA,gBAAAA,cAAA,GADzBA,cAAA,CAEHK,IAAI,CAAC,EAAE,CAAC,cAAAL,cAAA,uBAFLA,cAAA,CAGHM,KAAK,CAAC,EAAE,CAAC;EAEbrB,cAAc,GAAGgB,IAAI,CAAC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AIR,YAAY,CAACQ,MAAM,GAAG,CAAC,IAAIN,UAAU,GAAGG,SAAS,CAAC,CAAC,EAAE;IACxJ,MAAMI,UAAU,GAAGX,SAAS,CAACS,GAAG,GAAGP,YAAY,CAACO,GAAG;IACnD,MAAMG,WAAW,GAAGV,YAAY,CAACW,MAAM;IACvC;IACA,MAAMC,WAAW,GAAGd,SAAS,CAACa,MAAM,GAAGD,WAAW,GAAGR,UAAU,GAAGG,SAAS,IAAIzE,YAAY,CAACiF,UAAU,GAAG,CAAC,GAAG,CAAC,IAAIX,UAAU,GAAGG,SAAS,CAAC,CAAC;IAE1I1D,MAAM,CAACmE,QAAQ,CAAC,CAAC,EAAEL,UAAU,GAAG9D,MAAM,CAACoE,SAAS,GAAGH,WAAW,CAAC;EACjE;AACF;AAEA,SAAQzB,wBAAwB,EAAED,eAAe,EAAE/B,iBAAiB,EAAET,WAAW,EAAE+C,eAAe,EAAER,oBAAoB,EAAEnD,iBAAiB"} +\ No newline at end of file +diff --git a/node_modules/@expensify/react-native-live-markdown/lib/module/web/parserUtils.js b/node_modules/@expensify/react-native-live-markdown/lib/module/web/parserUtils.js +index 0c0d538..3de4592 100644 +--- a/node_modules/@expensify/react-native-live-markdown/lib/module/web/parserUtils.js ++++ b/node_modules/@expensify/react-native-live-markdown/lib/module/web/parserUtils.js +@@ -16,7 +16,10 @@ function addStyling(targetElement, type, markdownStyle) { + node.style.textDecoration = 'line-through'; + break; + case 'emoji': +- Object.assign(node.style, markdownStyle.emoji); ++ Object.assign(node.style, { ++ ...markdownStyle.emoji, ++ verticalAlign: 'middle' ++ }); + break; + case 'mention-here': + Object.assign(node.style, markdownStyle.mentionHere); +diff --git a/node_modules/@expensify/react-native-live-markdown/lib/module/web/parserUtils.js.map b/node_modules/@expensify/react-native-live-markdown/lib/module/web/parserUtils.js.map +index 2e4f75a..2da1c8a 100644 +--- a/node_modules/@expensify/react-native-live-markdown/lib/module/web/parserUtils.js.map ++++ b/node_modules/@expensify/react-native-live-markdown/lib/module/web/parserUtils.js.map +@@ -1 +1 @@ +-{"version":3,"names":["CursorUtils","BrowserUtils","addStyling","targetElement","type","markdownStyle","node","Object","assign","style","syntax","fontWeight","fontStyle","textDecoration","emoji","mentionHere","mentionUser","mentionReport","link","code","pre","blockquote","borderLeftStyle","display","maxWidth","boxSizing","h1","addSubstringAsTextNode","root","text","startIndex","endIndex","substring","length","appendChild","document","createTextNode","ungroupRanges","ranges","ungroupedRanges","forEach","range","depth","push","rangeWithoutDepth","Array","from","parseRangesToHTMLNodes","disableInlineStyles","createElement","className","textLength","stack","nestedStack","lastRangeEndIndex","shift","currentRoot","endOfCurrentRange","start","nextRangeStartIndex","span","prevRoot","pop","lastNestedNode","moveCursor","isFocused","alwaysMoveCursorToTheEnd","cursorPosition","target","moveCursorToEnd","setCursorPosition","parseText","cursorPositionIndex","activeElement","selection","getCurrentCursorPosition","end","global","parseExpensiMarkToRanges","markdownRanges","rootSpan","firstChild","innerHTML","innerText","dom","isChromium","setPrevText"],"sourceRoot":"../../../src","sources":["web/parserUtils.ts"],"mappings":"AAAA,OAAO,KAAKA,WAAW,MAAM,eAAe;AAE5C,OAAO,KAAKC,YAAY,MAAM,gBAAgB;AAkB9C,SAASC,UAAUA,CAACC,aAA0B,EAAEC,IAAkB,EAAEC,aAAmC,EAAE;EACvG,MAAMC,IAAI,GAAGH,aAAa;EAC1B,QAAQC,IAAI;IACV,KAAK,QAAQ;MACXG,MAAM,CAACC,MAAM,CAACF,IAAI,CAACG,KAAK,EAAEJ,aAAa,CAACK,MAAM,CAAC;MAC/C;IACF,KAAK,MAAM;MACTJ,IAAI,CAACG,KAAK,CAACE,UAAU,GAAG,MAAM;MAC9B;IACF,KAAK,QAAQ;MACXL,IAAI,CAACG,KAAK,CAACG,SAAS,GAAG,QAAQ;MAC/B;IACF,KAAK,eAAe;MAClBN,IAAI,CAACG,KAAK,CAACI,cAAc,GAAG,cAAc;MAC1C;IACF,KAAK,OAAO;MACVN,MAAM,CAACC,MAAM,C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,CAACF,SAAS,EAAE;MACrD/E,aAAa,CAAC+E,SAAS,GAAG,EAAE;MAC5B/E,aAAa,CAACgF,SAAS,GAAG,EAAE;MAC5Bf,MAAM,CAAClC,WAAW,CAACkD,GAAG,CAAC;MAEvB,IAAInF,YAAY,CAACoF,UAAU,EAAE;QAC3BrB,UAAU,CAACC,SAAS,EAAEC,wBAAwB,EAAEC,cAAc,EAAEC,MAAM,CAAC;MACzE;IACF;IAEA,IAAI,CAACnE,YAAY,CAACoF,UAAU,EAAE;MAC5BrB,UAAU,CAACC,SAAS,EAAEC,wBAAwB,EAAEC,cAAc,EAAEC,MAAM,CAAC;IACzE;EACF;EAEApE,WAAW,CAACsF,WAAW,CAAClB,MAAM,CAAC;EAE/B,OAAO;IAACvC,IAAI,EAAEuC,MAAM,CAACe,SAAS;IAAEhB,cAAc,EAAEA,cAAc,IAAI;EAAC,CAAC;AACtE;AAEA,SAAQI,SAAS,EAAExB,sBAAsB"} +\ No newline at end of file ++{"version":3,"names":["CursorUtils","BrowserUtils","addStyling","targetElement","type","markdownStyle","node","Object","assign","style","syntax","fontWeight","fontStyle","textDecoration","emoji","verticalAlign","mentionHere","mentionUser","mentionReport","link","code","pre","blockquote","borderLeftStyle","display","maxWidth","boxSizing","h1","addSubstringAsTextNode","root","text","startIndex","endIndex","substring","length","appendChild","document","createTextNode","ungroupRanges","ranges","ungroupedRanges","forEach","range","depth","push","rangeWithoutDepth","Array","from","parseRangesToHTMLNodes","disableInlineStyles","createElement","className","textLength","stack","nestedStack","lastRangeEndIndex","shift","currentRoot","endOfCurrentRange","start","nextRangeStartIndex","span","prevRoot","pop","lastNestedNode","moveCursor","isFocused","alwaysMoveCursorToTheEnd","cursorPosition","target","moveCursorToEnd","setCursorPosition","parseText","cursorPositionIndex","activeElement","selection","getCurrentCursorPosition","end","global","parseExpensiMarkToRanges","markdownRanges","rootSpan","firstChild","innerHTML","innerText","dom","isChromium","setPrevText"],"sourceRoot":"../../../src","sources":["web/parserUtils.ts"],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854912e5f60f3a0817a756eaa6e9f2ddd33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Fri, 5 Jul 2024 14:56:49 +0200 Subject: [PATCH 37/42] remove handlePaste change --- ...-markdown+0.1.88+002+addMissingEvents.patch | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/patches/@expensify+react-native-live-markdown+0.1.88+002+addMissingEvents.patch b/patches/@expensify+react-native-live-markdown+0.1.88+002+addMissingEvents.patch index a896cafd65d7..095bf5c993dc 100644 --- a/patches/@expensify+react-native-live-markdown+0.1.88+002+addMissingEvents.patch +++ b/patches/@expensify+react-native-live-markdown+0.1.88+002+addMissingEvents.patch @@ -1,5 +1,5 @@ diff --git a/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js b/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js -index 7be4e5c..345f50c 100644 +index 7be4e5c..5929c61 100644 --- a/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js +++ b/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js @@ -114,7 +114,8 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ @@ -129,21 +129,7 @@ index 7be4e5c..345f50c 100644 onChangeText(normalizedText); } handleContentSizeChange(); -@@ -389,8 +434,12 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ - e.target.value = normalizeValue(divRef.current.innerText || ''); - onClick(e); - }, [onClick, updateSelection]); -- const handlePaste = useCallback(() => { -+ const handlePaste = useCallback(e => { - pasteRef.current = true; -+ e.preventDefault(); -+ const clipboardData = e.clipboardData; -+ const text = clipboardData.getData('text/plain'); -+ document.execCommand('insertText', false, text); - }, []); - const startComposition = useCallback(() => { - compositionRef.current = true; -@@ -468,6 +517,7 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ +@@ -468,6 +513,7 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ /*#__PURE__*/ // eslint-disable-next-line jsx-a11y/no-static-element-interactions React.createElement("div", { From c489b4be42764049f7403b69543d76d083bc245e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Fri, 5 Jul 2024 15:06:21 +0200 Subject: [PATCH 38/42] fix eslint --- .../ComposerWithSuggestions/ComposerWithSuggestions.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index e434e0316e42..269e28932791 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -506,6 +506,7 @@ function ComposerWithSuggestions( if (nativeText === undefined) { // Assume we are on a platform where the text is stored in another field called value (e.g. web) // @ts-expect-error Not properly typed + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment nativeText = target.value; } From e8f8e0ae48647e80ff3c0cf14671775b22525f98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Tue, 16 Jul 2024 08:58:17 +0200 Subject: [PATCH 39/42] remove unused code --- .../ComposerWithSuggestions/ComposerWithSuggestions.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index 88ecb6b77eae..b03918784df8 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -437,8 +437,6 @@ function ComposerWithSuggestions( if (suggestionsRef.current) { suggestionsRef.current.resetSuggestions(); } - insertedEmojisRef.current = [...insertedEmojisRef.current, ...newEmojis]; - debouncedUpdateFrequentlyUsedEmojis(); } } emojisPresentBefore.current = emojis; @@ -479,7 +477,7 @@ function ComposerWithSuggestions( debouncedBroadcastUserIsTyping(reportID); } }, - [debouncedSaveReportComment, debouncedUpdateFrequentlyUsedEmojis, preferredLocale, preferredSkinTone, raiseIsScrollLikelyLayoutTriggered, reportID, setValue, suggestionsRef], + [debouncedSaveReportComment, preferredLocale, preferredSkinTone, raiseIsScrollLikelyLayoutTriggered, reportID, setValue, suggestionsRef], ); // This contains the previous value that we receive directly from the native text input (not our formatted value) From 9f5fa168f5c27632ead49ae7c22cea165a7a04a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Tue, 16 Jul 2024 08:58:45 +0200 Subject: [PATCH 40/42] delete now included patch --- ...markdown+0.1.88+002+addMissingEvents.patch | 212 ------------------ 1 file changed, 212 deletions(-) delete mode 100644 patches/@expensify+react-native-live-markdown+0.1.88+002+addMissingEvents.patch diff --git a/patches/@expensify+react-native-live-markdown+0.1.88+002+addMissingEvents.patch b/patches/@expensify+react-native-live-markdown+0.1.88+002+addMissingEvents.patch deleted file mode 100644 index 095bf5c993dc..000000000000 --- a/patches/@expensify+react-native-live-markdown+0.1.88+002+addMissingEvents.patch +++ /dev/null @@ -1,212 +0,0 @@ -diff --git a/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js b/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js -index 7be4e5c..5929c61 100644 ---- a/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js -+++ b/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js -@@ -114,7 +114,8 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ - style = {}, - value, - autoFocus = false, -- onContentSizeChange -+ onContentSizeChange, -+ id - }, ref) => { - const compositionRef = useRef(false); - const pasteRef = useRef(false); -@@ -169,16 +170,26 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ - caretColor: flattenedStyle.color || 'black' - }, disabled && styles.disabledInputStyles, createReactDOMStyle(preprocessStyle(flattenedStyle))]), [flattenedStyle, disabled]); - const undo = useCallback(target => { -- if (!history.current) return ''; -+ if (!history.current) { -+ return { -+ text: '', -+ cursorPosition: 0 -+ }; -+ } - const item = history.current.undo(); - const undoValue = item ? denormalizeValue(item.text) : null; -- return parseText(target, undoValue, processedMarkdownStyle, item ? item.cursorPosition : null, false).text; -+ return parseText(target, undoValue, processedMarkdownStyle, item ? item.cursorPosition : null, false); - }, [parseText, processedMarkdownStyle]); - const redo = useCallback(target => { -- if (!history.current) return ''; -+ if (!history.current) { -+ return { -+ text: '', -+ cursorPosition: 0 -+ }; -+ } - const item = history.current.redo(); - const redoValue = item ? denormalizeValue(item.text) : null; -- return parseText(target, redoValue, processedMarkdownStyle, item ? item.cursorPosition : null, false).text; -+ return parseText(target, redoValue, processedMarkdownStyle, item ? item.cursorPosition : null, false); - }, [parseText, processedMarkdownStyle]); - - // We have to process value property since contentEditable div adds one additional '\n' at the end of the text if we are entering new line -@@ -249,32 +260,43 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ - if (!divRef.current || !(e.target instanceof HTMLElement)) { - return; - } -+ const prevSelection = contentSelection.current ?? { -+ start: 0, -+ end: 0 -+ }; -+ const prevTextLength = CursorUtils.getPrevTextLength() ?? 0; - const changedText = e.target.innerText; - if (compositionRef.current && !BrowserUtils.isMobile) { - updateTextColor(divRef.current, changedText); - compositionRef.current = false; - return; - } -- let text = ''; -+ let newInputUpdate; - const nativeEvent = e.nativeEvent; -- switch (nativeEvent.inputType) { -+ const inputType = nativeEvent.inputType; -+ switch (inputType) { - case 'historyUndo': -- text = undo(divRef.current); -+ newInputUpdate = undo(divRef.current); - break; - case 'historyRedo': -- text = redo(divRef.current); -+ newInputUpdate = redo(divRef.current); - break; - case 'insertFromPaste': - // if there is no newline at the end of the copied text, contentEditable adds invisible
tag at the end of the text, so we need to normalize it - if (changedText.length > 2 && changedText[changedText.length - 2] !== '\n' && changedText[changedText.length - 1] === '\n') { -- text = parseText(divRef.current, normalizeValue(changedText), processedMarkdownStyle).text; -+ newInputUpdate = parseText(divRef.current, normalizeValue(changedText), processedMarkdownStyle); - break; - } -- text = parseText(divRef.current, changedText, processedMarkdownStyle).text; -+ newInputUpdate = parseText(divRef.current, changedText, processedMarkdownStyle); - break; - default: -- text = parseText(divRef.current, changedText, processedMarkdownStyle).text; -+ newInputUpdate = parseText(divRef.current, changedText, processedMarkdownStyle); - } -+ const { -+ text, -+ cursorPosition -+ } = newInputUpdate; -+ const normalizedText = normalizeValue(text); - if (pasteRef !== null && pasteRef !== void 0 && pasteRef.current) { - pasteRef.current = false; - updateSelection(e); -@@ -283,10 +305,33 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ - if (onChange) { - const event = e; - setEventProps(event); -+ -+ // The new text is between the prev start selection and the new end selection, can be empty -+ const addedText = normalizedText.slice(prevSelection.start, cursorPosition ?? 0); -+ // The length of the text that replaced the before text -+ const count = addedText.length; -+ // The start index of the replacement operation -+ let start = prevSelection.start; -+ const prevSelectionRange = prevSelection.end - prevSelection.start; -+ // The length the deleted text had before -+ let before = prevSelectionRange; -+ if (prevSelectionRange === 0 && (inputType === 'deleteContentBackward' || inputType === 'deleteContentForward')) { -+ // its possible the user pressed a delete key without a selection range, so we need to adjust the before value to have the length of the deleted text -+ before = prevTextLength - normalizedText.length; -+ } -+ if (inputType === 'deleteContentBackward') { -+ // When the user does a backspace delete he expects the content before the cursor to be removed. -+ // For this the start value needs to be adjusted (its as if the selection was before the text that we want to delete) -+ start = Math.max(start - before, 0); -+ } -+ event.nativeEvent.count = count; -+ event.nativeEvent.before = before; -+ event.nativeEvent.start = start; -+ -+ // @ts-expect-error TODO: Remove once react native PR merged https://github.com/facebook/react-native/pull/45248 - onChange(event); - } - if (onChangeText) { -- const normalizedText = normalizeValue(text); - onChangeText(normalizedText); - } - handleContentSizeChange(); -@@ -468,6 +513,7 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef(({ - /*#__PURE__*/ - // eslint-disable-next-line jsx-a11y/no-static-element-interactions - React.createElement("div", { -+ id: id, - ref: setRef, - contentEditable: !disabled, - style: inputStyles, -diff --git a/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js.map b/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js.map -index a44a5fa..5ddc80a 100644 ---- a/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js.map -+++ b/node_modules/@expensify/react-native-live-markdown/lib/module/MarkdownTextInput.web.js.map -@@ -1 +1 @@ --{"version":3,"names":["React","useEffect","useRef","useCallback","useMemo","useLayoutEffect","StyleSheet","ParseUtils","CursorUtils","StyleUtils","BrowserUtils","InputHistory","require","useClientEffect","window","createReactDOMStyle","default","e","Error","preprocessStyle","dangerousStyleValue","focusTimeout","normalizeValue","value","replace","denormalizeValue","endsWith","isEventComposing","nativeEvent","isComposing","keyCode","ZERO_WIDTH_SPACE","getPlaceholderValue","placeholder","length","processUnitsInMarkdownStyle","input","output","JSON","parse","stringify","Object","keys","forEach","key","obj","prop","processMarkdownStyle","mergeMarkdownStyleWithDefault","getElementHeight","node","styles","numberOfLines","tempElement","document","createElement","setAttribute","assign","style","innerText","Array","fill","join","parentElement","appendChild","height","clientHeight","removeChild","MarkdownTextInput","forwardRef","accessibilityLabel","accessibilityLabelledBy","accessibilityRole","autoCapitalize","autoCorrect","blurOnSubmit","clearTextOnFocus","dir","disabled","multiline","markdownStyle","onBlur","onChange","onChangeText","onClick","onFocus","onKeyPress","onSelectionChange","onSubmitEditing","placeholderTextColor","selectTextOnFocus","spellCheck","selection","autoFocus","onContentSizeChange","ref","compositionRef","pasteRef","divRef","currentlyFocusedField","contentSelection","className","history","dimensions","current","flattenedStyle","flatten","heightSafePlaceholder","setEventProps","text","target","parseText","customMarkdownStyles","cursorPosition","shouldAddToHistory","parsedText","throttledAdd","processedMarkdownStyle","newMarkdownStyle","inputStyles","defaultInputStyles","caretColor","color","disabledInputStyles","undo","item","undoValue","redo","redoValue","processedValue","updateTextColor","String","handleSelectionChange","event","updateRefSelectionVariables","newSelection","start","end","markdownHTMLInput","selectionStart","selectionEnd","updateSelection","predefinedSelection","getCurrentCursorPosition","handleContentSizeChange","_dimensions$current","offsetWidth","newWidth","offsetHeight","newHeight","width","contentSize","handleOnChangeText","HTMLElement","changedText","isMobile","inputType","normalizedText","handleKeyPress","hostNode","stopPropagation","metaKey","preventDefault","shiftKey","blurOnSubmitDefault","shouldBlurOnSubmit","isDefaultPrevented","execCommand","scrollCursorIntoView","setTimeout","blur","handleFocus","setCursorPosition","valueLength","clearTimeout","handleBlur","removeSelection","handleClick","handlePaste","startComposition","setRef","currentRef","r","isFocused","activeElement","clear","undefined","parseAndStyleValue","adjustHeight","elementHeight","maxHeight","focus","contentEditable","role","onKeyDown","onCompositionStart","onKeyUp","onInput","onPaste","create","borderColor","borderWidth","borderStyle","fontFamily","boxSizing","whiteSpace","overflowY","overflowX","overflowWrap","opacity","cursor"],"sourceRoot":"../../src","sources":["MarkdownTextInput.web.tsx"],"mappings":"AAAA;;AAYA,OAAOA,KAAK,IAAGC,SAAS,EAAEC,MAAM,EAAEC,WAAW,EAAEC,OAAO,EAAEC,eAAe,QAAO,OAAO;AAErF,SAAQC,UAAU,QAAO,cAAc;AACvC,OAAO,KAAKC,UAAU,MAAM,mBAAmB;AAC/C,OAAO,KAAKC,WAAW,MAAM,mBAAmB;AAChD,OAAO,KAAKC,UAAU,MAAM,cAAc;AAC1C,OAAO,KAAKC,YAAY,MAAM,oBAAoB;AAElD,OAAO,6BAA6B;AACpC,OAAOC,YAAY,MAAM,oBAAoB;AAE7CC,OAAO,CAAC,gDAAgD,CAAC;AAEzD,MAAMC,eAAe,GAAG,OAAOC,MAAM,KAAK,WAAW,G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BoC,qBAAsB;MACxC,kBAAgB5B,SAAU;MAC1BL,WAAW,EAAEA,WAAW,GAAG,IAAI,GAAG,KAAM;MACxCD,cAAc,EAAEA,cAAe;MAC/B4B,SAAS,EAAEA,SAAU;MACrB6F,SAAS,EAAEpC,cAAe;MAC1BqC,kBAAkB,EAAEhB,gBAAiB;MACrCiB,OAAO,EAAEvD,eAAgB;MACzBwD,OAAO,EAAE7C,kBAAmB;MAC5BpE,OAAO,EAAE6F,WAAY;MACrB5F,OAAO,EAAEsF,WAAY;MACrB1F,MAAM,EAAE8F,UAAW;MACnBuB,OAAO,EAAEpB,WAAY;MACrBjJ,WAAW,EAAE0E,qBAAsB;MACnChB,UAAU,EAAEA,UAAW;MACvBd,GAAG,EAAEA;IAAI,CACV;EAAC;AAEN,CACF,CAAC;AAED,MAAM1B,MAAM,GAAG7C,UAAU,CAACiM,MAAM,CAAC;EAC/B/E,kBAAkB,EAAE;IAClBgF,WAAW,EAAE,OAAO;IACpBC,WAAW,EAAE,CAAC;IACdC,WAAW,EAAE,OAAO;IACpBC,UAAU,EAAE,YAAY;IACxB;IACAC,SAAS,EAAE,YAAY;IACvBC,UAAU,EAAE,UAAU;IACtBC,SAAS,EAAE,MAAM;IACjBC,SAAS,EAAE,MAAM;IACjBC,YAAY,EAAE;EAChB,CAAC;EACDrF,mBAAmB,EAAE;IACnBsF,OAAO,EAAE,IAAI;IACbC,MAAM,EAAE;EACV;AACF,CAAC,CAAC;AAEF,eAAe9I,iBAAiB"} -\ No newline at end of file -+{"version":3,"names":["React","useEffect","useRef","useCallback","useMemo","useLayoutEffect","StyleSheet","ParseUtils","CursorUtils","StyleUtils","BrowserUtils","InputHistory","require","useClientEffect","window","createReactDOMStyle","default","e","Error","preprocessStyle","dangerousStyleValue","focusTimeout","normalizeValue","value","replace","denormalizeValue","endsWith","isEventComposing","nativeEvent","isComposing","keyCode","ZERO_WIDTH_SPACE","getPlaceholderValue","placeholder","length","processUnitsInMarkdownStyle","input","output","JSON","parse","stringify","Object","keys","forEach","key","obj","prop","processMarkdownStyle","mergeMarkdownStyleWithDefault","getElementHeight","node","styles","numberOfLines","tempElement","document","createElement","setAttribute","assign","style","innerText","Array","fill","join","parentElement","appendChild","height","clientHeight","removeChild","MarkdownTextInput","forwardRef","accessibilityLabel","accessibilityLabelledBy","accessibilityRole","autoCapitalize","autoCorrect","blurOnSubmit","clearTextOnFocus","dir","disabled","multiline","markdownStyle","onBlur","onChange","onChangeText","onClick","onFocus","onKeyPress","onSelectionChange","onSubmitEditing","placeholderTextColor","selectTextOnFocus","spellCheck","selection","autoFocus","onContentSizeChange","id","ref","compositionRef","pasteRef","divRef","currentlyFocusedField","contentSelection","className","history","dimensions","current","flattenedStyle","flatten","heightSafePlaceholder","setEventProps","text","target","parseText","customMarkdownStyles","cursorPosition","shouldAddToHistory","parsedText","throttledAdd","processedMarkdownStyle","newMarkdownStyle","inputStyles","defaultInputStyles","caretColor","color","disabledInputStyles","undo","item","undoValue","redo","redoValue","processedValue","updateTextColor","String","handleSelectionChange","event","updateRefSelectionVariables","newSelection","start","end","markdownHTMLInput","selectionStart","selectionEnd","updateSelection","predefinedSelection","getCurrentCursorPosition","handleContentSizeChange","_dimensions$current","offsetWidth","newWidth","offsetHeight","newHeight","width","contentSize","handleOnChangeText","HTMLElement","prevSelection","prevTextLength","getPrevTextLength","changedText","isMobile","newInputUpdate","inputType","normalizedText","addedText","slice","count","prevSelectionRange","before","handleKeyPress","hostNode","stopPropagation","metaKey","preventDefault","shiftKey","blurOnSubmitDefault","shouldBlurOnSubmit","isDefaultPrevented","execCommand","scrollCursorIntoView","setTimeout","blur","handleFocus","setCursorPosition","valueLength","clearTimeout","handleBlur","removeSelection","handleClick","handlePaste","clipboardData","getData","startComposition","setRef","currentRef","r","isFocused","activeElement","clear","undefined","parseAndStyleValue","adjustHeight","elementHeight","maxHeight","focus","contentEditable","role","onKeyDown","onCompositionStart","onKeyUp","onInput","onPaste","create","borderColor","borderWidth","borderStyle","fontFamily","boxSizing","whiteSpace","overflowY","overflowX","overflowWrap","opacity","cursor"],"sourceRoot":"../../src","sources":["MarkdownTextInput.web.tsx"],"mappings":"AAAA;;AAYA,OAAOA,KAAK,IAAGC,SAAS,EAAEC,MAAM,EAAEC,WAAW,EAAEC,OAAO,EAAEC,eAAe,QAAO,OAAO;AAErF,SAAQC,UAAU,QAAO,cAAc;AACvC,OAAO,KAAKC,UAAU,MAAM,mBAAmB;AAC/C,OAAO,KAAKC,WAAW,MAAM,mBAAmB;AAChD,OAAO,KAAKC,UAAU,MAAM,cAAc;AAC1C,OAAO,KAAKC,YAAY,MAAM,oBAAoB;AAElD,OAAO,6BAA6B;AACpC,OAAOC,YAAY,MAAM,oBAAoB;AAE7CC,OAAO,CAAC,gDAAgD,CAAC;AAEzD,MAAMC,eAAe,GAAG,OAAOC,MAAM,KAAK,WAAW,GAAGb,SAAS,GAAGI,eAAe;AAEnF,IAAIU,mBAAwC;AAC5C,IAAI;EACFA,mBAAmB;EACjB;EACAH,OAAO,CAAC,uEAAuE,CAAC,CAACI,OAAO;AAC5F,CAAC,CAAC,OAAOC,CAAC,EAAE;EACV,MAAM,IAAIC,KAAK,CAAC,kKAAkK,CAAC;AACrL;AAEA,IAAIC,eAAoC;AACxC,IAAI;EACFA,eAAe;EACb;EACAP,OAAO,CAAC,qDAAqD,CAAC,CAACI,OAAO;AAC1E,CAAC,CAAC,OAAOC,CAAC,EAAE;EACV,MAAM,IAAIC,KAAK,CAAC,0FAA0F,CAAC;AAC7G;AAEA,IAAIE,mBAAiF;AACrF,IAAI;EACFA,mBAAmB;EACjB;EACAR,OAAO,CAAC,qEAAqE,CAAC,CAACI,OAAO;AAC1F,CAAC,CAAC,OAAOC,CAAC,EAAE;EACV,MAAM,IAAIC,KAAK,CAAC,8FAA8F,CAAC;AACjH;AA8BA,IAAIG,YAAmC,GAAG,IAAI;;AAE9C;AACA,SAASC,cAAcA,CAACC,KAAa,EAAE;EACrC,OAAOA,KAAK,CAACC,OAAO,CAAC,KA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kB,EAAE;IAClB2F,WAAW,EAAE,OAAO;IACpBC,WAAW,EAAE,CAAC;IACdC,WAAW,EAAE,OAAO;IACpBC,UAAU,EAAE,YAAY;IACxB;IACAC,SAAS,EAAE,YAAY;IACvBC,UAAU,EAAE,UAAU;IACtBC,SAAS,EAAE,MAAM;IACjBC,SAAS,EAAE,MAAM;IACjBC,YAAY,EAAE;EAChB,CAAC;EACDhG,mBAAmB,EAAE;IACnBiG,OAAO,EAAE,IAAI;IACbC,MAAM,EAAE;EACV;AACF,CAAC,CAAC;AAEF,eAAe1J,iBAAiB"} -\ No newline at end of file -diff --git a/node_modules/@expensify/react-native-live-markdown/lib/module/web/cursorUtils.js b/node_modules/@expensify/react-native-live-markdown/lib/module/web/cursorUtils.js -index 6a4b510..fbab71b 100644 ---- a/node_modules/@expensify/react-native-live-markdown/lib/module/web/cursorUtils.js -+++ b/node_modules/@expensify/react-native-live-markdown/lib/module/web/cursorUtils.js -@@ -1,5 +1,8 @@ - import * as BrowserUtils from './browserUtils'; - let prevTextLength; -+function getPrevTextLength() { -+ return prevTextLength; -+} - function findTextNodes(textNodes, node) { - if (node.nodeType === Node.TEXT_NODE) { - textNodes.push(node); -@@ -53,7 +56,7 @@ function setCursorPosition(target, start, end = null) { - // 3. Caret at the end of whole input, when pressing enter - // 4. All other placements - if (prevChar === '\n' && prevTextLength !== undefined && prevTextLength < textCharacters.length) { -- if (nextChar !== '\n' && i !== n - 1 && nextChar) { -+ if (nextChar && nextChar !== '\n' && i !== n - 1) { - range.setStart(textNodes[i + 1], 0); - } else if (i !== textNodes.length - 1) { - range.setStart(textNodes[i], 1); -@@ -136,5 +139,5 @@ function scrollCursorIntoView(target) { - target.scrollTo(0, topToCaret + target.scrollTop + inputOffset); - } - } --export { getCurrentCursorPosition, moveCursorToEnd, setCursorPosition, setPrevText, removeSelection, scrollCursorIntoView }; -+export { getCurrentCursorPosition, moveCursorToEnd, setCursorPosition, setPrevText, removeSelection, scrollCursorIntoView, getPrevTextLength }; - //# sourceMappingURL=cursorUtils.js.map -\ No newline at end of file -diff --git a/node_modules/@expensify/react-native-live-markdown/lib/module/web/cursorUtils.js.map b/node_modules/@expensify/react-native-live-markdown/lib/module/web/cursorUtils.js.map -index 4ab44be..05849b4 100644 ---- a/node_modules/@expensify/react-native-live-markdown/lib/module/web/cursorUtils.js.map -+++ b/node_modules/@expensify/react-native-live-markdown/lib/module/web/cursorUtils.js.map -@@ -1 +1 @@ --{"version":3,"names":["BrowserUtils","prevTextLength","findTextNodes","textNodes","node","nodeType","Node","TEXT_NODE","push","i","length","childNodes","childNode","setPrevText","target","_textNodes$map","text","map","e","nodeValue","join","split","setCursorPosition","start","end","_textNodes$map2","document","activeElement","range","createRange","selectNodeContents","textCharacters","prevChar","nextChar","charCount","startNode","endNode","n","textNode","nextCharCount","undefined","setStart","setEnd","collapse","selection","window","getSelection","setBaseAndExtent","startContainer","startOffset","endContainer","endOffset","scrollCursorIntoView","moveCursorToEnd","getCurrentCursorPosition","rangeCount","getRangeAt","preSelectionRange","cloneRange","toString","removeSelection","removeAllRanges","selectionStart","value","isFirefox","caretRect","getClientRects","editableRect","getBoundingClientRect","paddingTop","parseFloat","getComputedStyle","borderTop","borderTopWidth","top","bottom","topToCaret","inputHeight","height","inputOffset","isChromium","scrollTo","scrollTop"],"sourceRoot":"../../../src","sources":["web/cursorUtils.ts"],"mappings":"AAAA,OAAO,KAAKA,YAAY,MAAM,gBAAgB;AAE9C,IAAIC,cAAkC;AAEtC,SAASC,aAAaA,CAACC,SAAiB,EAAEC,IAAe,EAAE;EACzD,IAAIA,IAAI,CAACC,QAAQ,KAAKC,IAAI,CAACC,SAAS,EAAE;IACpCJ,SAAS,CAACK,IAAI,CAACJ,IAAY,CAAC;EAC9B,CAAC,MAAM;IACL,KAAK,IAAIK,CAAC,GAAG,CAAC,EAAEC,MAAM,GAAGN,IAAI,CAACO,UAAU,CAACD,MAAM,EAAED,CAAC,GAAGC,MAAM,EAAE,EAAED,CAAC,EAAE;MAChE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,EAAE;IAC3D;EACF;EAEA,MAAMU,SAAS,GAAGrB,SAAS,CAACY,UAAU,CAAC,CAAC,CAAC,CAACU,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;EAC7D,MAAMC,YAAY,GAAGrD,MAAM,CAACsD,qBAAqB,CAAC,CAAC;;EAEnD;EACA,MAAMC,UAAU,GAAGC,UAAU,CAACzB,MAAM,CAAC0B,gBAAgB,CAACzD,MAAM,CAAC,CAACuD,UAAU,CAAC;EACzE,MAAMG,SAAS,GAAGF,UAAU,CAACzB,MAAM,CAAC0B,gBAAgB,CAACzD,MAAM,CAAC,CAAC2D,cAAc,CAAC;EAE5E,IAAIR,SAAS,IAAI,EAAEA,SAAS,CAACS,GAAG,IAAIP,YAAY,CAACO,GAAG,GAAGL,UAAU,GAAGG,SAAS,IAAIP,SAAS,CAACU,MAAM,IAAIR,YAAY,CAACQ,MAAM,GAAG,CAAC,IAAIN,UAAU,GAAGG,SAAS,CAAC,CAAC,EAAE;IACxJ,MAAMI,UAAU,GAAGX,SAAS,CAACS,GAAG,GAAGP,YAAY,CAACO,GAAG;IACnD,MAAMG,WAAW,GAAGV,YAAY,CAACW,MAAM;IACvC;IACA,MAAMC,WAAW,GAAGd,SAAS,CAACa,MAAM,GAAGD,WAAW,GAAGR,UAAU,GAAGG,SAAS,IAAIxE,YAAY,CAACgF,UAAU,GAAG,CAAC,GAAG,CAAC,IAAIX,UAAU,GAAGG,SAAS,CAAC,CAAC;IAE1I1D,MAAM,CAACmE,QAAQ,CAAC,CAAC,EAAEL,UAAU,GAAG9D,MAAM,CAACoE,SAAS,GAAGH,WAAW,CAAC;EACjE;AACF;AAEA,SAAQzB,wBAAwB,EAAED,eAAe,EAAE/B,iBAAiB,EAAET,WAAW,EAAE+C,eAAe,EAAER,oBAAoB"} -\ No newline at end of file -+{"version":3,"names":["BrowserUtils","prevTextLength","getPrevTextLength","findTextNodes","textNodes","node","nodeType","Node","TEXT_NODE","push","i","length","childNodes","childNode","setPrevText","target","_textNodes$map","text","map","e","nodeValue","join","split","setCursorPosition","start","end","_textNodes$map2","document","activeElement","range","createRange","selectNodeContents","textCharacters","prevChar","nextChar","charCount","startNode","endNode","n","textNode","nextCharCount","undefined","setStart","setEnd","collapse","selection","window","getSelection","setBaseAndExtent","startContainer","startOffset","endContainer","endOffset","scrollCursorIntoView","moveCursorToEnd","getCurrentCursorPosition","rangeCount","getRangeAt","preSelectionRange","cloneRange","toString","removeSelection","removeAllRanges","selectionStart","value","isFirefox","caretRect","getClientRects","editableRect","getBoundingClientRect","paddingTop","parseFloat","getComputedStyle","borderTop","borderTopWidth","top","bottom","topToCaret","inputHeight","height","inputOffset","isChromium","scrollTo","scrollTop"],"sourceRoot":"../../../src","sources":["web/cursorUtils.ts"],"mappings":"AAAA,OAAO,KAAKA,YAAY,MAAM,gBAAgB;AAE9C,IAAIC,cAAkC;AAEtC,SAASC,iBAAiBA,CAAA,EAAG;EAC3B,OAAOD,cAAc;AACvB;AAEA,SAASE,aAAaA,CAACC,SAAiB,EAAEC,IAAe,EAAE;EACzD,IAAIA,IAAI,CAACC,QAAQ,KAAKC,IAAI,CAACC,SAAS,EAAE;IACpCJ,SAAS,CAACK,IAAI,CAACJ,IAAY,CAAC;EAC9B,CAAC,MAAM;IACL,KAAK,IAAIK,CAAC,GAAG,CAAC,EAAEC,MAAM,GAAGN,IAAI,CAACO,UAAU,CAACD,MAAM,EAAED,CAAC,GAAGC,MAAM,EAAE,EAAED,CAAC,EAAE;MAChE,MAAMG,SAAS,GAAGR,IAAI,CAACO,UAAU,CAACF,CAAC,CAAC;MACpC,IAAIG,SAAS,EAAE;QACbV,aAAa,CAACC,SAAS,EAAES,SAAS,CAAC;MACrC;IACF;EACF;AACF;AAEA,SAASC,WAAWA,CAACC,MAAmB,EAAE;EAAA,IAAAC,cAAA;EACxC,IAAIC,IAAI,GAAG,EAAE;EACb,MAAMb,SAAiB,GAAG,EAAE;EAC5BD,aAAa,CAACC,SAAS,EAAEW,MAAM,CAAC;E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,CAACzD,MAAM,CAAC,CAACuD,UAAU,CAAC;EACzE,MAAMG,SAAS,GAAGF,UAAU,CAACzB,MAAM,CAAC0B,gBAAgB,CAACzD,MAAM,CAAC,CAAC2D,cAAc,CAAC;EAE5E,IAAIR,SAAS,IAAI,EAAEA,SAAS,CAACS,GAAG,IAAIP,YAAY,CAACO,GAAG,GAAGL,UAAU,GAAGG,SAAS,IAAIP,SAAS,CAACU,MAAM,IAAIR,YAAY,CAACQ,MAAM,GAAG,CAAC,IAAIN,UAAU,GAAGG,SAAS,CAAC,CAAC,EAAE;IACxJ,MAAMI,UAAU,GAAGX,SAAS,CAACS,GAAG,GAAGP,YAAY,CAACO,GAAG;IACnD,MAAMG,WAAW,GAAGV,YAAY,CAACW,MAAM;IACvC;IACA,MAAMC,WAAW,GAAGd,SAAS,CAACa,MAAM,GAAGD,WAAW,GAAGR,UAAU,GAAGG,SAAS,IAAIzE,YAAY,CAACiF,UAAU,GAAG,CAAC,GAAG,CAAC,IAAIX,UAAU,GAAGG,SAAS,CAAC,CAAC;IAE1I1D,MAAM,CAACmE,QAAQ,CAAC,CAAC,EAAEL,UAAU,GAAG9D,MAAM,CAACoE,SAAS,GAAGH,WAAW,CAAC;EACjE;AACF;AAEA,SAAQzB,wBAAwB,EAAED,eAAe,EAAE/B,iBAAiB,EAAET,WAAW,EAAE+C,eAAe,EAAER,oBAAoB,EAAEnD,iBAAiB"} -\ No newline at end of file -diff --git a/node_modules/@expensify/react-native-live-markdown/lib/module/web/parserUtils.js b/node_modules/@expensify/react-native-live-markdown/lib/module/web/parserUtils.js -index 0c0d538..3de4592 100644 ---- a/node_modules/@expensify/react-native-live-markdown/lib/module/web/parserUtils.js -+++ b/node_modules/@expensify/react-native-live-markdown/lib/module/web/parserUtils.js -@@ -16,7 +16,10 @@ function addStyling(targetElement, type, markdownStyle) { - node.style.textDecoration = 'line-through'; - break; - case 'emoji': -- Object.assign(node.style, markdownStyle.emoji); -+ Object.assign(node.style, { -+ ...markdownStyle.emoji, -+ verticalAlign: 'middle' -+ }); - break; - case 'mention-here': - Object.assign(node.style, markdownStyle.mentionHere); -diff --git a/node_modules/@expensify/react-native-live-markdown/lib/module/web/parserUtils.js.map b/node_modules/@expensify/react-native-live-markdown/lib/module/web/parserUtils.js.map -index 2e4f75a..2da1c8a 100644 ---- a/node_modules/@expensify/react-native-live-markdown/lib/module/web/parserUtils.js.map -+++ b/node_modules/@expensify/react-native-live-markdown/lib/module/web/parserUtils.js.map -@@ -1 +1 @@ --{"version":3,"names":["CursorUtils","BrowserUtils","addStyling","targetElement","type","markdownStyle","node","Object","assign","style","syntax","fontWeight","fontStyle","textDecoration","emoji","mentionHere","mentionUser","mentionReport","link","code","pre","blockquote","borderLeftStyle","display","maxWidth","boxSizing","h1","addSubstringAsTextNode","root","text","startIndex","endIndex","substring","length","appendChild","document","createTextNode","ungroupRanges","ranges","ungroupedRanges","forEach","range","depth","push","rangeWithoutDepth","Array","from","parseRangesToHTMLNodes","disableInlineStyles","createElement","className","textLength","stack","nestedStack","lastRangeEndIndex","shift","currentRoot","endOfCurrentRange","start","nextRangeStartIndex","span","prevRoot","pop","lastNestedNode","moveCursor","isFocused","alwaysMoveCursorToTheEnd","cursorPosition","target","moveCursorToEnd","setCursorPosition","parseText","cursorPositionIndex","activeElement","selection","getCurrentCursorPosition","end","global","parseExpensiMarkToRanges","markdownRanges","rootSpan","firstChild","innerHTML","innerText","dom","isChromium","setPrevText"],"sourceRoot":"../../../src","sources":["web/parserUtils.ts"],"mappings":"AAAA,OAAO,KAAKA,WAAW,MAAM,eAAe;AAE5C,OAAO,KAAKC,YAAY,MAAM,gBAAgB;AAkB9C,SAASC,UAAUA,CAACC,aAA0B,EAAEC,IAAkB,EAAEC,aAAmC,EAAE;EACvG,MAAMC,IAAI,GAAGH,aAAa;EAC1B,QAAQC,IAAI;IACV,KAAK,QAAQ;MACXG,MAAM,CAACC,MAAM,CAACF,IAAI,CAACG,KAAK,EAAEJ,aAAa,CAACK,MAAM,CAAC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AC5F/E,aAAa,CAAC+E,SAAS,GAAG,EAAE;IAC5B/E,aAAa,CAACgF,SAAS,GAAG,EAAE;EAC9B;;EAEA;EACA,IAAItD,IAAI,EAAE;IACR,MAAMuD,GAAG,GAAGrC,sBAAsB,CAAClB,IAAI,EAAEkD,cAAc,EAAE1E,aAAa,CAAC;IAEvE,IAAI,CAAC2E,QAAQ,IAAIA,QAAQ,CAACE,SAAS,KAAKE,GAAG,CAACF,SAAS,EAAE;MACrD/E,aAAa,CAAC+E,SAAS,GAAG,EAAE;MAC5B/E,aAAa,CAACgF,SAAS,GAAG,EAAE;MAC5Bf,MAAM,CAAClC,WAAW,CAACkD,GAAG,CAAC;MAEvB,IAAInF,YAAY,CAACoF,UAAU,EAAE;QAC3BrB,UAAU,CAACC,SAAS,EAAEC,wBAAwB,EAAEC,cAAc,EAAEC,MAAM,CAAC;MACzE;IACF;IAEA,IAAI,CAACnE,YAAY,CAACoF,UAAU,EAAE;MAC5BrB,UAAU,CAACC,SAAS,EAAEC,wBAAwB,EAAEC,cAAc,EAAEC,MAAM,CAAC;IACzE;EACF;EAEApE,WAAW,CAACsF,WAAW,CAAClB,MAAM,CAAC;EAE/B,OAAO;IAACvC,IAAI,EAAEuC,MAAM,CAACe,SAAS;IAAEhB,cAAc,EAAEA,cAAc,IAAI;EAAC,CAAC;AACtE;AAEA,SAAQI,SAAS,EAAExB,sBAAsB"} -\ No newline at end of file -+{"version":3,"names":["CursorUtils","BrowserUtils","addStyling","targetElement","type","markdownStyle","node","Object","assign","style","syntax","fontWeight","fontStyle","textDecoration","emoji","verticalAlign","mentionHere","mentionUser","mentionReport","link","code","pre","blockquote","borderLeftStyle","display","maxWidth","boxSizing","h1","addSubstringAsTextNode","root","text","startIndex","endIndex","substring","length","appendChild","document","createTextNode","ungroupRanges","ranges","ungroupedRanges","forEach","range","depth","push","rangeWithoutDepth","Array","from","parseRangesToHTMLNodes","disableInlineStyles","createElement","className","textLength","stack","nestedStack","lastRangeEndIndex","shift","currentRoot","endOfCurrentRange","start","nextRangeStartIndex","span","prevRoot","pop","lastNestedNode","moveCursor","isFocused","alwaysMoveCursorToTheEnd","cursorPosition","target","moveCursorToEnd","setCursorPosition","parseText","cursorPositionIndex","activeElement","selection","getCurrentCursorPosition","end","global","parseExpensiMarkToRanges","markdownRanges","rootSpan","firstChild","innerHTML","innerText","dom","isChromium","setPrevText"],"sourceRoot":"../../../src","sources":["web/parserUtils.ts"],"mappings":"AAAA,OAAO,KAAKA,WAAW,MAAM,eAAe;AAE5C,OAAO,KAAKC,YAAY,MAAM,gBAAgB;AAkB9C,SAASC,UAAUA,CAACC,aAA0B,EAAEC,IAAkB,EAAEC,aAAmC,EAAE;EACvG,MAAMC,IAAI,GAAGH,aAAa;EAC1B,QAAQC,IAAI;IACV,KAAK,QAAQ;MACXG,MAAM,CAACC,MAAM,CAACF,IAAI,CAACG,KAAK,EAAEJ,aAAa,CAACK,MAAM,CAAC;MAC/C;IACF,KAAK,MAAM;MACTJ,IAAI,CAACG,KAAK,CAACE,UAAU,GAAG,MAAM;MAC9B;IACF,KAAK,QAAQ;MACXL,IAAI,CAACG,KAAK,CAACG,SAAS,GAAG,QAAQ;MAC/B;IACF,KAAK,eAAe;MAClBN,IAAI,CAACG,KAAK,CAACI,cAAc,GAAG,cAAc;MAC1C;IACF,KAAK,OAAO;MACVN,MAAM,CAACC,MAAM,CAACF,IAAI,CAACG,KAAK,EAAE;QAAC,GAAGJ,aAAa,CAACS,KAAK;QAAEC,aAAa,EAAE;MAAQ,CAAC,CAAC;MAC5E;IACF,KAAK,cAAc;MACjBR,MAAM,CAACC,MAAM,CAACF,IAAI,CAACG,KAAK,EAAEJ,aAAa,CAACW,WAAW,CAAC;MACpD;IACF,KAAK,cAAc;MACjBT,MAAM,CAACC,MAAM,CAACF,IAAI,CAACG,KAAK,EAAEJ,aAAa,CAACY,WAAW,CAAC;MACpD;IACF,KAAK,gBAAgB;MACnBV,MAAM,CAACC,MAAM,CAACF,IAAI,CAACG,KAA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,SAAS,EAAEC,wBAAwB,EAAEC,cAAc,EAAEC,MAAM,CAAC;IACzE;EACF;EAEArE,WAAW,CAACuF,WAAW,CAAClB,MAAM,CAAC;EAE/B,OAAO;IAACvC,IAAI,EAAEuC,MAAM,CAACe,SAAS;IAAEhB,cAAc,EAAEA,cAAc,IAAI;EAAC,CAAC;AACtE;AAEA,SAAQI,SAAS,EAAExB,sBAAsB"} -\ No newline at end of file From a3fb1a3fb9682e0582d589210da78a925ff91e3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Tue, 16 Jul 2024 12:54:17 +0200 Subject: [PATCH 41/42] fix Suggestion usage in message edit --- src/pages/home/report/ReportActionItemMessageEdit.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/pages/home/report/ReportActionItemMessageEdit.tsx b/src/pages/home/report/ReportActionItemMessageEdit.tsx index b34cd68730f0..5bbe1678fd11 100644 --- a/src/pages/home/report/ReportActionItemMessageEdit.tsx +++ b/src/pages/home/report/ReportActionItemMessageEdit.tsx @@ -50,6 +50,7 @@ import getScrollPosition from './ReportActionCompose/getScrollPosition'; import type {SuggestionsRef} from './ReportActionCompose/ReportActionCompose'; import Suggestions from './ReportActionCompose/Suggestions'; import shouldUseEmojiPickerSelection from './shouldUseEmojiPickerSelection'; +import type { HandleComposerUpdateCallback } from './ReportActionCompose/ComposerWithSuggestions/types'; type ReportActionItemMessageEditProps = { /** All the data of the action */ @@ -403,6 +404,11 @@ function ReportActionItemMessageEdit( [cursorPositionValue.value, measureContainer, selection], ); + const handleComposerUpdate: HandleComposerUpdateCallback = useCallback( + ({fullNewText}) => { + updateDraft(fullNewText); + }, [updateDraft]) + useEffect(() => { // We use the tag to store the native ID of the text input. Later, we use it in onSelectionChange to pick up the proper text input data. @@ -535,11 +541,10 @@ function ReportActionItemMessageEdit( From 32ac0defd89703bdd1c235d349904a3e0a5f47be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Tue, 16 Jul 2024 13:48:02 +0200 Subject: [PATCH 42/42] ran prettier --- src/pages/home/report/ReportActionItemMessageEdit.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pages/home/report/ReportActionItemMessageEdit.tsx b/src/pages/home/report/ReportActionItemMessageEdit.tsx index 5bbe1678fd11..09c4d357391f 100644 --- a/src/pages/home/report/ReportActionItemMessageEdit.tsx +++ b/src/pages/home/report/ReportActionItemMessageEdit.tsx @@ -45,12 +45,12 @@ import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type * as OnyxTypes from '@src/types/onyx'; import * as ReportActionContextMenu from './ContextMenu/ReportActionContextMenu'; +import type {HandleComposerUpdateCallback} from './ReportActionCompose/ComposerWithSuggestions/types'; import getCursorPosition from './ReportActionCompose/getCursorPosition'; import getScrollPosition from './ReportActionCompose/getScrollPosition'; import type {SuggestionsRef} from './ReportActionCompose/ReportActionCompose'; import Suggestions from './ReportActionCompose/Suggestions'; import shouldUseEmojiPickerSelection from './shouldUseEmojiPickerSelection'; -import type { HandleComposerUpdateCallback } from './ReportActionCompose/ComposerWithSuggestions/types'; type ReportActionItemMessageEditProps = { /** All the data of the action */ @@ -407,7 +407,9 @@ function ReportActionItemMessageEdit( const handleComposerUpdate: HandleComposerUpdateCallback = useCallback( ({fullNewText}) => { updateDraft(fullNewText); - }, [updateDraft]) + }, + [updateDraft], + ); useEffect(() => { // We use the tag to store the native ID of the text input. Later, we use it in onSelectionChange to pick up the proper text input data.