Skip to content

Commit

Permalink
feat: kirby 5 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
mauricerenck committed Jan 24, 2025
1 parent 8bc2c29 commit 4f5985c
Show file tree
Hide file tree
Showing 9 changed files with 192 additions and 199 deletions.
5 changes: 5 additions & 0 deletions components/fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

return [
'pexels' => [
'computed' => [
'pageId' => function (): string {
return $this->model()->id();
}
],
'props' => [
'downloadSize' => function () {
return option('mauricerenck.PexelsImageField.downloadSize', 'large');
Expand Down
306 changes: 152 additions & 154 deletions composer.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion index.js

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

30 changes: 9 additions & 21 deletions src/components/Pexels.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
<template>
<div class="k-pexels-field">
<k-field :label="label">
<k-input
theme="field"
icon="search"
@input="onInput"
@keyup="onSubmit"
type="text"
name="textfield"
:value="value"
/>
<k-input theme="field" icon="search" @input="onSubmit" type="text" name="textfield" :value="this.keyword" />
</k-field>

<div>
Expand All @@ -35,6 +27,7 @@ export default {
label: String,
value: String,
downloadSize: String,
pageId: String,
},
data: function () {
Expand All @@ -51,29 +44,24 @@ export default {
}
},
computed: {
pageId() {
return this.$store.getters['content/id']()
},
pages() {
return Math.round(this.totalResults / this.perPage, 10)
},
},
methods: {
onInput(value) {
this.keyword = value
},
methods: {
onSubmit(value) {
this.keyword = value
if (this.timer !== null) {
clearTimeout(this.timer)
}
if (this.keyword.length < 3) {
if (value.length < 3) {
return
}
this.timer = setTimeout(() => {
this.search(this.keyword)
this.search(value)
}, 250)
},
Expand Down Expand Up @@ -143,7 +131,7 @@ export default {
const currentText = selectedPhoto.text
selectedPhoto.text = 'Downloading…'
panel.api
this.$api
.post('pexels/download', {
imageId: id,
pageId: this.pageId.split('?')[0],
Expand All @@ -154,12 +142,12 @@ export default {
.then(() => {
this.downloaded = false
panel.view.reload()
window.panel.notification.success('Image downloaded');
window.panel.notification.success('Image downloaded')
selectedPhoto.text = currentText
})
.catch(() => {
this.downloaded = false
window.panel.notification.error('Image download failed');
window.panel.notification.error('Image download failed')
selectedPhoto.text = currentText
})
},
Expand Down
4 changes: 2 additions & 2 deletions vendor/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
'Doctrine\\Common\\Collections\\Order' => $vendorDir . '/doctrine/collections/src/Order.php',
'Doctrine\\Common\\Collections\\ReadableCollection' => $vendorDir . '/doctrine/collections/src/ReadableCollection.php',
'Doctrine\\Common\\Collections\\Selectable' => $vendorDir . '/doctrine/collections/src/Selectable.php',
'Doctrine\\Deprecations\\Deprecation' => $vendorDir . '/doctrine/deprecations/lib/Doctrine/Deprecations/Deprecation.php',
'Doctrine\\Deprecations\\PHPUnit\\VerifyDeprecations' => $vendorDir . '/doctrine/deprecations/lib/Doctrine/Deprecations/PHPUnit/VerifyDeprecations.php',
'Doctrine\\Deprecations\\Deprecation' => $vendorDir . '/doctrine/deprecations/src/Deprecation.php',
'Doctrine\\Deprecations\\PHPUnit\\VerifyDeprecations' => $vendorDir . '/doctrine/deprecations/src/PHPUnit/VerifyDeprecations.php',
'GuzzleHttp\\BodySummarizer' => $vendorDir . '/guzzlehttp/guzzle/src/BodySummarizer.php',
'GuzzleHttp\\BodySummarizerInterface' => $vendorDir . '/guzzlehttp/guzzle/src/BodySummarizerInterface.php',
'GuzzleHttp\\Client' => $vendorDir . '/guzzlehttp/guzzle/src/Client.php',
Expand Down
2 changes: 1 addition & 1 deletion vendor/composer/autoload_psr4.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@
'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'),
'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
'Doctrine\\Deprecations\\' => array($vendorDir . '/doctrine/deprecations/lib/Doctrine/Deprecations'),
'Doctrine\\Deprecations\\' => array($vendorDir . '/doctrine/deprecations/src'),
'Doctrine\\Common\\Collections\\' => array($vendorDir . '/doctrine/collections/src'),
);
6 changes: 3 additions & 3 deletions vendor/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class ComposerStaticInitd6dab7feb2c0432282fb013bfa43cbe9
),
'Doctrine\\Deprecations\\' =>
array (
0 => __DIR__ . '/..' . '/doctrine/deprecations/lib/Doctrine/Deprecations',
0 => __DIR__ . '/..' . '/doctrine/deprecations/src',
),
'Doctrine\\Common\\Collections\\' =>
array (
Expand All @@ -247,8 +247,8 @@ class ComposerStaticInitd6dab7feb2c0432282fb013bfa43cbe9
'Doctrine\\Common\\Collections\\Order' => __DIR__ . '/..' . '/doctrine/collections/src/Order.php',
'Doctrine\\Common\\Collections\\ReadableCollection' => __DIR__ . '/..' . '/doctrine/collections/src/ReadableCollection.php',
'Doctrine\\Common\\Collections\\Selectable' => __DIR__ . '/..' . '/doctrine/collections/src/Selectable.php',
'Doctrine\\Deprecations\\Deprecation' => __DIR__ . '/..' . '/doctrine/deprecations/lib/Doctrine/Deprecations/Deprecation.php',
'Doctrine\\Deprecations\\PHPUnit\\VerifyDeprecations' => __DIR__ . '/..' . '/doctrine/deprecations/lib/Doctrine/Deprecations/PHPUnit/VerifyDeprecations.php',
'Doctrine\\Deprecations\\Deprecation' => __DIR__ . '/..' . '/doctrine/deprecations/src/Deprecation.php',
'Doctrine\\Deprecations\\PHPUnit\\VerifyDeprecations' => __DIR__ . '/..' . '/doctrine/deprecations/src/PHPUnit/VerifyDeprecations.php',
'GuzzleHttp\\BodySummarizer' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/BodySummarizer.php',
'GuzzleHttp\\BodySummarizerInterface' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/BodySummarizerInterface.php',
'GuzzleHttp\\Client' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Client.php',
Expand Down
32 changes: 16 additions & 16 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php return array(
'root' => array(
'name' => 'mauricerenck/pexelsimagefield',
'pretty_version' => '2.0.1',
'version' => '2.0.1.0',
'pretty_version' => '2.0.2',
'version' => '2.0.2.0',
'reference' => NULL,
'type' => 'kirby-plugin',
'install_path' => __DIR__ . '/../../',
Expand All @@ -20,9 +20,9 @@
'dev_requirement' => false,
),
'doctrine/deprecations' => array(
'pretty_version' => '1.1.3',
'version' => '1.1.3.0',
'reference' => 'dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab',
'pretty_version' => '1.1.4',
'version' => '1.1.4.0',
'reference' => '31610dbb31faa98e6b5447b62340826f54fbc4e9',
'type' => 'library',
'install_path' => __DIR__ . '/../doctrine/deprecations',
'aliases' => array(),
Expand All @@ -47,9 +47,9 @@
'dev_requirement' => false,
),
'guzzlehttp/promises' => array(
'pretty_version' => '2.0.3',
'version' => '2.0.3.0',
'reference' => '6ea8dd08867a2a42619d65c3deb2c0fcbf81c8f8',
'pretty_version' => '2.0.4',
'version' => '2.0.4.0',
'reference' => 'f9c436286ab2892c7db7be8c8da4ef61ccf7b455',
'type' => 'library',
'install_path' => __DIR__ . '/../guzzlehttp/promises',
'aliases' => array(),
Expand All @@ -65,8 +65,8 @@
'dev_requirement' => false,
),
'mauricerenck/pexelsimagefield' => array(
'pretty_version' => '2.0.1',
'version' => '2.0.1.0',
'pretty_version' => '2.0.2',
'version' => '2.0.2.0',
'reference' => NULL,
'type' => 'kirby-plugin',
'install_path' => __DIR__ . '/../../',
Expand Down Expand Up @@ -137,9 +137,9 @@
'dev_requirement' => false,
),
'symfony/deprecation-contracts' => array(
'pretty_version' => 'v3.5.0',
'version' => '3.5.0.0',
'reference' => '0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1',
'pretty_version' => 'v3.5.1',
'version' => '3.5.1.0',
'reference' => '74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/deprecation-contracts',
'aliases' => array(),
Expand All @@ -155,9 +155,9 @@
'dev_requirement' => false,
),
'symfony/yaml' => array(
'pretty_version' => 'v6.4.11',
'version' => '6.4.11.0',
'reference' => 'be37e7f13195e05ab84ca5269365591edd240335',
'pretty_version' => 'v6.4.13',
'version' => '6.4.13.0',
'reference' => 'e99b4e94d124b29ee4cf3140e1b537d2dad8cec9',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/yaml',
'aliases' => array(),
Expand Down
4 changes: 3 additions & 1 deletion vendor/guzzlehttp/promises/src/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ function ($value, $idx) use (&$results): void {
$results[$idx] = $value;
},
function ($reason, $idx, Promise $aggregate): void {
$aggregate->reject($reason);
if (Is::pending($aggregate)) {
$aggregate->reject($reason);
}
}
)->then(function () use (&$results) {
ksort($results);
Expand Down

0 comments on commit 4f5985c

Please sign in to comment.