domma-cms 0.7.0 → 0.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/admin/js/config/sidebar-config.js +1 -1
- package/admin/js/lib/markdown-toolbar.js +7 -2
- package/admin/js/templates/documentation.html +121 -0
- package/admin/js/views/documentation.js +1 -1
- package/admin/js/views/page-editor.js +29 -27
- package/config/navigation.json +5 -0
- package/config/plugins.json +8 -0
- package/package.json +1 -1
- package/plugins/analytics/stats.json +6 -6
- package/plugins/data-transfer/admin/templates/data-transfer.html +172 -0
- package/plugins/data-transfer/admin/views/data-transfer.js +558 -0
- package/plugins/data-transfer/config.js +9 -0
- package/plugins/data-transfer/plugin.js +424 -0
- package/plugins/data-transfer/plugin.json +33 -0
- package/plugins/garage/admin/templates/garage.html +81 -0
- package/plugins/garage/admin/views/garage.js +561 -0
- package/plugins/garage/config.js +18 -0
- package/plugins/garage/data/vehicles.json +70 -0
- package/plugins/garage/plugin.js +438 -0
- package/plugins/garage/plugin.json +33 -0
- package/server/routes/api/auth.js +17 -3
- package/server/routes/api/users.js +3 -0
- package/server/server.js +1 -1
- package/server/services/content.js +6 -2
- package/server/services/markdown.js +66 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
export function getSidebarConfig(o=[],t={},
|
|
1
|
+
export function getSidebarConfig(o=[],t={},r=[]){const e=n=>o.includes(n)||["read","create","update","delete"].some(l=>o.includes(`${n}.${l}`)),s=n=>n==null?null:typeof n=="string"?n.length>0?n:null:n>0?String(n):null,i=[],u=o.length>0&&o.every(n=>n.startsWith("jb-"));u||i.push({heading:"Overview"},{id:"dashboard",text:"Dashboard",icon:"home",url:"#/",section:"#/"},{divider:!0}),(e("navigation")||e("layouts"))&&i.push({heading:"Structure"},...e("navigation")?[{id:"navigation",text:"Navigation",icon:"menu",url:"#/navigation",section:"#/navigation",badge:s(t.navigation)}]:[],...e("layouts")?[{id:"layouts",text:"Layouts",icon:"layout",url:"#/layouts",section:"#/layouts",badge:s(t.layouts)}]:[],{divider:!0}),(e("pages")||e("media"))&&(i.push({heading:"Content"}),e("pages")&&i.push({id:"pages",text:"Pages",icon:"file-text",url:"#/pages",section:"#/pages",badge:s(t.pages)}),e("media")&&i.push({id:"media",text:"Media",icon:"image",url:"#/media",section:"#/media",badge:s(t.media)})),(e("collections")||e("views")||e("actions"))&&(i.push({divider:!0},{heading:"Data"}),e("collections")&&(i.push({id:"collections",text:"Collections",icon:"database",url:"#/collections",section:"#/collections",badge:s(t.collections)}),i.push({id:"forms",text:"Forms",icon:"layout",url:"#/forms",section:"#/forms",badge:s(t.forms)})),e("views")&&i.push({id:"views",text:"Views",icon:"eye",url:"#/views",section:"#/views",badge:s(t.views)}),e("actions")&&i.push({id:"actions",text:"Actions",icon:"zap",url:"#/actions",section:"#/actions",badge:s(t.actions)}),e("pages")&&i.push({id:"blocks",text:"Blocks",icon:"box",url:"#/blocks",section:"#/blocks",badge:s(t.blocks)})),(e("plugins")||e("users")||e("settings"))&&(i.push({divider:!0},{heading:"Configuration"}),e("plugins")&&i.push({id:"roles",text:"Roles",icon:"shield",url:"#/roles",section:"#/roles",badge:s(t.roles)}),e("users")&&i.push({id:"users",text:"Users",icon:"users",url:"#/users",section:"#/users",badge:s(t.users)}),e("settings")&&i.push({id:"settings",text:"Site Settings",icon:"settings",url:"#/settings",section:"#/settings"}));const a=r.filter(n=>n.permissions?.length?n.permissions.some(l=>o.includes(l)):!0);return e("plugins")?i.push({divider:!0},{heading:"Plugins"},{id:"plugins",text:"Plugins",icon:"package",url:"#/plugins",section:"#/plugins",badge:s(t.plugins)},...a):a.length&&i.push({divider:!0},...a),i.push({divider:!0},{heading:"Account"},{id:"my-profile",text:"My Profile",icon:"user",url:"#/my-profile",section:"#/my-profile"}),u||i.push({divider:!0},{heading:"View Site"},{id:"view-site",text:"View Site",icon:"external-link",url:"/",section:"/"}),(e("pages")||e("collections")||e("plugins")||e("settings"))&&i.push({divider:!0},{heading:"Documentation"},{id:"documentation",text:"Usage",icon:"book",url:"#/documentation",section:"#/documentation",badge:s(t.documents)},{id:"tutorials",text:"Tutorials",icon:"document",url:"#/tutorials",section:"#/documentation",badge:s(t.tutorials)},{id:"api-reference",text:"API Reference",icon:"code",url:"#/api-reference",section:"#/documentation"}),i}
|
|
@@ -55,10 +55,15 @@ Describe this event.
|
|
|
55
55
|
Describe this event.
|
|
56
56
|
[/event]
|
|
57
57
|
[/timeline]
|
|
58
|
-
`;e.value=e.value.substring(0,l)+r+e.value.substring(l),e.selectionStart=e.selectionEnd=l+r.length,e.dispatchEvent(new Event("input",{bubbles:!0})),e.focus()}else if(t==="effects")o.effects?o.effects(e):se(e,h);else if(t==="spacerpick")ce(e,h,c);else if(t==="iconpick")ae(e,h);else if(t==="
|
|
58
|
+
`;e.value=e.value.substring(0,l)+r+e.value.substring(l),e.selectionStart=e.selectionEnd=l+r.length,e.dispatchEvent(new Event("input",{bubbles:!0})),e.focus()}else if(t==="effects")o.effects?o.effects(e):se(e,h);else if(t==="spacerpick")ce(e,h,c);else if(t==="iconpick")ae(e,h);else if(t==="listgroup")o.listgroup?o.listgroup(e):insertAtCursor(e,`[listgroup]
|
|
59
|
+
[item]Item 1[/item]
|
|
60
|
+
[item]Item 2[/item]
|
|
61
|
+
[item]Item 3[/item]
|
|
62
|
+
[/listgroup]
|
|
63
|
+
`);else if(t==="collection")o.collection?o.collection(e):insertAtCursor(e,'[collection slug="" display="table" /]');else if(t==="view")o.view&&o.view(e);else if(t==="cta")o.cta&&o.cta(e);else if(t==="form")o.form?o.form(e):insertAtCursor(e,'[form slug="" /]');else if(t==="tabs")o.tabs&&o.tabs(e);else if(t==="accordion")if(o.accordion)o.accordion(e);else{const l=e.selectionStart,r=`[accordion]
|
|
59
64
|
[item title="Item 1"]Content here.[/item]
|
|
60
65
|
[item title="Item 2"]Content here.[/item]
|
|
61
66
|
[/accordion]
|
|
62
67
|
`;e.value=e.value.substring(0,l)+r+e.value.substring(l),e.selectionStart=e.selectionEnd=l+r.length,e.dispatchEvent(new Event("input",{bubbles:!0})),e.focus()}else if(t==="text"){let n=function(m,u){const f=document.createElement("div"),L=document.createElement("label");return L.style.cssText=a,L.textContent=m,f.appendChild(L),f.appendChild(u),f},s=function(m){const u=document.createElement("select");return u.style.cssText=b,[["","\u2014 default \u2014"],...m].forEach(([f,L])=>{const H=document.createElement("option");H.value=f,H.textContent=L,u.appendChild(H)}),u},p=function(m,u){const f=document.createElement("input");return f.type="text",f.placeholder=m||"",f.value=u||"",f.style.cssText=b,f},v=function(m){const u=document.createElement("label");u.style.cssText="display:flex;align-items:center;gap:.5rem;cursor:pointer;";const f=document.createElement("input");f.type="checkbox";const L=document.createElement("span");return L.style.cssText="font-size:.85em;color:var(--dm-text,#eee);",L.textContent=m,u.appendChild(f),u.appendChild(L),{wrap:u,cb:f}},y=function(m,u){const f=document.createElement("div");return f.style.cssText="display:grid;grid-template-columns:1fr 1fr;gap:.5rem;",f.appendChild(m),f.appendChild(u),f},k=function(m){const u=document.createElement("div");return u.style.cssText="border-top:1px solid var(--dm-border,#333);padding-top:.5rem;margin-top:.1rem;font-size:.65rem;font-weight:700;color:var(--dm-text-muted,#aaa);text-transform:uppercase;letter-spacing:.08em;",u.textContent=m,u},q=function(){const m=[];C.value&&m.push(`font-size:${Y[C.value]||C.value}`);const u=parseFloat(S.value);!isNaN(u)&&u>0&&m.push(`font-size:${u}pt`),M.checked?m.push("font-weight:700"):x.value&&m.push(`font-weight:${ee[x.value]||x.value}`),O.checked&&m.push("font-style:italic");const f=W.value.trim();f&&m.push(`color:${X[f]||f}`),z.value&&m.push(`font-family:${ne[z.value]}`),T.value&&m.push(`text-transform:${oe[T.value]}`),N.value&&m.push(`text-decoration:${ie[N.value]}`),B.value&&m.push(`letter-spacing:${te[B.value]}`),A.value&&(m.push("display:block"),m.push(`text-align:${A.value}`)),R.value.trim()&&m.push(R.value.trim()),D.style.cssText=m.join(";"),D.textContent=w.value||"Preview text"};const l=e.selectionStart,r=e.selectionEnd,d=e.value.substring(l,r)||"",a="display:block;font-size:.7rem;font-weight:600;color:var(--dm-text-muted,#aaa);text-transform:uppercase;letter-spacing:.05em;",b="width:100%;padding:.4rem .6rem;background:var(--dm-input-bg,#1a1a1a);border:1px solid var(--dm-border,#333);border-radius:4px;color:var(--dm-text,#eee);font-size:.9em;",g=document.createElement("div");g.style.cssText="padding:1rem;display:flex;flex-direction:column;gap:.6rem;overflow-y:auto;max-height:75vh;";const w=p("Text to style\u2026",d);g.appendChild(n("Content",w)),g.appendChild(k("Typography"));const C=s([["xs","xs \u2014 0.75rem"],["sm","sm \u2014 0.875rem"],["base","base \u2014 1rem"],["lg","lg \u2014 1.125rem"],["xl","xl \u2014 1.25rem"],["2xl","2xl \u2014 1.5rem"],["3xl","3xl \u2014 1.875rem"],["4xl","4xl \u2014 2.25rem"]]),S=p("pt value (overrides Size)");g.appendChild(y(n("Size",C),n("Point Size (pt)",S)));const x=s([["thin","Thin (100)"],["light","Light (300)"],["normal","Normal (400)"],["medium","Medium (500)"],["semibold","Semibold (600)"],["bold","Bold (700)"],["extrabold","Extrabold (800)"],["black","Black (900)"]]),{wrap:j,cb:M}=v("Bold (overrides Weight)"),{wrap:Q,cb:O}=v("Italic"),V=document.createElement("div");V.style.cssText="display:flex;flex-direction:column;gap:.4rem;justify-content:flex-end;",V.appendChild(j),V.appendChild(Q),g.appendChild(y(n("Weight",x),V)),g.appendChild(k("Appearance"));const W=p("e.g. primary, #ff0000"),z=s([["Georgia","Georgia (serif)"],["Arial","Arial (sans-serif)"],["Verdana","Verdana (sans-serif)"],["Courier New","Courier New (mono)"],["Times New Roman","Times New Roman (serif)"],["Trebuchet MS","Trebuchet MS"]]);g.appendChild(y(n("Colour",W),n("Font",z))),g.appendChild(k("Formatting"));const T=s([["upper","Uppercase"],["lower","Lowercase"],["capitalize","Capitalise"],["none","None"]]),N=s([["underline","Underline"],["line-through","Line-through"],["none","None"]]);g.appendChild(y(n("Transform",T),n("Decoration",N)));const B=s([["tight","Tight"],["normal","Normal"],["wide","Wide"],["wider","Wider"]]),A=s([["left","Left"],["center","Centre"],["right","Right"],["justify","Justify"]]);g.appendChild(y(n("Spacing",B),n("Align",A))),g.appendChild(k("Advanced"));const R=p("e.g. margin-top:1rem;display:block");g.appendChild(n("Style",R));const _=p("CSS class(es)"),F=p("ID");g.appendChild(y(n("Class",_),n("ID",F)));const G=document.createElement("div");G.style.cssText="padding:.75rem;background:var(--dm-surface-subtle,#111);border-radius:4px;min-height:2.5rem;display:flex;align-items:center;";const D=document.createElement("span");D.textContent=d||"Preview text",G.appendChild(D),g.appendChild(n("Preview",G));const X={primary:"var(--dm-color-primary)",secondary:"var(--dm-color-secondary)",muted:"var(--dm-text-muted)",danger:"var(--dm-color-danger)",success:"var(--dm-color-success)",warning:"var(--dm-color-warning)",info:"var(--dm-color-info)"},Y={xs:".75rem",sm:".875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem","4xl":"2.25rem"},ee={thin:"100",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"},te={tight:"-0.05em",normal:"0em",wide:"0.05em",wider:"0.1em"},ne={Georgia:"Georgia,serif",Arial:"Arial,sans-serif",Verdana:"Verdana,sans-serif","Courier New":"'Courier New',monospace","Times New Roman":"'Times New Roman',serif","Trebuchet MS":"'Trebuchet MS',sans-serif"},oe={upper:"uppercase",lower:"lowercase",capitalize:"capitalize",none:"none"},ie={underline:"underline","line-through":"line-through",none:"none"};M.addEventListener("change",()=>{x.disabled=M.checked,M.checked&&(x.value=""),q()}),[C,x,z,T,N,B,A].forEach(m=>{m.addEventListener("change",q)}),[W,w,R,S].forEach(m=>{m.addEventListener("input",q)}),O.addEventListener("change",q);const P=document.createElement("button");P.type="button",P.className="btn btn-primary",P.textContent="Insert",g.appendChild(P);const K=E.modal({title:"Style Text",size:"md"});K.element.appendChild(g),K.open(),P.addEventListener("click",()=>{const m=w.value;if(!m.trim())return;const u=[];C.value&&u.push(`size="${C.value}"`);const f=parseFloat(S.value);!isNaN(f)&&f>0&&u.push(`point-size="${f}"`),M.checked?u.push("bold"):x.value&&u.push(`weight="${x.value}"`),O.checked&&u.push("italic"),W.value.trim()&&u.push(`color="${W.value.trim()}"`),z.value&&u.push(`font="${z.value}"`),T.value&&u.push(`transform="${T.value}"`),N.value&&u.push(`decoration="${N.value}"`),B.value&&u.push(`spacing="${B.value}"`),A.value&&u.push(`align="${A.value}"`),R.value.trim()&&u.push(`style="${R.value.trim().replace(/"/g,""")}"`),_.value.trim()&&u.push(`class="${_.value.trim()}"`),F.value.trim()&&u.push(`id="${F.value.trim()}"`);const H=`[text${u.length?" "+u.join(" "):""}]${m}[/text]`;K.close(),insertAtCursor(e,H),e.dispatchEvent(new Event("input",{bubbles:!0})),e.focus()})}else t==="help"&&o.help&&o.help(e)}const J=[{icon:"bold",title:"Bold (Ctrl+B)",action:t=>wrapSelection(t,"**","**")},{icon:"italic",title:"Italic (Ctrl+I)",action:t=>wrapSelection(t,"_","_")},{icon:"strikethrough",title:"Strikethrough",action:t=>wrapSelection(t,"~~","~~")},"|",{type:"dropdown",icon:"heading-1",title:"Headings",items:[{label:"Heading 1",icon:"heading-1",action:t=>insertLine(t,"# ")},{label:"Heading 2",icon:"heading-2",action:t=>insertLine(t,"## ")},{label:"Heading 3",icon:"heading-3",action:t=>insertLine(t,"### ")}]},"|",{icon:"list-bullet",title:"Bullet list",action:t=>insertLine(t,"- ")},{icon:"list-numbered",title:"Numbered list",action:t=>insertLine(t,"1. ")},"|",{type:"dropdown",icon:"quote",title:"Paragraph",items:[{label:"Blockquote",icon:"quote",action:t=>insertLine(t,"> ")},{label:"Horizontal rule",icon:"minus-circle",action:t=>insertAtCursor(t,`
|
|
63
68
|
---
|
|
64
|
-
`)}]},"|",{type:"dropdown",icon:"code-inline",title:"Code",items:[{label:"Inline code",icon:"code-inline",action:t=>wrapSelection(t,"`","`")},{label:"Code block",icon:"code-block",action:t=>wrapSelection(t,"\n```\n","\n```\n")}]},"|",{type:"dropdown",icon:"plus-circle",title:"Insert",items:[{label:"Accordion",icon:"accordion-insert",action:"accordion"},{label:"Badge",icon:"badge",action:"badge"},{label:"Block",icon:"layout",action:"block"},{label:"Button",icon:"btn-insert",action:"button"},{label:"Card",icon:"card",action:"card"},{label:"Colour Picker",icon:"colour-picker",action:"colourpick"},{label:"Collection",icon:"database",action:"collection"},{label:"CTA Button",icon:"mouse-pointer",action:"cta"},{label:"Form",icon:"file-text",action:"form"},{label:"Grid",icon:"columns",action:"grid"},{label:"Hero",icon:"hero",action:"hero"},{label:"Icon",icon:"icon-pick",action:"iconpick"},{label:"Image",icon:"image-add",action:"image"},{label:"Link",icon:"link-shortcode",action:"linksc"},{label:"Spacer",icon:"spacer-insert",action:"spacerpick"},{label:"Tabs",icon:"layout-list",action:"tabs"},{label:"Text",icon:"text-style",action:"text"},{label:"Timeline",icon:"activity",action:"timeline"},{label:"View",icon:"eye",action:"view"}]},"|",{icon:"sparkles",title:"Effects",action:"effects"},{icon:"help-circle",title:"Editor help",action:"help"}];export function createToolbar(t,e,h={}){re();const i={link:null,image:null,card:null,grid:null,help:null,effects:null,collection:null,view:null,cta:null,form:null,button:null,linksc:null,tabs:null,accordion:null},c=h.spacerDefault??40,o=t.get(0),l=e.get(0);l.textContent="",J.forEach((n,s)=>{if(n==="|"){const p=document.createElement("span");p.className="editor-toolbar-sep",l.appendChild(p)}else{const p=document.createElement("button");p.className=n.type==="dropdown"?"editor-toolbar-btn editor-toolbar-dropdown-trigger":"editor-toolbar-btn",p.setAttribute("data-tooltip",n.title),p.setAttribute("data-idx",String(s)),p.type="button";const v=document.createElement("span");if(v.setAttribute("data-icon",n.icon),p.appendChild(v),n.type==="dropdown"){const y=document.createElement("span");y.className="editor-toolbar-caret",y.textContent="\u25BE",p.appendChild(y)}l.appendChild(p)}});const r=document.createElement("div");r.className="editor-toolbar-right",[{mode:"split",icon:"columns",label:"Split view",active:!0},{mode:"write",icon:"file-text",label:"Write only",active:!1},{mode:"preview",icon:"eye",label:"Preview only",active:!1}].forEach(n=>{const s=document.createElement("button");s.className="editor-view-btn"+(n.active?" active":""),s.setAttribute("data-mode",n.mode),s.setAttribute("data-tooltip",n.label),s.type="button";const p=document.createElement("span");p.setAttribute("data-icon",n.icon),s.appendChild(p),r.appendChild(s)});const d=document.createElement("span");d.className="editor-toolbar-sep",r.appendChild(d);const a=document.createElement("button");a.id="fullscreen-btn",a.className="editor-toolbar-btn",a.setAttribute("data-tooltip","Toggle fullscreen"),a.type="button";const b=document.createElement("span");return b.setAttribute("data-icon","expand"),a.appendChild(b),r.appendChild(a),l.appendChild(r),Domma.icons.scan(),l.querySelectorAll("[data-tooltip]").forEach(n=>{E.tooltip(n,{content:n.getAttribute("data-tooltip"),position:"top"})}),e.on("click",".editor-toolbar-btn[data-idx]",function(){const n=parseInt($(this).data("idx"),10),s=J[n];if(!s||s==="|")return;const p=e.get(0).querySelector(`[data-idx="${n}"]`),v={spacerDefault:c,handlers:i};s.type==="dropdown"?de(o,p,s.items,v):U(s.action,o,p,v)}),attachEditorKeybindings(o),o.addEventListener("keydown",n=>{const s=n.key.toLowerCase();(n.ctrlKey||n.metaKey)&&(s==="b"?(n.preventDefault(),wrapSelection(o,"**","**")):s==="i"?(n.preventDefault(),wrapSelection(o,"_","_")):s==="k"&&(n.preventDefault(),i.link&&i.link(o)))}),{$toolbar:e,onLink(n){i.link=n},onImage(n){i.image=n},onCard(n){i.card=n},onGrid(n){i.grid=n},onHelp(n){i.help=n},onEffects(n){i.effects=n},onCollection(n){i.collection=n},onBlock(n){i.block=n},onView(n){i.view=n},onCta(n){i.cta=n},onForm(n){i.form=n},onButton(n){i.button=n},onLinkShortcode(n){i.linksc=n},onTabs(n){i.tabs=n},onAccordion(n){i.accordion=n}}}
|
|
69
|
+
`)}]},"|",{type:"dropdown",icon:"code-inline",title:"Code",items:[{label:"Inline code",icon:"code-inline",action:t=>wrapSelection(t,"`","`")},{label:"Code block",icon:"code-block",action:t=>wrapSelection(t,"\n```\n","\n```\n")}]},"|",{type:"dropdown",icon:"plus-circle",title:"Insert",items:[{label:"Accordion",icon:"accordion-insert",action:"accordion"},{label:"Badge",icon:"badge",action:"badge"},{label:"Block",icon:"layout",action:"block"},{label:"Button",icon:"btn-insert",action:"button"},{label:"Card",icon:"card",action:"card"},{label:"Colour Picker",icon:"colour-picker",action:"colourpick"},{label:"Collection",icon:"database",action:"collection"},{label:"CTA Button",icon:"mouse-pointer",action:"cta"},{label:"Form",icon:"file-text",action:"form"},{label:"Grid",icon:"columns",action:"grid"},{label:"Hero",icon:"hero",action:"hero"},{label:"Icon",icon:"icon-pick",action:"iconpick"},{label:"Image",icon:"image-add",action:"image"},{label:"Link",icon:"link-shortcode",action:"linksc"},{label:"List Group",icon:"list",action:"listgroup"},{label:"Spacer",icon:"spacer-insert",action:"spacerpick"},{label:"Tabs",icon:"layout-list",action:"tabs"},{label:"Text",icon:"text-style",action:"text"},{label:"Timeline",icon:"activity",action:"timeline"},{label:"View",icon:"eye",action:"view"}]},"|",{icon:"sparkles",title:"Effects",action:"effects"},{icon:"help-circle",title:"Editor help",action:"help"}];export function createToolbar(t,e,h={}){re();const i={link:null,image:null,card:null,grid:null,help:null,effects:null,collection:null,view:null,cta:null,form:null,button:null,linksc:null,tabs:null,accordion:null},c=h.spacerDefault??40,o=t.get(0),l=e.get(0);l.textContent="",J.forEach((n,s)=>{if(n==="|"){const p=document.createElement("span");p.className="editor-toolbar-sep",l.appendChild(p)}else{const p=document.createElement("button");p.className=n.type==="dropdown"?"editor-toolbar-btn editor-toolbar-dropdown-trigger":"editor-toolbar-btn",p.setAttribute("data-tooltip",n.title),p.setAttribute("data-idx",String(s)),p.type="button";const v=document.createElement("span");if(v.setAttribute("data-icon",n.icon),p.appendChild(v),n.type==="dropdown"){const y=document.createElement("span");y.className="editor-toolbar-caret",y.textContent="\u25BE",p.appendChild(y)}l.appendChild(p)}});const r=document.createElement("div");r.className="editor-toolbar-right",[{mode:"split",icon:"columns",label:"Split view",active:!0},{mode:"write",icon:"file-text",label:"Write only",active:!1},{mode:"preview",icon:"eye",label:"Preview only",active:!1}].forEach(n=>{const s=document.createElement("button");s.className="editor-view-btn"+(n.active?" active":""),s.setAttribute("data-mode",n.mode),s.setAttribute("data-tooltip",n.label),s.type="button";const p=document.createElement("span");p.setAttribute("data-icon",n.icon),s.appendChild(p),r.appendChild(s)});const d=document.createElement("span");d.className="editor-toolbar-sep",r.appendChild(d);const a=document.createElement("button");a.id="fullscreen-btn",a.className="editor-toolbar-btn",a.setAttribute("data-tooltip","Toggle fullscreen"),a.type="button";const b=document.createElement("span");return b.setAttribute("data-icon","expand"),a.appendChild(b),r.appendChild(a),l.appendChild(r),Domma.icons.scan(),l.querySelectorAll("[data-tooltip]").forEach(n=>{E.tooltip(n,{content:n.getAttribute("data-tooltip"),position:"top"})}),e.on("click",".editor-toolbar-btn[data-idx]",function(){const n=parseInt($(this).data("idx"),10),s=J[n];if(!s||s==="|")return;const p=e.get(0).querySelector(`[data-idx="${n}"]`),v={spacerDefault:c,handlers:i};s.type==="dropdown"?de(o,p,s.items,v):U(s.action,o,p,v)}),attachEditorKeybindings(o),o.addEventListener("keydown",n=>{const s=n.key.toLowerCase();(n.ctrlKey||n.metaKey)&&(s==="b"?(n.preventDefault(),wrapSelection(o,"**","**")):s==="i"?(n.preventDefault(),wrapSelection(o,"_","_")):s==="k"&&(n.preventDefault(),i.link&&i.link(o)))}),{$toolbar:e,onLink(n){i.link=n},onImage(n){i.image=n},onCard(n){i.card=n},onGrid(n){i.grid=n},onHelp(n){i.help=n},onEffects(n){i.effects=n},onCollection(n){i.collection=n},onBlock(n){i.block=n},onView(n){i.view=n},onCta(n){i.cta=n},onForm(n){i.form=n},onButton(n){i.button=n},onLinkShortcode(n){i.linksc=n},onTabs(n){i.tabs=n},onAccordion(n){i.accordion=n},onListGroup(n){i.listgroup=n}}}
|
|
@@ -627,5 +627,126 @@ Step 3: email to={{entry.data.email}}
|
|
|
627
627
|
</div>
|
|
628
628
|
</div>
|
|
629
629
|
|
|
630
|
+
<!-- CTA Shortcode -->
|
|
631
|
+
<div class="card card-collapsible mb-4">
|
|
632
|
+
<div class="card-header" role="button" tabindex="0">
|
|
633
|
+
<div class="card-header-content"><h2><span data-icon="mouse-pointer"></span> CTA Shortcode <span
|
|
634
|
+
class="badge badge-warning" style="font-size:.7rem;">Pro</span></h2></div>
|
|
635
|
+
<span class="card-collapse-icon" data-icon="chevron-down"></span>
|
|
636
|
+
</div>
|
|
637
|
+
<div class="card-body docs-body">
|
|
638
|
+
<p>The <code>[cta]</code> shortcode places an action-trigger button in any public page. Clicking it calls
|
|
639
|
+
<code>POST /api/actions/:slug/public</code> with the entry ID, using the logged-in user's JWT.
|
|
640
|
+
If the user is not logged in, a warning toast is shown instead.</p>
|
|
641
|
+
|
|
642
|
+
<h3>Syntax & Attributes</h3>
|
|
643
|
+
<p><strong>Wrapping form:</strong></p>
|
|
644
|
+
<pre class="code-block"><code>[cta action="slug" entry="entry-id" icon="check" confirm="Are you sure?"]Button label[/cta]</code></pre>
|
|
645
|
+
<p><strong>Self-closing form:</strong></p>
|
|
646
|
+
<pre class="code-block"><code>[cta action="slug" entry="entry-id" label="Button label" /]</code></pre>
|
|
647
|
+
<table class="table table-sm" style="margin-top:1rem;">
|
|
648
|
+
<thead>
|
|
649
|
+
<tr>
|
|
650
|
+
<th>Attribute</th>
|
|
651
|
+
<th>Required</th>
|
|
652
|
+
<th>Default</th>
|
|
653
|
+
<th>Description</th>
|
|
654
|
+
</tr>
|
|
655
|
+
</thead>
|
|
656
|
+
<tbody>
|
|
657
|
+
<tr>
|
|
658
|
+
<td><code>action</code></td>
|
|
659
|
+
<td>Yes</td>
|
|
660
|
+
<td>—</td>
|
|
661
|
+
<td>Action slug</td>
|
|
662
|
+
</tr>
|
|
663
|
+
<tr>
|
|
664
|
+
<td><code>entry</code></td>
|
|
665
|
+
<td>Yes</td>
|
|
666
|
+
<td>—</td>
|
|
667
|
+
<td>Entry UUID to act on</td>
|
|
668
|
+
</tr>
|
|
669
|
+
<tr>
|
|
670
|
+
<td><code>label</code></td>
|
|
671
|
+
<td>No</td>
|
|
672
|
+
<td><code>"Run"</code></td>
|
|
673
|
+
<td>Button text (self-closing only)</td>
|
|
674
|
+
</tr>
|
|
675
|
+
<tr>
|
|
676
|
+
<td><code>style</code></td>
|
|
677
|
+
<td>No</td>
|
|
678
|
+
<td><code>"primary"</code></td>
|
|
679
|
+
<td>primary · secondary · ghost · danger</td>
|
|
680
|
+
</tr>
|
|
681
|
+
<tr>
|
|
682
|
+
<td><code>icon</code></td>
|
|
683
|
+
<td>No</td>
|
|
684
|
+
<td>—</td>
|
|
685
|
+
<td>Domma icon name</td>
|
|
686
|
+
</tr>
|
|
687
|
+
<tr>
|
|
688
|
+
<td><code>size</code></td>
|
|
689
|
+
<td>No</td>
|
|
690
|
+
<td>—</td>
|
|
691
|
+
<td>sm · md · lg</td>
|
|
692
|
+
</tr>
|
|
693
|
+
<tr>
|
|
694
|
+
<td><code>confirm</code></td>
|
|
695
|
+
<td>No</td>
|
|
696
|
+
<td>—</td>
|
|
697
|
+
<td>Confirmation prompt before executing</td>
|
|
698
|
+
</tr>
|
|
699
|
+
</tbody>
|
|
700
|
+
</table>
|
|
701
|
+
|
|
702
|
+
<h3>Collection Integration</h3>
|
|
703
|
+
<p>Add per-entry buttons to any <code>[collection]</code> shortcode:</p>
|
|
704
|
+
<pre class="code-block"><code>[collection slug="applications" display="cards" title-field="name"
|
|
705
|
+
cta="approve-application"
|
|
706
|
+
cta-label="Approve"
|
|
707
|
+
cta-icon="check"
|
|
708
|
+
cta-style="primary"
|
|
709
|
+
cta-confirm="Approve this application?" /]</code></pre>
|
|
710
|
+
<table class="table table-sm" style="margin-top:1rem;">
|
|
711
|
+
<thead>
|
|
712
|
+
<tr>
|
|
713
|
+
<th>Attribute</th>
|
|
714
|
+
<th>Default</th>
|
|
715
|
+
<th>Description</th>
|
|
716
|
+
</tr>
|
|
717
|
+
</thead>
|
|
718
|
+
<tbody>
|
|
719
|
+
<tr>
|
|
720
|
+
<td><code>cta</code></td>
|
|
721
|
+
<td>—</td>
|
|
722
|
+
<td>Action slug — enables per-entry buttons</td>
|
|
723
|
+
</tr>
|
|
724
|
+
<tr>
|
|
725
|
+
<td><code>cta-label</code></td>
|
|
726
|
+
<td><code>"Run"</code></td>
|
|
727
|
+
<td>Button label</td>
|
|
728
|
+
</tr>
|
|
729
|
+
<tr>
|
|
730
|
+
<td><code>cta-icon</code></td>
|
|
731
|
+
<td>—</td>
|
|
732
|
+
<td>Domma icon name</td>
|
|
733
|
+
</tr>
|
|
734
|
+
<tr>
|
|
735
|
+
<td><code>cta-style</code></td>
|
|
736
|
+
<td><code>"primary"</code></td>
|
|
737
|
+
<td>Button variant</td>
|
|
738
|
+
</tr>
|
|
739
|
+
<tr>
|
|
740
|
+
<td><code>cta-confirm</code></td>
|
|
741
|
+
<td>—</td>
|
|
742
|
+
<td>Confirmation prompt</td>
|
|
743
|
+
</tr>
|
|
744
|
+
</tbody>
|
|
745
|
+
</table>
|
|
746
|
+
<p>All three display modes support CTA buttons: <strong>cards</strong> (card footer),
|
|
747
|
+
<strong>list</strong> (inline), <strong>table</strong> (dedicated column).</p>
|
|
748
|
+
</div>
|
|
749
|
+
</div>
|
|
750
|
+
|
|
630
751
|
</div>
|
|
631
752
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const documentationView={templateUrl:"/admin/js/templates/documentation.html",async onMount(
|
|
1
|
+
export const documentationView={templateUrl:"/admin/js/templates/documentation.html",async onMount(t){Domma.elements.collapsible(t.get(0)),Domma.icons.scan(),Domma.syntax.scan()}};
|