Skip to content
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

Replace JS lazyloading with native. Fixes #4327. #4943

Merged
merged 2 commits into from
Dec 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"jquery": "^3.5.0",
"jquery-ui": "file:resources/js/vendor/jquery-ui",
"laravel-echo": "^1.6.1",
"lazysizes": "^5.2.2",
"luminous-lightbox": "^0.2.0",
"marked": "^0.7.0",
"marked-plaintext": "0.0.2",
Expand Down
7 changes: 3 additions & 4 deletions resources/js/components/assets/Browser/Thumbnail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@

<template v-else>
<img v-if="asset.is_image"
:data-src="asset.thumbnail"
class="asset-thumbnail rounded max-h-full max-w-full mx-auto rounded lazyload"
:src="asset.thumbnail"
class="asset-thumbnail rounded max-h-full max-w-full mx-auto rounded"
loading="lazy"
:class="{'w-8 h-8 fit-cover': square}"
/>
<file-icon v-else :extension="asset.extension" class="p-px asset-thumbnail rounded w-full h-full" />
Expand All @@ -22,8 +23,6 @@
</template>

<script>
require('lazysizes')

export default {

props: {
Expand Down
4 changes: 1 addition & 3 deletions resources/js/components/fieldtypes/assets/AssetRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
:style="'background-image:url('+asset.url+')'">
</div>
<button class="w-7 h-7 cursor-pointer whitespace-no-wrap flex items-center justify-center" @click="edit" v-else>
<img class="asset-thumbnail max-h-full max-w-full rounded w-7 h-7 fit-cover lazyloaded" :src="thumbnail" v-if="isImage" />
<img class="asset-thumbnail max-h-full max-w-full rounded w-7 h-7 fit-cover" loading="lazy" :src="thumbnail" v-if="isImage" />
<file-icon :extension="asset.extension" v-else />
</button>
<button v-if="showFilename" @click="edit" class="flex-1 ml-1 text-sm text-left truncate" :aria-label="__('Edit Asset')" v-tooltip="asset.basename">{{ asset.basename }}</button>
Expand All @@ -32,8 +32,6 @@

<script>
import Asset from './Asset';
require('lazysizes')

export default {

mixins: [Asset]
Expand Down
1 change: 0 additions & 1 deletion webpack.mix.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ mix.extract([
'dmuploader',
'jquery-ui',
'jquery',
'lazysizes',
'luminous-lightbox',
'marked-plaintext',
'marked',
Expand Down