mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): fix dependency tracking for copy/paste hotkeys
This commit is contained in:
parent
dbfaa07e03
commit
c359ab6d9b
@ -193,36 +193,32 @@ export const Flow = memo(() => {
|
|||||||
|
|
||||||
const { copySelection, pasteSelection } = useCopyPaste();
|
const { copySelection, pasteSelection } = useCopyPaste();
|
||||||
|
|
||||||
useHotkeys(['Ctrl+c', 'Meta+c'], (e) => {
|
const onCopyHotkey = useCallback(
|
||||||
|
(e: KeyboardEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
copySelection();
|
copySelection();
|
||||||
});
|
},
|
||||||
|
[copySelection]
|
||||||
|
);
|
||||||
|
useHotkeys(['Ctrl+c', 'Meta+c'], onCopyHotkey);
|
||||||
|
|
||||||
useHotkeys(['Ctrl+a', 'Meta+a'], (e) => {
|
const onSelectAllHotkey = useCallback(
|
||||||
|
(e: KeyboardEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
dispatch(selectedAll());
|
dispatch(selectedAll());
|
||||||
});
|
|
||||||
|
|
||||||
useHotkeys(['Ctrl+v', 'Meta+v'], (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
pasteSelection();
|
|
||||||
});
|
|
||||||
|
|
||||||
useHotkeys(
|
|
||||||
['meta+z', 'ctrl+z'],
|
|
||||||
() => {
|
|
||||||
dispatch(undo());
|
|
||||||
},
|
},
|
||||||
[dispatch]
|
[dispatch]
|
||||||
);
|
);
|
||||||
|
useHotkeys(['Ctrl+a', 'Meta+a'], onSelectAllHotkey);
|
||||||
|
|
||||||
useHotkeys(
|
const onPasteHotkey = useCallback(
|
||||||
['meta+shift+z', 'ctrl+shift+z'],
|
(e: KeyboardEvent) => {
|
||||||
() => {
|
e.preventDefault();
|
||||||
dispatch(redo());
|
pasteSelection();
|
||||||
},
|
},
|
||||||
[dispatch]
|
[pasteSelection]
|
||||||
);
|
);
|
||||||
|
useHotkeys(['Ctrl+v', 'Meta+v'], onPasteHotkey);
|
||||||
|
|
||||||
const onUndoHotkey = useCallback(() => {
|
const onUndoHotkey = useCallback(() => {
|
||||||
if (mayUndo) {
|
if (mayUndo) {
|
||||||
|
Loading…
Reference in New Issue
Block a user