Skip to content

Commit

Permalink
Merge pull request #18228 from Victor-Nyagudi/fix/17838-new-word-copi…
Browse files Browse the repository at this point in the history
…ed-with-messages-when-unread

Fix:  Copying the messages and marking a message in between as unread generates 'new' in the text
  • Loading branch information
Beamanator authored May 2, 2023
2 parents 081e45c + 2652e7d commit 4d4d484
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/UnreadActionIndicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import Text from './Text';
import withLocalize, {withLocalizePropTypes} from './withLocalize';

const UnreadActionIndicator = props => (
<View accessibilityLabel={props.translate('accessibilityHints.newMessageLineIndicator')} data-action-id={props.reportActionID} style={styles.unreadIndicatorContainer}>
<View
accessibilityLabel={props.translate('accessibilityHints.newMessageLineIndicator')}
data-action-id={props.reportActionID}
style={[styles.unreadIndicatorContainer, styles.userSelectNone]}
>
<View style={styles.unreadIndicatorLine} />
<Text style={styles.unreadIndicatorText}>
{props.translate('common.new')}
Expand Down
4 changes: 4 additions & 0 deletions src/libs/SelectionScraper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import render from 'dom-serializer';
import {parseDocument} from 'htmlparser2';
import _ from 'underscore';
import Str from 'expensify-common/lib/str';
import styles from '../../styles/styles';

const elementsWillBeSkipped = ['html', 'body'];
const tagAttribute = 'data-testid';
Expand Down Expand Up @@ -80,6 +81,9 @@ const getHTMLOfSelection = () => {
}
}

// Remove any element that isn't selectable to prevent copying unnecessary text/items
div.querySelectorAll(`div[style*="user-select: ${styles.userSelectNone.WebkitUserSelect}"]`).forEach(item => item.remove());

return div.innerHTML;
};

Expand Down

0 comments on commit 4d4d484

Please sign in to comment.