je ne sais plus se que contient se commit

This commit is contained in:
antonin gallon 2026-02-09 15:36:00 +01:00
parent c4892e919c
commit 309111c23a
6 changed files with 102 additions and 13 deletions

View file

@ -29,7 +29,8 @@
"php-http/guzzle7-adapter": "^1.1", "php-http/guzzle7-adapter": "^1.1",
"mailersend/mailersend": "^0.28.0", "mailersend/mailersend": "^0.28.0",
"sylvainjule/code-editor": "^1.0", "sylvainjule/code-editor": "^1.0",
"tobimori/kirby-seo": "^1.1" "tobimori/kirby-seo": "^1.1",
"splorp/paperback-export": "^2.0"
}, },
"config": { "config": {
"platform": { "platform": {

51
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "30f9edc8f90ec79150fffac01e3b80fd", "content-hash": "8ef02ef5b3cde9ff5bc677b8766397a3",
"packages": [ "packages": [
{ {
"name": "beberlei/assert", "name": "beberlei/assert",
@ -2292,6 +2292,55 @@
], ],
"time": "2025-01-31T14:54:12+00:00" "time": "2025-01-31T14:54:12+00:00"
}, },
{
"name": "splorp/paperback-export",
"version": "2.0.7",
"source": {
"type": "git",
"url": "https://github.com/splorp/kirby-paperback-export.git",
"reference": "94a43248af69040f1144700262e35842ce6602ff"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/splorp/kirby-paperback-export/zipball/94a43248af69040f1144700262e35842ce6602ff",
"reference": "94a43248af69040f1144700262e35842ce6602ff",
"shasum": ""
},
"require": {
"getkirby/composer-installer": "^1.1"
},
"type": "kirby-plugin",
"extra": {
"installer-name": "paperback-export"
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Grant Hutchinson",
"email": "grant@splorp.com",
"homepage": "https://splorp.com/"
}
],
"description": "Export Kirby CMS content for use with the PaperBack Book Maker",
"homepage": "https://github.com/splorp/kirby-paperback-export",
"keywords": [
"kirby",
"kirby-cms",
"kirby-plugin",
"newton-book",
"newton-os",
"paperback-book-maker"
],
"support": {
"docs": "https://github.com/splorp/kirby-paperback-export/blob/master/readme.md",
"issues": "https://github.com/splorp/kirby-paperback-export/issues",
"source": "https://github.com/splorp/kirby-paperback-export"
},
"time": "2025-06-25T20:50:14+00:00"
},
{ {
"name": "sylvainjule/code-editor", "name": "sylvainjule/code-editor",
"version": "1.1.0", "version": "1.1.0",

View file

@ -11,13 +11,13 @@ tabs:
contentTab: contentTab:
label: Contenu label: Contenu
sections: sections:
epub-export:
type: epubexport
headline: "Exporter cette page"
bodySection: bodySection:
label: Corps label: Corps
type: fields type: fields
fields: fields:
epub-export:
type: epubexport
headline: "Exporter cette page"
pdfVersion: pdfVersion:
label: version pdf label: version pdf
help: glisser ici le fichier pdf généré avec `ctrl + p` depuis la page du site help: glisser ici le fichier pdf généré avec `ctrl + p` depuis la page du site

View file

@ -7,9 +7,11 @@ Kirby::plugin('tonnom/epub-export', [
'pattern' => 'epub-export/(:any)', 'pattern' => 'epub-export/(:any)',
'method' => 'POST', 'method' => 'POST',
'action' => function () { 'action' => function () {
$pageId = get('id'); $pageId = get('id');
$page = page($pageId); $page = page($pageId);
throw new Exception($page);
throw new Exception($pageId);
if (!$page) { if (!$page) {
throw new Exception("Page introuvable"); throw new Exception("Page introuvable");
} }
@ -37,14 +39,13 @@ Kirby::plugin('tonnom/epub-export', [
] ]
], ],
'sections' => [ 'fields' => [
'epubexport' => [ 'epubexport' => [
'props' => [ 'computed' => [
'pageId' => function () { 'pageId' => function () {
return $this->model()->id(); return $this->model()->id();
}, },
], ],
'component' => 'export-button'
] ]
] ]
]); ]);

View file

@ -14,7 +14,7 @@
</k-box> </k-box>
</template> </template>
<script> <!-- <script>
export default { export default {
props: { props: {
pageId: String pageId: String
@ -29,8 +29,7 @@
async exportEpub() { async exportEpub() {
this.loading = true; this.loading = true;
this.error = null; this.error = null;
console.log(this.pageId)
try { try {
const response = await this.$api.post(`epub-export/${this.pageId}`); const response = await this.$api.post(`epub-export/${this.pageId}`);
const blob = await response.blob() const blob = await response.blob()
@ -52,4 +51,42 @@
} }
} }
} }
</script> -->
<script setup>
import { ref } from 'vue'
// Props
const { pageId } = defineProps({
pageId: String
})
// State
const loading = ref(false)
const error = ref(null)
// Methods
async function exportEpub() {
loading.value = true
error.value = null
try {
// Appel API
const response = await $api.post(`epub-export/${pageId}`)
const blob = await response.blob()
// Création du téléchargement
const url = window.URL.createObjectURL(blob)
const a = document.createElement('a')
a.href = url
a.download = pageId + '.epub'
a.click()
} catch (e) {
error.value = 'Erreur : ' + e.message
} finally {
loading.value = false
}
}
</script> </script>

View file

@ -1,7 +1,8 @@
import ExportButton from "./components/ExportButton.vue"; import ExportButton from "./components/ExportButton.vue";
window.panel.plugin("tonnom/epub-export", { window.panel.plugin("tonnom/epub-export", {
sections: { fields: {
epubexport: ExportButton epubexport: ExportButton
} }
}); });