fix: strip starting and ending quotes from field value on copy to clipboard (#5831)

This commit is contained in:
Yunus M 2024-09-06 11:17:56 +05:30 committed by GitHub
parent 4a9847abdd
commit 266894b0f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -67,7 +67,6 @@ export function TableViewActions(
);
const [isOpen, setIsOpen] = useState<boolean>(false);
const textToCopy = fieldData.value;
if (record.field === 'body') {
const parsedBody = recursiveParseJSON(fieldData.value);
@ -89,6 +88,17 @@ export function TableViewActions(
: { __html: '' };
const fieldFilterKey = filterKeyForField(fieldData.field);
let textToCopy = fieldData.value;
// remove starting and ending quotes from the value
try {
textToCopy = textToCopy.replace(/^"|"$/g, '');
} catch (error) {
console.error(
'Failed to remove starting and ending quotes from the value',
error,
);
}
return (
<div className={cx('value-field', isOpen ? 'open-popover' : '')}>