mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-18 03:00:56 +01:00
Use @2x & @3x fallback images in the filepicker. Fix #952
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
* Fixed issue `admin.super` or `admin.users` users changing the account when saving another user [#713](https://github.com/getgrav/grav-plugin-admin/issues/713)
|
||||
* Fix issue where non `admin.super`/`admin.users` users could see other users profiles [#713](https://github.com/getgrav/grav-plugin-admin/issues/713)
|
||||
* Fix removing responsive image from page media [#111](https://github.com/getgrav/grav-plugin-admin/issues/111) [#952](https://github.com/getgrav/grav-plugin-admin/issues/952)
|
||||
* Use @2x & @3x fallback images in the filepicker. [#952](https://github.com/getgrav/grav-plugin-admin/issues/952)
|
||||
|
||||
# v1.2.10
|
||||
## 1/30/2017
|
||||
|
||||
@@ -70,9 +70,17 @@ export default class FilePickerField {
|
||||
let renderOption = function renderOption(item, escape) {
|
||||
let image = '';
|
||||
if (imagesPreview && folder && item.status === 'available' && item.name.match(/\.(jpg|jpeg|png|gif)$/i)) {
|
||||
var insertTextInStringAt = function insertTextInStringAt(string, index, text) {
|
||||
return [string.slice(0, index), text, string.slice(index)].join('');
|
||||
};
|
||||
|
||||
let fallback1 = insertTextInStringAt(`${config.base_url_relative}/../${folder}/${item.name}`, -4, '@2x');
|
||||
let fallback2 = insertTextInStringAt(`${config.base_url_relative}/../${folder}/${item.name}`, -4, '@3x');
|
||||
|
||||
image = `
|
||||
<img class="filepicker-field-image"
|
||||
src="${config.base_url_relative}/../${folder}/${item.name}"/>`;
|
||||
<img class="filepicker-field-image"
|
||||
src="${config.base_url_relative}/../${folder}/${item.name}"
|
||||
onerror="if(this.src=='${fallback1}'){this.src='${fallback2}';this.onerror='';}else{this.src='${fallback1}'};" />`;
|
||||
}
|
||||
|
||||
return `<div>
|
||||
|
||||
30
themes/grav/js/admin.min.js
vendored
30
themes/grav/js/admin.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user