mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 13:46:13 +00:00
get the editor from the context for cases that its not the focused editor (#210962)
* get the editor from the context for cases that its not the focused editor * remove blob retries
This commit is contained in:
parent
dd168fb100
commit
23f9ce4a7e
|
@ -33,9 +33,15 @@ registerAction2(class CopyCellOutputAction extends Action2 {
|
|||
});
|
||||
}
|
||||
|
||||
private getNoteboookEditor(editorService: IEditorService, outputContext: INotebookOutputActionContext | { outputViewModel: ICellOutputViewModel } | undefined): INotebookEditor | undefined {
|
||||
if (outputContext && 'notebookEditor' in outputContext) {
|
||||
return outputContext.notebookEditor;
|
||||
}
|
||||
return getNotebookEditorFromEditorPane(editorService.activeEditorPane);
|
||||
}
|
||||
|
||||
async run(accessor: ServicesAccessor, outputContext: INotebookOutputActionContext | { outputViewModel: ICellOutputViewModel } | undefined): Promise<void> {
|
||||
const editorService = accessor.get(IEditorService);
|
||||
const notebookEditor = getNotebookEditorFromEditorPane(editorService.activeEditorPane);
|
||||
const notebookEditor = this.getNoteboookEditor(accessor.get(IEditorService), outputContext);
|
||||
|
||||
if (!notebookEditor) {
|
||||
return;
|
||||
|
|
|
@ -1576,7 +1576,7 @@ async function webviewPreloads(ctx: PreloadContext) {
|
|||
// copyImage can be called from outside of the webview, which means this function may be running whilst the webview is gaining focus.
|
||||
// Since navigator.clipboard.write requires the document to be focused, we need to wait for focus.
|
||||
// We cannot use a listener, as there is a high chance the focus is gained during the setup of the listener resulting in us missing it.
|
||||
setTimeout(() => { copyOutputImage(outputId, altOutputId, retries - 1); }, 20);
|
||||
setTimeout(() => { copyOutputImage(outputId, altOutputId, retries - 1); }, 50);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue