mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(editor): Show escape characters in json view (#16930)
This commit is contained in:
@@ -712,7 +712,7 @@ describe('NDV', () => {
|
|||||||
.outputDataContainer()
|
.outputDataContainer()
|
||||||
.should(
|
.should(
|
||||||
'have.text',
|
'have.text',
|
||||||
'[{"body": "<?xml version="1.0" encoding="UTF-8"?> <library> <book> <title>Introduction to XML</title> <author>John Doe</author> <publication_year>2020</publication_year> <isbn>1234567890</isbn> </book> <book> <title>Data Science Basics</title> <author>Jane Smith</author> <publication_year>2019</publication_year> <isbn>0987654321</isbn> </book> <book> <title>Programming in Python</title> <author>Bob Johnson</author> <publication_year>2021</publication_year> <isbn>5432109876</isbn> </book> </library>"}]',
|
'[{"body": "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> <library> <book> <title>Introduction to XML</title> <author>John Doe</author> <publication_year>2020</publication_year> <isbn>1234567890</isbn> </book> <book> <title>Data Science Basics</title> <author>Jane Smith</author> <publication_year>2019</publication_year> <isbn>0987654321</isbn> </book> <book> <title>Programming in Python</title> <author>Bob Johnson</author> <publication_year>2021</publication_year> <isbn>5432109876</isbn> </book> </library>"}]',
|
||||||
);
|
);
|
||||||
ndv.getters.outputDataContainer().find('mark').should('have.text', '<lib');
|
ndv.getters.outputDataContainer().find('mark').should('have.text', '<lib');
|
||||||
|
|
||||||
|
|||||||
@@ -112,10 +112,14 @@ const onDragEnd = (el: HTMLElement) => {
|
|||||||
}, 1000); // ensure dest data gets set if drop
|
}, 1000); // ensure dest data gets set if drop
|
||||||
};
|
};
|
||||||
|
|
||||||
const getContent = (value: unknown) => {
|
const formatKey = (value: unknown) => {
|
||||||
return isString(value) ? `"${value}"` : JSON.stringify(value);
|
return isString(value) ? `"${value}"` : JSON.stringify(value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const formatValue = (value: unknown) => {
|
||||||
|
return JSON.stringify(value);
|
||||||
|
};
|
||||||
|
|
||||||
const getListItemName = (path: string) => {
|
const getListItemName = (path: string) => {
|
||||||
return path.replace(/^(\["?\d"?]\.?)/g, '');
|
return path.replace(/^(\["?\d"?]\.?)/g, '');
|
||||||
};
|
};
|
||||||
@@ -168,7 +172,7 @@ const getListItemName = (path: string) => {
|
|||||||
>
|
>
|
||||||
<template #renderNodeKey="{ node }">
|
<template #renderNodeKey="{ node }">
|
||||||
<TextWithHighlights
|
<TextWithHighlights
|
||||||
:content="getContent(node.key)"
|
:content="formatKey(node.key)"
|
||||||
:search="search"
|
:search="search"
|
||||||
data-target="mappable"
|
data-target="mappable"
|
||||||
:data-value="getJsonParameterPath(node.path)"
|
:data-value="getJsonParameterPath(node.path)"
|
||||||
@@ -183,13 +187,7 @@ const getListItemName = (path: string) => {
|
|||||||
</template>
|
</template>
|
||||||
<template #renderNodeValue="{ node }">
|
<template #renderNodeValue="{ node }">
|
||||||
<TextWithHighlights
|
<TextWithHighlights
|
||||||
v-if="isNaN(node.index)"
|
:content="formatValue(node.content)"
|
||||||
:content="getContent(node.content)"
|
|
||||||
:search="search"
|
|
||||||
/>
|
|
||||||
<TextWithHighlights
|
|
||||||
v-else
|
|
||||||
:content="getContent(node.content)"
|
|
||||||
:search="search"
|
:search="search"
|
||||||
data-target="mappable"
|
data-target="mappable"
|
||||||
:data-value="getJsonParameterPath(node.path)"
|
:data-value="getJsonParameterPath(node.path)"
|
||||||
|
|||||||
@@ -416,7 +416,12 @@ exports[`RunDataJson.vue > renders json values properly 1`] = `
|
|||||||
>
|
>
|
||||||
|
|
||||||
<span
|
<span
|
||||||
class="content"
|
class="content mappable ph-no-capture"
|
||||||
|
data-depth="3"
|
||||||
|
data-name="record.name"
|
||||||
|
data-path="[0].record.name"
|
||||||
|
data-target="mappable"
|
||||||
|
data-value="{{ $('Set').item.json.record.name }}"
|
||||||
>
|
>
|
||||||
|
|
||||||
<span>
|
<span>
|
||||||
@@ -512,7 +517,12 @@ exports[`RunDataJson.vue > renders json values properly 1`] = `
|
|||||||
>
|
>
|
||||||
|
|
||||||
<span
|
<span
|
||||||
class="content"
|
class="content mappable ph-no-capture"
|
||||||
|
data-depth="2"
|
||||||
|
data-name="myNumber"
|
||||||
|
data-path="[0].myNumber"
|
||||||
|
data-target="mappable"
|
||||||
|
data-value="{{ $('Set').item.json.myNumber }}"
|
||||||
>
|
>
|
||||||
|
|
||||||
<span>
|
<span>
|
||||||
@@ -579,7 +589,12 @@ exports[`RunDataJson.vue > renders json values properly 1`] = `
|
|||||||
>
|
>
|
||||||
|
|
||||||
<span
|
<span
|
||||||
class="content"
|
class="content mappable ph-no-capture"
|
||||||
|
data-depth="2"
|
||||||
|
data-name="myStringNumber"
|
||||||
|
data-path="[0].myStringNumber"
|
||||||
|
data-target="mappable"
|
||||||
|
data-value="{{ $('Set').item.json.myStringNumber }}"
|
||||||
>
|
>
|
||||||
|
|
||||||
<span>
|
<span>
|
||||||
@@ -646,7 +661,12 @@ exports[`RunDataJson.vue > renders json values properly 1`] = `
|
|||||||
>
|
>
|
||||||
|
|
||||||
<span
|
<span
|
||||||
class="content"
|
class="content mappable ph-no-capture"
|
||||||
|
data-depth="2"
|
||||||
|
data-name="myStringText"
|
||||||
|
data-path="[0].myStringText"
|
||||||
|
data-target="mappable"
|
||||||
|
data-value="{{ $('Set').item.json.myStringText }}"
|
||||||
>
|
>
|
||||||
|
|
||||||
<span>
|
<span>
|
||||||
@@ -713,7 +733,12 @@ exports[`RunDataJson.vue > renders json values properly 1`] = `
|
|||||||
>
|
>
|
||||||
|
|
||||||
<span
|
<span
|
||||||
class="content"
|
class="content mappable ph-no-capture"
|
||||||
|
data-depth="2"
|
||||||
|
data-name="nil"
|
||||||
|
data-path="[0].nil"
|
||||||
|
data-target="mappable"
|
||||||
|
data-value="{{ $('Set').item.json.nil }}"
|
||||||
>
|
>
|
||||||
|
|
||||||
<span>
|
<span>
|
||||||
@@ -780,7 +805,12 @@ exports[`RunDataJson.vue > renders json values properly 1`] = `
|
|||||||
>
|
>
|
||||||
|
|
||||||
<span
|
<span
|
||||||
class="content"
|
class="content mappable ph-no-capture"
|
||||||
|
data-depth="2"
|
||||||
|
data-name="d"
|
||||||
|
data-path="[0].d"
|
||||||
|
data-target="mappable"
|
||||||
|
data-value="{{ $('Set').item.json.d }}"
|
||||||
>
|
>
|
||||||
<span />
|
<span />
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
Reference in New Issue
Block a user