Skip to content

Commit e788a91

Browse files
committed
Merge remote-tracking branch 'origin/development' into development
2 parents 24754f4 + f6e14ff commit e788a91

File tree

4 files changed

+39
-20
lines changed

4 files changed

+39
-20
lines changed

assets/src/dashboard/parts/components/GroupSettingsContainer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const GroupSettingsTitle = ({ children, className = '' }) => {
1818

1919
export const GroupSettingsOption = ({ children, className = '' }) => {
2020
return (
21-
<div className={classNames( 'text-sm text-gray-600 px-4 py-2 bg-white flex items-center rounded', className )}>
21+
<div className={classNames( 'text-sm text-gray-600 px-4 py-2 bg-white flex flex-wrap items-center rounded', className )}>
2222
{ children }
2323
</div>
2424
);

assets/src/dashboard/parts/connected/settings/Lazyload.js

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ import {
1515
ColorIndicator,
1616
Button,
1717
Popover,
18-
CheckboxControl
18+
CheckboxControl,
19+
Tooltip
1920
} from '@wordpress/components';
2021
import { sprintf } from '@wordpress/i18n';
2122

@@ -39,6 +40,7 @@ import {
3940
DescriptionWithTags,
4041
TextWithWarningBadge
4142
} from '../../components/Miscellaneous';
43+
import { Icon, help } from '@wordpress/icons';
4244

4345
const { options_strings } = optimoleDashboardApp.strings;
4446

@@ -150,19 +152,20 @@ const Lazyload = ({ settings, setSettings, setCanSave }) => {
150152

151153
const toggleLoadingBehavior = useCallback(
152154
( value, slug ) => {
153-
const setting = new Set(
155+
const lazyLoadValue = new Set(
154156
( settings?.lazyload_type ?? '' )
155157
?.split( '|' )
156158
.filter( ( i ) => 'viewport' === i || 'fixed' === i ) ?? []
157159
);
158160
if ( value ) {
159-
setting.add( slug );
161+
lazyLoadValue.add( slug );
160162
} else {
161-
setting.delete( slug );
163+
lazyLoadValue.delete( slug );
162164
}
163-
updateValue( 'lazyload_type', Array.from( setting ).toSorted().join( '|' ) );
165+
const updatedValue = Array.from( lazyLoadValue ).toSorted().join( '|' ) || 'all';
166+
updateValue( 'lazyload_type', updatedValue );
164167
},
165-
[ settings?.lazyload_type ]
168+
[ settings?.lazyload_type, updateValue ]
166169
);
167170

168171
if ( ! isLazyLoadEnabled ) {
@@ -325,6 +328,7 @@ const Lazyload = ({ settings, setSettings, setCanSave }) => {
325328
onChange={( value ) =>
326329
updateValue( 'skip_lazyload_images', value )
327330
}
331+
disabled={! isFixedSkipLazyEnabled}
328332
__nextHasNoMarginBottom={true}
329333
/>
330334
</div>
@@ -354,7 +358,8 @@ const Lazyload = ({ settings, setSettings, setCanSave }) => {
354358
{options_strings.visual_settings}
355359
</GroupSettingsTitle>
356360
<GroupSettingsOption>
357-
<div className="grow" htmlFor="optml-lazyload-placeholder">
361+
362+
<div className="grow flex flex-row gap-1" htmlFor="optml-lazyload-placeholder">
358363
<CheckboxControl
359364
label={options_strings.enable_lazyload_placeholder_title}
360365
checked={isLazyLoadPlaceholderEnabled}
@@ -364,8 +369,21 @@ const Lazyload = ({ settings, setSettings, setCanSave }) => {
364369
disabled={isLoading}
365370
__nextHasNoMarginBottom={true}
366371
/>
372+
<Tooltip
373+
text={<p
374+
className=""
375+
dangerouslySetInnerHTML={{
376+
__html: options_strings.enable_lazyload_placeholder_desc
377+
}}
378+
/>}
379+
>
380+
<Icon
381+
icon={ help }
382+
size={ 18 }
383+
className="text-gray-400 hover:text-gray-600"
384+
/>
385+
</Tooltip>
367386
</div>
368-
369387
{isLazyLoadPlaceholderEnabled && (
370388
<div className="relative inline-block">
371389
<Button

inc/admin.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,11 +1354,6 @@ private function localize_dashboard_app() {
13541354
$lang_code = isset( $available_languages[ $language ] ) ? 'de' : 'en';
13551355

13561356
$site_settings = $this->settings->get_site_settings();
1357-
// Migrate settings if needed.
1358-
if ( isset( $site_settings['lazyload_type'] ) && 'all' === $site_settings['lazyload_type'] ) {
1359-
$site_settings['lazyload_type'] = 'fixed';
1360-
$site_settings['skip_lazyload_images'] = 0;
1361-
}
13621357

13631358
return [
13641359
'strings' => $this->get_dashboard_strings(),
@@ -1827,7 +1822,12 @@ private function get_dashboard_strings() {
18271822
'<a class="inline-block text-purple-gray underline" target=”_blank” href="https://docs.optimole.com/article/1943-avif-conversion">',
18281823
'</a>'
18291824
),
1830-
'enable_bg_lazyload_desc' => __( 'Apply lazy loading to CSS background images. The toggle below enables it globally. The selector list is optional and only needed to extend coverage if certain elements are missed.', 'optimole-wp' ),
1825+
'enable_bg_lazyload_desc' => sprintf(
1826+
/* translators: 1 is the starting anchor tag, 2 is the ending anchor tag */
1827+
__( 'Apply lazy loading to CSS background images. The toggle below enables it globally. The selector list is optional and only needed to extend coverage if certain elements are missed. %1$sLearn more%2$s', 'optimole-wp' ),
1828+
'<a class="inline-block text-purple-gray underline" target="_blank" href="https://docs.optimole.com/article/1169-how-to-enable-the-background-lazyload-feature-for-certain-background-images">',
1829+
'</a>'
1830+
),
18311831
'enable_bg_lazyload_title' => __( 'CSS Background Lazy Load', 'optimole-wp' ),
18321832
'enable_video_lazyload_desc' => __( 'Lazy load embedded videos and iframe content', 'optimole-wp' ),
18331833
'enable_video_lazyload_title' => __( 'Video & iframes', 'optimole-wp' ),
@@ -1852,8 +1852,8 @@ private function get_dashboard_strings() {
18521852
'enable_image_replace' => __( 'Enable Optimole Image Handling', 'optimole-wp' ),
18531853
'enable_lazyload_placeholder_desc' => sprintf(
18541854
/* translators: 1 is the starting anchor tag, 2 is the ending anchor tag */
1855-
__( 'Enable this to use a generic transparent placeholder instead of the blurry images during lazy loading. Enhance the visual experience by selecting a custom color for the placeholder. %1$sLearn more%2$s', 'optimole-wp' ),
1856-
'<a class="inline-block text-purple-gray underline" target=”_blank” href="https://docs.optimole.com/article/1192-lazy-load-generic-placeholder">',
1855+
__( 'Enable this to use a generic transparent placeholder instead of the blurry images during lazy loading. %1$sLearn more%2$s', 'optimole-wp' ),
1856+
'<a class="inline-block underline text-white" target=”_blank” href="https://docs.optimole.com/article/1192-lazy-load-generic-placeholder">',
18571857
'</a>'
18581858
),
18591859

@@ -1866,7 +1866,7 @@ private function get_dashboard_strings() {
18661866
),
18671867
'lazyload_behaviour_all' => __( 'Lazy Load All Images', 'optimole-wp' ),
18681868
'lazyload_behaviour_all_desc' => __( 'All images will use lazy loading regardless of position.', 'optimole-wp' ),
1869-
'lazyload_behaviour_viewport' => __( 'Enable viewport-based loading', 'optimole-wp' ),
1869+
'lazyload_behaviour_viewport' => __( 'Skip images above the fold', 'optimole-wp' ),
18701870
'lazyload_behaviour_viewport_desc' => __( 'Automatically detects and immediately loads images visible in the initial viewport. Detection is done with a lightweight client-side script that identifies what\'s visible on each user\'s screen. All other images will lazy load.', 'optimole-wp' ),
18711871
'lazyload_behaviour_fixed' => __( 'Skip lazy loading for first images', 'optimole-wp' ),
18721872
'lazyload_behaviour_fixed_desc' => __( 'Indicate how many images at the top of each page should bypass lazy loading, ensuring they\'re instantly visible.', 'optimole-wp' ),
@@ -1988,7 +1988,7 @@ private function get_dashboard_strings() {
19881988
'low_q_title' => __( 'Low', 'optimole-wp' ),
19891989
'medium_q_title' => __( 'Medium', 'optimole-wp' ),
19901990
'no_images_found' => __( 'You dont have any images in your Media Library. Add one and check how the Optimole will perform.', 'optimole-wp' ),
1991-
'native_desc' => __( 'Uses the browser\'s build-in "lazy" behavior', 'optimole-wp' ),
1991+
'native_desc' => __( 'Uses the browser\'s built-in lazy loading feature. Enabling this will disable the auto scale.', 'optimole-wp' ),
19921992
'option_saved' => __( 'Option saved.', 'optimole-wp' ),
19931993
'ml_quality_desc' => sprintf( /* translators: 1 is the starting anchor tag, 2 is the ending anchor tag */ __( 'Optimole ML algorithms will predict the optimal image quality to get the smallest possible size with minimum perceived quality losses. When disabled, you can control the quality manually. %1$sLearn more%2$s', 'optimole-wp' ), '<a class="inline-block text-purple-gray underline" target=”_blank” href="https://docs.optimole.com/article/1016-what-is-the-difference-between-the-auto-high-medium-low-compression-levels">', '</a>' ),
19941994
'quality_desc' => __( 'Lower image quality might boost your loading speed by lowering the size. However, the low image quality may negatively impact the visual appearance of the images. Try experimenting with the setting, then click the View sample image link to see what option works best for you.', 'optimole-wp' ),
@@ -2115,7 +2115,7 @@ private function get_dashboard_strings() {
21152115
// translators: This option is discouraged from being used.
21162116
'not_recommended' => __( 'Not recommended', 'optimole-wp' ),
21172117
// translators: %1$s is the starting bold tag, %2$s is the ending bold tag.
2118-
'viewport_skip_images_notice' => sprintf( __( 'When %1$sviewport-based loading%2$s and %1$sskip first images%2$s are both enabled: the skip rule applies on a user\'s first page view. On subsequent views, once viewport data exists, the skip rule is ignored in favor of the viewport data.', 'optimole-wp' ), '<strong>', '</strong>' ),
2118+
'viewport_skip_images_notice' => sprintf( __( 'When %1$sskip above the fold%2$s and %1$sskip first images%2$s are both enabled: the skip rule applies on a user\'s first page view. On subsequent views, once viewport data exists, the skip rule is ignored in favor of the viewport data.', 'optimole-wp' ), '<strong>', '</strong>' ),
21192119
// translators: %1$s is the starting bold tag, %2$s is the ending bold tag.
21202120
'native_lazy_load_warning' => sprintf( __( 'Native browser loading works with viewport detection, but it does not support smart image scaling. It can offer better cross-browser compatibility. Still, we do %1$snot recommend%2$s it for most sites due to fewer controls and features compared to Smart Loading.', 'optimole-wp' ), '<strong>', '</strong>' ),
21212121
'performance_impact_alert_title' => __( 'Performance Impact Alert', 'optimole-wp' ),

inc/lazyload_replacer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ public static function get_skip_lazyload_limit() {
171171
if ( self::$skip_lazyload_images !== null ) {
172172
return self::$skip_lazyload_images;
173173
}
174+
174175
self::$skip_lazyload_images = apply_filters( 'optml_lazyload_images_skip', self::instance()->settings->get( 'skip_lazyload_images' ) );
175176
return self::$skip_lazyload_images;
176177
}

0 commit comments

Comments
 (0)