Merge "Fix drag and drop" into stable-3.2

This commit is contained in:
Paladox none 2021-07-01 15:55:13 +00:00 committed by Gerrit Code Review
commit 7d67dc1469
2 changed files with 18 additions and 5 deletions

View File

@ -302,6 +302,11 @@ class GrEditControls extends mixinBehaviors( [
fr.readAsDataURL(file);
}
}
_handleKeyPress(event) {
event.preventDefault();
event.stopImmediatePropagation();
}
}
customElements.define(GrEditControls.is, GrEditControls);

View File

@ -95,21 +95,29 @@ export const htmlTemplate = html`
query="[[_query]]"
text="{{_path}}"
></gr-autocomplete>
<div id="dragDropArea" on-drop="_handleDragAndDropUpload">
<p>Drag and drop a file here</p>
<p>or</p>
<p>
<div
id="dragDropArea"
contenteditable="true"
on-drop="_handleDragAndDropUpload"
on-keypress="_handleKeyPress"
>
<p contenteditable="false">Drag and drop a file here</p>
<p contenteditable="false">or</p>
<p contenteditable="false">
<iron-input>
<input
is="iron-input"
id="fileUploadInput"
type="file"
on-change="_handleFileUploadChanged"
multiple
hidden
/>
</iron-input>
<label for="fileUploadInput">
<gr-button id="fileUploadBrowse">Browse</gr-button>
<gr-button id="fileUploadBrowse" contenteditable="false"
>Browse</gr-button
>
</label>
</p>
</div>