0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

🐛 Fixed editor and drag/drop image uploads in IE11 (#926)

closes https://github.com/TryGhost/Ghost/issues/9321
- don't use `dataTransfer.effectAllowed` in IE11
- only fire the action in `{{gh-file-input}}` if there are files selected to prevent a double call to the action due to resetting the input
This commit is contained in:
Kevin Ansfield 2017-12-12 11:53:35 +00:00 committed by GitHub
parent 97ffb63203
commit 14f03a14a8
6 changed files with 24 additions and 12 deletions

View file

@ -89,8 +89,10 @@ export default Component.extend({
// this is needed to work around inconsistencies with dropping files
// from Chrome's downloads bar
let eA = event.dataTransfer.effectAllowed;
event.dataTransfer.dropEffect = (eA === 'move' || eA === 'linkMove') ? 'move' : 'copy';
if (navigator.userAgent.indexOf('Chrome') > -1) {
let eA = event.dataTransfer.effectAllowed;
event.dataTransfer.dropEffect = (eA === 'move' || eA === 'linkMove') ? 'move' : 'copy';
}
event.preventDefault();
event.stopPropagation();

View file

@ -6,8 +6,10 @@ import XFileInput from 'emberx-file-input/components/x-file-input';
export default XFileInput.extend({
change(e) {
let action = this.get('action');
if (action) {
action(this.files(e), this.resetInput.bind(this));
let files = this.files(e);
if (files.length && action) {
action(files, this.resetInput.bind(this));
}
},

View file

@ -109,8 +109,10 @@ export default Component.extend({
// this is needed to work around inconsistencies with dropping files
// from Chrome's downloads bar
let eA = event.dataTransfer.effectAllowed;
event.dataTransfer.dropEffect = (eA === 'move' || eA === 'linkMove') ? 'move' : 'copy';
if (navigator.userAgent.indexOf('Chrome') > -1) {
let eA = event.dataTransfer.effectAllowed;
event.dataTransfer.dropEffect = (eA === 'move' || eA === 'linkMove') ? 'move' : 'copy';
}
event.stopPropagation();
event.preventDefault();

View file

@ -100,8 +100,10 @@ export default Component.extend({
// this is needed to work around inconsistencies with dropping files
// from Chrome's downloads bar
let eA = event.dataTransfer.effectAllowed;
event.dataTransfer.dropEffect = (eA === 'move' || eA === 'linkMove') ? 'move' : 'copy';
if (navigator.userAgent.indexOf('Chrome') > -1) {
let eA = event.dataTransfer.effectAllowed;
event.dataTransfer.dropEffect = (eA === 'move' || eA === 'linkMove') ? 'move' : 'copy';
}
event.stopPropagation();
event.preventDefault();

View file

@ -62,8 +62,10 @@ export default Component.extend({
// this is needed to work around inconsistencies with dropping files
// from Chrome's downloads bar
let eA = event.dataTransfer.effectAllowed;
event.dataTransfer.dropEffect = (eA === 'move' || eA === 'linkMove') ? 'move' : 'copy';
if (navigator.userAgent.indexOf('Chrome') > -1) {
let eA = event.dataTransfer.effectAllowed;
event.dataTransfer.dropEffect = (eA === 'move' || eA === 'linkMove') ? 'move' : 'copy';
}
event.stopPropagation();
event.preventDefault();

View file

@ -86,8 +86,10 @@ export default Component.extend({
// this is needed to work around inconsistencies with dropping files
// from Chrome's downloads bar
let eA = event.dataTransfer.effectAllowed;
event.dataTransfer.dropEffect = (eA === 'move' || eA === 'linkMove') ? 'move' : 'copy';
if (navigator.userAgent.indexOf('Chrome') > -1) {
let eA = event.dataTransfer.effectAllowed;
event.dataTransfer.dropEffect = (eA === 'move' || eA === 'linkMove') ? 'move' : 'copy';
}
event.stopPropagation();
event.preventDefault();