domma-cms 1.66.9 → 1.67.0

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.
Files changed (44) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/admin/css/admin.css +1 -1
  3. package/admin/js/lib/actions-arrange.js +1 -1
  4. package/admin/js/lib/collections-arrange.js +1 -1
  5. package/admin/js/lib/forms-arrange.js +1 -1
  6. package/admin/js/lib/menus-arrange.js +1 -1
  7. package/admin/js/lib/page-editor-reference.js +1 -1
  8. package/admin/js/lib/projects-arrange.js +1 -1
  9. package/admin/js/lib/rich-field.js +9 -0
  10. package/admin/js/lib/views-arrange.js +1 -1
  11. package/admin/js/templates/docs/usage-shortcodes-components.html +4 -4
  12. package/admin/js/templates/docs/usage-shortcodes-content.html +1 -1
  13. package/admin/js/templates/docs/usage-shortcodes-effects.html +23 -6
  14. package/admin/js/templates/docs/usage-shortcodes-layout.html +3 -3
  15. package/admin/js/templates/effects.html +1 -1
  16. package/admin/js/templates/project-detail.html +1 -1
  17. package/admin/js/templates/view-preview.html +1 -1
  18. package/admin/js/views/action-editor.js +2 -2
  19. package/admin/js/views/collection-editor.js +4 -4
  20. package/admin/js/views/collection-entries.js +4 -4
  21. package/admin/js/views/form-editor.js +5 -5
  22. package/admin/js/views/menu-editor.js +5 -5
  23. package/admin/js/views/project-detail.js +2 -2
  24. package/admin/js/views/project-settings.js +1 -1
  25. package/admin/js/views/projects.js +3 -3
  26. package/admin/js/views/view-editor.js +1 -1
  27. package/admin/js/views/view-preview.js +1 -1
  28. package/docs/DommaFeatures.md +8 -0
  29. package/docs/markdown-shortcodes.md +15 -10
  30. package/docs/plugin-development.md +27 -0
  31. package/package.json +1 -1
  32. package/public/css/site.css +1 -1
  33. package/public/js/effects.js +1 -1
  34. package/public/js/rich-text.mjs +9 -0
  35. package/server/routes/api/forms.js +3 -1
  36. package/server/services/actions.js +3 -1
  37. package/server/services/collections.js +6 -1
  38. package/server/services/forms.js +2 -1
  39. package/server/services/markdown.js +107 -35
  40. package/server/services/menus.js +3 -2
  41. package/server/services/projects.js +3 -2
  42. package/server/services/richText.js +98 -0
  43. package/server/services/views.js +3 -1
  44. package/server/templates/page.html +2 -2
@@ -1 +1 @@
1
- (function(){"use strict";var C=window.__CMS_EFFECTS__;Promise.all([C&&typeof C=="object"?C:fetch("/api/effects/settings").then(function(g){return g.json()}),import("/public/js/scribe-style.mjs?v=20261029-all-cms-fonts")]).then(function(g){var w=g[0],R=g[1].buildScribeStyle,k=g[1].loadScribeFont,q=w.respectMotion!==!1,Y=w.defaultDuration||600,N=w.defaultAnimation||"fade",j=w.defaultThreshold!=null?w.defaultThreshold:.1,p=q&&window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,m=document.querySelector(".page-body");if(!m)return;var A=m.querySelector?m.querySelector(".dm-fx-demo-controls"):null;if(A){A.hidden=!1;var M=A.querySelector("[data-fx-demo-status]"),I=A.querySelector("[data-fx-demo-play]");M.textContent=p?"Animations are disabled by your Reduce motion preference. The demos show static content.":"Animations are enabled. Scroll to each demo to see it, or replay the page.",I.textContent=p?"Enable animations on this site":"Replay demos",I.addEventListener("click",function(){if(p)try{localStorage.setItem("domma:reduced_motion","false")}catch{M.textContent="Your browser blocked saving the motion preference. Use its accessibility settings to allow animations.";return}window.location.reload()})}function r(t,e){return t.getAttribute("data-fx-"+e)}function i(t,e,n){var a=r(t,e),o=a!==null?parseFloat(a):NaN;return Number.isFinite(o)?o:n}function x(t,e,n){var a=r(t,e);return a===null?n:a==="true"||a==="1"}function T(t,e,n){var a=new IntersectionObserver(function(o){o[0].isIntersecting&&(a.unobserve(t),n())},{threshold:e});a.observe(t)}m.querySelectorAll(".dm-fx-reveal").forEach(function(t){var e=r(t,"animation")||N,n=i(t,"duration",Y),a=i(t,"delay",0),o=i(t,"threshold",j),d=x(t,"once",!0);p||(t.style.opacity="0",t.style.transition="none",e==="slide-up"?t.style.transform="translateY(30px)":e==="slide-down"?t.style.transform="translateY(-30px)":e==="zoom"?t.style.transform="scale(0.85)":e==="flip"&&(t.style.transform="rotateY(90deg)"),requestAnimationFrame(function(){requestAnimationFrame(function(){t.style.transition="opacity "+n+"ms ease "+a+"ms, transform "+n+"ms ease "+a+"ms";var f=new IntersectionObserver(function(c){c.forEach(function(v){v.isIntersecting?(t.style.opacity="1",t.style.transform="",d&&f.unobserve(t)):d||(t.style.opacity="0",e==="slide-up"?t.style.transform="translateY(30px)":e==="slide-down"?t.style.transform="translateY(-30px)":e==="zoom"?t.style.transform="scale(0.85)":e==="flip"?t.style.transform="rotateY(90deg)":t.style.transform="")})},{threshold:o});f.observe(t)})}))}),m.querySelectorAll(".dm-fx-counter").forEach(function(t){var e=i(t,"to",0),n=i(t,"from",0),a=i(t,"duration",2e3),o=r(t,"prefix")||"",d=r(t,"suffix")||"",f=i(t,"decimals",0),c=r(t,"separator")||"";function v(l){var u=l.toFixed(f);if(c){var y=u.split(".");y[0]=y[0].replace(/\B(?=(\d{3})+(?!\d))/g,c),u=y.join(".")}return o+u+d}if(p){t.textContent=v(e);return}T(t,.5,function(){var l=null;requestAnimationFrame(function u(y){l||(l=y);var S=Math.min((y-l)/a,1),E=1-Math.pow(1-S,3);t.textContent=v(n+(e-n)*E),S<1&&requestAnimationFrame(u)})})}),p||m.querySelectorAll(".dm-fx-scramble").forEach(function(t){var e=i(t,"speed",50),n=t.textContent,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%&",o=0;T(t,.3,function(){var d=setInterval(function(){for(var f="",c=0;c<n.length;c++)c<o||n[c]===" "?f+=n[c]:f+=a[Math.floor(Math.random()*a.length)];t.textContent=f,o<n.length?o++:clearInterval(d)},e)})}),p||m.querySelectorAll(".dm-fx-shake").forEach(function(t){var e=i(t,"intensity",5),n=i(t,"duration",500),a=r(t,"direction")||"horizontal",o=a==="vertical"?"translateY":"translateX";t.animate([{transform:o+"(0)"},{transform:o+"(-"+e+"px)"},{transform:o+"("+e+"px)"},{transform:o+"(-"+e+"px)"},{transform:o+"("+e+"px)"},{transform:o+"(0)"}],{duration:n,easing:"ease-in-out"})}),m.querySelectorAll(".dm-fx-ripple").forEach(function(t){t.style.position="relative",t.style.overflow="hidden",t.addEventListener("click",function(e){var n=r(t,"colour")||"rgba(255,255,255,0.3)",a=i(t,"duration",600),o=t.getBoundingClientRect(),d=Math.max(o.width,o.height)*2,f=document.createElement("span");f.style.cssText="position:absolute;border-radius:50%;pointer-events:none;width:"+d+"px;height:"+d+"px;left:"+(e.clientX-o.left-d/2)+"px;top:"+(e.clientY-o.top-d/2)+"px;background:"+n+";transform:scale(0);opacity:1;transition:transform "+a+"ms ease,opacity "+a+"ms ease;",t.appendChild(f),requestAnimationFrame(function(){f.style.transform="scale(1)",f.style.opacity="0"}),setTimeout(function(){f.remove()},a)})});var h=window.Domma&&window.Domma.effects;h&&(m.querySelectorAll(".dm-fx-breathe").forEach(function(t){if(!p){var e={};r(t,"amplitude")&&(e.amplitude=i(t,"amplitude",6)),r(t,"duration")&&(e.duration=i(t,"duration",3e3)),r(t,"easing")&&(e.easing=r(t,"easing")),r(t,"stagger")&&(e.stagger=i(t,"stagger",0)),h.breathe(t,e)}}),m.querySelectorAll(".dm-fx-pulse").forEach(function(t){if(!p){var e={};r(t,"scale")&&(e.scale=i(t,"scale",1.05)),r(t,"duration")&&(e.duration=i(t,"duration",2e3)),r(t,"easing")&&(e.easing=r(t,"easing")),h.pulse(t,e)}}),m.querySelectorAll(".dm-fx-scribe").forEach(function(t){var e={};["font","size","font-size","weight","colour","color","italic","align","line-height","spacing"].forEach(function(s){var b=r(t,s);b!==null&&(e[s]=b)}),typeof k=="function"&&k(e.font);var n=R(e);n&&(t.style.cssText+=";"+n);var a={respectMotionPreference:q};[["speed","speed",50],["delete-speed","deleteSpeed",30],["loop-delay","loopDelay",1e3]].forEach(function(s){r(t,s[0])!==null&&(a[s[1]]=Math.max(0,i(t,s[0],s[2])))}),[["cursor","cursor",!0],["cursor-blink","cursorBlink",!0],["pause-on-hover","pauseOnHover",!1],["auto-start","autoStart",!0],["respect-motion-preference","respectMotionPreference",q]].forEach(function(s){r(t,s[0])!==null&&(a[s[1]]=x(t,s[0],s[2]))}),r(t,"cursor-char")!==null&&(a.cursorChar=r(t,"cursor-char"));var o=r(t,"mode");["typewriter","word","sentence"].includes(o)&&(a.mode=o);var d=r(t,"cursor-type");["caret","block","underline"].includes(d)&&(a.cursorType=d);var f=r(t,"loop");if(f!==null){var c=Number(f);a.loop=f==="true"?!0:Number.isInteger(c)&&c>=1?c:!1}var v=r(t,"effect");["none","fade","bounce","glow"].includes(v)||(v="none");var l=r(t,"actions");if(l){try{a.actions=JSON.parse(l)}catch{return}if(!Array.isArray(a.actions)||a.actions.some(function(s){return!s||typeof s!="object"}))return;a.actions=a.actions.map(function(s){return s.render!==void 0&&s.effect===void 0?Object.assign({},s,{effect:v}):s})}else{var u=t.textContent.trim();if(!u)return;a.actions=[{render:u,effect:v}]}var y=a.respectMotionPreference&&window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(y){var S=a.actions.find(function(s){return s.render!=null});S&&(t.textContent=String(S.render));return}l||(t.textContent=""),[["onStart","start"],["onComplete","complete"],["onCharacter","character"],["onRender","render"],["onUndoRender","undo"],["onLoop","loop"]].forEach(function(s){a[s[0]]=function(b,O){t.dispatchEvent(new CustomEvent("scribe:"+s[1],{bubbles:!0,detail:{value:b,index:O}}))}});var E=h.scribe(t,a);if(E&&(x(t,"controls",!1)||a.autoStart===!1)){var z=document.createElement("span");z.className="dm-scribe-controls",z.setAttribute("role","group"),z.setAttribute("aria-label","Text animation playback"),[["Play","resume"],["Pause","pause"],["Replay","restart"]].forEach(function(s){var b=document.createElement("button");b.type="button",b.className="btn btn-ghost btn-sm",b.textContent=s[0],b.addEventListener("click",function(){E[s[1]]()}),z.appendChild(b)}),t.insertAdjacentElement("afterend",z)}}),m.querySelectorAll(".dm-fx-twinkle").forEach(function(t){var e={};r(t,"count")&&(e.count=i(t,"count",100)),r(t,"shape")&&(e.shape=r(t,"shape")),r(t,"colour")&&(e.colour=r(t,"colour")),r(t,"min-size")&&(e.minSize=i(t,"min-size",1)),r(t,"max-size")&&(e.maxSize=i(t,"max-size",3)),h.twinkle(t,e)}),typeof h.tickerTape=="function"&&m.querySelectorAll(".dm-fx-ticker-tape").forEach(function(t){if(!p){var e={};r(t,"palette")&&(e.palette=r(t,"palette")),r(t,"density")&&(e.density=i(t,"density",50)),r(t,"speed")&&(e.speed=i(t,"speed",1)),r(t,"sway")&&(e.sway=i(t,"sway",60)),r(t,"rotation-speed")&&(e.rotationSpeed=i(t,"rotation-speed",6)),r(t,"min-width")&&(e.minWidth=i(t,"min-width",5)),r(t,"max-width")&&(e.maxWidth=i(t,"max-width",9)),r(t,"min-height")&&(e.minHeight=i(t,"min-height",12)),r(t,"max-height")&&(e.maxHeight=i(t,"max-height",22)),r(t,"fade-start")&&(e.fadeStart=i(t,"fade-start",.55)),r(t,"burst")&&(e.burst=x(t,"burst",!1)),r(t,"burst-count")&&(e.burstCount=i(t,"burst-count",150)),r(t,"z-index")&&(e.zIndex=i(t,"z-index",1));var n=r(t,"mode");n==="page"?h.tickerTape(null,e):h.tickerTape(t,e)}}),typeof h.butterflies=="function"&&m.querySelectorAll(".dm-fx-butterflies").forEach(function(t){if(!p){var e={};r(t,"palette")&&(e.palette=r(t,"palette")),r(t,"density")&&(e.density=i(t,"density",18)),r(t,"speed")&&(e.speed=i(t,"speed",1)),r(t,"wander")&&(e.wander=i(t,"wander",1)),r(t,"rise-speed")&&(e.riseSpeed=i(t,"rise-speed",.4)),r(t,"flap-speed")&&(e.flapSpeed=i(t,"flap-speed",1)),r(t,"min-size")&&(e.minSize=i(t,"min-size",14)),r(t,"max-size")&&(e.maxSize=i(t,"max-size",26)),r(t,"two-tone")&&(e.twoTone=x(t,"two-tone",!0)),r(t,"burst")&&(e.burst=x(t,"burst",!1)),r(t,"burst-count")&&(e.burstCount=i(t,"burst-count",40)),r(t,"z-index")&&(e.zIndex=i(t,"z-index",1));var n=r(t,"mode");n==="page"?h.butterflies(null,e):h.butterflies(t,e)}}),typeof h.strobe=="function"&&m.querySelectorAll(".dm-fx-strobe").forEach(function(t){if(p)return;function e(f){var c=r(t,f);if(!c)return null;var v=c.split(",").map(function(l){return l.trim()}).filter(Boolean);return v.length?v:null}var n={};r(t,"preset")&&(n.preset=r(t,"preset")),r(t,"motion")&&(n.motion=r(t,"motion")),r(t,"speed")&&(n.speed=i(t,"speed",1)),r(t,"sweep-arc")&&(n.sweepArc=i(t,"sweep-arc",100)),r(t,"beam-width")&&(n.beamWidth=i(t,"beam-width",16)),r(t,"intensity")&&(n.intensity=i(t,"intensity",.7)),r(t,"flicker")&&(n.flicker=x(t,"flicker",!0)),r(t,"hz")&&(n.hz=i(t,"hz",10));var a=e("origins");a&&(n.origins=a);var o=e("colours");o&&(n.colours=o),r(t,"duration")&&(n.duration=i(t,"duration",null)),r(t,"z-index")&&(n.zIndex=i(t,"z-index",9999));var d=r(t,"mode");d==="page"?h.strobe(null,n):h.strobe(t,n)}));var F=m.querySelectorAll(".dm-fx-celebrate");F.length&&import("/public/js/celebrations/index.js?v=20261015-occasions").then(function(t){var e=t.CelebrationsEffect;F.forEach(function(n){var a=r(n,"character");if(a){if(n.querySelector("canvas"))return;t.mountCharacter(n,{character:a,size:r(n,"size")||"medium",facing:r(n,"facing")||"right",animate:!p&&x(n,"animate",!0)}).then(function(u){var y=new MutationObserver(function(){n.isConnected||(u.destroy(),y.disconnect())});n.isConnected?y.observe(document.body,{childList:!0,subtree:!0}):u.destroy()}).catch(function(u){console.error("[celebrate]",u)});return}if(!p){var o=n.getAttribute("data-fx-theme")||"auto";o==="auto"&&r(n,"message")&&(o="greeting");var d=n.getAttribute("data-fx-intensity")||"medium",f=n.getAttribute("data-fx-z-index")?parseInt(n.getAttribute("data-fx-z-index"),10):999;if(!(o==="auto"&&(o=e.getCurrentTheme(),!o))){var c={},v=["data-fx-theme","data-fx-intensity","data-fx-z-index"];if(Array.from(n.attributes).forEach(function(u){u.name.startsWith("data-fx-")&&!v.includes(u.name)&&(c[u.name.slice(8)]=u.value)}),o==="make-it-rain"||o==="money-rain"){t[o==="money-rain"?"moneyRain":"makeItRain"]({intensity:d,zIndex:f,overrides:c,duration:i(n,"duration",8e3)}).catch(function(u){console.error("[make-it-rain]",u)});return}var l=new e({theme:o,intensity:d,enabled:!0,zIndex:f,overrides:c});l.init().then(function(){l.start()})}}})}).catch(function(){})}).catch(function(){})})();
1
+ (function(){"use strict";var C=window.__CMS_EFFECTS__;Promise.all([C&&typeof C=="object"?C:fetch("/api/effects/settings").then(function(g){return g.json()}),import("/public/js/scribe-style.mjs?v=20261029-all-cms-fonts")]).then(function(g){var w=g[0],R=g[1].buildScribeStyle,M=g[1].loadScribeFont,q=w.respectMotion!==!1,Y=w.defaultDuration||600,N=w.defaultAnimation||"fade",O=w.defaultThreshold!=null?w.defaultThreshold:.1,v=q&&window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,l=document.querySelector(".page-body");if(!l)return;var A=l.querySelector?l.querySelector(".dm-fx-demo-controls"):null;if(A){A.hidden=!1;var k=A.querySelector("[data-fx-demo-status]"),I=A.querySelector("[data-fx-demo-play]");k.textContent=v?"Animations are disabled by your Reduce motion preference. The demos show static content.":"Animations are enabled. Scroll to each demo to see it, or replay the page.",I.textContent=v?"Enable animations on this site":"Replay demos",I.addEventListener("click",function(){if(v)try{localStorage.setItem("domma:reduced_motion","false")}catch{k.textContent="Your browser blocked saving the motion preference. Use its accessibility settings to allow animations.";return}window.location.reload()})}function r(t,e){return t.getAttribute("data-fx-"+e)}function i(t,e,n){var a=r(t,e),o=a!==null?parseFloat(a):NaN;return Number.isFinite(o)?o:n}function x(t,e,n){var a=r(t,e);return a===null?n:a==="true"||a==="1"}function T(t,e,n){var a=new IntersectionObserver(function(o){o[0].isIntersecting&&(a.unobserve(t),n())},{threshold:e});a.observe(t)}l.querySelectorAll(".dm-fx-reveal").forEach(function(t){var e=r(t,"animation")||N,n=i(t,"duration",Y),a=i(t,"delay",0),o=i(t,"threshold",O),d=x(t,"once",!0);v||(t.style.opacity="0",t.style.transition="none",e==="slide-up"?t.style.transform="translateY(30px)":e==="slide-down"?t.style.transform="translateY(-30px)":e==="zoom"?t.style.transform="scale(0.85)":e==="flip"&&(t.style.transform="rotateY(90deg)"),requestAnimationFrame(function(){requestAnimationFrame(function(){t.style.transition="opacity "+n+"ms ease "+a+"ms, transform "+n+"ms ease "+a+"ms";var u=new IntersectionObserver(function(f){f.forEach(function(m){m.isIntersecting?(t.style.opacity="1",t.style.transform="",d&&u.unobserve(t)):d||(t.style.opacity="0",e==="slide-up"?t.style.transform="translateY(30px)":e==="slide-down"?t.style.transform="translateY(-30px)":e==="zoom"?t.style.transform="scale(0.85)":e==="flip"?t.style.transform="rotateY(90deg)":t.style.transform="")})},{threshold:o});u.observe(t)})}))}),l.querySelectorAll(".dm-fx-counter").forEach(function(t){var e=i(t,"to",0),n=i(t,"from",0),a=i(t,"duration",2e3),o=r(t,"prefix")||"",d=r(t,"suffix")||"",u=i(t,"decimals",0),f=r(t,"separator")||"";function m(p){var c=p.toFixed(u);if(f){var h=c.split(".");h[0]=h[0].replace(/\B(?=(\d{3})+(?!\d))/g,f),c=h.join(".")}return o+c+d}if(v){t.textContent=m(e);return}T(t,.5,function(){var p=null;requestAnimationFrame(function c(h){p||(p=h);var S=Math.min((h-p)/a,1),E=1-Math.pow(1-S,3);t.textContent=m(n+(e-n)*E),S<1&&requestAnimationFrame(c)})})}),v||l.querySelectorAll(".dm-fx-scramble").forEach(function(t){var e=i(t,"speed",50),n=t.textContent,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%&",o=r(t,"loop"),d=o!=null&&["false","no","0","off"].indexOf(String(o).toLowerCase())===-1,u=Math.max(250,i(t,"loop-delay",2e3));function f(){var m=0,p=setInterval(function(){if(!t.isConnected)return clearInterval(p);for(var c="",h=0;h<n.length;h++)h<m||n[h]===" "?c+=n[h]:c+=a[Math.floor(Math.random()*a.length)];t.textContent=c,m<n.length?m++:(clearInterval(p),d&&n.trim()&&setTimeout(f,u))},e)}T(t,.3,f)}),v||l.querySelectorAll(".dm-fx-shake").forEach(function(t){var e=i(t,"intensity",5),n=i(t,"duration",500),a=r(t,"direction")||"horizontal",o=a==="vertical"?"translateY":"translateX";t.animate([{transform:o+"(0)"},{transform:o+"(-"+e+"px)"},{transform:o+"("+e+"px)"},{transform:o+"(-"+e+"px)"},{transform:o+"("+e+"px)"},{transform:o+"(0)"}],{duration:n,easing:"ease-in-out"})}),l.querySelectorAll(".dm-fx-ripple").forEach(function(t){t.style.position="relative",t.style.overflow="hidden",t.addEventListener("click",function(e){var n=r(t,"colour")||"rgba(255,255,255,0.3)",a=i(t,"duration",600),o=Math.min(1,Math.max(0,i(t,"opacity",1))),d=t.getBoundingClientRect(),u=Math.max(d.width,d.height)*2,f=document.createElement("span");f.style.cssText="position:absolute;border-radius:50%;pointer-events:none;width:"+u+"px;height:"+u+"px;left:"+(e.clientX-d.left-u/2)+"px;top:"+(e.clientY-d.top-u/2)+"px;background:"+n+";transform:scale(0);opacity:"+o+";transition:transform "+a+"ms ease,opacity "+a+"ms ease;",t.appendChild(f),requestAnimationFrame(function(){f.style.transform="scale(1)",f.style.opacity="0"}),setTimeout(function(){f.remove()},a)})});var y=window.Domma&&window.Domma.effects;y&&(l.querySelectorAll(".dm-fx-breathe").forEach(function(t){if(!v){var e={};r(t,"amplitude")&&(e.amplitude=i(t,"amplitude",6)),r(t,"duration")&&(e.duration=i(t,"duration",3e3)),r(t,"easing")&&(e.easing=r(t,"easing")),r(t,"stagger")&&(e.stagger=i(t,"stagger",0)),y.breathe(t,e)}}),l.querySelectorAll(".dm-fx-pulse").forEach(function(t){if(!v){var e={};r(t,"scale")&&(e.scale=i(t,"scale",1.05)),r(t,"duration")&&(e.duration=i(t,"duration",2e3)),r(t,"easing")&&(e.easing=r(t,"easing")),y.pulse(t,e)}}),l.querySelectorAll(".dm-fx-scribe").forEach(function(t){var e={};["font","size","font-size","weight","colour","color","italic","align","line-height","spacing"].forEach(function(s){var b=r(t,s);b!==null&&(e[s]=b)}),typeof M=="function"&&M(e.font);var n=R(e);n&&(t.style.cssText+=";"+n);var a={respectMotionPreference:q};[["speed","speed",50],["delete-speed","deleteSpeed",30],["loop-delay","loopDelay",1e3]].forEach(function(s){r(t,s[0])!==null&&(a[s[1]]=Math.max(0,i(t,s[0],s[2])))}),[["cursor","cursor",!0],["cursor-blink","cursorBlink",!0],["pause-on-hover","pauseOnHover",!1],["auto-start","autoStart",!0],["respect-motion-preference","respectMotionPreference",q]].forEach(function(s){r(t,s[0])!==null&&(a[s[1]]=x(t,s[0],s[2]))}),r(t,"cursor-char")!==null&&(a.cursorChar=r(t,"cursor-char"));var o=r(t,"mode");["typewriter","word","sentence"].includes(o)&&(a.mode=o);var d=r(t,"cursor-type");["caret","block","underline"].includes(d)&&(a.cursorType=d);var u=r(t,"loop");if(u!==null){var f=Number(u);a.loop=u==="true"?!0:Number.isInteger(f)&&f>=1?f:!1}var m=r(t,"effect");["none","fade","bounce","glow"].includes(m)||(m="none");var p=r(t,"actions");if(p){try{a.actions=JSON.parse(p)}catch{return}if(!Array.isArray(a.actions)||a.actions.some(function(s){return!s||typeof s!="object"}))return;a.actions=a.actions.map(function(s){return s.render!==void 0&&s.effect===void 0?Object.assign({},s,{effect:m}):s})}else{var c=t.textContent.trim();if(!c)return;a.actions=[{render:c,effect:m}]}var h=a.respectMotionPreference&&window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(h){var S=a.actions.find(function(s){return s.render!=null});S&&(t.textContent=String(S.render));return}p||(t.textContent=""),[["onStart","start"],["onComplete","complete"],["onCharacter","character"],["onRender","render"],["onUndoRender","undo"],["onLoop","loop"]].forEach(function(s){a[s[0]]=function(b,j){t.dispatchEvent(new CustomEvent("scribe:"+s[1],{bubbles:!0,detail:{value:b,index:j}}))}});var E=y.scribe(t,a);if(E&&(x(t,"controls",!1)||a.autoStart===!1)){var z=document.createElement("span");z.className="dm-scribe-controls",z.setAttribute("role","group"),z.setAttribute("aria-label","Text animation playback"),[["Play","resume"],["Pause","pause"],["Replay","restart"]].forEach(function(s){var b=document.createElement("button");b.type="button",b.className="btn btn-ghost btn-sm",b.textContent=s[0],b.addEventListener("click",function(){E[s[1]]()}),z.appendChild(b)}),t.insertAdjacentElement("afterend",z)}}),l.querySelectorAll(".dm-fx-twinkle").forEach(function(t){var e={};r(t,"count")&&(e.count=i(t,"count",100)),r(t,"shape")&&(e.shape=r(t,"shape")),r(t,"colour")&&(e.colour=r(t,"colour")),r(t,"min-size")&&(e.minSize=i(t,"min-size",1)),r(t,"max-size")&&(e.maxSize=i(t,"max-size",3)),y.twinkle(t,e)}),typeof y.tickerTape=="function"&&l.querySelectorAll(".dm-fx-ticker-tape").forEach(function(t){if(!v){var e={};r(t,"palette")&&(e.palette=r(t,"palette")),r(t,"density")&&(e.density=i(t,"density",50)),r(t,"speed")&&(e.speed=i(t,"speed",1)),r(t,"sway")&&(e.sway=i(t,"sway",60)),r(t,"rotation-speed")&&(e.rotationSpeed=i(t,"rotation-speed",6)),r(t,"min-width")&&(e.minWidth=i(t,"min-width",5)),r(t,"max-width")&&(e.maxWidth=i(t,"max-width",9)),r(t,"min-height")&&(e.minHeight=i(t,"min-height",12)),r(t,"max-height")&&(e.maxHeight=i(t,"max-height",22)),r(t,"fade-start")&&(e.fadeStart=i(t,"fade-start",.55)),r(t,"burst")&&(e.burst=x(t,"burst",!1)),r(t,"burst-count")&&(e.burstCount=i(t,"burst-count",150)),r(t,"z-index")&&(e.zIndex=i(t,"z-index",1));var n=r(t,"mode");n==="page"?y.tickerTape(null,e):y.tickerTape(t,e)}}),typeof y.butterflies=="function"&&l.querySelectorAll(".dm-fx-butterflies").forEach(function(t){if(!v){var e={};r(t,"palette")&&(e.palette=r(t,"palette")),r(t,"density")&&(e.density=i(t,"density",18)),r(t,"speed")&&(e.speed=i(t,"speed",1)),r(t,"wander")&&(e.wander=i(t,"wander",1)),r(t,"rise-speed")&&(e.riseSpeed=i(t,"rise-speed",.4)),r(t,"flap-speed")&&(e.flapSpeed=i(t,"flap-speed",1)),r(t,"min-size")&&(e.minSize=i(t,"min-size",14)),r(t,"max-size")&&(e.maxSize=i(t,"max-size",26)),r(t,"two-tone")&&(e.twoTone=x(t,"two-tone",!0)),r(t,"burst")&&(e.burst=x(t,"burst",!1)),r(t,"burst-count")&&(e.burstCount=i(t,"burst-count",40)),r(t,"z-index")&&(e.zIndex=i(t,"z-index",1));var n=r(t,"mode");n==="page"?y.butterflies(null,e):y.butterflies(t,e)}}),typeof y.strobe=="function"&&l.querySelectorAll(".dm-fx-strobe").forEach(function(t){if(v)return;function e(u){var f=r(t,u);if(!f)return null;var m=f.split(",").map(function(p){return p.trim()}).filter(Boolean);return m.length?m:null}var n={};r(t,"preset")&&(n.preset=r(t,"preset")),r(t,"motion")&&(n.motion=r(t,"motion")),r(t,"speed")&&(n.speed=i(t,"speed",1)),r(t,"sweep-arc")&&(n.sweepArc=i(t,"sweep-arc",100)),r(t,"beam-width")&&(n.beamWidth=i(t,"beam-width",16)),r(t,"intensity")&&(n.intensity=i(t,"intensity",.7)),r(t,"flicker")&&(n.flicker=x(t,"flicker",!0)),r(t,"hz")&&(n.hz=i(t,"hz",10));var a=e("origins");a&&(n.origins=a);var o=e("colours");o&&(n.colours=o),r(t,"duration")&&(n.duration=i(t,"duration",null)),r(t,"z-index")&&(n.zIndex=i(t,"z-index",9999));var d=r(t,"mode");d==="page"?y.strobe(null,n):y.strobe(t,n)}));var F=l.querySelectorAll(".dm-fx-celebrate");F.length&&import("/public/js/celebrations/index.js?v=20261015-occasions").then(function(t){var e=t.CelebrationsEffect;F.forEach(function(n){var a=r(n,"character");if(a){if(n.querySelector("canvas"))return;t.mountCharacter(n,{character:a,size:r(n,"size")||"medium",facing:r(n,"facing")||"right",animate:!v&&x(n,"animate",!0)}).then(function(c){var h=new MutationObserver(function(){n.isConnected||(c.destroy(),h.disconnect())});n.isConnected?h.observe(document.body,{childList:!0,subtree:!0}):c.destroy()}).catch(function(c){console.error("[celebrate]",c)});return}if(!v){var o=n.getAttribute("data-fx-theme")||"auto";o==="auto"&&r(n,"message")&&(o="greeting");var d=n.getAttribute("data-fx-intensity")||"medium",u=n.getAttribute("data-fx-z-index")?parseInt(n.getAttribute("data-fx-z-index"),10):999;if(!(o==="auto"&&(o=e.getCurrentTheme(),!o))){var f={},m=["data-fx-theme","data-fx-intensity","data-fx-z-index"];if(Array.from(n.attributes).forEach(function(c){c.name.startsWith("data-fx-")&&!m.includes(c.name)&&(f[c.name.slice(8)]=c.value)}),o==="make-it-rain"||o==="money-rain"){t[o==="money-rain"?"moneyRain":"makeItRain"]({intensity:d,zIndex:u,overrides:f,duration:i(n,"duration",8e3)}).catch(function(c){console.error("[make-it-rain]",c)});return}var p=new e({theme:o,intensity:d,enabled:!0,zIndex:u,overrides:f});p.init().then(function(){p.start()})}}})}).catch(function(){})}).catch(function(){})})();
@@ -0,0 +1,9 @@
1
+ const o=/^\s*<(p|ul|ol|h[2-4]|blockquote)(\s[^<>]*)?>/i;export function isRichText(r){return typeof r=="string"&&o.test(r)}export function escapeHtml(r){return String(r??"").replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[e])}export function plainToRichHtml(r){return String(r??"").replace(/\r\n?/g,`
2
+ `).split(/\n{2,}/).map(e=>e.trim()).filter(Boolean).map(e=>`<p>${escapeHtml(e).replace(/\n/g,"<br>")}</p>`).join("")}const c={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" "};export function richTextToPlain(r){const e=String(r??"");return isRichText(e)?e.replace(/<br\s*\/?>/gi,`
3
+ `).replace(/<li(\s[^<>]*)?>/gi,"- ").replace(/<\/(p|h[1-6]|blockquote|ul|ol)>/gi,`
4
+
5
+ `).replace(/<\/li>/gi,`
6
+ `).replace(/<[^<>]*>/g,"").replace(/&(#x[0-9a-f]+|#\d+|[a-z]+);/gi,(t,n)=>{if(n[0]!=="#")return c[n.toLowerCase()]??t;const i=n[1].toLowerCase()==="x"?Number.parseInt(n.slice(2),16):Number.parseInt(n.slice(1),10);return Number.isFinite(i)&&i>0&&i<=1114111?String.fromCodePoint(i):t}).replace(/[ \t]+\n/g,`
7
+ `).replace(/\n{3,}/g,`
8
+
9
+ `).trim():e.trim()}export function richTextSummary(r,e=160){const t=richTextToPlain(r).replace(/\s+/g," ").trim();return t.length>e?`${t.slice(0,e-1).trimEnd()}\u2026`:t}
@@ -56,6 +56,7 @@ import {v4 as uuidv4} from 'uuid';
56
56
  import {ago, clip, plural} from '../../services/sidebarBadges.js';
57
57
  import {safeFetch} from '../../services/outbound.js';
58
58
  import {verifyFormContext} from '../../services/formContext.js';
59
+ import {cleanRichText} from '../../services/richText.js';
59
60
 
60
61
  /**
61
62
  * Detect form↔collection mismatches at save time so admins know BEFORE
@@ -678,7 +679,7 @@ export async function formsRoutes(fastify) {
678
679
  const form = {
679
680
  slug,
680
681
  title: title.trim(),
681
- description: body.description || '',
682
+ description: cleanRichText(body.description, {max: 4000}),
682
683
  fields: Array.isArray(body.fields) ? body.fields : [],
683
684
  settings: {
684
685
  submitText: 'Submit',
@@ -783,6 +784,7 @@ export async function formsRoutes(fastify) {
783
784
  createdAt: existing.createdAt,
784
785
  updatedAt: new Date().toISOString()
785
786
  };
787
+ if ('description' in body) updated.description = cleanRichText(body.description, {max: 4000});
786
788
  if (await refusedPluginTarget(request, reply, updated)) return;
787
789
  await writeForm(slug, updated);
788
790
 
@@ -31,6 +31,7 @@ import {createEntry, deleteEntry, getEntry, updateEntry} from './collections.js'
31
31
  import {checkEntryAccess} from './rowAccess.js';
32
32
  import {canReadView} from './views.js';
33
33
  import {getEffectiveLevel} from './userRoles.js';
34
+ import {cleanRichText} from './richText.js';
34
35
 
35
36
  /** MongoDB collection where action configs are stored. */
36
37
  const ACTIONS_COLLECTION = 'cms__actions';
@@ -343,7 +344,7 @@ export async function createAction(data, userId = null) {
343
344
  id: uuidv4(),
344
345
  slug,
345
346
  title: title.trim(),
346
- description: description.trim(),
347
+ description: cleanRichText(description, {max: 4000}),
347
348
  collection,
348
349
  trigger: {
349
350
  type: trigger?.type || 'manual',
@@ -391,6 +392,7 @@ export async function updateAction(slug, data) {
391
392
  if (!existing) throw new Error(`Action "${slug}" not found`);
392
393
 
393
394
  const { _id, id, meta: inputMeta, ...rest } = data;
395
+ if ('description' in rest) rest.description = cleanRichText(rest.description, {max: 4000});
394
396
  const updated = {
395
397
  ...existing,
396
398
  ...rest,
@@ -16,6 +16,10 @@ import {typedEntryData} from './entryValues.js';
16
16
  import {toCsv} from '../../public/js/collection-export.mjs';
17
17
  import {fileIn} from './safePath.js';
18
18
  import {SHARED_TOOL_SLUGS} from './presetCollections.js';
19
+ import {cleanRichText} from './richText.js';
20
+
21
+ /** A collection's description: rich text (see richText.js), markup included. */
22
+ const DESCRIPTION_MAX = 4000;
19
23
 
20
24
  const COLLECTIONS_DIR = path.resolve(config.content.collectionsDir);
21
25
  const TOOL_TRASH_SLUGS = new Set(['notes-notes', 'todo-items', 'contacts-contacts']);
@@ -203,7 +207,7 @@ export async function createCollection({title, slug, description = '', fields =
203
207
  const schema = {
204
208
  slug: finalSlug,
205
209
  title: title.trim(),
206
- description: description.trim(),
210
+ description: cleanRichText(description, {max: DESCRIPTION_MAX}),
207
211
  fields,
208
212
  api: { ...defaultApiAccess({owned: Boolean(plugin)}), ...api },
209
213
  storage: storage || {adapter: 'file'},
@@ -240,6 +244,7 @@ export async function updateCollection(slug, updates) {
240
244
  createdAt: schema.createdAt,
241
245
  updatedAt: new Date().toISOString()
242
246
  };
247
+ if ('description' in rest) updated.description = cleanRichText(rest.description, {max: DESCRIPTION_MAX});
243
248
 
244
249
  // `api.mine` (see mineAllowed in collectionAccess.js) is kept when an
245
250
  // update's api block does not mention it: clients that rebuild `api` from
@@ -11,6 +11,7 @@ import * as cache from './cache/index.js';
11
11
  import {buttonSettingsProblems, formClassProblems} from '../../public/js/form-submit.mjs';
12
12
  import {fileIn} from './safePath.js';
13
13
  import {getConfig} from '../config.js';
14
+ import {cleanRichText} from './richText.js';
14
15
 
15
16
  /** What one submission's files may hold in memory together when server.json sets nothing: 50 MB. */
16
17
  export const DEFAULT_MAX_SUBMISSION_BYTES = 50 * 1024 * 1024;
@@ -234,7 +235,7 @@ export async function createForm(data) {
234
235
  const form = {
235
236
  slug,
236
237
  title: trimmedTitle,
237
- description,
238
+ description: cleanRichText(description, {max: 4000}),
238
239
  ...(plugin ? {plugin} : {}),
239
240
  fields: Array.isArray(fields) ? fields : [],
240
241
  settings: {
@@ -29,6 +29,7 @@ import {CHARACTERS, resolveCharacterSize} from '../../public/js/celebrations/cha
29
29
  import {publicButtonSettings} from '../../public/js/form-submit.mjs';
30
30
  import {FILE_LIMITS_TAG, publicFileLimits} from './forms.js';
31
31
  import {applyShortcodeExpiry} from './shortcodeExpiry.js';
32
+ import {richTextToPlain} from '../../public/js/rich-text.mjs';
32
33
 
33
34
  const __dirname_md = path.dirname(fileURLToPath(import.meta.url));
34
35
  const BLOCKS_DIR = path.resolve(__dirname_md, '../../content/blocks');
@@ -2406,26 +2407,13 @@ function processEffectsBlocks(markdown) {
2406
2407
  });
2407
2408
  }
2408
2409
 
2409
- apply('animate', (attrStr, body) => {
2410
- if (body === null) return '';
2411
- const attrs = parseShortcodeAttrs(attrStr);
2412
- const classes = [];
2413
- if (attrs.type) classes.push(`animate-${classToken(attrs.type)}`);
2414
- if (attrs.duration) classes.push(`animate-duration-${classToken(attrs.duration)}`);
2415
- if (attrs.delay) classes.push(`animate-delay-${classToken(attrs.delay)}`);
2416
- if (attrs.repeat) classes.push(`animate-${classToken(attrs.repeat)}`);
2417
- return `<div class="${classes.join(' ')}">${markedBody(processCardBlocks(processGridBlocks(processInlineShortcodes(restore(body.trim())))))}</div>\n`;
2418
- });
2419
-
2420
- apply('ambient', (attrStr, body) => {
2421
- if (body === null) return '';
2422
- const attrs = parseShortcodeAttrs(attrStr);
2423
- const classes = [];
2424
- if (attrs.type) classes.push(`bg-ambient-${classToken(attrs.type)}`);
2425
- if (attrs.speed) classes.push(`bg-ambient-${classToken(attrs.speed)}`);
2426
- if (attrs.intensity) classes.push(`bg-ambient-${classToken(attrs.intensity)}`);
2427
- return `<div class="${classes.join(' ')}">${markedBody(processCardBlocks(processGridBlocks(processInlineShortcodes(restore(body.trim())))))}</div>\n`;
2428
- });
2410
+ for (const name of ['animate', 'ambient']) {
2411
+ apply(name, (attrStr, body) => {
2412
+ if (body === null) return '';
2413
+ const classes = CSS_EFFECT_CLASSES[name](parseShortcodeAttrs(attrStr), '');
2414
+ return `<div class="${classes.join(' ')}">${markedBody(processCardBlocks(processGridBlocks(processInlineShortcodes(restore(body.trim())))))}</div>\n`;
2415
+ });
2416
+ }
2429
2417
 
2430
2418
  return restore(result);
2431
2419
  }
@@ -2649,6 +2637,31 @@ export function escapeAttr(str) {
2649
2637
  .replace(/>/g, '&gt;');
2650
2638
  }
2651
2639
 
2640
+ /**
2641
+ * The classes for the two CSS-only effects, shared by the [animate] / [ambient]
2642
+ * tags and by the same effects written as switches on a host tag. As a switch
2643
+ * with no type, each falls back to a default so the bare word does something.
2644
+ */
2645
+ const CSS_EFFECT_CLASSES = {
2646
+ animate({type, duration, delay, repeat} = {}, fallback = 'fade-in') {
2647
+ const classes = [];
2648
+ const kind = classToken(type === true ? '' : type) || fallback;
2649
+ if (kind) classes.push(`animate-${kind}`);
2650
+ if (duration) classes.push(`animate-duration-${classToken(duration)}`);
2651
+ if (delay) classes.push(`animate-delay-${classToken(delay)}`);
2652
+ if (repeat) classes.push(`animate-${classToken(repeat)}`);
2653
+ return classes;
2654
+ },
2655
+ ambient({type, speed, intensity} = {}, fallback = 'aurora') {
2656
+ const classes = [];
2657
+ const kind = classToken(type === true ? '' : type) || fallback;
2658
+ if (kind) classes.push(`bg-ambient-${kind}`);
2659
+ if (speed) classes.push(`bg-ambient-${classToken(speed)}`);
2660
+ if (intensity) classes.push(`bg-ambient-${classToken(intensity)}`);
2661
+ return classes;
2662
+ },
2663
+ };
2664
+
2652
2665
  /**
2653
2666
  * Extract injected-effect flag attributes from a parsed shortcode attrs object.
2654
2667
  *
@@ -2671,16 +2684,29 @@ export function extractInjectedEffects(attrs, allowed) {
2671
2684
 
2672
2685
  for (const effect of allowed) {
2673
2686
  if (!(effect in attrs)) continue;
2674
- effectClasses.push(`dm-fx-${effect}`);
2675
2687
  consumedKeys.add(effect);
2676
2688
 
2677
2689
  const prefix = `${effect}-`;
2690
+ const params = {};
2678
2691
  for (const key of Object.keys(attrs)) {
2679
2692
  if (!key.startsWith(prefix)) continue;
2680
- const param = key.slice(prefix.length);
2681
- dataAttrParts.push(` data-fx-${param}="${escapeAttr(String(attrs[key]))}"`);
2693
+ params[key.slice(prefix.length)] = attrs[key];
2682
2694
  consumedKeys.add(key);
2683
2695
  }
2696
+
2697
+ // animate and ambient are CSS only: nothing in the browser reads a
2698
+ // dm-fx-* class for them, so the switch emits the same classes the
2699
+ // [animate] / [ambient] tags do.
2700
+ const cssClasses = CSS_EFFECT_CLASSES[effect];
2701
+ if (cssClasses) {
2702
+ effectClasses.push(...cssClasses(params));
2703
+ continue;
2704
+ }
2705
+
2706
+ effectClasses.push(`dm-fx-${effect}`);
2707
+ for (const [param, value] of Object.entries(params)) {
2708
+ dataAttrParts.push(` data-fx-${param}="${escapeAttr(String(value))}"`);
2709
+ }
2684
2710
  }
2685
2711
 
2686
2712
  return {
@@ -3595,9 +3621,13 @@ function processCardBlocks(markdown) {
3595
3621
  * [/tabs]
3596
3622
  *
3597
3623
  * Supported attributes on [tabs]:
3598
- * style - "pills" for pill-style nav (default: standard underline)
3624
+ * style - "pills" for pill-style nav, "bordered" for a box around the tabs
3625
+ * and their panel (default: standard underline)
3626
+ * align - "center" or "right" (default: left)
3599
3627
  * id - optional id on the wrapper
3600
3628
  *
3629
+ * Panels always fade in: Domma's tabs do it themselves, so there is no switch.
3630
+ *
3601
3631
  * @param {string} markdown
3602
3632
  * @returns {string}
3603
3633
  */
@@ -3612,7 +3642,6 @@ function processTabsBlocks(markdown) {
3612
3642
  const attrs = parseShortcodeAttrs(attrStr);
3613
3643
  const pillsClass = attrs.style === 'pills' ? ' tabs-pills' : '';
3614
3644
  const borderedClass = attrs.style === 'bordered' ? ' tabs--bordered' : '';
3615
- const fadeClass = 'fade' in attrs ? ' tabs--fade' : '';
3616
3645
  const centeredClass = attrs.align === 'center' ? ' tabs-centered' : '';
3617
3646
  const rightClass = attrs.align === 'right' ? ' tabs--right' : '';
3618
3647
  const idAttr = attrs.id ? ` id="${escapeAttr(attrs.id)}"` : '';
@@ -3645,7 +3674,7 @@ function processTabsBlocks(markdown) {
3645
3674
  ).join('\n ');
3646
3675
 
3647
3676
  return (
3648
- `<div class="tabs${pillsClass}${borderedClass}${fadeClass}${centeredClass}${rightClass}"${idAttr}>\n` +
3677
+ `<div class="tabs${pillsClass}${borderedClass}${centeredClass}${rightClass}"${idAttr}>\n` +
3649
3678
  ` <div class="tab-list">\n ${navItems}\n </div>\n` +
3650
3679
  ` <div class="tab-content">\n ${panes}\n </div>\n` +
3651
3680
  `</div>\n`
@@ -4948,7 +4977,8 @@ async function expandReferenceFields(form) {
4948
4977
  */
4949
4978
  export function formSummaryHtml(form) {
4950
4979
  const title = String(form?.title ?? '').trim();
4951
- const description = String(form?.description ?? '').trim();
4980
+ // Read aloud, so the words alone: a rich description without its markup.
4981
+ const description = richTextToPlain(form?.description).replace(/\s+/g, ' ');
4952
4982
  if (!title && !description) return '';
4953
4983
  return inertShortcodes(`<div class="sr-only cms-form-embed-summary">`
4954
4984
  + (title ? `<p><strong>${escapeHtmlText(title)}</strong></p>` : '')
@@ -5104,6 +5134,31 @@ function processHeroBlocks(markdown) {
5104
5134
  * @param {string} markdown
5105
5135
  * @returns {string}
5106
5136
  */
5137
+ /**
5138
+ * Put every [banner …] opening tag's attributes aside before the containers run.
5139
+ *
5140
+ * [banner] is expanded late, after cards, grids, tabs and accordions have run
5141
+ * Markdown over their bodies - which turns the tag's quotes into entities,
5142
+ * links a URL in a title and so on, so a banner inside one lost its type, title
5143
+ * and icon. The attributes are swapped for a token only this render knows and
5144
+ * given back in processBannerBlocks. Entry data cannot forge one: its brackets
5145
+ * are inert at this point, and the token carries a per-render nonce.
5146
+ *
5147
+ * @param {string} markdown
5148
+ * @returns {{text: string, held: Map<string, string>}}
5149
+ */
5150
+ function holdBannerTags(markdown) {
5151
+ const held = new Map();
5152
+ if (!/\[banner/i.test(markdown)) return {text: markdown, held};
5153
+ const nonce = randomUUID();
5154
+ const text = markdown.replace(/\[banner([^\]]*)\]/gi, (_, attrStr) => {
5155
+ const token = `dmb-${nonce}-${held.size}`;
5156
+ held.set(token, attrStr);
5157
+ return `[banner ${token}]`;
5158
+ });
5159
+ return {text, held};
5160
+ }
5161
+
5107
5162
  /**
5108
5163
  * Pre-process [banner] shortcodes before running through marked.
5109
5164
  *
@@ -5122,10 +5177,26 @@ function processHeroBlocks(markdown) {
5122
5177
  * @param {string} markdown
5123
5178
  * @returns {string}
5124
5179
  */
5125
- function processBannerBlocks(markdown) {
5180
+ function processBannerBlocks(markdown, held = null) {
5126
5181
  return markdown.replace(
5127
- /\[banner([^\]]*)\]([\s\S]*?)\[\/banner\]/gi,
5128
- (_, attrStr, body) => {
5182
+ /(<p>)?\[banner([^\]]*)\]([\s\S]*?)\[\/banner\](<\/p>)?/gi,
5183
+ (_, openP, rawAttrStr, rawBody, closeP) => {
5184
+ // A tag the author wrote carries a held token (holdBannerTags), so its
5185
+ // attributes are exactly as written whatever a container did to its
5186
+ // body. Only such a tag has the <p> a container wrapped it in removed.
5187
+ // Any other [banner] is read as it always was - never entity-decoded,
5188
+ // because the quotes in entry data reach here as entities.
5189
+ const token = rawAttrStr.trim();
5190
+ const authored = !!held && held.has(token);
5191
+ const attrStr = authored ? held.get(token) : rawAttrStr;
5192
+ const wrapped = authored && !!(openP && closeP);
5193
+ let body = rawBody;
5194
+ if (wrapped) {
5195
+ const inner = body.trim();
5196
+ if (inner.startsWith('</p>') && inner.endsWith('<p>')) body = inner.slice(4, -3);
5197
+ }
5198
+ const before = wrapped ? '' : (openP || '');
5199
+ const after = wrapped ? '' : (closeP || '');
5129
5200
  const attrs = parseShortcodeAttrs(attrStr);
5130
5201
  const BANNER_INJECTABLE = ['reveal', 'pulse', 'shake', 'ambient', 'animate'];
5131
5202
  const injected = extractInjectedEffects(attrs, BANNER_INJECTABLE);
@@ -5137,7 +5208,7 @@ function processBannerBlocks(markdown) {
5137
5208
  const extraClass = attrs.class || '';
5138
5209
 
5139
5210
  const classes = [`dm-banner`, `dm-banner--${classToken(type)}`];
5140
- if (extraClass) classes.push(extraClass);
5211
+ if (extraClass) classes.push(escapeAttr(extraClass));
5141
5212
  classes.push(...injected.effectClasses);
5142
5213
 
5143
5214
  const iconHtml = icon
@@ -5152,11 +5223,11 @@ function processBannerBlocks(markdown) {
5152
5223
  : '';
5153
5224
 
5154
5225
  return (
5155
- `<div class="${classes.join(' ')}"${injected.effectDataAttrs}>\n` +
5226
+ `${before}<div class="${classes.join(' ')}"${injected.effectDataAttrs}>\n` +
5156
5227
  ` ${iconHtml}<div class="dm-banner__body">\n` +
5157
5228
  ` ${titleHtml}${bodyHtml}` +
5158
5229
  ` </div>${dismissHtml}\n` +
5159
- `</div>\n`
5230
+ `</div>\n${after}`
5160
5231
  );
5161
5232
  }
5162
5233
  );
@@ -5529,7 +5600,8 @@ export async function parseMarkdown(raw, opts = {}) {
5529
5600
  : {};
5530
5601
  const withMenu = await processMenuBlocks(withStaticBlock, opts.user || null, menuCtx);
5531
5602
  const withDconfig = processDConfigBlocks(withMenu);
5532
- const withEffects = processEffectsBlocks(withDconfig);
5603
+ const banners = holdBannerTags(withDconfig);
5604
+ const withEffects = processEffectsBlocks(banners.text);
5533
5605
  const withPluginShortcodes = await processPluginShortcodes(withEffects, opts.user || null);
5534
5606
  const withTabs = processTabsBlocks(withPluginShortcodes);
5535
5607
  const withAccordion = processAccordionBlocks(withTabs);
@@ -5554,7 +5626,7 @@ export async function parseMarkdown(raw, opts = {}) {
5554
5626
  const withCta = processCtaBlocks(withLink);
5555
5627
  const withGrid = processGridBlocks(withCta);
5556
5628
  const withCard = processCardBlocks(withGrid);
5557
- const withBanner = processBannerBlocks(withCard);
5629
+ const withBanner = processBannerBlocks(withCard, banners.held);
5558
5630
  const withSlideover = processSlideoverBlocks(withBanner);
5559
5631
  const rendered = slots.restore(marked.parse(withSlideover));
5560
5632
 
@@ -24,6 +24,7 @@ import {
24
24
  } from '../../public/js/menu-decor.mjs';
25
25
  import {fileIn} from './safePath.js';
26
26
  import {normaliseLook, lookProblems, itemLookProblems} from '../../public/js/menu-look.mjs';
27
+ import {cleanRichText} from './richText.js';
27
28
 
28
29
  export {normaliseLook};
29
30
 
@@ -617,7 +618,7 @@ export async function createMenu(input) {
617
618
  const menu = {
618
619
  slug: input.slug,
619
620
  name: input.name || input.slug,
620
- description: input.description || '',
621
+ description: cleanRichText(input.description, {max: 4000}),
621
622
  ...(input.variant != null && {variant: input.variant}),
622
623
  ...(input.position != null && {position: input.position}),
623
624
  ...(input.orientation != null && {orientation: input.orientation}),
@@ -691,7 +692,7 @@ export async function updateMenu(slug, input, opts = {}) {
691
692
  const merged = {
692
693
  slug,
693
694
  name: input.name || existing.name,
694
- description: input.description || '',
695
+ description: cleanRichText(input.description, {max: 4000}),
695
696
  ...(input.variant != null && {variant: input.variant}),
696
697
  ...(input.position != null && {position: input.position}),
697
698
  ...(input.orientation != null && {orientation: input.orientation}),
@@ -22,6 +22,7 @@
22
22
  import {createEntry, deleteEntry, listEntries, updateEntry} from './collections.js';
23
23
  import {getRoleLevel} from './roles.js';
24
24
  import * as cache from './cache/index.js';
25
+ import {cleanRichText} from './richText.js';
25
26
 
26
27
  /** Slug of the preset collection that stores project records. */
27
28
  export const PROJECTS_COLLECTION_SLUG = 'projects';
@@ -148,7 +149,7 @@ export async function createProject(input) {
148
149
  const data = {
149
150
  slug: input.slug,
150
151
  name: input.name,
151
- description: input.description || '',
152
+ description: cleanRichText(input.description, {max: 4000}),
152
153
  icon: input.icon || 'folder',
153
154
  ...(input.rootUrl != null && {rootUrl: input.rootUrl}),
154
155
  sortOrder: Number.isFinite(input.sortOrder) ? input.sortOrder : 0,
@@ -233,7 +234,7 @@ export async function updateProject(slug, input) {
233
234
  const merged = {
234
235
  ...existing,
235
236
  ...(input.name != null && {name: input.name}),
236
- ...(input.description != null && {description: input.description}),
237
+ ...(input.description != null && {description: cleanRichText(input.description, {max: 4000})}),
237
238
  ...(input.icon != null && {icon: input.icon}),
238
239
  ...(input.rootUrl != null && {rootUrl: input.rootUrl}),
239
240
  ...(Number.isFinite(input.sortOrder) && {sortOrder: input.sortOrder}),
@@ -0,0 +1,98 @@
1
+ /**
2
+ * Rich text Description fields - cleaning what is saved and what is shown.
3
+ *
4
+ * See `public/js/rich-text.mjs` for how a description is stored (one string,
5
+ * plain or rich) and told apart. This is the half that needs a sanitiser:
6
+ *
7
+ * - `cleanRichText(value)` on SAVE. A rich value is reduced to the small set
8
+ * of elements the editor makes; a plain one is kept as typed.
9
+ * - `renderRichText(value)` wherever a description goes into a page or an
10
+ * HTML email. A rich value is cleaned again (what is stored may predate a
11
+ * rule, or have been written around the API); a plain one is escaped into
12
+ * paragraphs. Its result is always safe to put in a page.
13
+ * - `richTextToPlain` / `richTextSummary` (re-exported) for everything that is
14
+ * not HTML: meta descriptions, plain emails, CSV, ICS, search, JSON-LD.
15
+ *
16
+ * Deliberately far stricter than `sanitizePageHtml`: a description is a few
17
+ * formatted paragraphs, not a page. No images, classes, styles or embeds.
18
+ *
19
+ * @module server/services/richText
20
+ */
21
+ import sanitizeHtml from 'sanitize-html';
22
+ import {isRichText, plainToRichHtml, richTextToPlain, richTextSummary, escapeHtml} from '../../public/js/rich-text.mjs';
23
+
24
+ export {isRichText, plainToRichHtml, richTextToPlain, richTextSummary};
25
+
26
+ /** How long a description may be unless the caller says otherwise. */
27
+ export const RICH_TEXT_MAX = 20000;
28
+
29
+ const OPTIONS = {
30
+ allowedTags: ['p', 'br', 'strong', 'b', 'em', 'i', 'u', 's', 'ul', 'ol', 'li', 'a', 'h2', 'h3', 'h4', 'blockquote', 'code'],
31
+ allowedAttributes: {a: ['href', 'target', 'rel']},
32
+ allowedSchemes: ['http', 'https', 'mailto', 'tel'],
33
+ allowProtocolRelative: false,
34
+ // The editor makes divs and spans (a pasted line, a font change); their text is kept.
35
+ transformTags: {
36
+ div: 'p',
37
+ a: (tagName, attribs) => ({tagName, attribs: {
38
+ ...(attribs.href ? {href: attribs.href} : {}),
39
+ ...(attribs.target === '_blank' ? {target: '_blank'} : {}),
40
+ rel: 'noopener noreferrer'
41
+ }})
42
+ },
43
+ // A link with nowhere to go is its text.
44
+ exclusiveFilter: frame => frame.tag === 'a' && !frame.attribs.href && !frame.text.trim()
45
+ };
46
+
47
+ /**
48
+ * @param {string} html
49
+ * @returns {string} cleaned, starting with a block element; '' when it says nothing
50
+ */
51
+ function clean(html) {
52
+ // As the editor writes a line break, so an unedited description reads back the same.
53
+ let out = sanitizeHtml(html, OPTIONS).replace(/<br \/>/g, '<br>').trim();
54
+ // An empty list item reads as its bullet alone: that is still nothing.
55
+ if (!richTextToPlain(isRichText(out) ? out : `<p>${out}</p>`).replace(/^- ?$/gm, '').trim()) return '';
56
+ if (!isRichText(out)) out = `<p>${out}</p>`;
57
+ return out;
58
+ }
59
+
60
+ /**
61
+ * A description as it should be stored.
62
+ *
63
+ * @param {*} value - from a request body
64
+ * @param {{max?: number}} [options] - the longest it may be, markup included
65
+ * @returns {string}
66
+ */
67
+ export function cleanRichText(value, {max = RICH_TEXT_MAX} = {}) {
68
+ if (typeof value !== 'string') return '';
69
+ // eslint-disable-next-line no-control-regex
70
+ const raw = value.replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g, '');
71
+ if (!isRichText(raw)) return raw.trim().slice(0, max);
72
+ const out = clean(raw);
73
+ // Cut, then cleaned again so no element is left open.
74
+ return out.length > max ? clean(out.slice(0, max)) : out;
75
+ }
76
+
77
+ /**
78
+ * A description as HTML that is safe to put in a page.
79
+ *
80
+ * @param {*} value - as stored
81
+ * @returns {string} '' for nothing
82
+ */
83
+ export function renderRichText(value) {
84
+ if (typeof value !== 'string' || !value.trim()) return '';
85
+ return isRichText(value) ? clean(value) : plainToRichHtml(value);
86
+ }
87
+
88
+ /**
89
+ * The same, for one line of plain text shown inline (a list row, a title
90
+ * attribute): always escaped text, never markup.
91
+ *
92
+ * @param {*} value
93
+ * @param {number} [max]
94
+ * @returns {string}
95
+ */
96
+ export function renderRichTextInline(value, max = 160) {
97
+ return escapeHtml(richTextSummary(value, max));
98
+ }
@@ -41,6 +41,7 @@ import {executePipeline} from './viewPipeline.js';
41
41
  import * as cache from './cache/index.js';
42
42
  import {fileIn} from './safePath.js';
43
43
  import {assertSafeMongoQuery, toSafeMongoPipeline} from './mongoQueryGuard.js';
44
+ import {cleanRichText} from './richText.js';
44
45
 
45
46
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
46
47
  const ROOT = path.resolve(__dirname, '..', '..');
@@ -293,7 +294,7 @@ export async function createView(data, userId = null) {
293
294
  id: uuidv4(),
294
295
  slug,
295
296
  title: title.trim(),
296
- description: description.trim(),
297
+ description: cleanRichText(description, {max: 4000}),
297
298
  connection,
298
299
  pipeline: { source: pipeline.source, stages },
299
300
  display: {
@@ -341,6 +342,7 @@ export async function updateView(slug, data) {
341
342
  // `_id` strip is load-bearing for configs migrated from the legacy
342
343
  // MongoDB store; `id` is immutable.
343
344
  const { _id, id, meta: inputMeta, ...rest } = data;
345
+ if ('description' in rest) rest.description = cleanRichText(rest.description, {max: 4000});
344
346
  const updated = {
345
347
  ...existing,
346
348
  ...rest,
@@ -25,7 +25,7 @@
25
25
  <link rel="stylesheet" href="/dist/domma/themes/domma-themes.css">
26
26
 
27
27
  <!-- Site CSS -->
28
- <link rel="stylesheet" href="/public/css/site.css?v=20261113-vertical-align">
28
+ <link rel="stylesheet" href="/public/css/site.css?v=20261115-tabs-bordered">
29
29
  <link rel="stylesheet" href="/public/css/forms.css?v=20261031-forms-reduce-motion">
30
30
  <!-- Menu item hover / current-page effects. Loaded after site.css so a
31
31
  menu's own highlight wins over the blanket link styling there. -->
@@ -201,7 +201,7 @@
201
201
  visitor's browser asked about both on every page. -->
202
202
 
203
203
  <!-- Core effects runtime -->
204
- <script src="/public/js/effects.js?v=20261111-inline-settings" defer></script>
204
+ <script src="/public/js/effects.js?v=20261115-scramble-loop" defer></script>
205
205
 
206
206
  <!-- Plugin body-end injection -->
207
207
  {{bodyEndInject}}