mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-28 06:31:58 +00:00
making sure the then on triggerPaste is not evaluated twice (#284961)
Some checks are pending
Monaco Editor checks / Monaco Editor checks (push) Waiting to run
Code OSS (node_modules) / Compile (push) Waiting to run
Code OSS (node_modules) / Linux (push) Waiting to run
Code OSS (node_modules) / macOS (push) Waiting to run
Code OSS (node_modules) / Windows (push) Waiting to run
Some checks are pending
Monaco Editor checks / Monaco Editor checks (push) Waiting to run
Code OSS (node_modules) / Compile (push) Waiting to run
Code OSS (node_modules) / Linux (push) Waiting to run
Code OSS (node_modules) / macOS (push) Waiting to run
Code OSS (node_modules) / Windows (push) Waiting to run
making sure the then is not evaluated twice
This commit is contained in:
parent
2934fd48b2
commit
5d2a6f896d
@ -168,7 +168,8 @@ export const CopyOptions = {
|
||||
};
|
||||
|
||||
export const PasteOptions = {
|
||||
electronBugWorkaroundPasteEventHasFired: false
|
||||
electronBugWorkaroundPasteEventHasFired: false,
|
||||
electronBugWorkaroundPasteEventLock: false
|
||||
};
|
||||
|
||||
interface InMemoryClipboardMetadata {
|
||||
|
||||
@ -321,8 +321,16 @@ if (PasteAction) {
|
||||
const triggerPaste = clipboardService.triggerPaste(getActiveWindow().vscodeWindowId);
|
||||
if (triggerPaste) {
|
||||
logService.trace('registerExecCommandImpl (triggerPaste defined)');
|
||||
PasteOptions.electronBugWorkaroundPasteEventLock = false;
|
||||
return triggerPaste.then(async () => {
|
||||
if (PasteOptions.electronBugWorkaroundPasteEventHasFired === false) {
|
||||
// Ensure this doesn't run twice, what appears to be happening is
|
||||
// triggerPasteis called once but it's handler is called multiple times
|
||||
// when it reproduces
|
||||
if (PasteOptions.electronBugWorkaroundPasteEventLock === true) {
|
||||
return;
|
||||
}
|
||||
PasteOptions.electronBugWorkaroundPasteEventLock = true;
|
||||
return pasteWithNavigatorAPI(focusedEditor, clipboardService, logService);
|
||||
}
|
||||
logService.trace('registerExecCommandImpl (after triggerPaste)');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user