Loheide-eu-mitarbeiterplatt.../public/build/assets/SnippetEditor-DzJt1AUQ.js
Friederich Loheide 03e31f42b5
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 7m38s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 8m0s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 11m51s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 12m15s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 13m27s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 13m42s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 16m0s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 15m20s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 56s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m14s
Noch schneller (0.46.0)
- Erscheinungsbild: große Fotos (Anmeldung, Titelbild) beim Speichern als WebP
  ≤ 2400 px; Migration verkleinert vorhandene einmal
- Vite: Grundgerüst und UI-Bausteine als gemeinsame Dateien (Startseite 34 statt
  58 Skripte)
- Plugin-Oberflächen: Kopie nach public/ erneuert sich bei neuem Build
  (Fingerabdruck von dist/inhaus.json), auch ohne neue Version

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 17:00:29 +00:00

1 line
No EOL
7.9 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{Ot as e,P as t,U as n,W as r,et as ee,ft as te,it as ne,tt as re}from"./ui-DTELwomD.js";import{C as i,Et as ie,J as a,O as o,S as s,T as c,U as ae,W as oe,Y as se,_t as l,g as u,gt as d,i as ce,k as f,kt as p,ot as m,p as h,q as g,r as le,rt as _,st as v,v as y,w as b,wt as x,x as S}from"./framework-CFqPLBV8.js";import{t as ue}from"./arrow-left-CMu6dfzA.js";import{a as de,c as fe,i as pe,n as C,o as me,r as w,s as T,t as E}from"./EditorBlockList-DTYPsoDm.js";import{d as he,o as ge}from"./useMediaList-CcW71U_U.js";import{t as _e}from"./component-CJ3jlXhc.js";import{t as ve}from"./file-stack-BwzGP_ZX.js";import{t as ye}from"./plus-DBUMooLa.js";import{t as be}from"./save-BNWbmxLs.js";import{E as D,x as xe}from"./app-Bi2ZjL_5.js";import{n as Se,t as Ce}from"./useMediaPicker-CMbOxhTZ.js";var we={class:`flex h-dvh flex-col bg-background`},Te={class:`flex shrink-0 items-center gap-3 border-b bg-card px-3 py-2 sm:px-4`},Ee={class:`inline-flex shrink-0 items-center gap-1.5 rounded bg-brand-soft px-2 py-0.5 text-xs font-medium text-brand-soft-foreground`},De={class:`hidden min-w-0 flex-1 truncate text-xs text-muted-foreground sm:block`},Oe={key:2,class:`size-1.5 rounded-full bg-current`,"aria-label":`ungespeicherte Änderungen`},ke={class:`flex min-h-0 flex-1`},Ae={class:`mx-auto max-w-[1100px] px-4 py-8 sm:px-8`},je=[`placeholder`],Me={class:`@container`},Ne={class:`hidden w-[340px] shrink-0 flex-col border-l bg-card lg:flex`},Pe={class:`flex shrink-0 border-b px-2`,role:`tablist`},Fe=[`aria-selected`,`disabled`,`onClick`],Ie={key:0,class:`absolute inset-x-2 bottom-0 h-[3px] rounded-t-full bg-brand`},Le={class:`min-h-0 flex-1 overflow-y-auto p-4`},O=`/redaktion/bausteine`,k={__name:`SnippetEditor`,props:{snippet:{type:Object,required:!0},kinds:{type:Object,required:!0},usages:{type:Array,default:()=>[]},blockTypes:{type:Array,required:!0},blockGroups:{type:Object,required:!0},audienceOptions:{type:Object,required:!0},uploadsUrl:{type:String,required:!0}},setup(k){let A=k,j=Object.fromEntries(A.blockTypes.map(e=>[e.key,e])),M=A.snippet.kind===`block`,N=d({name:A.snippet.name,description:A.snippet.description??``,content:pe(A.snippet.content)}),P=l(null),F=l(null),I=d({}),L=l(`blocks`),R=l(!1),z=l(A.snippet.updated_at),B=S(()=>P.value?T(N.content.blocks,P.value)?.block??null:null);_(P,e=>L.value=e?`block`:`blocks`);let V=e=>P.value=e??null;function H(e,t,n){let r=de(n);e.splice(t,0,r),V(r.id)}function U(e){let t=B.value?T(N.content.blocks,B.value.id):null;t?H(t.list,t.index+1,e):H(N.content.blocks,N.content.blocks.length,e),R.value=!1}function Re(e){let t=T(N.content.blocks,e);t&&(t.list.splice(t.index,1),P.value===e&&V(null))}function ze(e,t){let n=T(N.content.blocks,e),r=n?n.index+t:-1;n&&r>=0&&r<n.list.length&&n.list.splice(r,0,n.list.splice(n.index,1)[0])}function Be(e){let t=T(N.content.blocks,e);if(!t)return;let n=me(t.block);t.list.splice(t.index+1,0,n),V(n.id)}function Ve(e){return[B.value,F.value?T(N.content.blocks,F.value)?.block:null].filter(Boolean).some(t=>t.items?.includes(e)||T(e.blocks,t.id))}let W=(e,t)=>he(`${O}/bilder`,e,{onProgress:t}),G=Ce({upload:W,contextLabel:M?`In diesem Baustein`:`In dieser Vorlage`,contextPaths:()=>ge(N.content)});a(`pagebuilder:editor`,{types:j,groups:A.blockGroups,selectedId:P,hoveredId:F,previews:I,readOnly:l(!1),files:l([]),peopleCache:d({}),audienceOptions:A.audienceOptions,select:V,insert:H,remove:Re,move:ze,duplicate:Be,containsActive:Ve,uploadImage:W,uploadFile:()=>Promise.reject(Error(`Dateien zum Herunterladen gehören zu einer Seite – bitte dort hochladen.`)),pickMedia:e=>G.pick(e),imageUrl:e=>`${A.uploadsUrl}/${e}`,saveAsSnippet:null}),a(`pagebuilder:list`,E),a(`pagebuilder:types`,j),a(`pagebuilder:editing`,S(()=>!0));let K={},q;function J(){let e=[];fe(N.content.blocks,t=>{if(!j[t.type]?.dynamic)return;let n=JSON.stringify(t.data);K[t.id]!==n&&(K[t.id]=n,e.push({id:t.id,type:t.type,data:t.data}))}),e.length&&D.post(`${O}/vorschau`,{blocks:e.slice(0,100)}).then(e=>Object.assign(I,e.props)).catch(()=>{})}let Y=l(!1),X=JSON.stringify(N),Z=l(!1);_(N,()=>{Z.value=JSON.stringify(N)!==X,clearTimeout(q),q=setTimeout(J,500)},{deep:!0});async function Q(){if(!Y.value){Y.value=!0;try{let e=await D.put(`${O}/${A.snippet.id}`,{name:N.name,description:N.description||null,content:N.content});X=JSON.stringify(N),Z.value=!1,z.value=e.updated_at,r.success(M&&A.usages.length?`Gespeichert – gilt jetzt auf ${A.usages.length} ${A.usages.length===1?`Seite`:`Seiten`}`:`Gespeichert`)}catch(e){r.error(e.data?.errors?.name?.[0]??e.message??`Speichern fehlgeschlagen`)}finally{Y.value=!1}}}function $(e){(e.ctrlKey||e.metaKey)&&e.key===`s`&&(e.preventDefault(),Q())}let He=e=>Z.value&&e.preventDefault();return oe(()=>{J(),window.addEventListener(`keydown`,$),window.addEventListener(`beforeunload`,He)}),ae(()=>{window.removeEventListener(`keydown`,$),window.removeEventListener(`beforeunload`,He)}),(r,a)=>(g(),c(y,null,[f(x(le),{title:`${k.kinds[k.snippet.kind]}: ${N.name}`},null,8,[`title`]),s(`div`,we,[s(`header`,Te,[f(x(ce),{href:`/redaktion`,class:`grid size-9 place-items-center rounded-md text-muted-foreground hover:bg-accent`,"aria-label":`Zurück zur Redaktion`},{default:m(()=>[f(x(ue),{class:`size-5`})]),_:1}),s(`span`,Ee,[M?(g(),i(x(_e),{key:0,class:`size-3.5`})):(g(),i(x(ve),{key:1,class:`size-3.5`})),o(` `+p(k.kinds[k.snippet.kind]),1)]),s(`p`,De,[M?(g(),c(y,{key:0},[o(p(k.usages.length?`Eingebunden auf: ${k.usages.map(e=>e.title).join(`, `)}`:`Noch auf keiner Seite eingebunden`),1)],64)):(g(),c(y,{key:1},[o(`Neue Seiten können mit diesem Inhalt starten.`)],64)),z.value?(g(),c(y,{key:2},[o(` · gespeichert `+p(x(xe)(z.value)),1)],64)):b(``,!0)]),a[8]||=s(`span`,{class:`flex-1 sm:hidden`},null,-1),f(x(t),{variant:`outline`,size:`icon`,class:`lg:hidden`,"aria-label":`Block hinzufügen`,onClick:a[0]||=e=>R.value=!0},{default:m(()=>[f(x(ye))]),_:1}),f(x(t),{disabled:Y.value||!N.name.trim(),onClick:Q},{default:m(()=>[Y.value?(g(),i(x(e),{key:0,class:`animate-spin`})):(g(),i(x(be),{key:1})),a[7]||=o(` Speichern`,-1),Z.value?(g(),c(`span`,Oe)):b(``,!0)]),_:1},8,[`disabled`])]),s(`div`,ke,[s(`main`,{class:`min-w-0 flex-1 overflow-y-auto`,onClick:a[5]||=e=>V(null)},[s(`div`,Ae,[v(s(`input`,{"onUpdate:modelValue":a[1]||=e=>N.name=e,class:`w-full bg-transparent text-3xl font-semibold tracking-tight outline-none placeholder:text-muted-foreground/60`,placeholder:M?`Name des Bausteins`:`Name der Vorlage`,maxlength:`120`,"aria-label":`Name`,onClick:a[2]||=u(()=>{},[`stop`])},null,8,je),[[h,N.name]]),v(s(`input`,{"onUpdate:modelValue":a[3]||=e=>N.description=e,class:`mt-1 mb-6 w-full bg-transparent text-sm text-muted-foreground outline-none placeholder:text-muted-foreground/60`,placeholder:`Kurze Beschreibung (optional) – erscheint bei der Auswahl`,maxlength:`300`,"aria-label":`Beschreibung`,onClick:a[4]||=u(()=>{},[`stop`])},null,512),[[h,N.description]]),s(`div`,Me,[f(E,{item:N.content,root:``},null,8,[`item`])])])]),s(`aside`,Ne,[s(`div`,Pe,[(g(),c(y,null,se([{key:`blocks`,label:`Blöcke`},{key:`block`,label:`Ausgewählter Block`}],e=>s(`button`,{key:e.key,type:`button`,role:`tab`,class:ie([`relative px-3 py-3 text-sm font-medium disabled:opacity-40`,L.value===e.key?`text-foreground`:`text-muted-foreground hover:text-foreground`]),"aria-selected":L.value===e.key,disabled:e.key===`block`&&!B.value,onClick:t=>L.value=e.key},[o(p(e.label)+` `,1),L.value===e.key?(g(),c(`span`,Ie)):b(``,!0)],10,Fe)),64))]),s(`div`,Le,[L.value===`block`&&B.value?(g(),i(C,{key:B.value.id,block:B.value},null,8,[`block`])):(g(),i(w,{key:1,onPick:U}))])])]),f(x(te),{open:R.value,"onUpdate:open":a[6]||=e=>R.value=e},{default:m(()=>[f(x(ne),{side:`right`,class:`w-[340px] overflow-y-auto p-4`},{default:m(()=>[f(x(re),{class:`p-0`},{default:m(()=>[f(x(ee),null,{default:m(()=>[o(p(B.value?`Block bearbeiten`:`Block hinzufügen`),1)]),_:1})]),_:1}),B.value?(g(),i(C,{key:B.value.id,block:B.value},null,8,[`block`])):(g(),i(w,{key:1,onPick:U}))]),_:1})]),_:1},8,[`open`])]),f(Se,{picker:x(G)},null,8,[`picker`]),f(x(n),{position:`bottom-left`})],64))}};export{k as default};