mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-29 00:46:00 +01:00
EditContext: Setting the edit context when current window id does not correspond to previous window id (#230368)
setting the edit context within nativeeditcontext
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
import './nativeEditContext.css';
|
||||
import { isFirefox } from '../../../../../base/browser/browser.js';
|
||||
import { addDisposableListener, getActiveWindow } from '../../../../../base/browser/dom.js';
|
||||
import { addDisposableListener, getActiveWindow, getWindow, getWindowId } from '../../../../../base/browser/dom.js';
|
||||
import { FastDomNode } from '../../../../../base/browser/fastDomNode.js';
|
||||
import { StandardKeyboardEvent } from '../../../../../base/browser/keyboardEvent.js';
|
||||
import { KeyCode } from '../../../../../base/common/keyCodes.js';
|
||||
@@ -48,6 +48,8 @@ export class NativeEditContext extends AbstractEditContext {
|
||||
|
||||
private _textStartPositionWithinEditor: Position = new Position(1, 1);
|
||||
|
||||
private _targetWindowId: number = -1;
|
||||
|
||||
private readonly _focusTracker: FocusTracker;
|
||||
|
||||
private readonly _selectionChangeListener: MutableDisposable<IDisposable>;
|
||||
@@ -179,7 +181,12 @@ export class NativeEditContext extends AbstractEditContext {
|
||||
// TODO: added as a workaround fix for https://github.com/microsoft/vscode/issues/229825
|
||||
// When this issue will be fixed the following should be removed.
|
||||
public setEditContextOnDomNode(): void {
|
||||
this.domNode.domNode.editContext = this._editContext;
|
||||
const targetWindow = getWindow(this.domNode.domNode);
|
||||
const targetWindowId = getWindowId(targetWindow);
|
||||
if (this._targetWindowId !== targetWindowId) {
|
||||
this.domNode.domNode.editContext = this._editContext;
|
||||
this._targetWindowId = targetWindowId;
|
||||
}
|
||||
}
|
||||
|
||||
// --- Private methods ---
|
||||
|
||||
@@ -111,8 +111,6 @@ export class View extends ViewEventHandler {
|
||||
private _shouldRecomputeGlyphMarginLanes: boolean = false;
|
||||
private _renderAnimationFrame: IDisposable | null;
|
||||
|
||||
private _targetWindow: CodeWindow | undefined;
|
||||
|
||||
constructor(
|
||||
commandDelegate: ICommandDelegate,
|
||||
configuration: IEditorConfiguration,
|
||||
@@ -458,14 +456,13 @@ export class View extends ViewEventHandler {
|
||||
throw new BugIndicatingError();
|
||||
}
|
||||
if (this._renderAnimationFrame === null) {
|
||||
const targetWindow = dom.getWindow(this.domNode?.domNode);
|
||||
if (targetWindow !== this._targetWindow && this._editContext instanceof NativeEditContext) {
|
||||
// TODO: workaround fix for https://github.com/microsoft/vscode/issues/229825
|
||||
if (this._editContext instanceof NativeEditContext) {
|
||||
this._editContext.setEditContextOnDomNode();
|
||||
this._targetWindow = targetWindow;
|
||||
}
|
||||
const rendering = this._createCoordinatedRendering();
|
||||
this._renderAnimationFrame = EditorRenderingCoordinator.INSTANCE.scheduleCoordinatedRendering({
|
||||
window: targetWindow,
|
||||
window: dom.getWindow(this.domNode?.domNode),
|
||||
prepareRenderText: () => {
|
||||
if (this._store.isDisposed) {
|
||||
throw new BugIndicatingError();
|
||||
|
||||
Reference in New Issue
Block a user