webview:show find widget with argument
This commit is contained in:
parent
8801172d07
commit
f6cdb061a1
|
@ -261,6 +261,10 @@ export abstract class SimpleFindWidget extends Widget implements IVerticalSashLa
|
|||
return this._findInput.getValue();
|
||||
}
|
||||
|
||||
public setInputValue(value: string) {
|
||||
this._findInput.setValue(value);
|
||||
}
|
||||
|
||||
public get focusTracker(): dom.IFocusTracker {
|
||||
return this._focusTracker;
|
||||
}
|
||||
|
|
|
@ -359,6 +359,13 @@ export class OverlayWebview extends Disposable implements IOverlayWebview {
|
|||
}
|
||||
}
|
||||
|
||||
public showFindWithArg(arg: string) {
|
||||
if (this._webview.value) {
|
||||
this._webview.value.showFindWithArg!(arg);
|
||||
this._findWidgetVisible?.set(true);
|
||||
}
|
||||
}
|
||||
|
||||
hideFind(animated = true) {
|
||||
this._findWidgetVisible?.reset();
|
||||
this._webview.value?.hideFind(animated);
|
||||
|
|
|
@ -248,6 +248,7 @@ export interface IWebview extends IDisposable {
|
|||
reload(): void;
|
||||
|
||||
showFind(animated?: boolean): void;
|
||||
showFindWithArg?(value: string): void;
|
||||
hideFind(animated?: boolean): void;
|
||||
runFindAction(previous: boolean): void;
|
||||
|
||||
|
|
|
@ -875,6 +875,11 @@ export class WebviewElement extends Disposable implements IWebview, WebviewFindD
|
|||
this._webviewFindWidget?.reveal(undefined, animated);
|
||||
}
|
||||
|
||||
public showFindWithArg(arg: string) {
|
||||
this.showFind();
|
||||
this._webviewFindWidget?.setInputValue(arg);
|
||||
}
|
||||
|
||||
public hideFind(animated = true) {
|
||||
this._webviewFindWidget?.hide(animated);
|
||||
}
|
||||
|
|
|
@ -39,6 +39,26 @@ export class ShowWebViewEditorFindWidgetAction extends Action2 {
|
|||
}
|
||||
}
|
||||
|
||||
export class ShowWebViewEditorFindWidgetWithArgAction extends Action2 {
|
||||
public static readonly ID = 'editor.action.webvieweditor.showFindWithArg';
|
||||
public static readonly LABEL = nls.localize('editor.action.webvieweditor.showFindWithArg', "Show find with argument");
|
||||
|
||||
constructor() {
|
||||
super({
|
||||
id: ShowWebViewEditorFindWidgetWithArgAction.ID,
|
||||
title: ShowWebViewEditorFindWidgetWithArgAction.LABEL,
|
||||
keybinding: {
|
||||
when: ContextKeyExpr.and(webviewActiveContextKeyExpr, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_ENABLED),
|
||||
weight: KeybindingWeight.EditorContrib
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public run(accessor: ServicesAccessor, ...args: any[]): void {
|
||||
getActiveWebviewEditor(accessor)?.showFindWithArg!(args[0] as string);
|
||||
}
|
||||
}
|
||||
|
||||
export class HideWebViewEditorFindCommand extends Action2 {
|
||||
public static readonly ID = 'editor.action.webvieweditor.hideFind';
|
||||
public static readonly LABEL = nls.localize('editor.action.webvieweditor.hideFind', "Stop find");
|
||||
|
|
|
@ -16,7 +16,7 @@ import { EditorExtensions, IEditorFactoryRegistry } from 'vs/workbench/common/ed
|
|||
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
|
||||
import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
|
||||
import { HideWebViewEditorFindCommand, ReloadWebviewAction, ShowWebViewEditorFindWidgetAction, WebViewEditorFindNextCommand, WebViewEditorFindPreviousCommand } from './webviewCommands';
|
||||
import { HideWebViewEditorFindCommand, ReloadWebviewAction, ShowWebViewEditorFindWidgetAction, ShowWebViewEditorFindWidgetWithArgAction, WebViewEditorFindNextCommand, WebViewEditorFindPreviousCommand } from './webviewCommands';
|
||||
import { WebviewEditor } from './webviewEditor';
|
||||
import { WebviewInput } from './webviewEditorInput';
|
||||
import { WebviewEditorInputSerializer } from './webviewEditorInputSerializer';
|
||||
|
@ -91,6 +91,7 @@ Registry.as<IEditorFactoryRegistry>(EditorExtensions.EditorFactory).registerEdit
|
|||
registerSingleton(IWebviewWorkbenchService, WebviewEditorService, InstantiationType.Delayed);
|
||||
|
||||
registerAction2(ShowWebViewEditorFindWidgetAction);
|
||||
registerAction2(ShowWebViewEditorFindWidgetWithArgAction);
|
||||
registerAction2(HideWebViewEditorFindCommand);
|
||||
registerAction2(WebViewEditorFindNextCommand);
|
||||
registerAction2(WebViewEditorFindPreviousCommand);
|
||||
|
|
Loading…
Reference in New Issue