This commit is contained in:
Rao 2025-03-05 16:50:47 +08:00
parent 854d43d098
commit 1c080304e4
7 changed files with 30 additions and 13 deletions

View File

@ -20,9 +20,11 @@ import { useTusUpload } from "@web/src/hooks/useTusUpload";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { useAuth } from "@web/src/providers/auth-provider"; import { useAuth } from "@web/src/providers/auth-provider";
import { MIND_OPTIONS } from "./constant"; 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 JoinButton from "../../models/course/detail/CourseOperationBtns/JoinButton";
import { CourseDetailContext } from "../../models/course/detail/PostDetailContext"; 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 }) { export default function MindEditor({ id }: { id?: string }) {
const containerRef = useRef<HTMLDivElement>(null); const containerRef = useRef<HTMLDivElement>(null);
const { const {
@ -57,6 +59,17 @@ export default function MindEditor({ id }: { id?: string }) {
}); });
const { handleFileUpload } = useTusUpload(); const { handleFileUpload } = useTusUpload();
const [form] = Form.useForm(); 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(<GlobalOutlined></GlobalOutlined>)
});
});
};
useEffect(() => { useEffect(() => {
if (post?.id && id) { if (post?.id && id) {
read.mutateAsync({ read.mutateAsync({
@ -98,6 +111,7 @@ export default function MindEditor({ id }: { id?: string }) {
nodeMenu: canEdit, // 禁用节点右键菜单 nodeMenu: canEdit, // 禁用节点右键菜单
keypress: canEdit, // 禁用键盘快捷键 keypress: canEdit, // 禁用键盘快捷键
}); });
mind.install(CustomLinkIconPlugin);
mind.init(MindElixir.new("新思维导图")); mind.init(MindElixir.new("新思维导图"));
containerRef.current.hidden = true; containerRef.current.hidden = true;
//挂载实例 //挂载实例
@ -173,16 +187,13 @@ export default function MindEditor({ id }: { id?: string }) {
} }
console.log(result); console.log(result);
}, },
(error) => {}, (error) => { },
`mind-thumb-${new Date().toString()}` `mind-thumb-${new Date().toString()}`
); );
}; };
useEffect(() => { useEffect(() => {
containerRef.current.style.height = `${Math.floor(window.innerHeight - 271)}px`; containerRef.current.style.height = `${Math.floor(window.innerHeight - 271)}px`;
}, []); }, []);
useEffect(()=>{
console.log(canEdit,user?.id,post?.author?.id)
})
return ( return (
<div className={` flex-col flex `}> <div className={` flex-col flex `}>
{taxonomies && ( {taxonomies && (

View File

@ -40,7 +40,7 @@ export const CourseDetailDisplayArea: React.FC = () => {
opacity: videoOpacity, opacity: videoOpacity,
}} }}
className="w-full bg-black rounded-lg "> className="w-full bg-black rounded-lg ">
<div className=" w-full "> <div className=" w-full cursor-pointer">
<VideoPlayer src={lecture?.meta?.videoUrl} /> <VideoPlayer src={lecture?.meta?.videoUrl} />
</div> </div>
</motion.div> </motion.div>

View File

@ -91,6 +91,7 @@ export default function PostSelect({
dropdownStyle={{ dropdownStyle={{
minWidth: 200, // 设置合适的最小宽度 minWidth: 200, // 设置合适的最小宽度
}} }}
autoClearSearchValue
placeholder={placeholder} placeholder={placeholder}
onChange={onChange} onChange={onChange}
filterOption={false} filterOption={false}

View File

@ -191,8 +191,15 @@ export const VideoDisplay: React.FC<VideoDisplayProps> = ({
}; };
}, [src, onError, autoPlay]); }, [src, onError, autoPlay]);
const handleVideoClick = () => {
if (videoRef.current) {
videoRef.current.pause();
setIsPlaying(false);
}
};
return ( return (
<div className="relative w-full aspect-video"> <div className="relative w-full aspect-video" onClick={handleVideoClick}>
<video <video
ref={videoRef} ref={videoRef}
className="w-full h-full" className="w-full h-full"

View File

@ -72,9 +72,7 @@ export const routes: CustomRouteObject[] = [
{ {
path: "editor/:id?", path: "editor/:id?",
element: ( element: (
<WithAuth> <PathEditorPage></PathEditorPage>
<PathEditorPage></PathEditorPage>
</WithAuth>
), ),
}, },
], ],

View File

@ -2,7 +2,7 @@ server {
# 监听80端口 # 监听80端口
listen 80; listen 80;
# 服务器域名/IP地址使用环境变量 # 服务器域名/IP地址使用环境变量
server_name 192.168.252.77; server_name host.docker.internal;
# 基础性能优化配置 # 基础性能优化配置
# 启用tcp_nopush以优化数据发送 # 启用tcp_nopush以优化数据发送
@ -100,7 +100,7 @@ server {
# 仅供内部使用 # 仅供内部使用
internal; internal;
# 代理到认证服务 # 代理到认证服务
proxy_pass http://192.168.252.77:3000/auth/file; proxy_pass http://host.docker.internal:3001/auth/file;
# 请求优化:不传递请求体 # 请求优化:不传递请求体
proxy_pass_request_body off; proxy_pass_request_body off;

View File

@ -15,7 +15,7 @@ done
if [ -f "/usr/share/nginx/html/index.html" ]; then if [ -f "/usr/share/nginx/html/index.html" ]; then
# Use envsubst to replace environment variable placeholders # Use envsubst to replace environment variable placeholders
echo "Processing /usr/share/nginx/html/index.html" echo "Processing /usr/share/nginx/html/index.html"
envsubst < /usr/share/nginx/html/index.template > /usr/share/nginx/html/index.html.tmp envsubst < /usr/share/nginx/html/index.temp > /usr/share/nginx/html/index.html.tmp
mv /usr/share/nginx/html/index.html.tmp /usr/share/nginx/html/index.html mv /usr/share/nginx/html/index.html.tmp /usr/share/nginx/html/index.html
echo "Processed content:" echo "Processed content:"
cat /usr/share/nginx/html/index.html cat /usr/share/nginx/html/index.html