chore: updates
This commit is contained in:
@@ -17,6 +17,7 @@ const ImagePreview = ({ context = "chat" }: Props) => {
|
||||
const chatHandler = (evt: MouseEvent) => {
|
||||
const target = evt.target as HTMLImageElement;
|
||||
if (target && target.nodeName == "IMG" && target.classList.contains("preview")) {
|
||||
// console.log("click chat", target);
|
||||
evt.stopPropagation();
|
||||
const thumbnail = target.src;
|
||||
const originUrl = target.dataset.origin || target.src;
|
||||
@@ -27,8 +28,15 @@ const ImagePreview = ({ context = "chat" }: Props) => {
|
||||
};
|
||||
const markdownHandler = (evt: MouseEvent) => {
|
||||
const target = evt.target as HTMLImageElement;
|
||||
const isMarkdown = !!target.closest("#MARKDOWN_CONTAINER");
|
||||
// 图片 并且没被 a 标签包裹
|
||||
if (target && target.nodeName == "IMG" && target.parentElement?.tagName !== "A") {
|
||||
if (
|
||||
isMarkdown &&
|
||||
target &&
|
||||
target.nodeName == "IMG" &&
|
||||
target.parentElement?.tagName !== "A"
|
||||
) {
|
||||
// console.log("click markdown", target);
|
||||
evt.stopPropagation();
|
||||
const urlObj = new URL(target.src);
|
||||
const originUrl = `${urlObj.origin}${urlObj.pathname}?file_path=${urlObj.searchParams.get(
|
||||
|
||||
Reference in New Issue
Block a user