Skip to content

Commit c8127c6

Browse files
committed
feat: 탭 전환 추가
1 parent 71a2595 commit c8127c6

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

src/renderer/components/main/Tool/TabTool.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const TabTool = () => {
3333
ref={gridButtonRef}
3434
className="flex items-center justify-center w-[40px] h-[40px] bg-button-primary rounded-[7px]"
3535
onClick={() => {
36-
setIsPopupOpen(true);
36+
setIsPopupOpen((prev) => !prev);
3737
}}
3838
>
3939
<div

src/renderer/windows/main/App.jsx

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ import NoteSettingModal from "@components/main/modal/content/NoteSetting";
1212
import { useSettingsStore } from "@stores/useSettingsStore";
1313
import FloatingPopup from "@components/main/modal/FloatingPopup";
1414
import Palette from "@components/main/modal/content/Palette";
15+
import { useKeyStore } from "@stores/useKeyStore";
1516

1617
export default function App() {
18+
const { selectedKeyType, setSelectedKeyType } = useKeyStore();
1719
useCustomCssInjection();
1820

1921
const primaryButtonRef = useRef(null);
@@ -35,7 +37,8 @@ export default function App() {
3537
const [activeTool, setActiveTool] = useState("move");
3638
const [isSettingsOpen, setIsSettingsOpen] = useState(false);
3739
const [isNoteSettingOpen, setIsNoteSettingOpen] = useState(false);
38-
const [skipModalAnimationOnReturn, setSkipModalAnimationOnReturn] = useState(false);
40+
const [skipModalAnimationOnReturn, setSkipModalAnimationOnReturn] =
41+
useState(false);
3942
const [noteSettings, setNoteSettings] = useState(null);
4043
const {
4144
noteEffect,
@@ -93,6 +96,28 @@ export default function App() {
9396
};
9497
}, []);
9598

99+
// Tab 키로 기본 탭(4/5/6/8key) 순환
100+
useEffect(() => {
101+
const handler = (e) => {
102+
if (e.key !== "Tab" || e.shiftKey) return;
103+
const active = document.activeElement;
104+
if (active) {
105+
const tag = (active.tagName || "").toLowerCase();
106+
const editable = active.isContentEditable;
107+
if (tag === "input" || tag === "textarea" || editable) return;
108+
}
109+
const defaults = ["4key", "5key", "6key", "8key"];
110+
if (!defaults.includes(selectedKeyType)) return; // 커스텀 탭일 땐 미적용
111+
e.preventDefault();
112+
e.stopPropagation();
113+
const idx = defaults.indexOf(selectedKeyType);
114+
const next = defaults[(idx + 1) % defaults.length];
115+
setSelectedKeyType(next);
116+
};
117+
window.addEventListener("keydown", handler, true);
118+
return () => window.removeEventListener("keydown", handler, true);
119+
}, [selectedKeyType, setSelectedKeyType]);
120+
96121
const showAlert = (message) =>
97122
setAlertState({
98123
isOpen: true,
@@ -152,7 +177,9 @@ export default function App() {
152177
activeTool={activeTool}
153178
showConfirm={showConfirm}
154179
shouldSkipModalAnimation={skipModalAnimationOnReturn}
155-
onModalAnimationConsumed={() => setSkipModalAnimationOnReturn(false)}
180+
onModalAnimationConsumed={() =>
181+
setSkipModalAnimationOnReturn(false)
182+
}
156183
/>
157184
)}
158185
</div>

0 commit comments

Comments
 (0)