Quellcode durchsuchen

feat(free-demo): enable switch line while readonly

liuyangxing vor 10 Monaten
Ursprung
Commit
7484c5a16c

+ 1 - 1
apps/demo-free-layout/src/components/node-panel/node-list.tsx

@@ -19,7 +19,7 @@ const NodeWrap = styled.div`
   &:hover {
     background-color: hsl(252deg 62% 55% / 9%);
     color: hsl(252 62% 54.9%);
-  },
+  }
 `;
 
 const NodeLabel = styled.div`

+ 2 - 9
apps/demo-free-layout/src/components/tools/switch-line.tsx

@@ -1,12 +1,11 @@
 import { useCallback } from 'react';
 
-import { usePlayground, useService, WorkflowLinesManager } from '@flowgram.ai/free-layout-editor';
+import { useService, WorkflowLinesManager } from '@flowgram.ai/free-layout-editor';
 import { IconButton, Tooltip } from '@douyinfe/semi-ui';
 
 import { IconSwitchLine } from '../../assets/icon-switch-line';
 
 export const SwitchLine = () => {
-  const playground = usePlayground();
   const linesManager = useService(WorkflowLinesManager);
   const switchLine = useCallback(() => {
     linesManager.switchLineType();
@@ -14,13 +13,7 @@ export const SwitchLine = () => {
 
   return (
     <Tooltip content={'Switch Line'}>
-      <IconButton
-        disabled={playground.config.readonly}
-        type="tertiary"
-        theme="borderless"
-        onClick={switchLine}
-        icon={IconSwitchLine}
-      />
+      <IconButton type="tertiary" theme="borderless" onClick={switchLine} icon={IconSwitchLine} />
     </Tooltip>
   );
 };