This commit is contained in:
熊潇 2025-03-27 12:07:07 +08:00
parent c1247eba32
commit 4d0e945a92
5 changed files with 19 additions and 7 deletions

View File

@ -5,9 +5,11 @@ import { Auth } from './modules/layouts/Auth';
// import { basename } from './modules/basename';
import 'github-markdown-css/github-markdown.css';
export const App = () => {
const url = new URL(location.href);
const id = url.searchParams.get('id') || undefined;
return (
<>
<Flow checkLogin={false} />
<Flow checkLogin={false} id={id} />
<ToastContainer />
</>
);

View File

@ -49,7 +49,7 @@ export class TextEditor {
StarterKit, // 使用 StarterKit 包含基础功能
Highlight,
Placeholder.configure({
placeholder: 'Type ! to see commands (e.g., !today, !list !test )...',
placeholder: 'Type @ to see commands (e.g., @today, @list @test )...',
}),
Typography,
Markdown,

View File

@ -16,7 +16,7 @@ export const Commands = Extension.create({
addOptions() {
return {
suggestion: {
char: '!',
char: '@',
command: ({ editor, range, props }: any) => {
editor
.chain()

View File

@ -33,6 +33,8 @@ import { ContextMenu } from './modules/ContextMenu';
import { useSelect } from './hooks/use-select';
import clsx from 'clsx';
import { AppendDemo, DemoLogin } from '../demo-login';
import { List } from './pages/List';
type NodeData = {
id: string;
position: XYPosition;
@ -221,6 +223,9 @@ export const Flow = ({ id }: { checkLogin?: boolean; id?: string }) => {
if (!token) {
return <DemoLogin />;
}
if (!id) {
return <List />;
}
const wallStore = useWallStore(
useShallow((state) => {
return {
@ -232,7 +237,9 @@ export const Flow = ({ id }: { checkLogin?: boolean; id?: string }) => {
);
useEffect(() => {
wallStore.init(id);
if (id) {
wallStore.init(id);
}
}, [id]);
if (!wallStore.loaded) {

View File

@ -3,9 +3,7 @@ import { useWallStore } from '../store/wall';
import { useUserWallStore } from '../store/user-wall';
import { useShallow } from 'zustand/react/shallow';
import { formatDate, formatRelativeDate } from '../../../modules/dayjs';
import { useNavigate } from 'react-router-dom';
export const List = () => {
const navigate = useNavigate();
const wallStore = useUserWallStore(
useShallow((state) => {
return {
@ -20,6 +18,9 @@ export const List = () => {
const init = () => {
wallStore.queryWallList();
};
const navigate = (path: string) => {
window.location.href = path;
};
return (
<div className='p-4 bg-white w-full h-full flex flex-col'>
<div
@ -37,7 +38,9 @@ export const List = () => {
key={wall.id}
className='p-4 border border-gray-200 w-80 rounded-md'
onClick={() => {
navigate(`/edit/${wall.id}`);
const url = new URL(location.href);
url.searchParams.set('id', wall.id!);
navigate(url.toString());
}}>
<div>
<div>{wall.title}</div>