domma-cms 0.6.21 → 0.6.22
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
function
|
|
1
|
+
function le(){I.register("bold",{viewBox:"0 0 24 24",path:"M7 5H14a3 3 0 0 1 0 6H7V5zM7 11H15a3 3 0 0 1 0 6H7V11z",stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("italic",{viewBox:"0 0 24 24",path:"M11 5h4M9 19h4M13 5l-2 14",stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("strikethrough",{viewBox:"0 0 24 24",path:"M16 4H9a3 3 0 0 0 0 6h6a3 3 0 0 1 0 6H6M3 12h18",stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("quote",{viewBox:"0 0 24 24",path:"M3 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1zM15 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z",stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("eye",{viewBox:"0 0 24 24",path:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8zM12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("expand",{viewBox:"0 0 24 24",path:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3",stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("columns",{viewBox:"0 0 24 24",path:"M3 4h18a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1zM12 4v16",stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("card",{viewBox:"0 0 24 24",paths:["M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z","M3 9h18"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("help-circle",{viewBox:"0 0 24 24",path:"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10zM12 17h.01M12 13a2 2 0 0 0 2-2 2 2 0 0 0-2-2 2 2 0 0 0-2 2",stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("spacer-insert",{viewBox:"0 0 24 24",paths:["M3 8h18","M3 16h18","M12 8v8"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("icon-pick",{viewBox:"0 0 24 24",paths:["M4 4h6v6H4z","M14 4h6v6h-6z","M4 14h6v6H4z","M14 14h6v6h-6z"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("btn-insert",{viewBox:"0 0 24 24",paths:["M3 7a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z","M8 12h8M12 9v6"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("link-shortcode",{viewBox:"0 0 24 24",paths:["M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71","M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("layout-list",{viewBox:"0 0 24 24",paths:["M3 5h18M3 9h18","M3 14h4v6H3zM9 14h12M9 17h8"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("sparkles",{viewBox:"0 0 24 24",paths:["M12 3L13.5 8.5H19L14.5 11.5L16 17L12 14L8 17L9.5 11.5L5 8.5H10.5L12 3Z","M19 3L19.7 5.3H22L20.2 6.6L20.9 9L19 7.7L17.1 9L17.8 6.6L16 5.3H18.3L19 3Z","M5 13L5.5 14.7H7L5.8 15.5L6.3 17.2L5 16.3L3.7 17.2L4.2 15.5L3 14.7H4.5L5 13Z"],stroke:"currentColor",fill:"none",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("accordion-insert",{viewBox:"0 0 24 24",paths:["M3 4h18","M3 8h18","M8 11l4 4 4-4","M3 16h18","M3 20h18"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("hero",{viewBox:"0 0 24 24",paths:["M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5z","M7 8h10M7 11h6"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("text-style",{viewBox:"0 0 24 24",paths:["M4 7V5h16v2","M9 19h6","M12 5v14","M5 12h14"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}export function wrapSelection(t,e,b){const l=t.selectionStart,a=t.selectionEnd,o=t.value,r=o.substring(l,a);r?(t.value=o.substring(0,l)+e+r+b+o.substring(a),t.selectionStart=l+e.length,t.selectionEnd=a+e.length):(t.value=o.substring(0,l)+e+b+o.substring(l),t.selectionStart=t.selectionEnd=l+e.length),t.dispatchEvent(new Event("input",{bubbles:!0})),t.focus()}export function insertAtCursor(t,e){const b=t.selectionStart,l=t.value;t.value=l.substring(0,b)+e+l.substring(b),t.selectionStart=t.selectionEnd=b+e.length,t.dispatchEvent(new Event("input",{bubbles:!0})),t.focus()}export function insertLine(t,e){const b=t.selectionStart,l=t.value,a=l.lastIndexOf(`
|
|
2
2
|
`,b-1)+1,o=l.indexOf(`
|
|
3
|
-
`,
|
|
3
|
+
`,a),r=l.substring(a,o===-1?l.length:o);if(r.startsWith(e)){const i=o===-1?"":l.substring(o);t.value=l.substring(0,a)+r.substring(e.length)+i,t.selectionStart=t.selectionEnd=Math.max(a,b-e.length)}else t.value=l.substring(0,a)+e+l.substring(a),t.selectionStart=t.selectionEnd=b+e.length;t.dispatchEvent(new Event("input",{bubbles:!0})),t.focus()}const re=[{category:"Entrance"},{label:"Reveal (fade)",snippet:t=>`[reveal animation="fade"]
|
|
4
4
|
${t||"Content"}
|
|
5
5
|
[/reveal]`},{label:"Reveal (slide up)",snippet:t=>`[reveal animation="slide-up"]
|
|
6
6
|
${t||"Content"}
|
|
@@ -29,12 +29,12 @@ ${t||"Content"}
|
|
|
29
29
|
[/firework]`},{label:"Fireworks show",snippet:()=>`[fireworks]
|
|
30
30
|
[firework type="burst" colour="rainbow" /]
|
|
31
31
|
[firework type="sparkle" colour="primary" /]
|
|
32
|
-
[/fireworks]`,insert:!0},{label:"Celebrate",snippet:()=>'[celebrate theme="auto" intensity="medium" /]',insert:!0}];function
|
|
33
|
-
`)});const n=e.getBoundingClientRect(),s=e.closest(".editor-toolbar").getBoundingClientRect();
|
|
32
|
+
[/fireworks]`,insert:!0},{label:"Celebrate",snippet:()=>'[celebrate theme="auto" intensity="medium" /]',insert:!0}];function se(t,e){const b=document.querySelector(".editor-effects-dropdown-menu");if(b){b.remove();return}const l=document.createElement("div");l.className="editor-effects-dropdown-menu",re.forEach(function(i){if(i.category){const p=document.createElement("div");p.className="editor-effects-category",p.textContent=i.category,l.appendChild(p)}else{const p=document.createElement("button");p.type="button",p.className="editor-effects-item",p.textContent=i.label,p.addEventListener("click",function(){if(l.remove(),i.insert)insertAtCursor(t,i.snippet(""));else{const d=t.selectionStart,f=t.selectionEnd,n=t.value.substring(d,f),s=i.snippet(n);t.value=t.value.substring(0,d)+s+t.value.substring(f),t.selectionStart=d,t.selectionEnd=d+s.length,t.dispatchEvent(new Event("input",{bubbles:!0})),t.focus()}}),l.appendChild(p)}});const a=e.getBoundingClientRect(),o=e.closest(".editor-toolbar").getBoundingClientRect();l.style.top=a.bottom-o.top+4+"px",l.style.left=a.left-o.left+"px",e.closest(".editor-toolbar").appendChild(l);function r(i){!l.contains(i.target)&&i.target!==e&&(l.remove(),document.removeEventListener("click",r,!0))}setTimeout(function(){document.addEventListener("click",r,!0)},0)}const Z=["activity","airpods","airport","alert-circle","alert-warning","ambulance","angry","annoyed","apartment","arch","archive","arrow-down","arrow-down-left","arrow-down-right","arrow-left","arrow-right","arrow-up","arrow-up-left","arrow-up-right","astonished","at-sign","attachment","award","badge","ban","bandage","bank","banknote","barbell","barcode","barn","baseball","basketball","battery","battery-charging","bauble","bell","bell-off","bells","bicycle","bitcoin","blood-drop","blush","bold","bone","book","book-closed","book-open","bookmark","bookmark-filled","bowling","box","boxing-glove","brain","bridge","briefcase","building","bus","cabin","cake","calculator","calendar","camera","camera-off","candy-cane","capsule","car","cart","cart-add","cash","cast","castle","chart-area","chart-bar","chart-bar-horizontal","chart-candlestick","chart-line","chart-pie","chat","chat-alt","check","check-circle","check-circle-filled","check-square","chevron-down","chevron-left","chevron-right","chevron-up","chevrons-down","chevrons-left","chevrons-right","chevrons-up","church","circle","circle-filled","clear-format","clipboard","clipboard-check","clipboard-list","clock","close","cloud","cloud-download","cloud-drizzle","cloud-lightning","cloud-off","cloud-rain","cloud-sun","cloud-upload","code","code-block","code-inline","cog","coins","columns","comment","compass","component","confused","cool","copy","corner-down-left","corner-down-right","corner-up-left","corner-up-right","court","cpu","credit-card","crown","crutch","cry","currency-dollar","currency-euro","currency-pound","cycling","database","dead","desktop","disappointed","dna","document","document-add","document-check","document-remove","document-text","dollar-sign","dome","dot","dots-horizontal","dots-vertical","download","droplet","droplets","dumbbell","edit","embed","emoji-happy","emoji-sad","euro-sign","exclamation","expand","expressionless","external-link","eye","eye-medical","eye-off","factory","fast-forward","feather","file-code","file-text","file-zip","fill","film","filter","fire","first-aid","fishing","flag","fog","folder","folder-add","folder-minus","folder-open","folder-plus","folder-remove","football","fortress","fuel","gamepad","garage","gauge","gift","git-branch","github","globe","golf","grid","grin","growth","hard-drive","hash","haze","heading-1","heading-2","heading-3","headphones","heart","heart-eyes","heart-filled","heart-pulse","heartbeat","help-circle","holly","home","hospital","hotel","house","image","image-add","images","inbox","indent","info","info-filled","investment","invoice","italic","joy","joystick","key","kettlebell","keyboard","laptop","laugh","layers","layout","library","lighthouse","lightning","link","link-2","link-add","linkedin","list","list-bullet","list-numbered","loader","loading","lock","log-in","log-out","lungs","mail","mail-open","map","map-pin","mask","maximize","medal","medical-cross","menu","menu-alt","message-circle","message-square","mic","mic-off","microscope","minimize","minus","minus-circle","minus-square","monitor","monument","moon","moon-star","more-horizontal","more-vertical","mosque","motorcycle","mountain","mouse","mouse-pointer","move","museum","music","nerd","neutral","notification","obelisk","office","outdent","package","palette","panel-bottom","panel-left","panel-right","panel-top","paperclip","parking","pause","pause-filled","percent","phone","phone-call","phone-incoming","phone-off","phone-outgoing","piggy-bank","pill","pill-bottle","pin","play","play-circle","play-filled","plug","plus","plus-circle","plus-square","podium","pound-sign","printer","pulse","pyramid","qrcode","question","quote","racket","radio","rage","rain","rainbow","receipt","redo","refresh","refresh-cw","reindeer","rewind","road","rotate-ccw","rotate-cw","router","rss","running","sad","safe","save","scale","scale-weight","school","search","send","server","settings","share","share-2","share-alt","shield","shield-alert","shield-check","shield-x","shipping","shocked","shopping-bag","shrink","sick","sidebar-left","sidebar-right","silly","skate","ski","skip-back","skip-forward","skyscraper","sleepy","sleigh","sliders","smartphone","smartwatch","smile","snow","snowflake","snowman","sob","soccer","sort","sparkles","speaker","spinner","square","stadium","star","star-decoration","star-eyes","star-filled","stethoscope","stop","stop-filled","stopwatch","store","strikethrough","sun","sunrise","sunset","surfboard","surprised","swimming","sync","syringe","tablet","tablet-smartphone","tag","tags","target","taxi","temple","tennis","tent","terminal","test-tube","text-center","text-left","text-right","thermometer","thermometer-medical","thermometer-sun","thinking","thumb-down","thumb-up","tongue","tool","tooth","tower","train-station","trash","tree","trending-down","trending-neutral","trending-up","trophy","truck","tv","tv-minimal","twitter","type","umbrella","underline","undo","university","unlink","unlock","upload","usb","user","user-add","user-check","user-group","user-plus","user-remove","users","vaccine","van","vault","video","video-off","volleyball","volume","volume-down","volume-mute","volume-off","volume-up","wallet","warehouse","warning","warning-filled","watch","webcam","wheelchair","whistle","wifi","wifi-off","wind","windmill","wink","wreath","x","x-circle","x-circle-filled","yoga","youtube","zany","zap"];function ce(t,e,b){const l=document.querySelector(".editor-spacer-picker");if(l){l.remove();return}const a=document.createElement("div");a.className="editor-spacer-picker";const o=document.createElement("div");o.className="editor-spacer-picker-label",o.textContent="Spacer height",a.appendChild(o);const r=document.createElement("div");r.className="editor-spacer-picker-row";const i=document.createElement("input");i.type="range",i.className="editor-spacer-slider",i.min="4",i.max="200",i.step="4",i.value=b;const p=document.createElement("span");p.className="editor-spacer-slider-value",p.textContent=b+"px",i.addEventListener("input",function(){p.textContent=this.value+"px"}),r.appendChild(i),r.appendChild(p),a.appendChild(r);const d=document.createElement("button");d.type="button",d.className="btn btn-primary btn-sm editor-spacer-insert-btn",d.textContent="Insert",a.appendChild(d);function f(k){!a.contains(k.target)&&k.target!==e&&(a.remove(),document.removeEventListener("click",f,!0))}d.addEventListener("click",function(){a.remove(),document.removeEventListener("click",f,!0),insertAtCursor(t,`[spacer size="${i.value}" /]
|
|
33
|
+
`)});const n=e.getBoundingClientRect(),s=e.closest(".editor-toolbar").getBoundingClientRect();a.style.top=n.bottom-s.top+4+"px";const u=n.left-s.left;a.style.left=Math.min(u,s.width-240-8)+"px",e.closest(".editor-toolbar").appendChild(a),setTimeout(function(){document.addEventListener("click",f,!0)},0)}function ae(t,e){const b=document.querySelector(".editor-icon-picker");if(b){b.remove();return}const l=document.createElement("div");l.className="editor-icon-picker";const a=document.createElement("input");a.type="text",a.className="form-input editor-icon-picker-search",a.placeholder="Search icons\u2026",l.appendChild(a);const o=document.createElement("div");o.className="editor-icon-picker-size-row";const r=document.createElement("label");r.textContent="Size (px)";const i=document.createElement("input");i.type="number",i.className="form-input editor-icon-picker-size",i.placeholder="default",i.min="8",i.max="256",o.appendChild(r),o.appendChild(i),l.appendChild(o);const p=document.createElement("div");p.className="editor-icon-picker-grid",l.appendChild(p);function d(C){!l.contains(C.target)&&C.target!==e&&(l.remove(),document.removeEventListener("click",d,!0))}function f(C){p.textContent="";const v=C?Z.filter(w=>w.includes(C.toLowerCase())):Z;if(v.length===0){const w=document.createElement("div");w.className="editor-icon-picker-empty",w.textContent="No icons found",p.appendChild(w);return}v.forEach(function(w){const y=document.createElement("button");y.type="button",y.className="editor-icon-picker-item";const S=document.createElement("span");S.setAttribute("data-icon",w);const x=document.createElement("span");x.textContent=w,y.appendChild(S),y.appendChild(x),y.addEventListener("click",function(){l.remove(),document.removeEventListener("click",d,!0);const V=i.value.trim(),M=V?`[icon name="${w}" size="${V}" /]`:`[icon name="${w}" /]`;insertAtCursor(t,M)}),p.appendChild(y)}),Domma.icons.scan(p)}f(""),a.addEventListener("input",function(){f(this.value.trim())});const n=e.getBoundingClientRect(),s=e.closest(".editor-toolbar").getBoundingClientRect();l.style.top=n.bottom-s.top+4+"px";const u=n.left-s.left,k=320,g=s.width;l.style.left=Math.min(u,g-k-8)+"px",e.closest(".editor-toolbar").appendChild(l),requestAnimationFrame(function(){a.focus()}),setTimeout(function(){document.addEventListener("click",d,!0)},0)}function de(t,e,b,l){const a=document.querySelector(".editor-toolbar-dropdown");if(a){a.remove();return}const o=document.createElement("div");o.className="editor-toolbar-dropdown",b.forEach(function(f){const n=document.createElement("button");if(n.type="button",n.className="editor-toolbar-dropdown-item",f.icon){const u=document.createElement("span");u.setAttribute("data-icon",f.icon),n.appendChild(u)}const s=document.createElement("span");s.textContent=f.label,n.appendChild(s),n.addEventListener("click",function(){o.remove(),document.removeEventListener("click",d,!0),U(f.action,t,e,l)}),o.appendChild(n)});const r=e.getBoundingClientRect(),i=e.closest(".editor-toolbar").getBoundingClientRect();o.style.top=r.bottom-i.top+4+"px";const p=r.left-i.left;o.style.left=Math.min(p,i.width-180-8)+"px",e.closest(".editor-toolbar").appendChild(o),Domma.icons.scan(o);function d(f){!o.contains(f.target)&&f.target!==e&&(o.remove(),document.removeEventListener("click",d,!0))}setTimeout(function(){document.addEventListener("click",d,!0)},0)}function U(t,e,b,l){const{spacerDefault:a,handlers:o}=l;if(typeof t=="function")t(e);else if(t==="block")if(o.block)o.block(e);else{const r=e.selectionStart,i='[block template="" /]';e.value=e.value.substring(0,r)+i+e.value.substring(r),e.selectionStart=e.selectionEnd=r+17,e.dispatchEvent(new Event("input",{bubbles:!0})),e.focus()}else if(t==="button")if(o.button)o.button(e);else{const r=e.selectionStart,i=e.selectionEnd,d=`[button href="" variant="primary"]${e.value.substring(r,i)||"Click me"}[/button]`;e.value=e.value.substring(0,r)+d+e.value.substring(i),e.selectionStart=e.selectionEnd=r+14,e.dispatchEvent(new Event("input",{bubbles:!0})),e.focus()}else if(t==="linksc")if(o.linksc)o.linksc(e);else{const r=e.selectionStart,i=e.selectionEnd,d=`[link href=""]${e.value.substring(r,i)||"Link text"}[/link]`;e.value=e.value.substring(0,r)+d+e.value.substring(i),e.selectionStart=e.selectionEnd=r+12,e.dispatchEvent(new Event("input",{bubbles:!0})),e.focus()}else if(t==="link")o.link&&o.link(e);else if(t==="image")o.image&&o.image(e);else if(t==="card")if(o.card)o.card(e);else{const r=e.selectionStart,i=e.selectionEnd,d=`[card title="Card Title"]
|
|
34
34
|
${e.value.substring(r,i)||"Content here"}
|
|
35
|
-
[/card]`;e.value=e.value.substring(0,r)+
|
|
35
|
+
[/card]`;e.value=e.value.substring(0,r)+d+e.value.substring(i),e.selectionStart=r+13,e.selectionEnd=r+23,e.dispatchEvent(new Event("input",{bubbles:!0})),e.focus()}else if(t==="hero"){const r=e.selectionStart,i=e.selectionEnd,d=`[hero title="Hero Title" tagline="A short tagline" size="lg" variant="gradient-blue"]
|
|
36
36
|
${e.value.substring(r,i)||"Optional body content here."}
|
|
37
|
-
[/hero]`;e.value=e.value.substring(0,r)+
|
|
37
|
+
[/hero]`;e.value=e.value.substring(0,r)+d+e.value.substring(i),e.selectionStart=e.selectionEnd=r+d.length,e.dispatchEvent(new Event("input",{bubbles:!0})),e.focus()}else if(t==="grid")if(o.grid)o.grid(e);else{const r=e.selectionStart,i=`[grid cols="2" gap="4"]
|
|
38
38
|
[col]
|
|
39
39
|
Column 1
|
|
40
40
|
[/col]
|
|
@@ -42,7 +42,7 @@ Column 1
|
|
|
42
42
|
Column 2
|
|
43
43
|
[/col]
|
|
44
44
|
[/grid]
|
|
45
|
-
`;e.value=e.value.substring(0,r)+i+e.value.substring(r),e.selectionStart=e.selectionEnd=r+i.length,e.dispatchEvent(new Event("input",{bubbles:!0})),e.focus()}else if(t==="badge"){const r=e.selectionStart,i=e.selectionEnd,
|
|
45
|
+
`;e.value=e.value.substring(0,r)+i+e.value.substring(r),e.selectionStart=e.selectionEnd=r+i.length,e.dispatchEvent(new Event("input",{bubbles:!0})),e.focus()}else if(t==="badge"){const r=e.selectionStart,i=e.selectionEnd,d=`[badge variant="primary"]${e.value.substring(r,i)||"New"}[/badge]`;e.value=e.value.substring(0,r)+d+e.value.substring(i),e.selectionStart=r+16,e.selectionEnd=r+23,e.dispatchEvent(new Event("input",{bubbles:!0})),e.focus()}else if(t==="timeline"){const r=e.selectionStart,i=`[timeline layout="vertical"]
|
|
46
46
|
[event title="First Event" date="${new Date().toISOString().slice(0,10)}" status="completed"]
|
|
47
47
|
Describe this event.
|
|
48
48
|
[/event]
|
|
@@ -50,11 +50,11 @@ Describe this event.
|
|
|
50
50
|
Describe this event.
|
|
51
51
|
[/event]
|
|
52
52
|
[/timeline]
|
|
53
|
-
`;e.value=e.value.substring(0,r)+i+e.value.substring(r),e.selectionStart=e.selectionEnd=r+i.length,e.dispatchEvent(new Event("input",{bubbles:!0})),e.focus()}else if(t==="effects")o.effects?o.effects(e):
|
|
53
|
+
`;e.value=e.value.substring(0,r)+i+e.value.substring(r),e.selectionStart=e.selectionEnd=r+i.length,e.dispatchEvent(new Event("input",{bubbles:!0})),e.focus()}else if(t==="effects")o.effects?o.effects(e):se(e,b);else if(t==="spacerpick")ce(e,b,a);else if(t==="iconpick")ae(e,b);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 r=e.selectionStart,i=`[accordion]
|
|
54
54
|
[item title="Item 1"]Content here.[/item]
|
|
55
55
|
[item title="Item 2"]Content here.[/item]
|
|
56
56
|
[/accordion]
|
|
57
|
-
`;e.value=e.value.substring(0,r)+i+e.value.substring(r),e.selectionStart=e.selectionEnd=r+i.length,e.dispatchEvent(new Event("input",{bubbles:!0})),e.focus()}else if(t==="text"){let n=function(
|
|
57
|
+
`;e.value=e.value.substring(0,r)+i+e.value.substring(r),e.selectionStart=e.selectionEnd=r+i.length,e.dispatchEvent(new Event("input",{bubbles:!0})),e.focus()}else if(t==="text"){let n=function(m,c){const h=document.createElement("div"),L=document.createElement("label");return L.style.cssText=d,L.textContent=m,h.appendChild(L),h.appendChild(c),h},s=function(m){const c=document.createElement("select");return c.style.cssText=f,[["","\u2014 default \u2014"],...m].forEach(([h,L])=>{const P=document.createElement("option");P.value=h,P.textContent=L,c.appendChild(P)}),c},u=function(m,c){const h=document.createElement("input");return h.type="text",h.placeholder=m||"",h.value=c||"",h.style.cssText=f,h},k=function(m){const c=document.createElement("label");c.style.cssText="display:flex;align-items:center;gap:.5rem;cursor:pointer;";const h=document.createElement("input");h.type="checkbox";const L=document.createElement("span");return L.style.cssText="font-size:.85em;color:var(--dm-text,#eee);",L.textContent=m,c.appendChild(h),c.appendChild(L),{wrap:c,cb:h}},g=function(m,c){const h=document.createElement("div");return h.style.cssText="display:grid;grid-template-columns:1fr 1fr;gap:.5rem;",h.appendChild(m),h.appendChild(c),h},C=function(m){const c=document.createElement("div");return c.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;",c.textContent=m,c},D=function(){const m=[];y.value&&m.push(`font-size:${Y[y.value]||y.value}`);const c=parseFloat(S.value);!isNaN(c)&&c>0&&m.push(`font-size:${c}pt`),M.checked?m.push("font-weight:700"):x.value&&m.push(`font-weight:${ee[x.value]||x.value}`),_.checked&&m.push("font-style:italic");const h=H.value.trim();h&&m.push(`color:${X[h]||h}`),z.value&&m.push(`font-family:${ne[z.value]}`),N.value&&m.push(`text-transform:${oe[N.value]}`),T.value&&m.push(`text-decoration:${ie[T.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()),q.style.cssText=m.join(";"),q.textContent=w.value||"Preview text"};const r=e.selectionStart,i=e.selectionEnd,p=e.value.substring(r,i)||"",d="display:block;font-size:.7rem;font-weight:600;color:var(--dm-text-muted,#aaa);text-transform:uppercase;letter-spacing:.05em;",f="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;",v=document.createElement("div");v.style.cssText="padding:1rem;display:flex;flex-direction:column;gap:.6rem;overflow-y:auto;max-height:75vh;";const w=u("Text to style\u2026",p);v.appendChild(n("Content",w)),v.appendChild(C("Typography"));const y=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=u("pt value (overrides Size)");v.appendChild(g(n("Size",y),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:V,cb:M}=k("Bold (overrides Weight)"),{wrap:Q,cb:_}=k("Italic"),j=document.createElement("div");j.style.cssText="display:flex;flex-direction:column;gap:.4rem;justify-content:flex-end;",j.appendChild(V),j.appendChild(Q),v.appendChild(g(n("Weight",x),j)),v.appendChild(C("Appearance"));const H=u("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"]]);v.appendChild(g(n("Colour",H),n("Font",z))),v.appendChild(C("Formatting"));const N=s([["upper","Uppercase"],["lower","Lowercase"],["capitalize","Capitalise"],["none","None"]]),T=s([["underline","Underline"],["line-through","Line-through"],["none","None"]]);v.appendChild(g(n("Transform",N),n("Decoration",T)));const B=s([["tight","Tight"],["normal","Normal"],["wide","Wide"],["wider","Wider"]]),A=s([["left","Left"],["center","Centre"],["right","Right"],["justify","Justify"]]);v.appendChild(g(n("Spacing",B),n("Align",A))),v.appendChild(C("Advanced"));const R=u("e.g. margin-top:1rem;display:block");v.appendChild(n("Style",R));const O=u("CSS class(es)"),F=u("ID");v.appendChild(g(n("Class",O),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 q=document.createElement("span");q.textContent=p||"Preview text",G.appendChild(q),v.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=""),D()}),[y,x,z,N,T,B,A].forEach(m=>{m.addEventListener("change",D)}),[H,w,R,S].forEach(m=>{m.addEventListener("input",D)}),_.addEventListener("change",D);const W=document.createElement("button");W.type="button",W.className="btn btn-primary",W.textContent="Insert",v.appendChild(W);const K=E.modal({title:"Style Text",size:"md"});K.element.appendChild(v),K.open(),W.addEventListener("click",()=>{const m=w.value;if(!m.trim())return;const c=[];y.value&&c.push(`size="${y.value}"`);const h=parseFloat(S.value);!isNaN(h)&&h>0&&c.push(`point-size="${h}"`),M.checked?c.push("bold"):x.value&&c.push(`weight="${x.value}"`),_.checked&&c.push("italic"),H.value.trim()&&c.push(`color="${H.value.trim()}"`),z.value&&c.push(`font="${z.value}"`),N.value&&c.push(`transform="${N.value}"`),T.value&&c.push(`decoration="${T.value}"`),B.value&&c.push(`spacing="${B.value}"`),A.value&&c.push(`align="${A.value}"`),R.value.trim()&&c.push(`style="${R.value.trim().replace(/"/g,""")}"`),O.value.trim()&&c.push(`class="${O.value.trim()}"`),F.value.trim()&&c.push(`id="${F.value.trim()}"`);const P=`[text${c.length?" "+c.join(" "):""}]${m}[/text]`;K.close(),insertAtCursor(e,P),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,`
|
|
58
58
|
---
|
|
59
|
-
`)}]},"|",{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:"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,b={}){
|
|
60
|
-
`,o.selectionStart-1)+1,
|
|
59
|
+
`)}]},"|",{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:"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,b={}){le();const l={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},a=b.spacerDefault??40,o=t.get(0),r=e.get(0);r.textContent="",J.forEach((n,s)=>{if(n==="|"){const u=document.createElement("span");u.className="editor-toolbar-sep",r.appendChild(u)}else{const u=document.createElement("button");u.className=n.type==="dropdown"?"editor-toolbar-btn editor-toolbar-dropdown-trigger":"editor-toolbar-btn",u.setAttribute("data-tooltip",n.title),u.setAttribute("data-idx",String(s)),u.type="button";const k=document.createElement("span");if(k.setAttribute("data-icon",n.icon),u.appendChild(k),n.type==="dropdown"){const g=document.createElement("span");g.className="editor-toolbar-caret",g.textContent="\u25BE",u.appendChild(g)}r.appendChild(u)}});const i=document.createElement("div");i.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 u=document.createElement("span");u.setAttribute("data-icon",n.icon),s.appendChild(u),i.appendChild(s)});const p=document.createElement("span");p.className="editor-toolbar-sep",i.appendChild(p);const d=document.createElement("button");d.id="fullscreen-btn",d.className="editor-toolbar-btn",d.setAttribute("data-tooltip","Toggle fullscreen"),d.type="button";const f=document.createElement("span");return f.setAttribute("data-icon","expand"),d.appendChild(f),i.appendChild(d),r.appendChild(i),Domma.icons.scan(),r.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 u=e.get(0).querySelector(`[data-idx="${n}"]`),k={spacerDefault:a,handlers:l};s.type==="dropdown"?de(o,u,s.items,k):U(s.action,o,u,k)}),t.on("keydown",function(n){const s=n.key.toLowerCase();if(n.ctrlKey||n.metaKey)s==="b"?(n.preventDefault(),wrapSelection(o,"**","**")):s==="i"?(n.preventDefault(),wrapSelection(o,"_","_")):s==="k"&&(n.preventDefault(),l.link&&l.link(o));else if(n.key==="Tab")if(n.preventDefault(),n.shiftKey){const u=o.value.lastIndexOf(`
|
|
60
|
+
`,o.selectionStart-1)+1,k=o.value.substring(u),g=k.match(/^ {1,4}/);if(g){const C=o.value.substring(0,u),v=o.value.substring(u+g[0].length);o.value=C+k.substring(g[0].length),o.selectionStart=o.selectionEnd=Math.max(u,o.selectionStart-g[0].length),o.dispatchEvent(new Event("input",{bubbles:!0}))}}else insertAtCursor(o," ")}),{$toolbar:e,onLink(n){l.link=n},onImage(n){l.image=n},onCard(n){l.card=n},onGrid(n){l.grid=n},onHelp(n){l.help=n},onEffects(n){l.effects=n},onCollection(n){l.collection=n},onBlock(n){l.block=n},onView(n){l.view=n},onCta(n){l.cta=n},onForm(n){l.form=n},onButton(n){l.button=n},onLinkShortcode(n){l.linksc=n},onTabs(n){l.tabs=n},onAccordion(n){l.accordion=n}}}
|
package/package.json
CHANGED
package/server/server.js
CHANGED
|
@@ -72,6 +72,7 @@ await app.register(helmet, {
|
|
|
72
72
|
imgSrc: ["'self'", 'data:', 'blob:'],
|
|
73
73
|
fontSrc: ["'self'", 'data:', 'https://fonts.gstatic.com'],
|
|
74
74
|
connectSrc: ["'self'", 'https://cdn.jsdelivr.net'],
|
|
75
|
+
upgradeInsecureRequests: null, // prevent browsers forcing HTTPS on HTTP deployments
|
|
75
76
|
}
|
|
76
77
|
},
|
|
77
78
|
crossOriginEmbedderPolicy: false, // allow embedding images/resources
|