Files
Netcatty/components/plugins/primitives/PluginCodeEditor.tsx
T
陈大猫 f4a087e890 feat(plugins): add host-rendered IDE primitives, STARTTLS/SSH bindings, file/secret APIs, and pooled image rasterizer (#4437)
- Add host-rendered native IDE primitives (PluginCodeEditor/Monaco, PluginDataGrid/@tanstack/react-virtual, PluginSplitPane, PluginErCanvas) with Shadow DOM slot projection (zero iframes, zero plugin JS in renderer)
- Expand Remote DOM budgets, expose full 22 Netcatty semantic CSS tokens, add dblclick/contextmenu/scroll/selection events, cursor-anchored PluginPopover, database theme icon, and full-bleed chrome flag
- Add dynamic user-approved TCP/TLS byte streams (incl. localhost opt-in blocking internal control ports), in-band STARTTLS upgrade with cert fingerprint confirmation, durable revocable Vault SSH host bindings, plugin-owned encrypted secrets, native ui.openFile/saveFile streaming handles, 4 MiB clipboard, and prefix-filtered storage.keys
- Optimize plugin view image pipeline with pooled sandboxed rasterizer window (auto-destroyed on idle/error/dispose), LRU version+hash cache in PluginViewResources, transient failure eviction in HostDrawnViewHost, renderer-side session deduplication, and RemoteImageElement cache + retry
- Temporarily enable plugin host by default in hostBootstrap.cjs (marked TODO(revert), opt-out via NETCATTY_PLUGIN_DEV=0)
2026-11-26 17:52:27 +08:00

30 lines
1.0 KiB
TypeScript

import { Loader2 } from 'lucide-react';
import React, { Suspense, lazy } from 'react';
import { LazyLoadBoundary } from '../../ui/lazy-load-boundary';
import type { PluginCodeEditorWidgetProps, PluginWidgetEventCallback } from './types';
const LazyPluginCodeEditorInner = lazy(() => import('./PluginCodeEditorInner'));
export interface PluginCodeEditorProps extends PluginCodeEditorWidgetProps {
onWidgetEvent: PluginWidgetEventCallback;
}
export function PluginCodeEditor(props: PluginCodeEditorProps) {
return (
<LazyLoadBoundary
name="Plugin SQL Editor"
fallback={<div className="flex h-full w-full items-center justify-center p-4 text-xs text-destructive">Unable to load code editor.</div>}
>
<Suspense
fallback={(
<div className="flex h-full w-full items-center justify-center bg-background text-muted-foreground">
<Loader2 size={18} className="animate-spin" />
</div>
)}
>
<LazyPluginCodeEditorInner {...props} />
</Suspense>
</LazyLoadBoundary>
);
}