Skip to content

Commit

Permalink
only clear in case of edit composer
Browse files Browse the repository at this point in the history
  • Loading branch information
tienifr committed Aug 21, 2023
1 parent 9add8d1 commit 9005a8a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/components/Composer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ const propTypes = {
/** Function to check whether composer is covered up or not */
checkComposerVisibility: PropTypes.func,

/** Whether this is the report action compose */
isReportActionCompose: PropTypes.bool,

...withLocalizePropTypes,

...windowDimensionsPropTypes,
Expand Down Expand Up @@ -107,6 +110,7 @@ const defaultProps = {
setIsFullComposerAvailable: () => {},
shouldCalculateCaretPosition: false,
checkComposerVisibility: () => false,
isReportActionCompose: false,
};

/**
Expand Down Expand Up @@ -156,6 +160,7 @@ function Composer({
setIsFullComposerAvailable,
checkComposerVisibility,
selection: selectionProp,
isReportActionCompose,
...props
}) {
const textRef = useRef(null);
Expand Down Expand Up @@ -371,7 +376,9 @@ function Composer({
}

return () => {
ReportActionComposeFocusManager.clear();
if (!isReportActionCompose) {
ReportActionComposeFocusManager.clear();
}
unsubscribeFocus();
unsubscribeBlur();
document.removeEventListener('paste', handlePaste);
Expand Down
2 changes: 1 addition & 1 deletion src/libs/ReportActionComposeFocusManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function focus() {
function clear(isMainComposer = false) {
if (isMainComposer) {
mainComposerFocusCallback = null;
} else if (mainComposerFocusCallback) {
} else {
focusCallback = null;
}
}
Expand Down
1 change: 1 addition & 0 deletions src/pages/home/report/ReportActionCompose.js
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,7 @@ function ReportActionCompose({
shouldClear={textInputShouldClear}
onClear={() => setTextInputShouldClear(false)}
isDisabled={isBlockedFromConcierge || disabled}
isReportActionCompose
selection={selection}
onSelectionChange={onSelectionChange}
isFullComposerAvailable={isFullSizeComposerAvailable}
Expand Down

0 comments on commit 9005a8a

Please sign in to comment.