дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-06 10:07:11 +02:00
feat(viewers): open SVG files as source with a live image preview (#6266)
SVG files open in the text editor with the image viewer beside it and the Editor Only / Editor and Preview / Preview Only switch Markdown has. The preview is redrawn from the source as it is typed, reports invalid SVG and recovers once it is valid; it is drawn as an image, so scripts never run. The SVG layout is remembered apart from Markdown's, raster images keep the image viewer, and text editor wrappers gain `fallback` so a plugin's editor for a more specific SVG pattern still wins. Fixes #6234
Цей коміт міститься в:
1 джерело
3d2b0946de
коміт
add23fe97f
14 files changed
+482
-125
No files matched your search
@@ -706,6 +706,8 @@ export async function openFileExternally(path: string): Promise<boolean> {
|
||||
export interface TextEditorWrapperContribution {
|
||||
keepAlive?: boolean;
|
||||
id: string;
|
||||
/** Yields to any other wrapper matching the file (a plugin's editor for `*.diagram.svg`). */
|
||||
fallback?: boolean;
|
||||
matches(path: string): boolean;
|
||||
component: ComponentType<{ path: string; tabId: string; children: ReactNode; actionsInTabs?: boolean }>;
|
||||
/** Layout controls in the tab strip; the wrapper supplies a floating fallback when tabs are hidden. */
|
||||
@@ -733,8 +735,13 @@ export function textEditorWrapperFor(
|
||||
wrappers: ReadonlyMap<string, TextEditorWrapperContribution>,
|
||||
path: string,
|
||||
): TextEditorWrapperContribution | undefined {
|
||||
for (const w of wrappers.values()) if (w.matches(path)) return w;
|
||||
return undefined;
|
||||
let fallback: TextEditorWrapperContribution | undefined;
|
||||
for (const w of wrappers.values()) {
|
||||
if (!w.matches(path)) continue;
|
||||
if (!w.fallback) return w;
|
||||
fallback ??= w;
|
||||
}
|
||||
return fallback;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Заблокувати користувача