提交 25384400 编写于 作者: R rebornix

fix #111735.

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