import { useState, useEffect } from 'react'; import { usePlayground, usePlaygroundTools, useRefresh } from '@flowgram.ai/fixed-layout-editor'; import { Tooltip, IconButton } from '@douyinfe/semi-ui'; import { IconUndo, IconRedo } from '@douyinfe/semi-icons'; import { ZoomSelect } from './zoom-select'; import { SwitchVertical } from './switch-vertical'; import { ToolContainer, ToolSection } from './styles'; import { Save } from './save'; import { Readonly } from './readonly'; import { MinimapSwitch } from './minimap-switch'; import { Minimap } from './minimap'; import { FitView } from './fit-view'; export const DemoTools = () => { const tools = usePlaygroundTools(); const [minimapVisible, setMinimapVisible] = useState(false); const playground = usePlayground(); const refresh = useRefresh(); useEffect(() => { const disposable = playground.config.onReadonlyOrDisabledChange(() => refresh()); return () => disposable.dispose(); }, [playground]); return ( } disabled={!tools.canUndo} onClick={() => tools.undo()} /> } disabled={!tools.canRedo} onClick={() => tools.redo()} /> ); };