tout doit disparaitre

This commit is contained in:
antonin gallon 2025-11-28 17:58:50 +01:00
parent 7d3d20d006
commit 3df6ff186f
7 changed files with 86 additions and 124 deletions

View file

@ -8,8 +8,14 @@ tabs:
presentationSection: presentationSection:
type: fields type: fields
fields: fields:
demo:
type: demo web2printTest:
type: web2print
options:
- summary
- page-number
- cover
presentation: presentation:
extends: fields/body extends: fields/body
label: Présentation label: Présentation

View file

@ -1,2 +0,0 @@
/** Put your CSS here **/

View file

@ -1,40 +1 @@
(function() { (function(){"use strict";function d(n,t,o,c,s,r,i,a){var e=typeof n=="function"?n.options:n;return t&&(e.render=t,e.staticRenderFns=o,e._compiled=!0),{exports:n,options:e}}const l={__name:"Web2PrintBtn",props:{htmlPageString:String},setup(n){const{htmlPageString:t}=n;async function o(){const r=await fetch("https://web2print.studio-variable.com",{method:"POST","Content-Type":"application/pdf","X-API-Key":"25377ab6e2153b159d1d5fa22501228810b6aec9d63346bd0614045dc167061c",body:{html:t}});if(r.ok){const i=await r.blob(),a=window.URL.createObjectURL(i),e=document.createElement("a");e.href=a,e.download="document.pdf",e.click()}else{const i=await r.json();console.error("Erreur:",i)}}return{__sfc:!0,getPdf:o}}};var u=function(){var t=this,o=t._self._c,c=t._self._setupProxy;return o("k-button",{attrs:{variant:"filled"},on:{click:function(s){return c.getPdf()}}},[t._v("Button")])},f=[],_=d(l,u,f);const p=_.exports;window.panel.plugin("studio-variable/web2print",{fields:{web2print:p}})})();
"use strict";
function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
if (render) {
options.render = render;
options.staticRenderFns = staticRenderFns;
options._compiled = true;
}
return {
exports: scriptExports,
options
};
}
const _sfc_main = {
// Put your section logic here
};
var _sfc_render = function render() {
var _vm = this;
_vm._self._c;
return _vm._m(0);
};
var _sfc_staticRenderFns = [function() {
var _vm = this, _c = _vm._self._c;
return _c("section", { staticClass: "k-demo-section" }, [_c("header", { staticClass: "k-section-header" }, [_c("h2", { staticClass: "k-headline" }, [_vm._v("Test")])])]);
}];
_sfc_render._withStripped = true;
var __component__ = /* @__PURE__ */ normalizeComponent(
_sfc_main,
_sfc_render,
_sfc_staticRenderFns
);
__component__.options.__file = "C:/Users/anton/Desktop/studioVariable/actuelleInactuelle/actuel-inactuel/site/plugins/your-plugin/src/components/DemoSection.vue";
const DemoSection = __component__.exports;
window.panel.plugin("getkirby/pluginkit", {
sections: {
demo: DemoSection
}
});
})();

View file

@ -1,20 +1,16 @@
<?php <?php
Kirby::plugin('getkirby/pluginkit', [ Kirby::plugin('studio-variable/web2print', [
'fields' => [ 'fields' => [
'demo' => [ 'web2print' => [
'props' => [ 'props' => [
'value' => function ($value = null) { 'options' => function ($options = []) {
$margins = Yaml::decode($value); return $options;
return [ },
'top' => 0, 'value' => function ($value = []) {
'right' => 0, return $value;
'bottom' => 0,
'left' => 0,
...$margins
];
} }
] ],
] ],
], ],
]); ]);

View file

@ -1,60 +0,0 @@
<template>
<k-field class="">
<header class="k-section-header">
<h2 class="k-headline">Test</h2>
</header>
<main>
<k-input
:value="value.top"
type="text"
before="Top"
@input="onInput('top', $event)"
/>
<k-input
:value="value.right"
type="text"
before="Right"
@input="onInput('right', $event)"
/>
<k-input
:value="value.bottom"
type="text"
before="Bottom"
@input="onInput('bottom', $event)"
/>
<k-input
:value="value.left"
type="text"
before="Left"
@input="onInput('left', $event)"
/>
<k-button class="k-button">
Générer le fichier texte
</k-button>
</main>
</k-field>
</template>
<script>
export default {
extends: "k-field",
props: {
value: Object
},
methods: {
onInput(margin, value){
const newValue = {
...this.value,
[margin]: value
}
this.$emit("input", newValue)
}
}
};
</script>
<style>
/** Put your CSS here **/
</style>

View file

@ -0,0 +1,61 @@
<template>
<k-field class="bg-red" v-bind="$props">
<k-form :fields="computedFields" v-model="localValue" @input="update" />
</k-field>
</template>
<script>
export default {
props: {
value: Object,
options: Array,
},
data() {
return {
localValue: this.value || {}
};
},
computed: {
computedFields() {
const fields = {};
if (this.options.includes("summary")) {
fields.summary = {
label: "Inclure le sommaire",
type: "toggle"
};
}
if (this.options.includes("page-number")) {
fields.pageNumber = {
label: "Afficher la numérotation",
type: "toggle"
};
}
if (this.options.includes("cover")) {
fields.cover = {
label: "Inclure la couverture",
type: "toggle"
};
}
return fields;
}
},
methods: {
update() {
this.$emit("input", this.localValue);
}
}
};
</script>
<style>
.bg-red{
border: solid red 2px;
}
</style>

View file

@ -1,7 +1,7 @@
import DemoSection from "./components/DemoSection.vue"; import ToggleGroup from "./components/Web2printField.vue";
window.panel.plugin("getkirby/pluginkit", { window.panel.plugin("studio-variable/web2print", {
fields: { fields: {
demo: DemoSection web2print: ToggleGroup
} }
}); });