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

Android anchor markdown format 40564 #42147

Merged
5 changes: 4 additions & 1 deletion src/pages/home/report/ContextMenu/ContextMenuActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@
if (!Clipboard.canSetHtml()) {
Clipboard.setString(parser.htmlToMarkdown(content));
} else {
const plainText = parser.htmlToText(content);
const anchorRegex = /<a\s+(?:[^>]*?\s+)?href="([^"]*)"/gi;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we create a CONST for this regex to avoid duplicated code?

Copy link
Contributor

@DylanDylann DylanDylann May 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samilabud Please test again to make sure this regex also works well

const isAnchorTag = anchorRegex.test(content);
console.log({isAnchorTag});

Check failure on line 50 in src/pages/home/report/ContextMenu/ContextMenuActions.tsx

View workflow job for this annotation

GitHub Actions / Run ESLint

Unexpected console statement
const plainText = isAnchorTag ? parser.htmlToMarkdown(content) : parser.htmlToText(content);
Clipboard.setHtml(content, plainText);
}
}
Expand Down
Loading