diff --git a/packages/core/src/browser/widget-open-handler.ts b/packages/core/src/browser/widget-open-handler.ts index 02440e74ef988..e36271738c237 100644 --- a/packages/core/src/browser/widget-open-handler.ts +++ b/packages/core/src/browser/widget-open-handler.ts @@ -36,6 +36,13 @@ export interface WidgetOpenerOptions extends OpenerOptions { * By default to the main area. */ widgetOptions?: ApplicationShell.WidgetOptions; + /** + * Specify what the widget is opened for + * preview: preview of image/pdf/etc. + * edit: source file + * By default to `edit` + */ + openFor?: 'preview' | 'edit'; } @injectable() diff --git a/packages/editor/src/browser/editor-manager.ts b/packages/editor/src/browser/editor-manager.ts index 29b549d8f8dba..01dff7b63b6d1 100644 --- a/packages/editor/src/browser/editor-manager.ts +++ b/packages/editor/src/browser/editor-manager.ts @@ -98,6 +98,10 @@ export class EditorManager extends NavigatableWidgetOpenHandler { } canHandle(uri: URI, options?: WidgetOpenerOptions): number { + // Set the priority negative if an open handler is called for 'preview' (not for 'edit) + if (options && options.openFor === 'preview') { + return -100; + } return 100; } diff --git a/packages/mini-browser/src/browser/mini-browser-open-handler.ts b/packages/mini-browser/src/browser/mini-browser-open-handler.ts index 9eea089d06bc2..14acb5acef0b5 100644 --- a/packages/mini-browser/src/browser/mini-browser-open-handler.ts +++ b/packages/mini-browser/src/browser/mini-browser-open-handler.ts @@ -97,11 +97,15 @@ export class MiniBrowserOpenHandler extends NavigatableWidgetOpenHandler