From 346d1941253e17ab2046095f4de2ddb26e225624 Mon Sep 17 00:00:00 2001 From: "pmoreno.rodriguez" Date: Fri, 25 Oct 2024 11:42:20 +0200 Subject: [PATCH 1/5] New Trait for fetchPriority attribute in images (#3850) --- system/blueprints/config/system.yaml | 11 +++++ system/config/system.yaml | 1 + .../Media/Traits/ImageFetchPriorityTrait.php | 40 +++++++++++++++++++ .../Grav/Common/Page/Medium/ImageMedium.php | 2 + 4 files changed, 54 insertions(+) create mode 100644 system/src/Grav/Common/Media/Traits/ImageFetchPriorityTrait.php diff --git a/system/blueprints/config/system.yaml b/system/blueprints/config/system.yaml index b0ad371d0..352d4193f 100644 --- a/system/blueprints/config/system.yaml +++ b/system/blueprints/config/system.yaml @@ -1311,6 +1311,17 @@ form: auto: Auto sync: Sync async: Async + + images.defaults.fetchpriority: + type: select + size: small + label: PLUGIN_ADMIN.IMAGES_FETCHPRIORITY + help: PLUGIN_ADMIN.IMAGES_FETCHPRIORITY_HELP + highlight: auto + options: + auto: Auto + high: High + low: Low images.seofriendly: type: toggle diff --git a/system/config/system.yaml b/system/config/system.yaml index 3495c448b..1280f7d13 100644 --- a/system/config/system.yaml +++ b/system/config/system.yaml @@ -169,6 +169,7 @@ images: defaults: loading: auto # Let browser pick [auto|lazy|eager] decoding: auto # Let browser pick [auto|sync|async] + fetchpriority: auto # Let browser pick [auto|high|low] watermark: image: 'system://images/watermark.png' # Path to a watermark image position_y: 'center' # top|center|bottom diff --git a/system/src/Grav/Common/Media/Traits/ImageFetchPriorityTrait.php b/system/src/Grav/Common/Media/Traits/ImageFetchPriorityTrait.php new file mode 100644 index 000000000..af20a975a --- /dev/null +++ b/system/src/Grav/Common/Media/Traits/ImageFetchPriorityTrait.php @@ -0,0 +1,40 @@ +get('system.images.defaults.fetchpriority', 'auto'); + } + + // Validate the provided value (similar to loading and decoding attributes) + if ($value !== null && $value !== 'auto') { + $this->attributes['fetchpriority'] = $value; + } + + return $this; + } + +} \ No newline at end of file diff --git a/system/src/Grav/Common/Page/Medium/ImageMedium.php b/system/src/Grav/Common/Page/Medium/ImageMedium.php index 4de211bee..580e9f586 100644 --- a/system/src/Grav/Common/Page/Medium/ImageMedium.php +++ b/system/src/Grav/Common/Page/Medium/ImageMedium.php @@ -16,6 +16,7 @@ use Grav\Common\Media\Interfaces\MediaLinkInterface; use Grav\Common\Media\Traits\ImageLoadingTrait; use Grav\Common\Media\Traits\ImageDecodingTrait; +use Grav\Common\Media\Traits\ImageFetchPriorityTrait; use Grav\Common\Media\Traits\ImageMediaTrait; use Grav\Common\Utils; use Gregwar\Image\Image; @@ -32,6 +33,7 @@ class ImageMedium extends Medium implements ImageMediaInterface, ImageManipulate use ImageMediaTrait; use ImageLoadingTrait; use ImageDecodingTrait; + use ImageFetchPriorityTrait; /** * @var mixed|string From a0614dc3ebdbc1a91f2ddb17ba4ccd7413d07155 Mon Sep 17 00:00:00 2001 From: Artyom Mezin Date: Fri, 25 Oct 2024 12:44:26 +0300 Subject: [PATCH 2/5] Resolving style conflict for other tooltips (#3861) --- system/assets/debugger/clockwork.css | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/system/assets/debugger/clockwork.css b/system/assets/debugger/clockwork.css index 39c356f83..4e0287b6b 100644 --- a/system/assets/debugger/clockwork.css +++ b/system/assets/debugger/clockwork.css @@ -30,7 +30,7 @@ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAA/1BMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAeHh4AAAD///8EBAT7+/sLCwv29vYVFRUvLy/t7e3m5ubCwsKxsbE/Pz+mpqZMTEwcHBzy8vLp6emfn5+AgIA2Njbi4uLf39+rq6tzc3NWVlYhISHa2trW1tbS0tLMzMy7u7uZmZmU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YkAeFnMFuGO7S5gEp7YhXxa5OOAM39RXDPXb0qmpROsswZe+twXdU55oUIZAiEv3bD1UFwIYKkmGqytPCDCwKFQCKK0yL7qtSAPX54UAbtsLuBHkb9zyLmPQSNjsSgmQwKUOIfEY8F8t4B34DvndJY9BA8tNBJq1Nev9axmaStFcQLhgYoCTo0salkIaW8OUDdWjMTR2sHPhrAFZqx6cqcKE4pl2BJJ4K6hfwvqNgAnXfKX/HU6X3Zrhnu0k7tLNZtTBRv1hkwTDBY1NzFU6doDYjJbWdQkQhWwuU7/LvhTh3SDoco4ECL4i5dwURbc8NdDZz2IwKicE8d0KIqWetLE3+lL4hvUuGSeRfVWNLfj/gpOw4smBJBkKQHCzlHGwvAj4woB1gq5NGGLSXtORBPnUQPV5/MPVkDMxbpwG7w4x0xL6Ltxka0A/4NBvV09UVk4DoSn/jl2+JQS9q9KYawisAD4CfhsZ4TH3htylsdEHARIQBusqCKyUpymycgbbkkXEXjT3z7/oKQFTFVuZD2FMJHZIDsO5x2d4aAr2jR+GLwZhtAb028/0yJ9J8dE87jQyKObcjtTXT8dH+fDuKF4/eiPwzH44wTf/yUi6wrpRIOZ9lM1EtXAifFI+CJn9+iX/t2xMQwOMth/UZbASi8btAwR9FHWSpJr75g9Oqbin3VDg+SpwlP6k6TB4ex/7JvmcJx8jydy6XPk8eFTKhyfwCgX71MSvaBHgAAAABJRU5ErkJggg==); } -.tooltip { +.clockwork-badge .tooltip { display: none; /* Hidden by default */ position: absolute; bottom: 35px; /* Position above the badge */ @@ -51,11 +51,11 @@ display: block; /* Show tooltip on hover */ } -.tooltip a { +.clockwork-badge .tooltip a { color: #007BFF; text-decoration: none; } -.tooltip a:hover { +.clockwork-badge .tooltip a:hover { text-decoration: underline; -} \ No newline at end of file +} From 6b07088189494d88df579381e6be646f16dc80d5 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Sun, 27 Oct 2024 12:24:39 +0000 Subject: [PATCH 3/5] cli Alias support in 1.7 --- .../Application/CommandLoader/PluginCommandLoader.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/system/src/Grav/Console/Application/CommandLoader/PluginCommandLoader.php b/system/src/Grav/Console/Application/CommandLoader/PluginCommandLoader.php index f550c518e..210250c64 100644 --- a/system/src/Grav/Console/Application/CommandLoader/PluginCommandLoader.php +++ b/system/src/Grav/Console/Application/CommandLoader/PluginCommandLoader.php @@ -57,6 +57,14 @@ public function __construct(string $name) $command = new $command_class(); if ($command instanceof Command) { $this->commands[$command->getName()] = $command; + + // If the command has an alias, add that as a possible command name. + $aliases = $this->commands[$command->getName()]->getAliases(); + if (isset($aliases)) { + foreach ($aliases as $alias) { + $this->commands[$alias] = $command; + } + } } } } From 3952491ce9f622d18cd00e34f4fe33ae288ba960 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Sun, 27 Oct 2024 12:24:46 +0000 Subject: [PATCH 4/5] updated changelog --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8af149c6b..88d1ea8bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +# v1.7.48 +## mm/dd/2024 + +1. [](#new) + * New Trait for fetchPriority attribute on images [#3850](https://github.com/getgrav/grav/pull/3850) +1. [](#improved) + * Fix for #3164. Adds aliases as possible commands during lookup [#3863](https://github.com/getgrav/grav/pull/3863) +1. [](#bugfix) + * Fix style conflict with Clockwork and tooltips [#3861](https://github.com/getgrav/grav/pull/3861) + # v1.7.47 ## 10/23/2024 From 2896aea30a041a81e27f4f5f3f025f787a5417cc Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Mon, 28 Oct 2024 11:30:04 +0000 Subject: [PATCH 5/5] prepare for release --- CHANGELOG.md | 2 +- system/defines.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 88d1ea8bf..447bc4852 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ # v1.7.48 -## mm/dd/2024 +## 10/28/2024 1. [](#new) * New Trait for fetchPriority attribute on images [#3850](https://github.com/getgrav/grav/pull/3850) diff --git a/system/defines.php b/system/defines.php index c3e1cdd65..6538348de 100644 --- a/system/defines.php +++ b/system/defines.php @@ -9,7 +9,7 @@ // Some standard defines define('GRAV', true); -define('GRAV_VERSION', '1.7.47'); +define('GRAV_VERSION', '1.7.48'); define('GRAV_SCHEMA', '1.7.0_2020-11-20_1'); define('GRAV_TESTING', false);