|
@@ -1,6 +1,6 @@
|
|
|
import React, { useState } from "react";
|
|
import React, { useState } from "react";
|
|
|
import { useEffect } from "react";
|
|
import { useEffect } from "react";
|
|
|
-import { Tree } from "antd";
|
|
|
|
|
|
|
+import { Tree, Typography } from "antd";
|
|
|
import type { DataNode, TreeProps } from "antd/es/tree";
|
|
import type { DataNode, TreeProps } from "antd/es/tree";
|
|
|
import { Key } from "antd/lib/table/interface";
|
|
import { Key } from "antd/lib/table/interface";
|
|
|
import {
|
|
import {
|
|
@@ -11,10 +11,13 @@ import {
|
|
|
import { Button, Divider, Space } from "antd";
|
|
import { Button, Divider, Space } from "antd";
|
|
|
import { useIntl } from "react-intl";
|
|
import { useIntl } from "react-intl";
|
|
|
|
|
|
|
|
|
|
+const { Text } = Typography;
|
|
|
|
|
+
|
|
|
interface TreeNodeData {
|
|
interface TreeNodeData {
|
|
|
key: string;
|
|
key: string;
|
|
|
title: string | React.ReactNode;
|
|
title: string | React.ReactNode;
|
|
|
children: TreeNodeData[];
|
|
children: TreeNodeData[];
|
|
|
|
|
+ deletedAt?: string;
|
|
|
level: number;
|
|
level: number;
|
|
|
}
|
|
}
|
|
|
export type ListNodeData = {
|
|
export type ListNodeData = {
|
|
@@ -22,6 +25,7 @@ export type ListNodeData = {
|
|
|
title: string | React.ReactNode;
|
|
title: string | React.ReactNode;
|
|
|
level: number;
|
|
level: number;
|
|
|
children?: number;
|
|
children?: number;
|
|
|
|
|
+ deletedAt?: string;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
var tocActivePath: TreeNodeData[] = [];
|
|
var tocActivePath: TreeNodeData[] = [];
|
|
@@ -47,6 +51,7 @@ function tocGetTreeData(articles: ListNodeData[], active = "") {
|
|
|
title: element.title,
|
|
title: element.title,
|
|
|
children: [],
|
|
children: [],
|
|
|
level: element.level,
|
|
level: element.level,
|
|
|
|
|
+ deletedAt: element.deletedAt,
|
|
|
};
|
|
};
|
|
|
/*
|
|
/*
|
|
|
if (active == element.article) {
|
|
if (active == element.article) {
|
|
@@ -283,6 +288,15 @@ const Widget = ({
|
|
|
}
|
|
}
|
|
|
}}
|
|
}}
|
|
|
treeData={gData}
|
|
treeData={gData}
|
|
|
|
|
+ titleRender={(node: TreeNodeData) => {
|
|
|
|
|
+ return node.deletedAt ? (
|
|
|
|
|
+ <Text delete disabled>
|
|
|
|
|
+ {node.title}
|
|
|
|
|
+ </Text>
|
|
|
|
|
+ ) : (
|
|
|
|
|
+ <>{node.title}</>
|
|
|
|
|
+ );
|
|
|
|
|
+ }}
|
|
|
/>
|
|
/>
|
|
|
</>
|
|
</>
|
|
|
);
|
|
);
|