Fixed preview link for non-images files in Pagemedia (fixes #1727, fixes #1728)

This commit is contained in:
Djamil Legato
2019-08-21 10:10:49 -07:00
parent 1ac925b117
commit faac66c51e
3 changed files with 19 additions and 16 deletions

View File

@@ -2,7 +2,8 @@
## mm/dd/2019
1. [](#bugfix)
* Fixed regression with files in admin not allowing types other than images
* Fixed regression with files in admin not allowing types other than images [#1737](https://github.com/getgrav/grav-plugin-admin/issues/1737)
* Fixed preview link for non-images files in Pagemedia [#1727](https://github.com/getgrav/grav-plugin-admin/issues/1727)
# v1.9.8
## 08/11/2019

View File

@@ -139,7 +139,9 @@ export default class PageMedia extends FilesField {
let file = target.parent('.dz-preview').find('.dz-filename');
let filename = encodeURI(file.text());
let URL = target.closest('[data-media-path]').data('media-path');
let original = this.dropzone.files.filter((file) => encodeURIComponent(file.name) === filename).shift().extras.original;
let original = this.dropzone.files.filter((file) => encodeURIComponent(file.name) === filename).shift();
original = original.extras.original || encodeURIComponent(original.name);
target.attr('href', `${URL}/${original}`);
});

File diff suppressed because one or more lines are too long