fix: upload a image can clear other message
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { EyeOutlined } from '@ant-design/icons';
|
||||
import { Image, Typography } from 'antd';
|
||||
import { Checkbox, Image, Typography } from 'antd';
|
||||
import { unescape } from 'lodash';
|
||||
import { TokensList, marked } from 'marked';
|
||||
import React, { Fragment, useCallback, useEffect } from 'react';
|
||||
@@ -38,12 +38,15 @@ const MarkdownViewer: React.FC<MarkdownViewerProps> = ({
|
||||
'list_item',
|
||||
'br',
|
||||
'html',
|
||||
'escape'
|
||||
'escape',
|
||||
'del',
|
||||
'blockquote',
|
||||
'checkbox'
|
||||
];
|
||||
|
||||
renderer.link = ({ href, title, text }) => {
|
||||
return `<a href="${href}" title="${title || ''}" target="_blank" rel="noopener noreferrer">${text}</a>`;
|
||||
};
|
||||
// renderer.link = ({ href, title, text }) => {
|
||||
// return `<a href="${href}" title="${title || ''}" target="_blank" rel="noopener noreferrer">${text}</a>`;
|
||||
// };
|
||||
|
||||
const isValidURL = useCallback((url: string) => {
|
||||
const pattern = /^(https?:\/\/|\/\/)([^\s/$.?#].[^\s]*)$/;
|
||||
@@ -101,6 +104,18 @@ const MarkdownViewer: React.FC<MarkdownViewerProps> = ({
|
||||
htmlstr = <li>{text}</li>;
|
||||
}
|
||||
|
||||
if (token.type === 'del') {
|
||||
htmlstr = <del>{text}</del>;
|
||||
}
|
||||
|
||||
if (token.type === 'blockquote') {
|
||||
htmlstr = <blockquote>{text}</blockquote>;
|
||||
}
|
||||
|
||||
if (token.type === 'checkbox') {
|
||||
htmlstr = <Checkbox value={token.checked} />;
|
||||
}
|
||||
|
||||
if (token.type === 'br') {
|
||||
htmlstr = <br />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user