-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
23,383 additions
and
16,505 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
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
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
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
2 changes: 1 addition & 1 deletion
2
packages/console/src/components/Designer/plugins/plugin-config-i18n/pane/index.tsx
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
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
53 changes: 53 additions & 0 deletions
53
packages/console/src/components/Designer/plugins/plugin-save/content.tsx
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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { Button } from '@alifd/next'; | ||
import { IPublicModelPluginContext } from '@alilc/lowcode-types'; | ||
import { Badge } from 'antd'; | ||
import React, { useCallback, useEffect, useState } from 'react'; | ||
|
||
interface SavePluginContentProps { | ||
ctx: IPublicModelPluginContext; | ||
} | ||
export const SavePluginContent: React.FC<SavePluginContentProps> = ({ ctx }) => { | ||
const { event, hotkey, project } = ctx; | ||
|
||
const [isSavePoint, setIsSavePoint] = useState(false); | ||
|
||
const save = useCallback(() => { | ||
// 抛出一个 save 事件,让业务自己去实现 | ||
event.emit('save'); | ||
// 创建一个保存点,用于检查是否有未保存的更改 | ||
project.getCurrentDocument()?.history.savePoint(); | ||
setIsSavePoint(false); | ||
}, [event, project]); | ||
|
||
useEffect(() => { | ||
const checkIsSavePointTimeout = setInterval( | ||
() => setIsSavePoint(project.getCurrentDocument()?.history.isSavePoint()), | ||
2000 | ||
); | ||
|
||
return () => { | ||
clearInterval(checkIsSavePointTimeout); | ||
}; | ||
}, [project]); | ||
|
||
useEffect(() => { | ||
hotkey.bind('command+s', e => { | ||
e.preventDefault(); | ||
save(); | ||
}); | ||
}, [hotkey, save]); | ||
|
||
return ( | ||
<Badge color="orange" dot={isSavePoint} styles={{ indicator: { width: 10, height: 10 } }}> | ||
<Button | ||
onClick={e => { | ||
e.preventDefault(); | ||
save(); | ||
}} | ||
type="primary" | ||
> | ||
保存 | ||
</Button> | ||
</Badge> | ||
); | ||
}; |
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
2 changes: 1 addition & 1 deletion
2
packages/console/src/pages/ComponentDesigner/plugins/plugin-component-release/index.tsx
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
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
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
Oops, something went wrong.