-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
Make it possible to use drag and drop in a webview #8794
Comments
Taking out the preventDefault() from the dragover allows to drop any file/url into the window to open it and replace all of VS Code, so I am not easy to make a change there... |
@jrieken for the second issue. |
Problem is that |
Moreover, regardless of our changing the rule for
But maybe things have changed since we last looked at this. |
My workaround to make it happen in dev tools is in https://github.com/Microsoft/vscode/blob/fix-8324-8569/src/vs/code/electron-main/menus.ts#L790 |
@alexandrudima I can confirm that Cmd+A selects all in input fields and still in the editor. It does not select all in the though. There is another bug where Undo/Redo do no work in native input fields and I guess that is related. Can we apply your fix for these commands too? |
@alexandrudima I see an issue when selecting an item in the explorer and pressing |
@jrieken That is what I'm trying to explain here unsuccessfully. It is not the keybindings service that executes |
In fact, that is the case with all accelerators that appear in the menu on the mac. This is not the case under windows. |
The select all code falls back as a last chance to select last active editor: |
It also does the manual select all on input fields:
|
The select all behaviour in the explorer has been like that before already because we do not have multi select in the explorer. The fact that focus does not move has been reported already as far as I remember and is not very nice. |
yeah - we should either focus the editor after selecting all or ignore the command if the editor isn't focused |
I would just focus the editor, many people actually find it useful that Ctrl+A always goes to the editor, so I would not disable that. |
I like it. @alexandrudima what do you think? seems as easy as adding |
@bpasero 👍 Please do the change, we wrote that code together at your machine a long time ago :) |
Pushed via #9329 |
@jrieken It is not clear to me if my change fixed this issue. |
Reopening this to track just the drag and drop part. Select all was added by #54851 |
It would be fantastic to enable drag and drop into webviews. This screenshot shows how my extension's toolbox palette is able to render in the sidebar thanks to #46585. However, that doesn't do much good unless the user can drag items from the palette onto the canvas webview displayed in the editor. Is this enhancement so foundational a change that it's unlikely to be considered? |
I have a similar problem as Donald is having above. This looks like a fundamental problem with this framework. Are there any design patterns or workaround to drag and drop functionality in webview? What was the rationale to not support this kind of feature? |
The original example seems to work for me in iframe based webviews (which are now the default in the latest VS Code insiders) The original linked extension no longer works since <style type="text/css">
#div1 {
width: 488px;
height: 70px;
padding: 10px;
border: 1px solid #aaaaaa;
}
</style>
<script type="text/javascript">
function dragover(ev) {
ev.preventDefault();
}
function dragstart(ev) {
ev.dataTransfer.setData("Text", ev.target.id);
}
function drop(ev) {
ev.preventDefault();
var data = ev.dataTransfer.getData("Text");
ev.target.value = 'The element\'s id is \"' + data + '\"';
}
</script>
<p>Please Drag Button into here:</p>
<textarea id="div1" ondrop="drop(event)" ondragover="dragover(event)"></textarea>
<br />
<button id="button" draggable="true" ondragstart="dragstart(event)">
Button
</button> If you are still seeing issues with drag/drop in webviews, please open a new issue with an example extension so we can investigate |
Steps to Reproduce:
Hello Webview
to open my webview.Problem:
Ctrl+A
to select all, Nothing happen.Reason
selectAll
handler is prevented.The text was updated successfully, but these errors were encountered: