Skip to content

Commit

Permalink
Merge branch 'code'
Browse files Browse the repository at this point in the history
  • Loading branch information
nanqic committed Feb 12, 2024
2 parents ca16498 + a201f7e commit 87448f4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
<<<<<<< HEAD
=======
.gitattributes merge=ours
>>>>>>> code
.env merge=ours
1 change: 0 additions & 1 deletion src/components/Nav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export default function
const params = useParams();

useEffect(() => {
console.log(!params.dir || params.dir?.endsWith('.md'), params.foldername);
if (localStorage.getItem("theme")) {
import(`assets/theme-wheat.css`)
setTheme('wheat')
Expand Down
6 changes: 3 additions & 3 deletions src/components/TextEdit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function TextEdit({ content, setContent, setEditing }) {
const handleSave = async () => {
let title, res, userInput;
const re = /(?<=(#|-) )\S{1,32}/
title = content.match(re).shift()
title = content.match(re)?.shift()

if (location.pathname.endsWith('/repl')) {
userInput = window.prompt("确认保存", `${title}`)
Expand Down Expand Up @@ -117,7 +117,7 @@ export default function TextEdit({ content, setContent, setEditing }) {
<path d="M3 5.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5M3 8a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9A.5.5 0 0 1 3 8m0 2.5a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5" />
</svg>
),
execute: () => window.open(`${import.meta.env.VITE_SERVER_URL}/markmap${location.pathname.replace("/@markmap", "")}`)
execute: () => window.open(`${import.meta.env.VITE_SERVER_URL}${import.meta.env.VITE_SERVER_PATH}${location.pathname.replace("/@markmap", "")}`)
}

const clear = {
Expand Down Expand Up @@ -148,7 +148,7 @@ export default function TextEdit({ content, setContent, setEditing }) {
code,
br,
clear,
{ ...help, execute: () => window.open('https://box.hdcxb.net/markmap', '_blank') },
{ ...help, execute: () => window.open(`https://box.hdcxb.net${import.meta.env.VITE_SERVER_PATH}`, '_blank') },
divider,
localStorage.getItem("token") && save,
];
Expand Down
6 changes: 3 additions & 3 deletions src/pages/MarkmapLoader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const MarkmapLoader = () => {
}, [params])

const loadUsers = async () => {
const dirsUrl = `${import.meta.env.VITE_SERVER_URL}/api/fs/dirs?path=markmap`
const dirsUrl = `${import.meta.env.VITE_SERVER_URL}/api/fs/dirs?path=${import.meta.env.VITE_SERVER_PATH}`
const { data } = await postRequest(dirsUrl)
const userArr = data.map(item => item.name)
dispatch({ type: 'SET_USERLIST', payload: userArr });
Expand All @@ -74,7 +74,7 @@ const MarkmapLoader = () => {
}

async function loadUserFiles(user) {
const listUrl = `${import.meta.env.VITE_SERVER_URL}/api/fs/list?path=markmap`;
const listUrl = `${import.meta.env.VITE_SERVER_URL}/api/fs/list?path=${import.meta.env.VITE_SERVER_PATH}`;
const dirsContent = (await postRequest(`${listUrl}/${user}`))?.data.content;
dispatch({ type: 'SET_DIRS', payload: dirsContent?.filter(filterFile).map(x => x.name.slice(0, -3)) });
const dirfiles = dirsContent && await Promise.all(dirsContent?.filter(file => file.is_dir)?.map(async dir => {
Expand All @@ -87,7 +87,7 @@ const MarkmapLoader = () => {
}

const loadText = async (filename) => {
const fileUrl = `${import.meta.env.VITE_SERVER_URL}/p/markmap/${params.foldername}/${filename}`
const fileUrl = `${import.meta.env.VITE_SERVER_URL}/p${import.meta.env.VITE_SERVER_PATH}/${params.foldername}/${filename}`
let resp = await textRequest(fileUrl)
setContent(resp)
}
Expand Down

0 comments on commit 87448f4

Please sign in to comment.