Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
64ffb19
separate meta system
DavidCramer Jun 24, 2021
3d95d36
change meta check
DavidCramer Jun 24, 2021
ce5ae19
upload via url if not a local file
DavidCramer Jun 24, 2021
2e44519
add limit and unfilter meta
DavidCramer Jun 26, 2021
bd02105
Cleanup
Jun 30, 2021
f1d5612
Improve output consistency
Jun 30, 2021
c714cb0
Default get meta to null
Jun 30, 2021
9f59afc
Get single key for delivery type
Jun 30, 2021
23ab2c0
Change the source of information into the newly added Cloudinary meta…
Jun 30, 2021
fca6001
Use plugin internal logic to check if the media is local
Jun 30, 2021
d4f99a9
Merge branch 'master' into develop
Jun 30, 2021
a9a8998
Merge branch 'master' into uat
Jun 30, 2021
07da891
Merge pull request #467 from cloudinary/fix/separate-meta
pereirinha Jun 30, 2021
d59291b
Merge pull request #466 from cloudinary/feature/separate-meta
pereirinha Jun 30, 2021
4526fa0
add url and asset
DavidCramer Jul 1, 2021
3aedcef
cleanup settings and styling
DavidCramer Jul 1, 2021
4fe2e1e
add breakpoints class
DavidCramer Jul 1, 2021
496e50c
add breakpoints js
DavidCramer Jul 1, 2021
06d634e
add settings
DavidCramer Jul 1, 2021
c4dbe4f
connect delivery with breakpoints.
DavidCramer Jul 1, 2021
5ee3144
fix formatting
DavidCramer Jul 2, 2021
ef04fbf
add dpr and q_auto to js src
DavidCramer Jul 7, 2021
9de64bc
separate classes and update beta
DavidCramer Jul 7, 2021
97ce324
clean up delivery class
DavidCramer Jul 7, 2021
4e41144
fix connection tag renaming issue.
DavidCramer Jul 7, 2021
4a81544
reset values
DavidCramer Jul 7, 2021
97e3d5f
add auto suffix and cleanup settings
DavidCramer Jul 7, 2021
adbfb56
add colors
DavidCramer Jul 7, 2021
71eb29f
clean up cache clearing and prevent sizes that have the same file.
DavidCramer Jul 8, 2021
81c24f7
clean up legacy migrations
DavidCramer Jul 8, 2021
13b8fe6
cleanup nested groups showing duplicate rules
DavidCramer Jul 8, 2021
5bc3dd2
Fix CR issues
DavidCramer Jul 8, 2021
4f2ef54
Merge pull request #468 from cloudinary/beta/lazyload-breakpoints
pereirinha Jul 8, 2021
f60d2b1
Add Cloudidary analytics
Jul 8, 2021
23df59c
fix dpr setting and allow precision setting
DavidCramer Jul 9, 2021
2a268fa
reorder hook registration and value resetting
DavidCramer Jul 9, 2021
a7e4f64
rename js to lazy-load
DavidCramer Jul 9, 2021
0a7e1ea
refactor classes into an abstract
DavidCramer Jul 9, 2021
83af3f7
introduce setting init action
DavidCramer Jul 9, 2021
aeb63ae
introduce delivery init action and move old breackpoints to init_deli…
DavidCramer Jul 9, 2021
c0e33dc
refactor rebuild_tag to do less work
DavidCramer Jul 9, 2021
ccd5ddd
add calcs for threshold unit
DavidCramer Jul 9, 2021
f3865cc
stop errors from trying to get width on an svg
DavidCramer Jul 9, 2021
4495d1a
Merge pull request #474 from cloudinary/fix/lazy-breakpoints-cleanup
pereirinha Jul 9, 2021
ad42980
Prevent filtering analytics
Jul 9, 2021
2b6604a
Merge pull request #473 from cloudinary/feature/analytics-query-arg
pereirinha Jul 9, 2021
8f4d3f7
clean up dpr detection
DavidCramer Jul 9, 2021
4a5dc11
Merge pull request #475 from cloudinary/fix/dpr_detect
pereirinha Jul 9, 2021
34eb26a
Remove analytics query arg before saving
Jul 12, 2021
57c75ac
Merge pull request #476 from cloudinary/fix/cloudinary-analytics
pereirinha Jul 13, 2021
93576d1
Merge branch 'develop' into uat
Jul 13, 2021
218ce8d
Bump plugin version
Jul 13, 2021
a0bc246
Ensure that attachment_metadata is created and updated
Jul 13, 2021
c75de09
Merge pull request #478 from cloudinary/fix/attachment-metadata
pereirinha Jul 13, 2021
9dbc20a
Prevent variable polution
Jul 14, 2021
fa58ae3
Remove analytics for the download
Jul 14, 2021
d7b661b
Force the recheck
Jul 14, 2021
a27a05c
Merge pull request #480 from cloudinary/fix/cli-clean-caches
pereirinha Jul 14, 2021
7af3814
Merge pull request #479 from cloudinary/fix/storage-sync
pereirinha Jul 14, 2021
122c3df
Keep metas that allow getting the ID from given sync keys
Jul 14, 2021
58638e6
Update comment
Jul 14, 2021
3651433
The GT override meta is not part of the Cloudinary key
Jul 14, 2021
d101d2b
Merge pull request #482 from cloudinary/fix/feature-image
pereirinha Jul 15, 2021
5900a08
Merge pull request #481 from cloudinary/fix/get-id_from-sync-key
pereirinha Jul 15, 2021
74a786a
remove suffix version check. clean suffix
DavidCramer Jul 19, 2021
13e893e
Ensure that the key is set
Jul 19, 2021
d7fbe8e
Allow pushing to Cloudinary unsynced items on manual sync, regardless…
Jul 19, 2021
ba82bc9
Merge pull request #485 from cloudinary/fix/suffix-fix
pereirinha Jul 19, 2021
063161f
Merge pull request #486 from cloudinary/fix/missing-key
pereirinha Jul 19, 2021
0e4b3f0
Bump plugin version
Jul 19, 2021
565c96c
Remove analytics from video shortcode
Jul 20, 2021
147f65f
Check instead if the asset has been synced before
Jul 20, 2021
225815e
Merge pull request #487 from cloudinary/fix/videos-and-push
pereirinha Jul 20, 2021
dda25c9
Bump plugin version
Jul 20, 2021
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: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"jQuery": "readonly",
"$": "readonly",
"CLDN": "readonly",
"CLDLB": "readonly",
"CLD_GLOBAL_TRANSFORMATIONS": "readonly",
"samplePlayer": "readonly",
"CLDCACHE": "readonly"
Expand Down
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7.4
2.7.5-rc-3
2 changes: 1 addition & 1 deletion css/cloudinary.css

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions css/src/components/_ui.scss
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,6 @@
align-self: center;
padding: 0 0.45rem;
cursor: pointer;
position: absolute;
right: 0;
}

&-title {
Expand Down Expand Up @@ -318,16 +316,23 @@
}

&-group {
.cld-group .cld-group {
padding-left: 4px;
}

hr {
border-top: 1px solid $color-light-grey;
margin: 1.5rem 0;
clear: both;
}

.cld-group .cld-group hr {
display: none;
}

&-heading {
display: flex;

justify-content: space-between;
h3 {
font-size: 0.9rem;

Expand Down
2 changes: 1 addition & 1 deletion js/cloudinary.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions js/lazy-load.asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php return array('dependencies' => array('wp-polyfill'), 'version' => '4f54b160de748912ea5ea5d8ce80f326');
1 change: 1 addition & 0 deletions js/lazy-load.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 26 additions & 1 deletion js/src/components/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ const UI = {
const triggers = context.querySelectorAll( '[data-bind-trigger]' );
const masters = context.querySelectorAll( '[data-master]' );
const files = context.querySelectorAll( '[data-file]' );
const autoSuffix = context.querySelectorAll( '[data-auto-suffix]' );
const self = this;
const compilerDebounce = {};

// Bind on offs.
OnOff.bind( masters );

autoSuffix.forEach( ( input ) => this._autoSuffix( input ) );
triggers.forEach( ( input ) => this._trigger( input ) );
toggles.forEach( ( toggle ) => this._toggle( toggle ) );
conditions.forEach( ( condition ) => this._bind( condition ) );
Expand All @@ -48,6 +49,30 @@ const UI = {
// Start cache manager.
CacheManage.init( context );
},
_autoSuffix( input ) {
const suffixes = input.dataset.autoSuffix;
let defaultSuffix = '';
const valid = [ ...suffixes.split( ';' ) ].map( ( suffix ) => {
if ( 0 === suffix.indexOf( '*' ) ) {
defaultSuffix = suffix.replace( '*', '' );
return defaultSuffix;
}
return suffix;
} );
input.addEventListener( 'change', () => {
const value = input.value.replace( ' ', '' );
const number = value.replace( /[^0-9]/g, '' );
const type = value.replace( /[0-9]/g, '' ).toLowerCase();
if ( number ) {
if ( -1 === valid.indexOf( type ) ) {
input.value = number + defaultSuffix;
} else {
input.value = number + type;
}
}
} );
input.dispatchEvent( new Event( 'change' ) );
},
_files( file, compilerDebounce ) {
const parent = file.dataset.parent;
if ( ! parent ) {
Expand Down
200 changes: 200 additions & 0 deletions js/src/lazy-load.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
const LazyLoad = {
density: window.devicePixelRatio ? window.devicePixelRatio : 'auto',
images: [],
debounce: null,
config: CLDLB ? CLDLB : {},
lazyThreshold: 0,
_init() {
this._calcThreshold();
[ ...document.images ].forEach( ( image ) => {
if ( ! image.dataset.src ) {
return;
}
image.originalWidth = image.dataset.width;
this.images.push( image );
} );

// Resize handler.
window.addEventListener( 'resize', ( ev ) => {
this._debounceBuild();
} );
window.addEventListener( 'scroll', ( ev ) => {
this._debounceBuild();
} );
// Build images.
this._build();
},
_calcThreshold() {
const number = this.config.lazy_threshold.replace( /[^0-9]/g, '' );
const type = this.config.lazy_threshold
.replace( /[0-9]/g, '' )
.toLowerCase();
let unit = 0;
switch ( type ) {
case 'em':
unit =
parseFloat( getComputedStyle( document.body ).fontSize ) *
number;
break;
case 'rem':
unit =
parseFloat(
getComputedStyle( document.documentElement ).fontSize
) * number;
break;
case 'vh':
unit = ( window.innerHeight / number ) * 100;
break;
default:
unit = number;
}
this.lazyThreshold = window.innerHeight + parseInt( unit, 10 );
},
_debounceBuild() {
if ( this.debounce ) {
clearTimeout( this.debounce );
}
this.debounce = setTimeout( () => {
this._build();
}, 100 );
},
_getDensity() {
const maxDensity = CLDLB.dpr ? CLDLB.dpr.replace( 'X', '' ) : 'off';
if ( 'off' === maxDensity ) {
return 1;
}
let deviceDensity = this.density;
if (
! CLDLB.dpr_precise &&
'auto' !== maxDensity &&
'auto' !== deviceDensity
) {
deviceDensity =
deviceDensity > Math.ceil( maxDensity )
? maxDensity
: deviceDensity;
} else if ( 'auto' === CLDLB.dpr && 'auto' !== deviceDensity ) {
deviceDensity = 'auto';
}

return deviceDensity;
},
_build() {
this.images.forEach( ( image ) => {
this.buildSize( image );
} );
},
_shouldRebuild( image ) {
const width = this.scaleSize(
image.originalWidth,
image.width,
this.config.pixel_step
);
const rect = image.getBoundingClientRect();
const density = 'auto' !== this.density ? this._getDensity() : 1;
return (
rect.top < this.lazyThreshold &&
( width > image.naturalWidth / density || ! image.cld_loaded )
);
},
_shouldPlacehold( image ) {
const width = this.scaleSize(
image.originalWidth,
image.width,
this.config.pixel_step
);
const rect = image.getBoundingClientRect();
const density = 'auto' !== this.density ? this._getDensity() : 1;
return (
! image.cld_loaded &&
rect.top < this.lazyThreshold * 2 &&
( width > image.naturalWidth / density || ! image.cld_placehold )
);
},
getResponsiveSteps( image ) {
const steps = Math.ceil(
image.dataset.breakpoints
? image.originalWidth / image.dataset.breakpoints
: this.responsiveStep
);
return steps;
},
getQuality() {
let quality = 'q_auto';
switch (
navigator && navigator.connection
? navigator.connection.effectiveType
: 'none'
) {
case 'none':
break;
case '4g':
quality = 'q_auto:good';
break;
case '3g':
quality = 'q_auto:eco';
break;
case '2g':
case 'slow-2g':
quality = 'q_auto:low';
break;
default:
quality = 'q_auto:best';
break;
}
return quality;
},
scaleSize( original, newSize, responsiveStep ) {
const diff = Math.floor( ( original - newSize ) / responsiveStep );
let scaledSize = original - responsiveStep * diff;
if ( scaledSize > original ) {
scaledSize = original;
} else if ( this.config.max_width < scaledSize ) {
scaledSize = original;
}
return scaledSize;
},
buildSize( image ) {
if ( this._shouldRebuild( image ) ) {
if ( image.dataset.srcset ) {
image.srcset = image.dataset.srcset;
} else {
image.src = this.getSizeURL( image );
}
} else if ( this._shouldPlacehold( image ) ) {
image.src = this.getPlaceholderURL( image );
}
},
getSizeURL( image ) {
image.cld_loaded = true;
if ( image.dataset.srcset ) {
image.srcset = image.dataset.srcset;
delete image.dataset.srcset;
return '';
}
const width = this.scaleSize(
image.originalWidth,
image.width,
this.config.pixel_step
);
const density = this._getDensity();
let newSize = '';
if ( width ) {
newSize += 'w_' + width;
if ( 1 !== density ) {
newSize += ',dpr_' + density;
}
}
return image.dataset.src
.replace( '--size--', newSize )
.replace( /q_auto(?!:)/gi, this.getQuality() );
},
getPlaceholderURL( image ) {
image.cld_placehold = true;
return image.dataset.placeholder.replace( '/--size--', '/' );
},
};
// Init.
window.addEventListener( 'load', () => {
LazyLoad._init();
} );
11 changes: 11 additions & 0 deletions js/wp-color-picker-alpha.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading