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 { 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<HTMLDivElement>(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(<GlobalOutlined></GlobalOutlined>)
});
});
};
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 (
<div className={` flex-col flex `}>
{taxonomies && (

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@ server {
# 监听80端口
listen 80;
# 服务器域名/IP地址使用环境变量
server_name 192.168.252.77;
server_name host.docker.internal;
# 基础性能优化配置
# 启用tcp_nopush以优化数据发送
@ -100,7 +100,7 @@ server {
# 仅供内部使用
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;

View File

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