Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export const esHitsComplex = [
},
],
binary_blob: ['U29tZSBiaW5hcnkgYmxvYg=='],
text_message: ["I'm multiline\n*&%$#|@"],
text_message: ["I'm multiline\n*&%$\\#|@"],
'object_user.first': ['Jane'],
keyword_key: ['=1+2";=1+2'],
'array_objects.name': ['elastic_list'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe('convertValueToString', () => {
},
});

expect(result.formattedString).toBe('"I\'m multiline\n*&%$#|@"');
expect(result.formattedString).toBe('"I\'m multiline\n*&%$\\#|@"');
expect(result.withFormula).toBe(false);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,14 @@ describe('copyValueToClipboard', () => {
});

const textOutputTabular = '"bool_enabled"\t"keyword_key"\nfalse\tabcd1';
const textOutputEscapedTabular = `"text_message"\n"Hi there! I am a sample string."\n"I'm multiline\n*&%$#|@"`;
const textOutputEscapedTabular = `"text_message"\n"Hi there! I am a sample string."\n"I'm multiline\n*&%$\\#|@"`;
const textOutputMarkdown = `| bool_enabled | keyword_key |
| --- | --- |
| false | abcd1 |`;
const textOutputEscapedMarkdown = `| text_message |
| --- |
| Hi there! I am a sample string. |
| I'm multiline *&%$#\\|@ |`;
| I'm multiline *&%$\\\\#\\|@ |`;
describe.each([
[CopyAsTextFormat.tabular, textOutputTabular, textOutputEscapedTabular],
[CopyAsTextFormat.markdown, textOutputMarkdown, textOutputEscapedMarkdown],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export const copyRowsAsTextToClipboard = async ({
const isLast = index === columns.length - 1;

if (format === CopyAsTextFormat.markdown) {
const escapedText = text.replace(/\|/g, '\\|').replace(/\n/g, ' ');
const escapedText = text.replace(/\\/g, '\\\\').replace(/\|/g, '\\|').replace(/\n/g, ' ');
const start = isFirst ? '| ' : ' | ';
const end = isLast ? ' |' : '';
return `${start}${escapedText}${end}`;
Expand Down