From 1c080304e4f76aa987aa102a83559d78fc31b5b6 Mon Sep 17 00:00:00 2001 From: Rao <1227431568@qq.com> Date: Wed, 5 Mar 2025 16:50:47 +0800 Subject: [PATCH 1/9] rht --- .../components/common/editor/MindEditor.tsx | 21 ++++++++++++++----- .../course/detail/CourseDetailDisplayArea.tsx | 2 +- .../models/post/PostSelect/PostSelect.tsx | 1 + .../video-player/VideoDisplay.tsx | 9 +++++++- apps/web/src/routes/index.tsx | 4 +--- config/nginx/conf.d/web.conf | 4 ++-- config/nginx/entrypoint.sh | 2 +- 7 files changed, 30 insertions(+), 13 deletions(-) diff --git a/apps/web/src/components/common/editor/MindEditor.tsx b/apps/web/src/components/common/editor/MindEditor.tsx index e9a20b2..13d7cb1 100755 --- a/apps/web/src/components/common/editor/MindEditor.tsx +++ b/apps/web/src/components/common/editor/MindEditor.tsx @@ -20,9 +20,11 @@ import { useTusUpload } from "@web/src/hooks/useTusUpload"; import { useNavigate } from "react-router-dom"; import { useAuth } from "@web/src/providers/auth-provider"; import { MIND_OPTIONS } from "./constant"; -import { SaveOutlined } from "@ant-design/icons"; +import { GlobalOutlined, SaveOutlined } from "@ant-design/icons"; import JoinButton from "../../models/course/detail/CourseOperationBtns/JoinButton"; import { CourseDetailContext } from "../../models/course/detail/PostDetailContext"; +import ReactDOM from "react-dom"; +import { createRoot } from "react-dom/client"; export default function MindEditor({ id }: { id?: string }) { const containerRef = useRef(null); const { @@ -57,6 +59,17 @@ export default function MindEditor({ id }: { id?: string }) { }); const { handleFileUpload } = useTusUpload(); const [form] = Form.useForm(); + const CustomLinkIconPlugin = (mind) => { + mind.bus.addListener('operation', async () => { + const hyperLinkElement = await document.querySelectorAll('.hyper-link'); + console.log('hyperLinkElement', hyperLinkElement); + hyperLinkElement.forEach((item) => { + const hyperLinkDom = createRoot(item) + hyperLinkDom.render() + }); + + }); + }; useEffect(() => { if (post?.id && id) { read.mutateAsync({ @@ -98,6 +111,7 @@ export default function MindEditor({ id }: { id?: string }) { nodeMenu: canEdit, // 禁用节点右键菜单 keypress: canEdit, // 禁用键盘快捷键 }); + mind.install(CustomLinkIconPlugin); mind.init(MindElixir.new("新思维导图")); containerRef.current.hidden = true; //挂载实例 @@ -173,16 +187,13 @@ export default function MindEditor({ id }: { id?: string }) { } console.log(result); }, - (error) => {}, + (error) => { }, `mind-thumb-${new Date().toString()}` ); }; useEffect(() => { containerRef.current.style.height = `${Math.floor(window.innerHeight - 271)}px`; }, []); - useEffect(()=>{ - console.log(canEdit,user?.id,post?.author?.id) - }) return (
{taxonomies && ( diff --git a/apps/web/src/components/models/course/detail/CourseDetailDisplayArea.tsx b/apps/web/src/components/models/course/detail/CourseDetailDisplayArea.tsx index f95c29d..d24f7e6 100755 --- a/apps/web/src/components/models/course/detail/CourseDetailDisplayArea.tsx +++ b/apps/web/src/components/models/course/detail/CourseDetailDisplayArea.tsx @@ -40,7 +40,7 @@ export const CourseDetailDisplayArea: React.FC = () => { opacity: videoOpacity, }} className="w-full bg-black rounded-lg "> -
+
diff --git a/apps/web/src/components/models/post/PostSelect/PostSelect.tsx b/apps/web/src/components/models/post/PostSelect/PostSelect.tsx index 63f4058..f97d148 100644 --- a/apps/web/src/components/models/post/PostSelect/PostSelect.tsx +++ b/apps/web/src/components/models/post/PostSelect/PostSelect.tsx @@ -91,6 +91,7 @@ export default function PostSelect({ dropdownStyle={{ minWidth: 200, // 设置合适的最小宽度 }} + autoClearSearchValue placeholder={placeholder} onChange={onChange} filterOption={false} diff --git a/apps/web/src/components/presentation/video-player/VideoDisplay.tsx b/apps/web/src/components/presentation/video-player/VideoDisplay.tsx index 32b1109..976495b 100755 --- a/apps/web/src/components/presentation/video-player/VideoDisplay.tsx +++ b/apps/web/src/components/presentation/video-player/VideoDisplay.tsx @@ -191,8 +191,15 @@ export const VideoDisplay: React.FC = ({ }; }, [src, onError, autoPlay]); + const handleVideoClick = () => { + if (videoRef.current) { + videoRef.current.pause(); + setIsPlaying(false); + } + }; + return ( -
+