Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Copying the messages and marking a message in between as unread generates 'new' in the text #18228

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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