domma-cms 1.34.0 → 1.36.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.
- package/CHANGELOG.md +11 -0
- package/admin/js/api.js +1 -1
- package/admin/js/app.js +2 -2
- package/admin/js/lib/image-editor.js +1 -1
- package/admin/js/lib/media-arrange.js +1 -1
- package/admin/js/lib/media-picker.js +2 -2
- package/admin/js/lib/media-upload.js +1 -1
- package/admin/js/lib/seo-redirects.js +1 -1
- package/admin/js/templates/docs/usage-media.html +6 -0
- package/admin/js/templates/media.html +1 -0
- package/admin/js/views/media.js +3 -3
- package/docs/DommaFeatures.md +3 -0
- package/package.json +1 -1
- package/plugins/_lib/admin/mail/body-menu.js +1 -1
- package/plugins/_lib/admin/mail/cms-host.js +1 -1
- package/plugins/_lib/admin/mail/compose-window.js +1 -1
- package/plugins/_lib/admin/mail/contacts.js +1 -1
- package/plugins/_lib/admin/mail/diagnostics-section.js +1 -1
- package/plugins/_lib/admin/mail/drag-drop.js +1 -1
- package/plugins/_lib/admin/mail/folder-tree.js +26 -1
- package/plugins/_lib/admin/mail/font-controls.js +1 -1
- package/plugins/_lib/admin/mail/fonts.js +1 -1
- package/plugins/_lib/admin/mail/host-context.js +1 -1
- package/plugins/_lib/admin/mail/identity.js +1 -1
- package/plugins/_lib/admin/mail/image-senders-section.js +1 -1
- package/plugins/_lib/admin/mail/keyboard.js +1 -1
- package/plugins/_lib/admin/mail/mail.html +4 -1
- package/plugins/_lib/admin/mail/message-actions.js +1 -1
- package/plugins/_lib/admin/mail/oauth-panel.js +1 -1
- package/plugins/_lib/admin/mail/panes.js +1 -1
- package/plugins/_lib/admin/mail/reader-kit.js +9 -3
- package/plugins/_lib/admin/mail/reader-runtime.js +154 -6
- package/plugins/_lib/admin/mail/reader-view.js +1 -1
- package/plugins/_lib/admin/mail/resizable.js +1 -1
- package/plugins/_lib/admin/mail/restore-spam.js +1 -1
- package/plugins/_lib/admin/mail/rules.js +1 -1
- package/plugins/_lib/admin/mail/scheduling.js +1 -1
- package/plugins/_lib/admin/mail/section-kit.js +1 -1
- package/plugins/_lib/admin/mail/security-note.js +1 -1
- package/plugins/_lib/admin/mail/settings-section.js +1 -1
- package/plugins/_lib/admin/mail/templates.js +1 -1
- package/plugins/_lib/admin/mail/threads.js +1 -1
- package/plugins/_lib/admin/mail/vacation.js +1 -1
- package/plugins/_lib/admin/mail/when-closed.js +1 -1
- package/plugins/_lib/admin/ui/dates.js +1 -1
- package/plugins/_lib/admin/ui/resizable.js +1 -1
- package/plugins/_lib/domma-mail.lock.json +80 -80
- package/plugins/_lib/mail/accountFileStore.js +1 -1
- package/plugins/_lib/mail/accountRepository.js +1 -1
- package/plugins/_lib/mail/accountRoutes.js +1 -1
- package/plugins/_lib/mail/bodyTokenProvider.js +1 -1
- package/plugins/_lib/mail/bodyTokens.js +1 -1
- package/plugins/_lib/mail/compose.js +1 -1
- package/plugins/_lib/mail/defaults.js +1 -1
- package/plugins/_lib/mail/envelope.js +1 -1
- package/plugins/_lib/mail/folderActions.js +1 -1
- package/plugins/_lib/mail/folderRuntime.js +1 -1
- package/plugins/_lib/mail/folders.js +1 -1
- package/plugins/_lib/mail/imapPoolRuntime.js +1 -1
- package/plugins/_lib/mail/mbox.js +1 -1
- package/plugins/_lib/mail/message-action.js +1 -1
- package/plugins/_lib/mail/messageSecurity.js +1 -1
- package/plugins/_lib/mail/messageSecurityProvider.js +1 -1
- package/plugins/_lib/mail/networkAddresses.js +1 -1
- package/plugins/_lib/mail/networkPolicy.js +1 -1
- package/plugins/_lib/mail/oauthAccounts.js +1 -1
- package/plugins/_lib/mail/oauthRouteRuntime.js +1 -1
- package/plugins/_lib/mail/oauthRuntime.js +1 -1
- package/plugins/_lib/mail/pollSchedule.js +1 -1
- package/plugins/_lib/mail/poller.js +1 -1
- package/plugins/_lib/mail/pollerRuntime.js +1 -1
- package/plugins/_lib/mail/priority.js +1 -1
- package/plugins/_lib/mail/publicMailbox.js +1 -1
- package/plugins/_lib/mail/readRuntime.js +1 -1
- package/plugins/_lib/mail/render.js +1 -1
- package/plugins/_lib/mail/ruleRunner.js +1 -1
- package/plugins/_lib/mail/schedulerRuntime.js +1 -1
- package/plugins/_lib/mail/secretProvider.js +1 -1
- package/plugins/_lib/mail/secretbox.js +1 -1
- package/plugins/_lib/mail/senderAuth.js +1 -1
- package/plugins/_lib/mail/sieve.js +1 -1
- package/plugins/_lib/mail/smtpService.js +1 -1
- package/plugins/_lib/mail/snoozeRuntime.js +1 -1
- package/plugins/_lib/mail/store.js +1 -1
- package/plugins/_lib/mail/subscriptions.js +1 -1
- package/plugins/_lib/mail/syncPlan.js +1 -1
- package/plugins/_lib/mail/syncRuntime.js +1 -1
- package/plugins/_lib/mail/syncSelection.js +1 -1
- package/plugins/_lib/mail/unreadBadge.js +1 -1
- package/plugins/_lib/mail/unsubscribe.js +1 -1
- package/plugins/_lib/mail/vacationRuntime.js +1 -1
- package/plugins/_lib/mail/write.js +1 -1
- package/server/routes/api/media.js +3 -1
- package/server/routes/api/sidebar.js +2 -2
- package/server/services/content.js +26 -2
- package/server/services/hooks.js +27 -4
- package/server/services/plugins.js +9 -3
- package/server/services/renderer.js +3 -1
package/admin/js/views/media.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{api as
|
|
1
|
+
import{api as C}from"../api.js";import{catchFiles as qe,mediaUploader as ze}from"../lib/media-upload.js";import{addBannerAction as Ie}from"../lib/plugin-chrome.js";import{SHAPES as Re,whileLoading as Ue}from"../lib/loading.js";import{helpPopovers as ve}from"../lib/help-popover.js";import{onceClosed as Be,openMenuAt as ye,settingsStore as Fe,sidebarCount as j,viewLifetime as He}from"../lib/tool-kit.js";import{openImageEditor as Pe}from"../lib/image-editor.js";import{KIND_LABEL as he,arrangeMedia as Ke,formatBytes as ge,isEditable as G,isPreviewable as Oe,kindCounts as _e,kindOf as Ve,markdownFor as J,foldersText as Ye,mediaTile as je,normalisePrefs as Ge,safeName as L}from"../lib/media-arrange.js";import{fmtDateTime as Je}from"../lib/dates.js";const we=/^#\/media\/?(\?.*)?$/,Q="#/media",N="media.draft",ke=Fe("media.prefs",Ge),Qe=`
|
|
2
2
|
<div class="mdx-tile" data-name="{{name}}" tabindex="0" title="{{name}}">
|
|
3
3
|
<div class="mdx-thumb">
|
|
4
4
|
<img data-bind-hidden="!preview" data-bind-src="thumb" alt="" loading="lazy" decoding="async">
|
|
@@ -7,7 +7,7 @@ import{api as L}from"../api.js";import{catchFiles as qe,mediaUploader as Ne}from
|
|
|
7
7
|
<span class="mdx-chip">{{kindLabel}}</span>
|
|
8
8
|
<button type="button" class="mdx-kebab" aria-label="Actions for {{name}}" title="Actions">\u22EE</button>
|
|
9
9
|
<div class="mdx-info"><span class="mdx-name">{{name}}</span><span class="mdx-meta">{{meta}}</span></div>
|
|
10
|
-
</div>`,
|
|
10
|
+
</div>`,q=c=>String(c??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");function We(c){const s=document.createElement("template");return s.innerHTML=c.trim(),s.content.firstElementChild}const l=He(we);let W=null;async function z(c,s){try{await navigator.clipboard.writeText(c),E.toast(`${s} copied.`,{type:"success"})}catch{E.toast("Copy failed - the browser refused the clipboard.",{type:"error"})}}export const mediaView={templateUrl:"/admin/js/templates/media.html",async onMount(c){l.reset();const s=c.get(0).querySelector(".mdx")||c.get(0),m=()=>we.test(location.hash)&&s.isConnected,X=ke.read(),p=M.observable([]),Z=M.observable(!0),R=M.observable(""),b=M.observable(X.kind),U=M.observable(X.sort),ee=M.observable(""),te=M.observable(!1),ae=M.observable(""),ne=M.observable("");let B=String(Date.now());l.add(M.effect(()=>ke.write({kind:b.value,sort:U.value})));const D=M.observable([]);l.add(M.effect(()=>{const e=Date.now();D.value=Ke(p.value,{kind:b.value,query:ee.value,sort:U.value}).map(a=>je(a,{now:e,stamp:B}))}));const oe=M.computed(()=>_e(p.value));l.add(M.effect(()=>{b.value!=="all"&&!oe.value[b.value]&&p.value.length&&(b.value="all")}));const xe=M.computed(()=>{const e=p.value,a=D.value.length,i=ge(e.reduce((n,u)=>n+(Number(u.size)||0),0));return a===e.length?`${e.length} file${e.length===1?"":"s"} \xB7 ${i}`:`${a} of ${e.length} \xB7 ${i} in all`}),Ee=M.computed(()=>p.value.length?"No files match.":"Nothing uploaded yet - drop files here, or Upload in the banner."),h=e=>p.peek().find(a=>a.name===e);async function g(){try{const e=await Ue(s.querySelector(".dm-loading-slot"),C.media.list(),Re.tiles);if(!m())return;B=String(Date.now()),p.value=Array.isArray(e)?e:[],R.value=""}catch(e){R.value=`Could not load the media: ${e.message||e}`}finally{Z.value=!1}}async function F(e){if(!await E.confirm(`Delete "${q(e.name)}"? Pages that show it will show a broken image or link. This cannot be undone.`))return!1;try{return await C.media.delete(e.name),E.toast(`Deleted "${e.name}".`,{type:"success"}),j(Q),m()&&await g(),!0}catch(a){return E.toast(`Not deleted: ${a.message||a}`,{type:"error"}),!1}}async function se(e){const a=await Pe(e);return a&&m()&&(j(Q),await g()),a}const H=e=>window.location.origin+e.url;let v=null,ie=!1;const P=new Set;function w(e,{focusRename:a=!1,draftName:i=null}={}){const n=h(e);if(!n){E.toast(`"${e}" is not here any more.`,{type:"warning"});return}const u=M.observable(i??n.name),$=M.observable(!1),ce=M.computed(()=>{const t=u.value.trim();if(!t)return"A file needs a name.";const o=L(t);return o!==n.name&&h(o)?`"${o}" is already here.`:""}),Ce=M.computed(()=>{const t=u.value.trim(),o=L(t);return t&&o!==t?`Saved as "${o}" - only letters, numbers, dots, hyphens and underscores are kept.`:""}),me=()=>u.peek().trim()!==n.name,ue={newName:u,saving:$,renameErr:ce,renameHint:Ce,cannotRename:M.computed(()=>$.value||!!ce.value||L(u.value.trim())===n.name),editable:G(n.name)},d=E.slideover({title:q(n.name),size:"md",position:"right"}),r=We(`
|
|
11
11
|
<div class="mdx-panel">
|
|
12
12
|
<div class="mdx-preview"></div>
|
|
13
13
|
<dl class="mdx-facts"></dl>
|
|
@@ -37,4 +37,4 @@ import{api as L}from"../api.js";import{catchFiles as qe,mediaUploader as Ne}from
|
|
|
37
37
|
<a class="btn btn-sm btn-ghost mdx-open" target="_blank" rel="noopener"><span data-icon="external-link" data-icon-size="13"></span> Open</a>
|
|
38
38
|
<button type="button" class="btn btn-sm btn-outline" data-on-click="edit" data-bind-hidden="!editable"><span data-icon="edit" data-icon-size="13"></span> Edit image</button>
|
|
39
39
|
</div>
|
|
40
|
-
</div>`),O=r.querySelector(".mdx-preview"),x=
|
|
40
|
+
</div>`),O=r.querySelector(".mdx-preview"),x=Ve(n.name);if(Oe(n.name)){const t=document.createElement("img");t.src=`${n.url}?t=${encodeURIComponent(B)}`,t.alt=n.name,O.appendChild(t)}else if(x==="video"||x==="audio"){const t=document.createElement(x);t.src=n.url,t.controls=!0,t.preload="metadata",O.appendChild(t)}else{const t=document.createElement("span");t.setAttribute("data-icon",x==="document"?"file-text":"paperclip"),t.setAttribute("data-icon-size","40"),O.appendChild(t)}const De=r.querySelector(".mdx-facts"),T=(t,o)=>{const be=document.createElement("dt");be.textContent=t;const Y=document.createElement("dd");return Y.textContent=o,De.append(be,Y),Y};if(T("Type",`${he[x]==="Images"?"Image":he[x].replace(/s$/,"")} (${(n.name.split(".").pop()||"").toUpperCase()})`),T("Size",ge(n.size)),T("Uploaded",n.createdAt?Je(n.createdAt):"-"),G(n.name)){const t=T("Dimensions","\u2026");C.media.info(n.name).then(o=>{t.textContent=o?.width?`${o.width} \xD7 ${o.height} px`:"-"}).catch(()=>{t.textContent="-"})}r.querySelector(".mdx-url").value=H(n),r.querySelector(".mdx-md").value=J(n),r.querySelector(".mdx-open").href=n.url;let A=!1;async function pe(){if(!ue.cannotRename.peek()){$.value=!0;try{const t=await C.media.rename(n.name,u.peek().trim());E.toast(`Renamed to "${t?.name||L(u.peek().trim())}".`,{type:"success"}),A=!0,d.close(),m()&&await g()}catch(t){E.toast(`Not renamed: ${t.message||t}`,{type:"error"})}finally{$.value=!1}}}d.element.appendChild(r);const $e=ve(r),Te=M.applyBindings(ue,r,{methods:{rename:pe,copyUrl:()=>z(H(n),"Address"),copyMd:()=>z(J(n),"Markdown"),async del(){await F(n)&&(A=!0,d.close())},async edit(){A=!0,d.close(),await se(n)}}}),_=r.querySelector("#mdx-rename"),Le=t=>{t.key==="Enter"&&t.target===_&&(t.preventDefault(),pe())};r.addEventListener("keydown",Le);const fe={name:n.name,dirty:me,newName:()=>u.peek()};v=fe,P.add(d),Be(d,()=>{Te.dispose(),$e(),r.querySelectorAll("video, audio").forEach(t=>{try{t.pause()}catch{}}),P.delete(d),v===fe&&(v=null)});const Ne=d.close.bind(d);let V=!1;d.close=async t=>{if(!A&&!ie&&t!==!0&&me()){if(V)return;V=!0;const o=await E.confirm("Discard the new name you typed?");if(V=!1,!o)return}return A=!0,Ne()},I.scan(r),d.open(),(a||i)&&(_.focus(),_.select())}function Me(e){const a=h(e);return a?[{header:a.name},{label:"Details\u2026",icon:"info",action:()=>w(a.name)},{label:"Copy address",icon:"link",action:()=>z(H(a),"Address")},{label:"Copy for a page",icon:"copy",action:()=>z(J(a),"Markdown")},{label:"Open in a new tab",icon:"external-link",action:()=>window.open(a.url,"_blank","noopener")},{type:"divider"},{label:"Rename\u2026",icon:"type",action:()=>w(a.name,{focusRename:!0})},...G(a.name)?[{label:"Edit image\u2026",icon:"edit",action:()=>se(a)}]:[],{type:"divider"},{label:"Delete\u2026",icon:"trash",danger:!0,action:()=>F(a)}]:[]}const f=s.querySelector(".mdx-grid");f.innerHTML=Qe;const k=e=>()=>{b.value=e},Se=M.applyBindings({files:p,loading:Z,loadError:R,kind:b,sort:U,query:ee,tiles:D,counts:oe,totalText:xe,emptyText:Ee,hintText:ae,foldersNote:ne,dragging:te},s,{methods:{kindAll:k("all"),kindImage:k("image"),kindVideo:k("video"),kindAudio:k("audio"),kindDocument:k("document"),kindOther:k("other")}});l.add(()=>Se.dispose()),l.add(ve(s,{position:"bottom"})),l.add(M.effect(()=>{D.value,requestAnimationFrame(()=>{f.isConnected&&I.scan(f)})}));const Ae=E.contextMenu(f,{cursor:"glyph",match:".mdx-tile",inherit:!1,density:"compact",items:e=>Me(e.dataset.name)});l.add(()=>Ae?.destroy?.());const le=e=>{const a=e.target.closest(".mdx-tile");if(!a)return;const i=e.target.closest(".mdx-kebab");if(i){ye(i);return}w(a.dataset.name)},re=e=>{const a=e.target.closest(".mdx-tile");if(!a||e.target!==a)return;const i=h(a.dataset.name);i&&(e.key==="F10"&&e.shiftKey?(e.preventDefault(),ye(a)):e.key==="Enter"?w(i.name):e.key==="F2"?(e.preventDefault(),w(i.name,{focusRename:!0})):e.key==="Delete"&&(e.preventDefault(),F(i)))};f.addEventListener("click",le),f.addEventListener("keydown",re),l.add(()=>{f.removeEventListener("click",le),f.removeEventListener("keydown",re)});const K=ze(s.querySelector(".mdx-zone"),{input:s.querySelector(".mdx-file-input"),exists:e=>!!h(e),showing:m,onHint:e=>{ae.value=e},onUploaded(){j(Q),m()?g():W?.()}});W=()=>{m()&&g()},l.add(()=>{W=null,K.release()}),Ie(c,{id:"media-upload",icon:"upload",title:"Upload files",onClick:()=>K.browse()}),l.add(qe(c.get(0),K.addFiles,{onDragging:e=>{te.value=e}}));const de=e=>{v?.dirty()&&(e.preventDefault(),e.returnValue="")};if(window.addEventListener("beforeunload",de),l.add(()=>window.removeEventListener("beforeunload",de)),l.add(()=>{if(v?.dirty())try{S.set(N,{name:v.name,newName:v.newName(),at:new Date().toISOString()})}catch{}ie=!0,[...P].forEach(e=>{try{e.close(!0)}catch{}})}),I.scan(s),await g(),!m())return;C.media.folders().then(e=>{m()&&e?.files&&(ne.value=Ye(e))}).catch(()=>{});let y=null;try{y=S.get(N)}catch{}if(y?.name){try{S.remove?S.remove(N):S.set(N,null)}catch{}h(y.name)&&await E.confirm(`You were renaming "${q(y.name)}" to "${q(y.newName)}" and left before saving. Pick up where you left off?`)&&m()&&w(y.name,{draftName:y.newName})}}};
|
package/docs/DommaFeatures.md
CHANGED
|
@@ -40,6 +40,7 @@ Code was treated as the truth. Where docs disagree with it, the disagreement is
|
|
|
40
40
|
| `booking-pro` | paid | 0.4.1 | More for Booking: online appointments as a video call on your site (optional host recording), Call now - open a booking's call at once or call anyone from a contact or an email (switches on the CMS's instant calls), a person and a room together, classes with places and a waiting list that fills a freed place by itself, repeat bookings, questions on the booking form, a daily limit and one booking per customer every N days. A lapse leaves Booking and every booking as they were. |
|
|
41
41
|
| `calendar` | paid | 1.15.4 | Events calendar - month, day and list views, online meetings as a video call on your site (with the call's chat kept, and Add people during the call), call anyone now from a contact or an email, all-day and recurring events, sharing with people and roles, RSVPs and an iCal feed. |
|
|
42
42
|
| `campaigns-pro` | paid | 1.6.0 | Marketing campaigns, one paid Tool: compose a message, send it to Contacts groups (read live when it sends) or an audience of its own (shared with Surveys), from the site's sending or your own Email mailbox (small lists), schedule sends, attach an offer that closes by a date or a claim limit. Opens and clicks (cookieless), links tagged for Analytics, a linked Shop discount code, send a survey as a campaign, follow-up sequences, resend to non-openers, A/B subject tests, and a version-1 stats feed other Tools read. |
|
|
43
|
+
| `media-pro` | paid | 0.2.0 | Media, properly organised: folders inside folders, choose from them anywhere, and move or rename anything without breaking a page. Select several, see where each file is used, find what is unused or duplicated, shrink big pictures, alt text and credits with each file, Trash, and a whole folder as a gallery. Works on the same files as the built-in Tool. |
|
|
43
44
|
| `contacts-pro` | paid | 0.13.0 | Contacts, with more to them: send a campaign to a group or the selected contacts (with Campaigns Pro), your own custom fields, birthdays and ages with the ones coming up and a reminder in the sidebar, and groups with their own emblem and colours. Share a contact, several, or a whole group with people or roles - to view, or to edit. Call a contact now on a video call on your site. Works over the same contacts as the built-in Tool, so nothing moves and nothing is lost. |
|
|
44
45
|
| `crossword` | paid (giftable) | 1.5.1 | Crosswords on your site: type the answers and clues and the grid lays itself out (live preview, Another layout). Players type a name and race the server's clock, checks and wrong guesses cost time, fastest solvers on a leaderboard. Hints for a time penalty, personal best and Share, animations, export and import. Test it from the Tool - a test go never reaches the board. Rotation (a new quiz every day or week from a queue, off by default) and fresh quizzes from Domma for review. |
|
|
45
46
|
| `daily-word` | paid (giftable) | 1.3.0 | One hidden word a day, the same for everyone: six guesses, each letter marked right place, in the word or not; real words only (a bundled dictionary, switchable), an archive of past days, streaks, Share as coloured squares, a calendar of what is coming. Fewest guesses tops the day's board, then the fastest. |
|
|
@@ -335,6 +336,8 @@ Fast, file-based and friendly.
|
|
|
335
336
|
### Media library
|
|
336
337
|
|
|
337
338
|
- **Media library** - upload by button or by dropping files anywhere on the screen (images, documents, audio, video; 10 MB default limit). Tiles with thumbnail, size, age and type; filter All / Images / Video / Audio / Documents / Other; sort newest, oldest, name or largest. Details slideover with rename, Copy address and Copy for a page (Markdown); right-click menu, F2 to rename, Delete key. Replacing a same-named file asks first.
|
|
339
|
+
- **Files in folders** - the built-in screen lists the top of the library; when there are files in folders it says how many, and they keep working at their addresses (`GET /api/media/_folders`). Managing folders is Media Pro.
|
|
340
|
+
- **Media Pro** (paid, `media-pro`, marketplace; dev on dcm) - takes over the Media screen and every image picker. Nested folders that are real folders (`/media/products/shoes/red.jpg`), drag to move, upload a whole folder keeping its shape, select several (move, tag, shrink, zip, Trash). Moving or renaming anything updates pages, collections and settings that use it and adds a redirect in the SEO Tool; blocks, forms, menus, custom.css and other Tools' data are reported and kept working by that redirect. Used-on list per file, Tidy up (unused, duplicates, big pictures, no alt text), alt text, caption, credit and tags with each file, Replace keeping the address, Shrink (optionally to WebP), upload rules (longest side, remove location data, store as WebP), Trash with restore, thumbnails, `[media-gallery folder="…" /]`. 0.2.0: pages offer phones smaller copies (`srcset`), a focal point per picture is kept in crops, and Claude writes alt text for a person to check, included in the plan (the Manager holds the key: site-manager `mediaAltRoutes.js`, `tools/media-alt`; 5,000 per site per month). Over the same files as the built-in Tool: a lapsed licence loses no file and breaks no address. Hooks in core: `BUILT_IN_TOOLS` takes `media`, `admin.mediaPicker` in a manifest, `openImageEditor(file, {api})`, `mediaUploader(zone, {url})`.
|
|
338
341
|
- Where: **Content > Media**; `content/media/`; `config/server.json` `uploads.maxFileSize`
|
|
339
342
|
- Since: 0.5.0
|
|
340
343
|
- **Image editor** - edit JPEG, PNG, WebP, GIF or TIFF in place: crop (aspect lock), resize, rotate, flip, colour presets (grayscale, sepia, warm, cool, enhance, sharpen, soften, invert), adjustments, watermark (position, scale, opacity), border (solid, mirror, repeat) and output format (JPEG, PNG, WebP with quality). Save as a copy or overwrite.
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.0, packages/core/src/admin/mail/body-menu.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* The reading pane's right-click menu - the pure parts.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.0, packages/core/src/admin/mail/cms-host.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/** The CMS shell boundary. Standalone never imports this adapter. */
|
|
4
4
|
const version = new URL(import.meta.url).searchParams.get('v') ?? '1';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.0, packages/core/src/admin/mail/compose-window.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
const MAIL_MODULE_VERSION = new URL(import.meta.url).searchParams.get('v') ?? '1';
|
|
4
4
|
const {createMailHost} = await import(new URL(`./host-context.js?v=${MAIL_MODULE_VERSION}`, import.meta.url).href);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.0, packages/core/src/admin/mail/contacts.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* Recipient suggestions from the host address book.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.0, packages/core/src/admin/mail/diagnostics-section.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* The settings section that answers "which build is this, and what went wrong".
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.0, packages/core/src/admin/mail/drag-drop.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/** Drag identities include the mailbox and source folder: UIDs alone are not unique. */
|
|
4
4
|
const PROTECTED_USES = new Set(['\\Inbox', '\\Sent', '\\Drafts', '\\Trash', '\\Junk', '\\Archive', '\\All', '\\Flagged']);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.0, packages/core/src/admin/mail/folder-tree.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* Mail folder presentation, shared by the Mail Reader and Email Pro.
|
|
@@ -174,6 +174,31 @@ export function unreadInSubtree(node) {
|
|
|
174
174
|
return node.children.reduce((total, child) => total + unreadInSubtree(child), own);
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
+
/**
|
|
178
|
+
* Every folder that has folders inside it - what "Close all folders" shuts.
|
|
179
|
+
*
|
|
180
|
+
* @param {object[]} roots
|
|
181
|
+
* @returns {string[]}
|
|
182
|
+
*/
|
|
183
|
+
export function foldablePaths(roots) {
|
|
184
|
+
return flattenFolderTree(roots).filter(node => node.children.length > 0).map(node => node.path);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* A folder and every folder beneath it that can hold mail, parent first -
|
|
189
|
+
* what "including folders inside" acts on. Unselectable levels (a parent a
|
|
190
|
+
* server lists only as a container, or one the tree synthesised) are left out.
|
|
191
|
+
*
|
|
192
|
+
* @param {object[]} roots
|
|
193
|
+
* @param {string} path
|
|
194
|
+
* @returns {string[]} empty when the path is not in the tree
|
|
195
|
+
*/
|
|
196
|
+
export function subtreePaths(roots, path) {
|
|
197
|
+
const node = flattenFolderTree(roots).find(item => item.path === path);
|
|
198
|
+
if (!node) return [];
|
|
199
|
+
return flattenFolderTree([node]).filter(item => item.selectable !== false).map(item => item.path);
|
|
200
|
+
}
|
|
201
|
+
|
|
177
202
|
/**
|
|
178
203
|
* Keep only the branches that lead to unread mail.
|
|
179
204
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.0, packages/core/src/admin/mail/font-controls.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
const MAIL_MODULE_VERSION = new URL(import.meta.url).searchParams.get('v') ?? '1';
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.0, packages/core/src/admin/mail/fonts.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* The fonts and sizes the mail editor offers - pure, so both the compose
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.0, packages/core/src/admin/mail/host-context.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/** Services supplied by the application that hosts the shared mail interface. */
|
|
4
4
|
export function createMailApi({getToken, fetch: request = globalThis.fetch, onUnauthorized = () => {}}) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.0, packages/core/src/admin/mail/identity.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* Who a mailbox sends as, and what it signs off with.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.0, packages/core/src/admin/mail/image-senders-section.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* The settings section for senders whose images always load.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.0, packages/core/src/admin/mail/keyboard.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* Keyboard navigation for the reader.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!-- Source: @domma-mail/core 0.
|
|
1
|
+
<!-- Source: @domma-mail/core 0.22.0, packages/core/src/admin/mail/mail.html. -->
|
|
2
2
|
<div class="mail-layout">
|
|
3
3
|
|
|
4
4
|
<!-- Folders -->
|
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
<input type="checkbox" id="mail-unread-only">
|
|
10
10
|
<span>Unread</span>
|
|
11
11
|
</label>
|
|
12
|
+
<button class="btn btn-sm btn-ghost" id="mail-fold-all-btn" title="Close all folders" hidden>
|
|
13
|
+
<span data-icon="chevrons-right" data-icon-size="14"></span>
|
|
14
|
+
</button>
|
|
12
15
|
<button class="btn btn-sm btn-ghost" id="mail-new-folder-btn" title="New folder" hidden>
|
|
13
16
|
<span data-icon="folder-plus" data-icon-size="14"></span>
|
|
14
17
|
</button>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.0, packages/core/src/admin/mail/message-actions.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* What other Tools add to a message's menu - Booking's "Book Sam...".
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.0, packages/core/src/admin/mail/oauth-panel.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* "Sign in with Microsoft / Google" for a mailbox - the part of the mailbox
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.0, packages/core/src/admin/mail/panes.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* Pane sizing for the mail reader, shared by the Mail Reader and Email Pro.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.0, packages/core/src/admin/mail/reader-kit.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* The reader view's decisions that need no DOM - escaping, the mailbox form's
|
|
@@ -237,14 +237,20 @@ export function onceOnly() {
|
|
|
237
237
|
/**
|
|
238
238
|
* What a mailbox row's menu offers, as ids the view maps to actions.
|
|
239
239
|
*
|
|
240
|
-
* @param {{isCurrent: boolean, isDefault: boolean, count: number,
|
|
240
|
+
* @param {{isCurrent: boolean, isDefault: boolean, count: number, foldable?: number|null}} o
|
|
241
241
|
* @returns {{id: string, label: string, icon: string, disabled?: boolean, danger?: boolean}[]|object[]}
|
|
242
242
|
*/
|
|
243
|
-
export function accountMenuModel({isCurrent = false, isDefault = false, count = 1} = {}) {
|
|
243
|
+
export function accountMenuModel({isCurrent = false, isDefault = false, count = 1, foldable = null} = {}) {
|
|
244
|
+
// `foldable` is how many folders have folders inside, known only for the
|
|
245
|
+
// open mailbox; for another one the items open it first, so they stay on.
|
|
246
|
+
const nothingToFold = isCurrent && foldable === 0;
|
|
244
247
|
return [
|
|
245
248
|
{id: 'open', label: isCurrent ? 'Open (already open)' : 'Open', icon: 'inbox', disabled: isCurrent},
|
|
246
249
|
{id: 'refresh', label: 'Check for new mail', icon: 'refresh-cw', disabled: !isCurrent},
|
|
247
250
|
{type: 'divider'},
|
|
251
|
+
{id: 'expandAll', label: 'Open all folders', icon: 'chevrons-down', disabled: nothingToFold},
|
|
252
|
+
{id: 'collapseAll', label: 'Close all folders', icon: 'chevrons-right', disabled: nothingToFold},
|
|
253
|
+
{type: 'divider'},
|
|
248
254
|
{id: 'edit', label: 'Edit…', icon: 'edit-3'},
|
|
249
255
|
...(count > 1 ? [{id: 'default', label: isDefault ? 'Unset default' : 'Make default', icon: 'star'}] : []),
|
|
250
256
|
{type: 'divider'},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.0, packages/core/src/admin/mail/reader-runtime.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
const MAIL_MODULE_VERSION = new URL(import.meta.url).searchParams.get('v') ?? '1';
|
|
4
4
|
const {createMailHost} = await import(new URL(`./host-context.js?v=${MAIL_MODULE_VERSION}`, import.meta.url).href);
|
|
@@ -35,9 +35,11 @@ const {
|
|
|
35
35
|
flattenFolderTree,
|
|
36
36
|
folderHeading,
|
|
37
37
|
folderMenuItems,
|
|
38
|
+
foldablePaths,
|
|
38
39
|
iconForFolder,
|
|
39
40
|
isSpamFolder,
|
|
40
41
|
pruneToUnread,
|
|
42
|
+
subtreePaths,
|
|
41
43
|
unreadInSubtree
|
|
42
44
|
} = await import(versioned('folder-tree.js'));
|
|
43
45
|
const {imageSendersSection} = await import(versioned('image-senders-section.js'));
|
|
@@ -296,6 +298,7 @@ return {
|
|
|
296
298
|
*/
|
|
297
299
|
let folderMenu = null;
|
|
298
300
|
let folderActionMenu = null;
|
|
301
|
+
let folderHeadMenu = null;
|
|
299
302
|
let folderActionBusy = false;
|
|
300
303
|
let dragState = null;
|
|
301
304
|
let dropBusy = false;
|
|
@@ -384,6 +387,27 @@ return {
|
|
|
384
387
|
renderFolders();
|
|
385
388
|
}
|
|
386
389
|
|
|
390
|
+
/**
|
|
391
|
+
* Open or shut every folder in a mailbox, opening that mailbox first
|
|
392
|
+
* when it is not the one on screen (only its folders are loaded).
|
|
393
|
+
*
|
|
394
|
+
* @param {string} accountId
|
|
395
|
+
* @param {boolean} open
|
|
396
|
+
* @returns {Promise<void>}
|
|
397
|
+
*/
|
|
398
|
+
async function setAllFolded(accountId, open) {
|
|
399
|
+
if (accountId !== currentAccountId) await selectAccount(accountId);
|
|
400
|
+
if (!here() || currentAccountId !== accountId) return;
|
|
401
|
+
const paths = open ? [] : foldablePaths(buildFolderTree(folders));
|
|
402
|
+
collapsedByAccount = {...collapsedByAccount, [currentAccountId]: paths};
|
|
403
|
+
try {
|
|
404
|
+
S.set(COLLAPSED_KEY, collapsedByAccount);
|
|
405
|
+
} catch {
|
|
406
|
+
// Storage unavailable - the fold still works for this visit.
|
|
407
|
+
}
|
|
408
|
+
renderFolders();
|
|
409
|
+
}
|
|
410
|
+
|
|
387
411
|
const foldersEl = $container.find('#mail-folders-list').get(0);
|
|
388
412
|
const listEl = $container.find('#mail-list').get(0);
|
|
389
413
|
const selectAllEl = $container.find('#mail-select-all').get(0);
|
|
@@ -393,6 +417,7 @@ return {
|
|
|
393
417
|
const readerBodyEl = $container.find('#mail-reader-body').get(0);
|
|
394
418
|
const listTitleEl = $container.find('#mail-list-title').get(0);
|
|
395
419
|
const folderActionsBtn = $container.find('#mail-folder-actions-btn').get(0);
|
|
420
|
+
const foldAllBtn = $container.find('#mail-fold-all-btn').get(0);
|
|
396
421
|
const searchEl = $container.find('#mail-search').get(0);
|
|
397
422
|
const searchInputEl = $container.find('#mail-search-input').get(0);
|
|
398
423
|
const searchClearEl = $container.find('#mail-search-clear').get(0);
|
|
@@ -691,6 +716,8 @@ return {
|
|
|
691
716
|
folderMenu = null;
|
|
692
717
|
folderActionMenu?.destroy?.();
|
|
693
718
|
folderActionMenu = null;
|
|
719
|
+
folderHeadMenu?.destroy?.();
|
|
720
|
+
folderHeadMenu = null;
|
|
694
721
|
clearDrag();
|
|
695
722
|
stopFitting?.();
|
|
696
723
|
stopFitting = null;
|
|
@@ -1910,6 +1937,7 @@ return {
|
|
|
1910
1937
|
foldersEl.textContent = '';
|
|
1911
1938
|
if (folderActionsBtn) folderActionsBtn.disabled = !currentAccountId || folderActionBusy || !folders.length;
|
|
1912
1939
|
paintUnreadFilter();
|
|
1940
|
+
paintFoldAll();
|
|
1913
1941
|
|
|
1914
1942
|
for (const box of mailboxes) {
|
|
1915
1943
|
const isCurrent = box.id === currentAccountId;
|
|
@@ -2073,6 +2101,37 @@ return {
|
|
|
2073
2101
|
*
|
|
2074
2102
|
* @returns {void}
|
|
2075
2103
|
*/
|
|
2104
|
+
/**
|
|
2105
|
+
* What the Folders head offers for the open mailbox: open everything
|
|
2106
|
+
* when every branch is shut, otherwise close everything. Nothing to
|
|
2107
|
+
* fold, no button.
|
|
2108
|
+
*
|
|
2109
|
+
* @returns {{foldable: string[], allShut: boolean}}
|
|
2110
|
+
*/
|
|
2111
|
+
function foldAllState() {
|
|
2112
|
+
const foldable = currentAccountId ? foldablePaths(buildFolderTree(folders)) : [];
|
|
2113
|
+
const collapsed = collapsedSet();
|
|
2114
|
+
return {foldable, allShut: foldable.length > 0 && foldable.every(path => collapsed.has(path))};
|
|
2115
|
+
}
|
|
2116
|
+
|
|
2117
|
+
/** @returns {void} */
|
|
2118
|
+
function paintFoldAll() {
|
|
2119
|
+
if (!foldAllBtn) return;
|
|
2120
|
+
const {foldable, allShut} = foldAllState();
|
|
2121
|
+
foldAllBtn.hidden = !foldable.length;
|
|
2122
|
+
const label = allShut ? 'Open all folders' : 'Close all folders';
|
|
2123
|
+
foldAllBtn.title = label;
|
|
2124
|
+
foldAllBtn.setAttribute('aria-label', label);
|
|
2125
|
+
const icon = allShut ? 'chevrons-down' : 'chevrons-right';
|
|
2126
|
+
if (foldAllBtn.dataset.icon === icon) return;
|
|
2127
|
+
foldAllBtn.dataset.icon = icon;
|
|
2128
|
+
const glyph = document.createElement('span');
|
|
2129
|
+
glyph.setAttribute('data-icon', icon);
|
|
2130
|
+
glyph.setAttribute('data-icon-size', '14');
|
|
2131
|
+
foldAllBtn.replaceChildren(glyph);
|
|
2132
|
+
try { Domma.icons?.scan?.(foldAllBtn); } catch { /* the title still names it */ }
|
|
2133
|
+
}
|
|
2134
|
+
|
|
2076
2135
|
function paintUnreadFilter() {
|
|
2077
2136
|
const label = unreadFilterEl?.querySelector('span');
|
|
2078
2137
|
if (!label) return;
|
|
@@ -5214,6 +5273,24 @@ return {
|
|
|
5214
5273
|
return true;
|
|
5215
5274
|
}
|
|
5216
5275
|
});
|
|
5276
|
+
// The Folders head: open or close every folder - the only place
|
|
5277
|
+
// for it when there is one mailbox and so no mailbox row.
|
|
5278
|
+
const head = foldersEl.closest('.mail-folders-pane')?.querySelector('.mail-pane-head');
|
|
5279
|
+
if (head) {
|
|
5280
|
+
folderHeadMenu = elements.contextMenu(head, {
|
|
5281
|
+
inherit: false,
|
|
5282
|
+
items: [],
|
|
5283
|
+
onBeforeOpen: () => {
|
|
5284
|
+
const {foldable} = foldAllState();
|
|
5285
|
+
if (!foldable.length) return false;
|
|
5286
|
+
folderHeadMenu.setItems([
|
|
5287
|
+
{label: 'Open all folders', icon: 'chevrons-down', action: () => setAllFolded(currentAccountId, true)},
|
|
5288
|
+
{label: 'Close all folders', icon: 'chevrons-right', action: () => setAllFolded(currentAccountId, false)}
|
|
5289
|
+
]);
|
|
5290
|
+
return true;
|
|
5291
|
+
}
|
|
5292
|
+
});
|
|
5293
|
+
}
|
|
5217
5294
|
if (features.folders && folderActionsBtn) {
|
|
5218
5295
|
folderActionsBtn.hidden = false;
|
|
5219
5296
|
folderActionMenu = elements.contextMenu(folderActionsBtn, {
|
|
@@ -5240,10 +5317,13 @@ return {
|
|
|
5240
5317
|
return mergeExtensionItems(menuItems(accountMenuModel({
|
|
5241
5318
|
isCurrent: box.id === currentAccountId,
|
|
5242
5319
|
isDefault: box.isDefault === true,
|
|
5243
|
-
count: mailboxes.length
|
|
5320
|
+
count: mailboxes.length,
|
|
5321
|
+
foldable: box.id === currentAccountId ? foldablePaths(buildFolderTree(folders)).length : null
|
|
5244
5322
|
}), {
|
|
5245
5323
|
open: () => selectAccount(box.id),
|
|
5246
5324
|
refresh: () => refreshMailbox(),
|
|
5325
|
+
expandAll: () => setAllFolded(box.id, true),
|
|
5326
|
+
collapseAll: () => setAllFolded(box.id, false),
|
|
5247
5327
|
edit: () => openMailboxForm(box),
|
|
5248
5328
|
default: () => toggleDefaultMailbox(box),
|
|
5249
5329
|
remove: () => removeMailbox(box)
|
|
@@ -5290,14 +5370,23 @@ return {
|
|
|
5290
5370
|
const read = folderReadItems(folder);
|
|
5291
5371
|
const extra = extensionItems('folderItems', folder);
|
|
5292
5372
|
if (!features.folders) return mergeExtensionItems(read, extra);
|
|
5373
|
+
// A folder with folders inside offers "this one" or "the lot" as a
|
|
5374
|
+
// submenu; a leaf keeps the plain item.
|
|
5375
|
+
const inside = subtreePaths(buildFolderTree(folders), folder.path).filter(path => path !== folder.path);
|
|
5376
|
+
const markItem = (label, icon, action) => !inside.length
|
|
5377
|
+
? {label, icon, disabled: () => folderActionBusy, action: () => folderContentsAction(folder, action)}
|
|
5378
|
+
: {label, icon, disabled: () => folderActionBusy, submenu: [
|
|
5379
|
+
{label: 'This folder', icon: 'folder', disabled: () => folderActionBusy || folder.selectable === false,
|
|
5380
|
+
action: () => folderContentsAction(folder, action)},
|
|
5381
|
+
{label: 'Including folders inside', icon: 'folder-open', disabled: () => folderActionBusy,
|
|
5382
|
+
action: () => folderTreeAction(folder, action)}
|
|
5383
|
+
]};
|
|
5293
5384
|
return mergeExtensionItems([
|
|
5294
5385
|
...read,
|
|
5295
5386
|
{type: 'divider'},
|
|
5296
5387
|
{label: 'Refresh folders', icon: 'refresh-cw', action: () => refreshFolders()},
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
{label: 'Mark all as unread', icon: 'mail', disabled: () => folderActionBusy,
|
|
5300
|
-
action: () => folderContentsAction(folder, 'markUnread')},
|
|
5388
|
+
markItem('Mark all as read', 'mail-open', 'markRead'),
|
|
5389
|
+
markItem('Mark all as unread', 'mail', 'markUnread'),
|
|
5301
5390
|
{label: folder.specialUse === '\\Trash' ? 'Empty Trash...' : 'Clear folder...', icon: 'trash', danger: true,
|
|
5302
5391
|
disabled: () => folderActionBusy || ['\\All', '\\Flagged'].includes(folder.specialUse)
|
|
5303
5392
|
|| !folders.some(item => item.specialUse === '\\Trash'),
|
|
@@ -5353,6 +5442,62 @@ return {
|
|
|
5353
5442
|
], extra);
|
|
5354
5443
|
}
|
|
5355
5444
|
|
|
5445
|
+
/**
|
|
5446
|
+
* Mark every message in a folder and the folders beneath it, one
|
|
5447
|
+
* folder at a time (the server allows one folder action per mailbox).
|
|
5448
|
+
*
|
|
5449
|
+
* @param {object} folder
|
|
5450
|
+
* @param {'markRead'|'markUnread'} action
|
|
5451
|
+
* @returns {Promise<void>}
|
|
5452
|
+
*/
|
|
5453
|
+
async function folderTreeAction(folder, action) {
|
|
5454
|
+
if (folderActionBusy || !currentAccountId) return;
|
|
5455
|
+
const account = currentAccountId;
|
|
5456
|
+
const paths = subtreePaths(buildFolderTree(folders), folder.path);
|
|
5457
|
+
if (!paths.length) return;
|
|
5458
|
+
folderActionBusy = true;
|
|
5459
|
+
if (folderActionsBtn) folderActionsBtn.disabled = true;
|
|
5460
|
+
let count = 0;
|
|
5461
|
+
let done = 0;
|
|
5462
|
+
const failed = [];
|
|
5463
|
+
try {
|
|
5464
|
+
if (paths.includes(currentFolder)) cancelMarkRead();
|
|
5465
|
+
for (const path of paths) {
|
|
5466
|
+
if (!here() || currentAccountId !== account) return;
|
|
5467
|
+
try {
|
|
5468
|
+
const result = await api(`${BASE}/folders/messages?${new URLSearchParams({account})}`, 'POST', {
|
|
5469
|
+
path, action, confirmed: false
|
|
5470
|
+
});
|
|
5471
|
+
count += Number(result?.processed) || 0;
|
|
5472
|
+
done++;
|
|
5473
|
+
} catch {
|
|
5474
|
+
failed.push(path);
|
|
5475
|
+
}
|
|
5476
|
+
}
|
|
5477
|
+
if (!here() || currentAccountId !== account) return;
|
|
5478
|
+
const word = action === 'markRead' ? 'read' : 'unread';
|
|
5479
|
+
const where = `${done} folder${done === 1 ? '' : 's'}`;
|
|
5480
|
+
if (failed.length) {
|
|
5481
|
+
E.toast(`Marked ${count} messages as ${word} in ${where}; could not do ${failed.join(', ')}.`, {type: 'warning'});
|
|
5482
|
+
} else {
|
|
5483
|
+
E.toast(`Marked ${count} messages as ${word} in ${where}.`, {type: 'success'});
|
|
5484
|
+
}
|
|
5485
|
+
} finally {
|
|
5486
|
+
folderActionBusy = false;
|
|
5487
|
+
if (here()) {
|
|
5488
|
+
if (folderActionsBtn) folderActionsBtn.disabled = !currentAccountId || !folders.length;
|
|
5489
|
+
if (currentAccountId === account) {
|
|
5490
|
+
if (paths.includes(currentFolder)) {
|
|
5491
|
+
clearSelection();
|
|
5492
|
+
page = 1;
|
|
5493
|
+
}
|
|
5494
|
+
await refreshFolders();
|
|
5495
|
+
if (searchQuery) await loadMessages({fresh: true, quiet: true});
|
|
5496
|
+
}
|
|
5497
|
+
}
|
|
5498
|
+
}
|
|
5499
|
+
}
|
|
5500
|
+
|
|
5356
5501
|
/** Apply to the entire named folder, including messages beyond this page. */
|
|
5357
5502
|
async function folderContentsAction(folder, action) {
|
|
5358
5503
|
if (folderActionBusy || !currentAccountId) return;
|
|
@@ -6425,6 +6570,9 @@ return {
|
|
|
6425
6570
|
} catch { /* no banner: the pane buttons stay */ }
|
|
6426
6571
|
if (!here()) return;
|
|
6427
6572
|
$container.find('#mail-refresh-btn').on('click', () => refreshMailbox());
|
|
6573
|
+
foldAllBtn?.addEventListener('click', () => {
|
|
6574
|
+
if (currentAccountId) setAllFolded(currentAccountId, foldAllState().allShut);
|
|
6575
|
+
});
|
|
6428
6576
|
|
|
6429
6577
|
// Folder management was right-click only, which is the same as not
|
|
6430
6578
|
// existing for anyone who does not already know it is there.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.0, packages/core/src/admin/mail/reader-view.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/** Existing CMS entry point for the shared mail view. */
|
|
4
4
|
const version = new URL(import.meta.url).searchParams.get('v') ?? '1';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.0, packages/core/src/admin/mail/resizable.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* The mail reader's resizable slideovers.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.0, packages/core/src/admin/mail/restore-spam.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/** Undo restores both junk status and the original folder, following each UID remap. */
|
|
4
4
|
export async function restoreSpam({api, base, account, from, destination, uids, spam}) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.0, packages/core/src/admin/mail/scheduling.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
const MAIL_MODULE_VERSION = new URL(import.meta.url).searchParams.get('v') ?? '1';
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.0, packages/core/src/admin/mail/section-kit.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
const MAIL_MODULE_VERSION = new URL(import.meta.url).searchParams.get('v') ?? '1';
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.0, packages/core/src/admin/mail/security-note.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* What the reader says about a signed or encrypted (S/MIME) message.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.0, packages/core/src/admin/mail/settings-section.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/** Browser preferences for the shared mail reader. */
|
|
4
4
|
export const READ_DELAY_KEY = 'domma-mail.mark-read-seconds';
|