mirror of https://gitee.com/answerdev/answer.git
Merge branch 'feat/ui-1.0.2' of git.backyard.segmentfault.com:opensource/answer into feat/ui-1.0.2
This commit is contained in:
commit
ae66685c1e
|
@ -93,16 +93,18 @@ const Index: FC<Props> = ({
|
|||
className={classnames(
|
||||
'fs-14 font-monospace',
|
||||
newData.original_text && 'mb-4',
|
||||
)}>
|
||||
{`/tags/${
|
||||
newData?.main_tag_slug_name
|
||||
? diffText(
|
||||
newData.main_tag_slug_name,
|
||||
oldData?.main_tag_slug_name,
|
||||
)
|
||||
: diffText(newData.slug_name, oldData?.slug_name)
|
||||
}`}
|
||||
</div>
|
||||
)}
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `/tags/${
|
||||
newData?.main_tag_slug_name
|
||||
? diffText(
|
||||
newData.main_tag_slug_name,
|
||||
oldData?.main_tag_slug_name,
|
||||
)
|
||||
: diffText(newData.slug_name, oldData?.slug_name)
|
||||
}`,
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
|
|
|
@ -179,6 +179,8 @@ function diffText(newText: string, oldText: string): string {
|
|||
?.replace(/<input/gi, '<input');
|
||||
}
|
||||
const diff = Diff.diffChars(oldText, newText);
|
||||
console.log(diff);
|
||||
|
||||
const result = diff.map((part) => {
|
||||
if (part.added) {
|
||||
if (part.value.replace(/\n/g, '').length <= 0) {
|
||||
|
|
Loading…
Reference in New Issue