freeze v0.2.0

This commit is contained in:
2026-05-16 20:07:52 +02:00
parent afeb46a210
commit bdbb6c0a1c
9 changed files with 857 additions and 161 deletions

View File

@@ -8,6 +8,7 @@ import WorkspacePanel from './components/WorkspacePanel';
import ActionDialog, {
type ActionDialogAction,
} from './components/ActionDialog';
import HelpDialog from './components/HelpDialog';
import { PDFDocument } from 'pdf-lib';
import type {
StoredWorkspace,
@@ -105,6 +106,7 @@ const App: React.FC = () => {
content: React.ReactNode;
actions: ActionDialogAction[];
} | null>(null);
const [helpOpen, setHelpOpen] = useState(false);
const [pdf, setPdf] = useState<PdfFile | null>(null);
const [isBusy, setIsBusy] = useState(false);
@@ -785,6 +787,23 @@ const App: React.FC = () => {
const hasPdf = !!pdf;
useEffect(() => {
const handleKeyDown = (e: KeyboardEvent) => {
if (isEditableKeyboardTarget(e.target)) return;
if (e.key === 'F1' || e.key === '?') {
e.preventDefault();
setHelpOpen(true);
}
};
window.addEventListener('keydown', handleKeyDown);
return () => {
window.removeEventListener('keydown', handleKeyDown);
};
}, []);
// === UI interactions ===
const handleRotatePageClockwise = (pageId: string) => {
const before = getCurrentCommandState();
@@ -1257,7 +1276,7 @@ const App: React.FC = () => {
previewVisualIndex >= 0 && previewVisualIndex < pages.length - 1;
return (
<Layout>
<Layout onOpenHelp={() => setHelpOpen(true)}>
<FileLoader pdf={pdf} onFileLoaded={handleFileLoaded} />
<WorkspacePanel
@@ -1446,6 +1465,8 @@ const App: React.FC = () => {
>
{actionDialog?.content}
</ActionDialog>
<HelpDialog open={helpOpen} onClose={() => setHelpOpen(false)} />
</Layout>
);
};