-
Notifications
You must be signed in to change notification settings - Fork 3k
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 Edited Line Through Alignment #17781
Changes from 6 commits
f9d3ec3
2e56bd7
11a3777
4fffba5
32627e7
8ea952e
ea026be
74ef8c9
63772da
c5bf385
d977935
5e9687a
83a0173
6e0b118
4d4d79a
a4f096e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,8 @@ import Text from '../../Text'; | |
import variables from '../../../styles/variables'; | ||
import themeColors from '../../../styles/themes/default'; | ||
import styles from '../../../styles/styles'; | ||
import CONST from '../../../CONST'; | ||
import getPlatform from '../../../libs/getPlatform'; | ||
|
||
const propTypes = { | ||
...htmlRendererPropTypes, | ||
|
@@ -14,12 +16,16 @@ const propTypes = { | |
|
||
const EditedRenderer = (props) => { | ||
const defaultRendererProps = _.omit(props, ['TDefaultRenderer', 'style', 'tnode']); | ||
const isPendingDelete = !!props.tnode.attributes.deleted; | ||
const isWeb = [CONST.PLATFORM.WEB, CONST.PLATFORM.DESKTOP].includes(getPlatform()); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NAB: extra blank line There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated |
||
return ( | ||
<Text | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
{...defaultRendererProps} | ||
fontSize={variables.fontSizeSmall} | ||
color={themeColors.textSupporting} | ||
style={isPendingDelete && isWeb ? [styles.offlineFeedback.deleted, styles.offlineFeedback.edited] : {}} | ||
> | ||
{/* Native devices do not support margin between nested text */} | ||
<Text style={styles.w1}>{' '}</Text> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ import * as StyleUtils from '../../../styles/StyleUtils'; | |
import {withNetwork} from '../../../components/OnyxProvider'; | ||
import CONST from '../../../CONST'; | ||
import applyStrikethrough from '../../../components/HTMLEngineProvider/applyStrikethrough'; | ||
import getPlatform from '../../../libs/getPlatform'; | ||
|
||
const propTypes = { | ||
/** The message fragment needing to be displayed */ | ||
|
@@ -107,11 +108,12 @@ const ReportActionItemFragment = (props) => { | |
// we render it as text, not as html. | ||
// This is done to render emojis with line breaks between them as text. | ||
const differByLineBreaksOnly = Str.replaceAll(html, '<br />', '\n') === text; | ||
const isWeb = [CONST.PLATFORM.WEB, CONST.PLATFORM.DESKTOP].includes(getPlatform()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pubudu-ranasinghe Why is this necessary? We discourage the use of platform dependent code unless it is absolutely necessary. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This issue doesn't happen on native apps. And providing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the error? If it is not supported by react-native, we better look for other solutions. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It says it should be one of the supported values |
||
|
||
// Only render HTML if we have html in the fragment | ||
if (!differByLineBreaksOnly) { | ||
const isPendingDelete = props.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE && props.network.isOffline; | ||
const editedTag = props.fragment.isEdited ? '<edited></edited>' : ''; | ||
const editedTag = props.fragment.isEdited ? `<edited ${isPendingDelete ? 'deleted="true"' : ''}></edited>` : ''; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NAB: Do we need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I've updated to use just the attribute key |
||
const htmlContent = applyStrikethrough(html + editedTag, isPendingDelete); | ||
|
||
return ( | ||
|
@@ -133,6 +135,7 @@ const ReportActionItemFragment = (props) => { | |
<Text | ||
fontSize={variables.fontSizeSmall} | ||
color={themeColors.textSupporting} | ||
style={[...props.style, isWeb ? styles.offlineFeedback.edited : {}]} | ||
> | ||
{` ${props.translate('reportActionCompose.edited')}`} | ||
</Text> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
Boolean(props.tnode.attributes.deleted);
might be a little clearer. You could also do this inline on line 26 instead of making a separate variable for it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated