add ctrl+s to download image

This commit is contained in:
Qing
2024-01-01 16:37:29 +08:00
parent 79a41454f6
commit b0e009f879
3 changed files with 38 additions and 4 deletions

View File

@@ -501,7 +501,7 @@ export default function Editor(props: EditorProps) {
}
)
const download = async () => {
const download = useCallback(async () => {
if (file === undefined) {
return
}
@@ -543,7 +543,17 @@ export default function Editor(props: EditorProps) {
// Get the code to click the download link
aDownloadLink.click()
}
}
}, [
file,
enableAutoSaving,
renders,
settings,
imageHeight,
imageWidth,
lineGroups,
])
useHotKey("meta+s,ctrl+s", download)
const toggleShowBrush = (newState: boolean) => {
if (newState !== showBrush && !isPanning && !isCropperExtenderResizing) {