+ {nodeTypes.map(nodeType => (
+
dragService.startDragCard(nodeType, e, {
+ data: {
+ title: nodeType,
+ content: '拖拽创建的节点'
+ }
+ })}
+ >
+ {nodeType}
+
+ ))}
+
+ );
+};
+```
+
+#### 步骤五:创建工具栏和缩略图
+
+```tsx
+// src/components/tools.tsx
+import React from 'react';
+import { useEffect, useState } from 'react';
+import { usePlaygroundTools, useClientContext } from '@flowgram.ai/free-layout-editor';
+
+export const Tools: React.FC = () => {
+ const { history } = useClientContext();
+ const tools = usePlaygroundTools();
+ const [canUndo, setCanUndo] = useState(false);
+ const [canRedo, setCanRedo] = useState(false);
+
+ useEffect(() => {
+ const disposable = history.undoRedoService.onChange(() => {
+ setCanUndo(history.canUndo());
+ setCanRedo(history.canRedo());
+ });
+ return () => disposable.dispose();
+ }, [history]);
+
+ return (
+