diff --git a/src/CONST.js b/src/CONST.js index 8997b0b285fd..85b01b943216 100755 --- a/src/CONST.js +++ b/src/CONST.js @@ -2437,9 +2437,9 @@ const CONST = { }, SPACE_CHARACTER_WIDTH: 4, - // This ID is used in SelectionScraper.js to query the DOM for UnreadActionIndicator's - // div and then remove it from copied contents in the getHTMLOfSelection() method. - UNREAD_ACTION_INDICATOR_ID: 'no-copy-area-unread-action-indicator', + // The attribute used in the SelectionScraper.js helper to query all the DOM elements + // that should be removed from the copied contents in the getHTMLOfSelection() method + SELECTION_SCRAPER_HIDDEN_ELEMENT: 'selection-scrapper-hidden-element', MODERATION: { MODERATOR_DECISION_PENDING: 'pending', MODERATOR_DECISION_PENDING_HIDE: 'pendingHide', diff --git a/src/components/UnreadActionIndicator.js b/src/components/UnreadActionIndicator.js index 81cf266bef28..0d45c90aa441 100755 --- a/src/components/UnreadActionIndicator.js +++ b/src/components/UnreadActionIndicator.js @@ -10,7 +10,7 @@ const UnreadActionIndicator = (props) => ( accessibilityLabel={props.translate('accessibilityHints.newMessageLineIndicator')} data-action-id={props.reportActionID} style={[styles.unreadIndicatorContainer, styles.userSelectNone]} - nativeID={CONST.UNREAD_ACTION_INDICATOR_ID} + dataSet={{[CONST.SELECTION_SCRAPER_HIDDEN_ELEMENT]: true}} > {props.translate('common.new')} diff --git a/src/libs/SelectionScraper/index.js b/src/libs/SelectionScraper/index.js index aab5ca78e4ed..44b87deba796 100644 --- a/src/libs/SelectionScraper/index.js +++ b/src/libs/SelectionScraper/index.js @@ -83,10 +83,12 @@ const getHTMLOfSelection = () => { // Find and remove the div housing the UnreadActionIndicator because we don't want // the 'New/Nuevo' text inside it being copied. - const newMessageLineIndicatorDiv = div.querySelector(`#${CONST.UNREAD_ACTION_INDICATOR_ID}`); + const divsToRemove = div.querySelectorAll(`[data-${CONST.SELECTION_SCRAPER_HIDDEN_ELEMENT}=true]`); - if (newMessageLineIndicatorDiv) { - newMessageLineIndicatorDiv.remove(); + if (divsToRemove && divsToRemove.length > 0) { + divsToRemove.forEach((element) => { + element.remove(); + }); } return div.innerHTML; diff --git a/src/pages/home/report/ContextMenu/MiniReportActionContextMenu/index.js b/src/pages/home/report/ContextMenu/MiniReportActionContextMenu/index.js index f2883acc3b95..2c0f2ff65561 100644 --- a/src/pages/home/report/ContextMenu/MiniReportActionContextMenu/index.js +++ b/src/pages/home/report/ContextMenu/MiniReportActionContextMenu/index.js @@ -5,6 +5,7 @@ import PropTypes from 'prop-types'; import {propTypes as genericReportActionContextMenuPropTypes, defaultProps as GenericReportActionContextMenuDefaultProps} from '../genericReportActionContextMenuPropTypes'; import * as StyleUtils from '../../../../../styles/StyleUtils'; import BaseReportActionContextMenu from '../BaseReportActionContextMenu'; +import CONST from '../../../../../CONST'; const propTypes = { ..._.omit(genericReportActionContextMenuPropTypes, ['isMini']), @@ -20,7 +21,10 @@ const defaultProps = { }; const MiniReportActionContextMenu = (props) => ( - +