fix: context menu click

This commit is contained in:
Tristan Yang
2024-08-19 09:55:24 +08:00
parent a9a65f00cf
commit bda2ee34b0
3 changed files with 1182 additions and 1089 deletions
+27 -27
View File
@@ -1,13 +1,13 @@
{
"name": "vocechat-web",
"version": "0.7.27",
"version": "0.7.28",
"homepage": "https://voce.chat",
"dependencies": {
"@metamask/onboarding": "^1.0.1",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.15",
"@radix-ui/react-popover": "^1.1.1",
"@react-oauth/google": "^0.12.1",
"@reduxjs/toolkit": "^2.2.6",
"@reduxjs/toolkit": "^2.2.7",
"@svgr/webpack": "^8.1.0",
"@tippyjs/react": "^4.2.6",
"@toast-ui/editor": "^3.2.2",
@@ -23,22 +23,22 @@
"@udecode/plate-node-id": "^33.0.0",
"@udecode/plate-paragraph": "^33.0.0",
"@udecode/plate-trailing-block": "^33.0.0",
"@uiball/loaders": "^1.3.0",
"agora-rtc-sdk-ng": "^4.21.0",
"@uiball/loaders": "^1.3.1",
"agora-rtc-sdk-ng": "^4.22.0",
"broadcast-channel": "^7.0.0",
"browserslist": "^4.23.1",
"browserslist": "^4.23.3",
"clsx": "^2.1.1",
"copy-image-clipboard": "^2.1.2",
"css-loader": "^7.1.2",
"css-minimizer-webpack-plugin": "^7.0.0",
"dayjs": "^1.11.11",
"dayjs": "^1.11.12",
"eslint": "^8.57.0",
"firebase": "^10.12.3",
"framer-motion": "11.2.13",
"firebase": "^10.13.0",
"framer-motion": "11.3.28",
"fs-extra": "^11.2.0",
"heic2any": "^0.0.4",
"html-webpack-plugin": "^5.6.0",
"i18next": "^23.11.5",
"i18next": "^23.13.0",
"i18next-browser-languagedetector": "^8.0.0",
"i18next-http-backend": "^2.5.2",
"linkify-plugin-mention": "^4.1.3",
@@ -59,28 +59,28 @@
"react-error-boundary": "^4.0.13",
"react-helmet": "^6.1.0",
"react-hot-toast": "^2.4.1",
"react-i18next": "^14.1.2",
"react-i18next": "^15.0.1",
"react-redux": "^9.1.2",
"react-refresh": "0.14.2",
"react-router-dom": "^6.24.1",
"react-router-dom": "^6.26.1",
"react-syntax-highlighter": "^15.5.0",
"react-textarea-autosize": "^8.5.3",
"react-use-wizard": "^2.3.0",
"react-viewport-list": "^7.1.2",
"react-virtuoso": "^4.7.11",
"react-virtuoso": "^4.10.1",
"rooks": "^7.14.1",
"slate": "^0.103.0",
"slate-history": "^0.100.0",
"slate-hyperscript": "^0.100.0",
"slate-react": "0.106.0",
"slate-react": "0.108.0",
"source-map-loader": "^5.0.0",
"style-loader": "^4.0.0",
"tailwind-merge": "2.4.0",
"tailwind-merge": "2.5.2",
"terser-webpack-plugin": "^5.3.10",
"tippy.js": "^6.3.7",
"typescript": "^5.5.3",
"wavesurfer.js": "^7.8.1",
"webpack": "^5.92.1",
"typescript": "^5.5.4",
"wavesurfer.js": "^7.8.4",
"webpack": "^5.93.0",
"webpack-dev-server": "^4.15.1",
"webpack-manifest-plugin": "^5.0.0",
"workbox-core": "^7.1.0",
@@ -115,34 +115,34 @@
]
},
"devDependencies": {
"@babel/core": "^7.24.7",
"@ianvs/prettier-plugin-sort-imports": "^4.3.0",
"@types/lodash": "^4.17.6",
"@babel/core": "^7.25.2",
"@ianvs/prettier-plugin-sort-imports": "^4.3.1",
"@types/lodash": "^4.17.7",
"@types/masonry-layout": "^4.2.8",
"@types/node": "^20.14.10",
"@types/node": "^22.4.0",
"@types/react": "18.3.3",
"@types/react-dom": "^18.3.0",
"@types/react-helmet": "^6.1.11",
"@types/react-syntax-highlighter": "^15.5.13",
"@typescript-eslint/eslint-plugin": "^7.15.0",
"@typescript-eslint/parser": "^7.15.0",
"autoprefixer": "^10.4.19",
"autoprefixer": "^10.4.20",
"babel-loader": "^9.1.3",
"babel-plugin-named-asset-import": "^0.3.8",
"babel-preset-react-app": "^10.0.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.34.3",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.35.0",
"eslint-plugin-react-hooks": "^4.6.2",
"gh-pages": "^6.1.1",
"md5-file": "^5.0.0",
"patch-package": "^8.0.0",
"postcss": "^8.4.39",
"postcss": "^8.4.41",
"postcss-loader": "^8.1.1",
"postinstall-postinstall": "^2.1.0",
"prettier": "^3.3.2",
"tailwindcss": "^3.4.4",
"prettier": "^3.3.3",
"tailwindcss": "^3.4.10",
"webpack-bundle-analyzer": "^4.10.2"
}
}
+1151 -1055
View File
File diff suppressed because it is too large Load Diff
+4 -7
View File
@@ -16,10 +16,8 @@ const ImagePreview = ({ context = "chat" }: Props) => {
if (!container) return;
const chatHandler = (evt: MouseEvent) => {
const target = evt.target as HTMLImageElement;
console.log({ target });
if (!target) return;
if (target.nodeName == "IMG" && target.classList.contains("preview")) {
if (target && target.nodeName == "IMG" && target.classList.contains("preview")) {
evt.stopPropagation();
const thumbnail = target.src;
const originUrl = target.dataset.origin || target.src;
const downloadLink = target.dataset.download || target.src;
@@ -28,11 +26,10 @@ const ImagePreview = ({ context = "chat" }: Props) => {
}
};
const markdownHandler = (evt: MouseEvent) => {
evt.stopPropagation();
const target = evt.target as HTMLImageElement;
if (!target) return;
// 图片 并且没被 a 标签包裹
if (target.nodeName == "IMG" && target.parentElement?.tagName !== "A") {
if (target && target.nodeName == "IMG" && target.parentElement?.tagName !== "A") {
evt.stopPropagation();
const urlObj = new URL(target.src);
const originUrl = `${urlObj.origin}${urlObj.pathname}?file_path=${urlObj.searchParams.get(
"file_path"