Файли
openidea/src/main.tsx
T
l0ng-ai 329ad2c644 fix(ui): treat every second click of a burst as a double-click
WebKit fires `dblclick` only for the second click of a burst. A quick
double-click right after another arrives as `click` with `detail` 3 and 4 and
no `dblclick`, so the second double-click on a folder in the Project view (and
on any tree row, tab or list item handled by `onDoubleClick`) did nothing.

A window-level shim now dispatches a `dblclick` on the click's target for every
later even click of a burst (detail 4, 6, ...), after the page's own click
handlers. Existing `onDoubleClick` handlers and their `stopPropagation` apply
unchanged; an engine that fires its own `dblclick` for that click gets it
dropped as a duplicate.

The Project view test now delivers bursts the way WebKit does (`dblclick` only
at detail 2) and checks both expand modes over 2–6 click bursts.

Refs #724
2026-11-03 22:34:29 +08:00

52 рядки
2.3 KiB
TypeScript

import React from "react";
import ReactDOM from "react-dom/client";
import "./styles/global.css";
import { Workbench } from "./workbench/Workbench";
import { activateSecondaryWindow, activateWorkbench } from "./workbench/activate";
import { activateFeatures, activateSettingsWindowFeatures, SettingsWindow, settingsWindowParent } from "./features";
import { installRepeatedDoubleClick } from "./platform/doubleClick";
import { installKeyboardDispatcher } from "./platform/keymap";
import { isTauri } from "./platform/ipc";
import { hideSplash } from "./platform/splash";
import { prefetchLazyComponents } from "./ui";
if (import.meta.env.DEV && isTauri()) {
// The Tauri MCP bridge returns eval results via `window.__TAURI__` on Windows/Linux
// (macOS evaluates natively). Dev only, so release builds keep withGlobalTauri off.
const [{ invoke }, { emit }] = await Promise.all([import("@tauri-apps/api/core"), import("@tauri-apps/api/event")]);
(window as unknown as { __TAURI__?: unknown }).__TAURI__ ??= { core: { invoke }, event: { emit } };
}
installRepeatedDoubleClick();
// The native Settings window (`settings-<parent>`) loads this page too.
const settingsParent = settingsWindowParent();
if (settingsParent !== null) {
activateSecondaryWindow();
activateSettingsWindowFeatures(settingsParent);
} else {
activateWorkbench();
// `vite build --mode perf` is a production bundle for the performance harness (`perf/`).
const perfBuild = import.meta.env.MODE === "perf";
if ((import.meta.env.DEV || perfBuild) && !isTauri()) {
const { registerDevSamples } = await import("./workbench/devSamples");
registerDevSamples();
}
if (import.meta.env.DEV || perfBuild) {
const { installPerfProbe } = await import("./workbench/perfProbe");
installPerfProbe();
}
// Order matters: features (e.g. the terminal) install capture-phase key handlers
// that must run before the global dispatcher.
activateFeatures();
installKeyboardDispatcher();
}
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
<React.StrictMode>{settingsParent !== null ? <SettingsWindow /> : <Workbench />}</React.StrictMode>,
);
hideSplash();
// Views split out of the start-up bundle load in the background once the UI is up.
if (settingsParent === null) prefetchLazyComponents();