Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #218626 #219148

Merged
merged 16 commits into from
Aug 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions src/vs/workbench/contrib/webview/browser/pre/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
<meta charset="UTF-8">

<meta http-equiv="Content-Security-Policy"

content="default-src 'none'; script-src 'sha256-ikaxwm2UFoiIKkEZTEU4mnSxpYf3lmsrhy5KqqJZfek=' 'self'; frame-src 'self'; style-src 'unsafe-inline';">
content="default-src 'none'; script-src 'sha256-DXeP32g8BdMsVuVabYTmznoTH59F7M7UtV0vXemEFqc=' 'self'; frame-src 'self'; style-src 'unsafe-inline';">


<!-- Disable pinch zooming -->
Expand Down Expand Up @@ -799,13 +798,28 @@


function handleInnerDragEvent(/** @type {DragEvent} */ e) {
/**
* To ensure that the drop event always fires as expected, you should always include a preventDefault() call in the part of your code which handles the dragover event.
* source: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/drop_event
**/
e.preventDefault();

if (!e.dataTransfer) {
return;
}

hostMessaging.postMessage('drag', {
shiftKey: e.shiftKey
});

// Only handle drags from outside editor for now
if (e.dataTransfer.items.length && Array.prototype.every.call(e.dataTransfer.items, item => item.kind === 'file')) {
hostMessaging.postMessage('drag', {
shiftKey: e.shiftKey
});
}

}

function handleInnerDropEvent(/**@type {DragEvent} */e) {
e.preventDefault();
}

/**
Expand Down Expand Up @@ -900,6 +914,7 @@
window.addEventListener('dragenter', handleInnerDragStartEvent);
window.addEventListener('dragover', handleInnerDragEvent);
window.addEventListener('drag', handleInnerDragEvent);
window.addEventListener('drop', handleInnerDropEvent);


onDomReady(() => {
Expand Down Expand Up @@ -1184,6 +1199,7 @@
contentWindow.addEventListener('dragenter', handleInnerDragStartEvent);
contentWindow.addEventListener('dragover', handleInnerDragEvent);
contentWindow.addEventListener('drag', handleInnerDragEvent);
contentWindow.addEventListener('drop', handleInnerDropEvent);

unloadMonitor.onIframeLoaded(newFrame);
}
Expand Down
Loading