提交 e839ec02 编写于 作者: M Matt Bierner

Make find widget opt-in for webviews

Fixes #44597
上级 0999fc05
......@@ -48,6 +48,7 @@ export class MarkdownPreview {
previewColumn, {
enableScripts: true,
enableCommandUris: true,
enableFindWidget: true,
localResourceRoots: this.getLocalResourceRoots(_resource)
});
......
......@@ -528,6 +528,13 @@ declare module 'vscode' {
*/
readonly enableCommandUris?: boolean;
/**
* Should the find widget be enabled in the webview?
*
* Defaults to false.
*/
readonly enableFindWidget?: boolean;
/**
* Should the webview's context be kept around even when the webview is no longer visible?
*
......
......@@ -84,7 +84,7 @@ export class ReleaseNotesManager {
}
} else {
const uri = URI.parse('release-notes:' + version);
this._currentReleaseNotes = new WebviewInput(uri, title, { tryRestoreScrollPosition: true }, html, {
this._currentReleaseNotes = new WebviewInput(uri, title, { tryRestoreScrollPosition: true, enableFindWidget: true }, html, {
onDidClickLink: uri => this.onDidClickLink(uri),
onDispose: () => { this._currentReleaseNotes = undefined; }
}, this._partService);
......
......@@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { TPromise } from 'vs/base/common/winjs.base';
import { IDisposable, } from 'vs/base/common/lifecycle';
import { EditorOptions } from 'vs/workbench/common/editor';
......@@ -199,10 +197,12 @@ export class WebviewEditor extends BaseWebviewEditor {
this._onDidFocusWebview.fire();
});
this._contextKeyService = this._contextKeyService.createScoped(this.webviewContent);
this.contextKey = KEYBINDING_CONTEXT_WEBVIEWEDITOR_FOCUS.bindTo(this._contextKeyService);
this.findInputFocusContextKey = KEYBINDING_CONTEXT_WEBVIEWEDITOR_FIND_WIDGET_INPUT_FOCUSED.bindTo(this._contextKeyService);
this.findWidgetVisible = KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE.bindTo(this._contextKeyService);
if (input.options.enableFindWidget) {
this._contextKeyService = this._contextKeyService.createScoped(this.webviewContent);
this.contextKey = KEYBINDING_CONTEXT_WEBVIEWEDITOR_FOCUS.bindTo(this._contextKeyService);
this.findInputFocusContextKey = KEYBINDING_CONTEXT_WEBVIEWEDITOR_FIND_WIDGET_INPUT_FOCUSED.bindTo(this._contextKeyService);
this.findWidgetVisible = KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE.bindTo(this._contextKeyService);
}
this._webview = new Webview(
this._partService.getContainer(Parts.EDITOR_PART),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册