mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-01-15 13:43:39 +01:00
31 lines
982 B
TypeScript
31 lines
982 B
TypeScript
import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow';
|
|
import { type } from '@tauri-apps/plugin-os';
|
|
import { StrictMode } from 'react';
|
|
import { createRoot } from 'react-dom/client';
|
|
import { pdfjs } from 'react-pdf';
|
|
import { App } from './components/App';
|
|
import './main.css';
|
|
|
|
pdfjs.GlobalWorkerOptions.workerSrc = new URL(
|
|
'pdfjs-dist/build/pdf.worker.min.mjs',
|
|
import.meta.url,
|
|
).toString();
|
|
|
|
// Hide decorations here because it doesn't work in Rust for some reason (bug?)
|
|
const osType = type();
|
|
if (osType !== 'macos') {
|
|
await getCurrentWebviewWindow().setDecorations(false);
|
|
}
|
|
|
|
window.addEventListener('keydown', (e) => {
|
|
// Hack to not go back in history on backspace. Check for document body
|
|
// or else it will prevent backspace in input fields.
|
|
if (e.key === 'Backspace' && e.target === document.body) e.preventDefault();
|
|
});
|
|
|
|
createRoot(document.getElementById('root') as HTMLElement).render(
|
|
<StrictMode>
|
|
<App />
|
|
</StrictMode>,
|
|
);
|