diff --git a/.changeset/odd-cars-count.md b/.changeset/odd-cars-count.md new file mode 100644 index 000000000..070fd9b33 --- /dev/null +++ b/.changeset/odd-cars-count.md @@ -0,0 +1,5 @@ +--- +'@cube-dev/ui-kit': patch +--- + +Remove trailing space in CopySnippet. diff --git a/src/components/content/CopySnippet/CopySnippet.tsx b/src/components/content/CopySnippet/CopySnippet.tsx index 5131c10a2..93f1dc120 100644 --- a/src/components/content/CopySnippet/CopySnippet.tsx +++ b/src/components/content/CopySnippet/CopySnippet.tsx @@ -185,21 +185,24 @@ function CopySnippet(allProps: CubeCopySnippetProps) { let formattedCode = pristineCode .split(/\n/g) .map((line) => `${prefix}${line} `) - .join('\n'); + .join('\n') + .trim(); if (!showHidden) { if (hideText === true) { formattedCode = formattedCode .split('') .map((s) => HIDDEN_SYMBOL) - .join(''); + .join('') + .trim(); } else if (typeof hideText === 'string') { formattedCode = formattedCode.replaceAll( hideText, hideText .split('') .map((s) => HIDDEN_SYMBOL) - .join(''), + .join('') + .trim(), ); } else if (Array.isArray(hideText)) { hideText.forEach((text) => { @@ -208,7 +211,8 @@ function CopySnippet(allProps: CubeCopySnippetProps) { text .split('') .map((s) => HIDDEN_SYMBOL) - .join(''), + .join('') + .trim(), ); }); }