Skip to content

Commit

Permalink
chore: update expensify-common 2.0.17
Browse files Browse the repository at this point in the history
  • Loading branch information
dominictb committed Jun 17, 2024
1 parent d1fc0b3 commit a2cfd54
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 15 deletions.
11 changes: 5 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
"date-fns-tz": "^2.0.0",
"dom-serializer": "^0.2.2",
"domhandler": "^4.3.0",
"expensify-common": "^2.0.12",
"expensify-common": "2.0.17",
"expo": "^50.0.3",
"expo-av": "~13.10.4",
"expo-image": "1.11.0",
Expand Down
18 changes: 14 additions & 4 deletions src/libs/OnyxAwareParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,22 @@ Onyx.connect({
},
});

function parseHtmlToMarkdown(html: string, reportIDToName?: Record<string, string>, accountIDToName?: Record<string, string>): string {
return parser.htmlToMarkdown(html, {reportIDToName: reportIDToName ?? reportIDToNameMap, accountIDToName: accountIDToName ?? accountIDToNameMap});
function parseHtmlToMarkdown(
html: string,
reportIDToName?: Record<string, string>,
accountIDToName?: Record<string, string>,
cacheVideoAttributes?: (videoSource: string, videoAttrs: string) => void,
): string {
return parser.htmlToMarkdown(html, {reportIDToName: reportIDToName ?? reportIDToNameMap, accountIDToName: accountIDToName ?? accountIDToNameMap, cacheVideoAttributes});
}

function parseHtmlToText(html: string, reportIDToName?: Record<string, string>, accountIDToName?: Record<string, string>): string {
return parser.htmlToText(html, {reportIDToName: reportIDToName ?? reportIDToNameMap, accountIDToName: accountIDToName ?? accountIDToNameMap});
function parseHtmlToText(
html: string,
reportIDToName?: Record<string, string>,
accountIDToName?: Record<string, string>,
cacheVideoAttributes?: (videoSource: string, videoAttrs: string) => void,
): string {
return parser.htmlToText(html, {reportIDToName: reportIDToName ?? reportIDToNameMap, accountIDToName: accountIDToName ?? accountIDToNameMap, cacheVideoAttributes});
}

export {parseHtmlToMarkdown, parseHtmlToText};
1 change: 1 addition & 0 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1450,6 +1450,7 @@ function removeLinksFromHtml(html: string, links: string[]): string {
*
* @param newCommentText text of the comment after editing.
* @param originalCommentMarkdown original markdown of the comment before editing.
* @param videoAttributeCache cache of video attributes ([videoSource]: videoAttributes)
*/
function handleUserDeletedLinksInHtml(newCommentText: string, originalCommentMarkdown: string, videoAttributeCache?: Record<string, string>): string {
const parser = new ExpensiMark();
Expand Down
6 changes: 2 additions & 4 deletions src/pages/home/report/ReportActionItemMessageEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,8 @@ function ReportActionItemMessageEdit(
useEffect(() => {
draftMessageVideoAttributeCache.clear();

const originalMessage = parseHtmlToMarkdown(action.message?.[0]?.html ?? '', undefined, undefined, {
cacheVideoAttributes: (videoSource, attrs) => {
draftMessageVideoAttributeCache.set(videoSource, attrs);
},
const originalMessage = parseHtmlToMarkdown(action.message?.[0]?.html ?? '', undefined, undefined, (videoSource, attrs) => {
draftMessageVideoAttributeCache.set(videoSource, attrs);
});
if (ReportActionsUtils.isDeletedAction(action) || !!(action.message && draftMessage === originalMessage) || !!(prevDraftMessage === draftMessage || isCommentPendingSaved.current)) {
return;
Expand Down

0 comments on commit a2cfd54

Please sign in to comment.