提交 25384400 编写于 作者: R rebornix

fix #111735.

上级 1fc36c35
...@@ -43,6 +43,7 @@ export class NotebookFindWidget extends SimpleFindReplaceWidget implements INote ...@@ -43,6 +43,7 @@ export class NotebookFindWidget extends SimpleFindReplaceWidget implements INote
private _currentMatchDecorations: ICellModelDecorations[] = []; private _currentMatchDecorations: ICellModelDecorations[] = [];
private _showTimeout: number | null = null; private _showTimeout: number | null = null;
private _hideTimeout: number | null = null; private _hideTimeout: number | null = null;
private _previousFocusElement?: HTMLElement;
constructor( constructor(
private readonly _notebookEditor: INotebookEditor, private readonly _notebookEditor: INotebookEditor,
...@@ -65,6 +66,10 @@ export class NotebookFindWidget extends SimpleFindReplaceWidget implements INote ...@@ -65,6 +66,10 @@ export class NotebookFindWidget extends SimpleFindReplaceWidget implements INote
this._register(this._state.onFindReplaceStateChange(() => { this._register(this._state.onFindReplaceStateChange(() => {
this.onInputChanged(); this.onInputChanged();
})); }));
this._register(DOM.addDisposableListener(this.getDomNode(), DOM.EventType.FOCUS, e => {
this._previousFocusElement = e.relatedTarget instanceof HTMLElement ? e.relatedTarget : undefined;
}, true));
} }
private _onFindInputKeyDown(e: IKeyboardEvent): void { private _onFindInputKeyDown(e: IKeyboardEvent): void {
...@@ -167,6 +172,7 @@ export class NotebookFindWidget extends SimpleFindReplaceWidget implements INote ...@@ -167,6 +172,7 @@ export class NotebookFindWidget extends SimpleFindReplaceWidget implements INote
} }
protected onFocusTrackerBlur() { protected onFocusTrackerBlur() {
this._previousFocusElement = undefined;
this._findWidgetFocused.reset(); this._findWidgetFocused.reset();
} }
...@@ -324,6 +330,11 @@ export class NotebookFindWidget extends SimpleFindReplaceWidget implements INote ...@@ -324,6 +330,11 @@ export class NotebookFindWidget extends SimpleFindReplaceWidget implements INote
} else { } else {
// no op // no op
} }
if (this._previousFocusElement && this._previousFocusElement.offsetParent) {
this._previousFocusElement.focus();
this._previousFocusElement = undefined;
}
} }
clear() { clear() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册