mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
Hide input focus tracker, cleanup
This commit is contained in:
parent
b69d45bb9f
commit
27f45235cf
|
@ -14,10 +14,5 @@
|
|||
"win32ShellNameShort": "C&ode - OSS",
|
||||
"darwinBundleIdentifier": "com.visualstudio.code.oss",
|
||||
"reportIssueUrl": "https://github.com/Microsoft/vscode/issues/new",
|
||||
"urlProtocol": "code-oss",
|
||||
"extensionsGallery": {
|
||||
"serviceUrl": "https://marketplace.visualstudio.com/_apis/public/gallery",
|
||||
"cacheUrl": "https://vscode.blob.core.windows.net/gallery/index",
|
||||
"itemUrl": "https://marketplace.visualstudio.com/items"
|
||||
}
|
||||
}
|
||||
"urlProtocol": "code-oss"
|
||||
}
|
|
@ -112,8 +112,8 @@ export abstract class SimpleFindWidget extends Widget {
|
|||
this._register(this._focusTracker.addBlurListener(this.onFocusTrackerBlur.bind(this)));
|
||||
|
||||
this._findInputFocusTracker = this._register(dom.trackFocus(this._findInput.domNode));
|
||||
this._register(this._findInputFocusTracker.addFocusListener(this.onFindInputFocusTrackerFocus.bind(this)));
|
||||
this._register(this._findInputFocusTracker.addBlurListener(this.onFindInputFocusTrackerBlur.bind(this)));
|
||||
this._register(this._findInputFocusTracker.addFocusListener(this._onFindInputFocusTrackerFocus.bind(this)));
|
||||
this._register(this._findInputFocusTracker.addBlurListener(this._onFindInputFocusTrackerBlur.bind(this)));
|
||||
|
||||
this._register(dom.addDisposableListener(this._domNode, 'click', (event) => {
|
||||
event.stopPropagation();
|
||||
|
@ -124,8 +124,14 @@ export abstract class SimpleFindWidget extends Widget {
|
|||
protected abstract find(previous: boolean);
|
||||
protected abstract onFocusTrackerFocus();
|
||||
protected abstract onFocusTrackerBlur();
|
||||
protected abstract onFindInputFocusTrackerFocus();
|
||||
protected abstract onFindInputFocusTrackerBlur();
|
||||
|
||||
private _onFindInputFocusTrackerFocus() {
|
||||
this._findInputFocused.set(true);
|
||||
}
|
||||
|
||||
private _onFindInputFocusTrackerBlur() {
|
||||
this._findInputFocused.reset();
|
||||
}
|
||||
|
||||
protected get inputValue() {
|
||||
return this._findInput.getValue();
|
||||
|
|
|
@ -53,7 +53,7 @@ import { IContextKeyService, RawContextKey, ContextKeyExpr, IContextKey } from '
|
|||
import { Command } from 'vs/editor/common/editorCommonExtensions';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import { default as WebView, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_INPUT_FOCUSED } from 'vs/workbench/parts/html/browser/webview';
|
||||
import { default as Webview, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_INPUT_FOCUSED } from 'vs/workbench/parts/html/browser/webview';
|
||||
|
||||
/** A context key that is set when an extension editor webview has focus. */
|
||||
export const KEYBINDING_CONTEXT_EXTENSIONEDITOR_WEBVIEW_FOCUS = new RawContextKey<boolean>('extensionEditorWebviewFocus', undefined);
|
||||
|
@ -173,7 +173,7 @@ export class ExtensionEditor extends BaseEditor {
|
|||
private contentDisposables: IDisposable[] = [];
|
||||
private transientDisposables: IDisposable[] = [];
|
||||
private disposables: IDisposable[];
|
||||
private activeWebview: WebView;
|
||||
private activeWebview: Webview;
|
||||
|
||||
constructor(
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
|
@ -391,7 +391,7 @@ export class ExtensionEditor extends BaseEditor {
|
|||
.then<void>(body => {
|
||||
const allowedBadgeProviders = this.extensionsWorkbenchService.allowedBadgeProviders;
|
||||
const webViewOptions = allowedBadgeProviders.length > 0 ? { allowScripts: false, allowSvgs: false, svgWhiteList: allowedBadgeProviders } : undefined;
|
||||
this.activeWebview = new WebView(this.content, this.partService.getContainer(Parts.EDITOR_PART), this.contextViewService, this.contextKeyService, this.contextKey, webViewOptions);
|
||||
this.activeWebview = new Webview(this.content, this.partService.getContainer(Parts.EDITOR_PART), this.contextViewService, this.contextKeyService, this.contextKey, webViewOptions);
|
||||
const removeLayoutParticipant = arrays.insert(this.layoutParticipants, this.activeWebview);
|
||||
this.contentDisposables.push(toDisposable(removeLayoutParticipant));
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/edi
|
|||
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { ContextKeyExpr, IContextKey, RawContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import { default as WebView, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_INPUT_FOCUSED } from './webview';
|
||||
import { default as Webview, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_INPUT_FOCUSED } from './webview';
|
||||
import { Builder } from 'vs/base/browser/builder';
|
||||
|
||||
export interface HtmlPreviewEditorViewState {
|
||||
|
@ -32,7 +32,7 @@ export const KEYBINDING_CONTEXT_WEBVIEWEDITOR_NOT_FOCUSED: ContextKeyExpr = KEYB
|
|||
export abstract class WebviewEditor extends BaseWebviewEditor {
|
||||
|
||||
protected _webviewFocusContextKey: IContextKey<boolean>;
|
||||
protected _webview: WebView;
|
||||
protected _webview: Webview;
|
||||
protected content: HTMLElement;
|
||||
protected contextKey: IContextKey<boolean>;
|
||||
|
||||
|
|
|
@ -6,20 +6,19 @@
|
|||
import { SimpleFindWidget } from 'vs/editor/contrib/find/browser/simpleFindWidget';
|
||||
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
import WebView from './webview';
|
||||
import Webview from './webview';
|
||||
|
||||
export class WebviewFindWidget extends SimpleFindWidget {
|
||||
|
||||
constructor(
|
||||
@IContextViewService _contextViewService: IContextViewService,
|
||||
@IContextKeyService private _contextKeyService: IContextKeyService,
|
||||
private webview: WebView,
|
||||
private webview: Webview,
|
||||
private _findInputContextKey: RawContextKey<boolean>
|
||||
) {
|
||||
super(_contextViewService);
|
||||
|
||||
this._findInputFocused = _findInputContextKey.bindTo(this._contextKeyService);
|
||||
console.debug(this._findInputContextKey.keys());
|
||||
this.find = this.find.bind(this);
|
||||
this.hide = this.hide.bind(this);
|
||||
this.onInputChanged = this.onInputChanged.bind(this);
|
||||
|
@ -59,11 +58,4 @@ export class WebviewFindWidget extends SimpleFindWidget {
|
|||
this.webview.notifyFindWidgetFocusChanged(false);
|
||||
}
|
||||
|
||||
protected onFindInputFocusTrackerFocus() {
|
||||
this._findInputFocused.set(true);
|
||||
}
|
||||
|
||||
protected onFindInputFocusTrackerBlur() {
|
||||
this._findInputFocused.reset();
|
||||
}
|
||||
}
|
|
@ -355,11 +355,11 @@ actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(ShowPreviousFind
|
|||
actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(NextMatchTerminalFindWidgetAction, NextMatchTerminalFindWidgetAction.ID, NextMatchTerminalFindWidgetAction.LABEL, {
|
||||
primary: KeyCode.F3,
|
||||
mac: { primary: KeyMod.CtrlCmd | KeyCode.KEY_G, secondary: [KeyCode.F3] }
|
||||
}, KEYBINDING_CONTEXT_TERMINAL_FOCUS), 'Terminal: Find Next', category);
|
||||
}, KEYBINDING_CONTEXT_TERMINAL_FOCUS), 'Find Next', category);
|
||||
actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(PreviousMatchTerminalFindWidgetAction, PreviousMatchTerminalFindWidgetAction.ID, PreviousMatchTerminalFindWidgetAction.LABEL, {
|
||||
primary: KeyMod.Shift | KeyCode.F3,
|
||||
mac: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_G, secondary: [KeyMod.Shift | KeyCode.F3] }
|
||||
}, KEYBINDING_CONTEXT_TERMINAL_FOCUS), 'Terminal: Find Previous', category);
|
||||
}, KEYBINDING_CONTEXT_TERMINAL_FOCUS), 'Find Previous', category);
|
||||
|
||||
actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(DeleteWordLeftTerminalAction, DeleteWordLeftTerminalAction.ID, DeleteWordLeftTerminalAction.LABEL, {
|
||||
primary: KeyMod.CtrlCmd | KeyCode.Backspace,
|
||||
|
|
|
@ -48,11 +48,4 @@ export class TerminalFindWidget extends SimpleFindWidget {
|
|||
this._terminalService.getActiveInstance().notifyFindWidgetFocusChanged(false);
|
||||
}
|
||||
|
||||
protected onFindInputFocusTrackerFocus() {
|
||||
this._findInputFocused.set(true);
|
||||
}
|
||||
|
||||
protected onFindInputFocusTrackerBlur() {
|
||||
this._findInputFocused.reset();
|
||||
}
|
||||
}
|
|
@ -14,7 +14,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
|||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { ReleaseNotesInput } from './releaseNotesInput';
|
||||
import { EditorOptions } from 'vs/workbench/common/editor';
|
||||
import WebView from 'vs/workbench/parts/html/browser/webview';
|
||||
import Webview from 'vs/workbench/parts/html/browser/webview';
|
||||
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { tokenizeToString } from 'vs/editor/common/modes/textToHtmlTokenizer';
|
||||
|
@ -95,7 +95,7 @@ export class ReleaseNotesEditor extends WebviewEditor {
|
|||
})
|
||||
.then(renderBody)
|
||||
.then<void>(body => {
|
||||
this._webview = new WebView(this.content, this.partService.getContainer(Parts.EDITOR_PART), this._contextViewService, this._contextKeyService, this.contextKey);
|
||||
this._webview = new Webview(this.content, this.partService.getContainer(Parts.EDITOR_PART), this._contextViewService, this._contextKeyService, this.contextKey);
|
||||
|
||||
if (this.input && this.input instanceof ReleaseNotesInput) {
|
||||
const state = this.loadViewState(this.input.version);
|
||||
|
|
Loading…
Reference in a new issue