Merge branch 'feat/ui-0.5.0' into 'test'

Feat/ui 0.5.0

See merge request opensource/answer!293
This commit is contained in:
Li Shuailing 2022-11-29 10:12:48 +00:00
commit 57487a9ef8
2 changed files with 9 additions and 3 deletions

View File

@ -1,5 +1,7 @@
import { FC, memo } from 'react';
import clssnames from 'classnames';
import { Tag } from '@/components';
import { diffText } from '@/utils';
@ -74,7 +76,7 @@ const Index: FC<Props> = ({
)}
{objectType === 'question' && (
<div className="mb-4">
{tag.map((item) => {
{tag?.map((item) => {
return (
<Tag
key={item.slug_name}
@ -87,7 +89,11 @@ const Index: FC<Props> = ({
</div>
)}
{objectType === 'tag' && opts?.showTagUrlSlug && (
<div className="mb-4 fs-14 font-monospace">
<div
className={clssnames(
'fs-14 font-monospace',
newData.original_text && 'mb-4',
)}>
{`/tags/${
newData?.main_tag_slug_name
? diffText(

View File

@ -170,7 +170,7 @@ function diffText(newText: string, oldText: string): string {
return '';
}
if (!oldText) {
if (typeof oldText !== 'string') {
return newText
?.replace(/\n/gi, '<br>')
?.replace(/<iframe/gi, '&lt;iframe')