fix prompt input ctrl + z
This commit is contained in:
parent
5be91edf9d
commit
5429bf2e87
@ -640,6 +640,10 @@ export default function Editor(props: EditorProps) {
|
||||
|
||||
// Handle Cmd+Z
|
||||
const undoPredicate = (event: KeyboardEvent) => {
|
||||
// TODO: fix prompt input ctrl+z
|
||||
if (isSD) {
|
||||
return false
|
||||
}
|
||||
const isCmdZ =
|
||||
(event.metaKey || event.ctrlKey) && !event.shiftKey && event.key === 'z'
|
||||
// Handle tab switch
|
||||
@ -654,7 +658,7 @@ export default function Editor(props: EditorProps) {
|
||||
return false
|
||||
}
|
||||
|
||||
useKey(undoPredicate, undo, undefined, [undoStroke, undoRender])
|
||||
useKey(undoPredicate, undo, undefined, [undoStroke, undoRender, isSD])
|
||||
|
||||
const disableUndo = () => {
|
||||
if (isInpainting) {
|
||||
@ -714,6 +718,9 @@ export default function Editor(props: EditorProps) {
|
||||
|
||||
// Handle Cmd+shift+Z
|
||||
const redoPredicate = (event: KeyboardEvent) => {
|
||||
if (isSD) {
|
||||
return false
|
||||
}
|
||||
const isCmdZ =
|
||||
(event.metaKey || event.ctrlKey) &&
|
||||
event.shiftKey &&
|
||||
@ -730,7 +737,7 @@ export default function Editor(props: EditorProps) {
|
||||
return false
|
||||
}
|
||||
|
||||
useKey(redoPredicate, redo, undefined, [redoStroke, redoRender])
|
||||
useKey(redoPredicate, redo, undefined, [redoStroke, redoRender, isSD])
|
||||
|
||||
const disableRedo = () => {
|
||||
if (isInpainting) {
|
||||
|
@ -32,12 +32,19 @@ const PromptInput = () => {
|
||||
}
|
||||
})
|
||||
|
||||
const onKeyUp = (e: React.KeyboardEvent) => {
|
||||
if (e.key === 'Enter') {
|
||||
handleRepaintClick()
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="prompt-wrapper">
|
||||
<TextInput
|
||||
ref={ref}
|
||||
value={prompt}
|
||||
onInput={handleOnInput}
|
||||
onKeyUp={onKeyUp}
|
||||
placeholder="I want to repaint of..."
|
||||
/>
|
||||
<Button
|
||||
|
@ -12,7 +12,7 @@ const INPUT_WIDTH = 30
|
||||
|
||||
// TODO: 添加收起来的按钮
|
||||
const SidePanel = () => {
|
||||
const [open, toggleOpen] = useToggle(false)
|
||||
const [open, toggleOpen] = useToggle(true)
|
||||
const [setting, setSettingState] = useRecoilState(settingState)
|
||||
|
||||
return (
|
||||
|
Loading…
Reference in New Issue
Block a user