-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(free-demo): enable switch line while readonly
- Loading branch information
1 parent
651b821
commit 7484c5a
Showing
2 changed files
with
3 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,19 @@ | ||
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(); | ||
}, [linesManager]); | ||
|
||
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> | ||
); | ||
}; |