Skip to content

Commit 8d7b0f8

Browse files
symbol element
1 parent e1e87fd commit 8d7b0f8

File tree

2 files changed

+32
-4
lines changed

2 files changed

+32
-4
lines changed

packages/react/src/components/DiffContent.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,14 @@ const DiffString = ({
7171
operator === "add" ? `var(${addContentHighlightBGName})` : `var(${delContentHighlightBGName})`,
7272
}}
7373
>
74-
{isLast ? `${_str2}${getSymbol(isNewLineSymbolChanged)}` : str2}
74+
{isLast ? (
75+
<>
76+
{_str2}
77+
<span data-newline-symbol>{getSymbol(isNewLineSymbolChanged)}</span>
78+
</>
79+
) : (
80+
str2
81+
)}
7582
</span>
7683
{str3}
7784
</span>
@@ -164,7 +171,14 @@ const DiffSyntax = ({
164171
borderBottomRightRadius: isEnd || isLast ? "0.2em" : undefined,
165172
}}
166173
>
167-
{isLast ? `${_str2}${getSymbol(isNewLineSymbolChanged)}` : str2}
174+
{isLast ? (
175+
<>
176+
{_str2}
177+
<span data-newline-symbol>{getSymbol(isNewLineSymbolChanged)}</span>
178+
</>
179+
) : (
180+
str2
181+
)}
168182
</span>
169183
{str3}
170184
</span>

packages/vue/src/components/DiffContent.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,14 @@ const DiffString = ({
4141
operator === "add" ? `var(${addContentHighlightBGName})` : `var(${delContentHighlightBGName})`,
4242
}}
4343
>
44-
{isLast ? `${_str2}${getSymbol(isNewLineSymbolChanged)}` : str2}
44+
{isLast ? (
45+
<>
46+
{_str2}
47+
<span data-newline-symbol>{getSymbol(isNewLineSymbolChanged)}</span>
48+
</>
49+
) : (
50+
str2
51+
)}
4552
</span>
4653
{str3}
4754
</span>
@@ -134,7 +141,14 @@ const DiffSyntax = ({
134141
borderBottomRightRadius: isEnd || isLast ? "0.2em" : undefined,
135142
}}
136143
>
137-
{isLast ? `${_str2}${getSymbol(isNewLineSymbolChanged)}` : str2}
144+
{isLast ? (
145+
<>
146+
{_str2}
147+
<span data-newline-symbol>{getSymbol(isNewLineSymbolChanged)}</span>
148+
</>
149+
) : (
150+
str2
151+
)}
138152
</span>
139153
{str3}
140154
</span>

0 commit comments

Comments
 (0)