domma-cms 1.10.13 → 1.10.14

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 CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.10.14] - 2026-10-24
4
+
5
+ - **Docs 2.14.1**: the Version history panel's clean-ups listen with `modal.once('close')`, ready for domma-js 0.58.
6
+ - The mail reader's "when this panel closes" cleanup listens with the component's own `on('close')`, ready for domma-js 0.58, which drops the modal's old unprefixed `close` event. Behaviour is unchanged: once per close by the X, backdrop, Escape or a button, after any "discard changes?" guard.
7
+
3
8
  ## [1.10.13] - 2026-10-24
4
9
 
5
10
  - **Built against domma-js 0.57.0** - see [its release notes](https://github.com/pinpointzero73/domma/releases/tag/v0.57.0).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "domma-cms",
3
- "version": "1.10.13",
3
+ "version": "1.10.14",
4
4
  "description": "File-based CMS powered by Domma and Fastify. Run npx domma-cms my-site to create a new project.",
5
5
  "type": "module",
6
6
  "main": "server/server.js",
@@ -1,23 +1,14 @@
1
1
  /**
2
2
  * Run code when a Domma modal or slideover actually closes.
3
3
  *
4
- * NOT `component.on('close', fn)`: Domma's Component.on() only calls
5
- * `options[event]` when that happens to be a function, so it silently does
6
- * nothing - every "on close" cleanup in the mail client written that way
7
- * (editor teardown, resize handles, address suggesters, settling a dialog's
8
- * promise when it was closed by its X) never ran.
4
+ * Both are Domma components (0.55+), so `component.on('close', fn)` is the
5
+ * hook: it fires once per close - the X, the backdrop, Escape and close()
6
+ * alike - after any "discard changes?" guard has let it through, and a modal
7
+ * opened inside this one closing does not count. The modal's unprefixed
8
+ * `close` DOM event this used to listen for is gone in domma-js 0.58.
9
9
  *
10
- * Two kinds of component, two hooks:
11
- *
12
- * - A slideover is a class whose close() reads `options.onClose` at the moment
13
- * it closes - so chaining that fires only when a close really happens, after
14
- * any "discard changes?" guard has let it through.
15
- * - E.modal is a `<domma-modal>` web component. Its handle's `options` is the
16
- * element's `_options` - usually undefined, so the old code returned without
17
- * hooking anything - and close() never reads it: it dispatches a `close` DOM
18
- * event instead - for the X, the backdrop, Escape and close() alike. Chaining
19
- * `onClose` there did nothing at all, which is how a modal shut with Escape
20
- * left its promise unsettled (Email Pro saw it). The event is what fires.
10
+ * Anything without on() (a plain object, an older handle) falls back to
11
+ * chaining `options.onClose`.
21
12
  *
22
13
  * @module _lib/admin/mail/when-closed
23
14
  *
@@ -26,27 +17,13 @@
26
17
  * @returns {void}
27
18
  */
28
19
  export function whenClosed(component, fn) {
29
- const opts = component?.options;
30
- const el = component?.element;
31
- // The web component (`<domma-modal>` - a custom element's tag has a
32
- // hyphen). Its handle's `options` is the element's `_options`, which is
33
- // often not even set, so it cannot be what decides.
34
- const custom = typeof el?.tagName === 'string' && el.tagName.includes('-');
35
- if (el && typeof el.addEventListener === 'function' && (custom || !opts || el._options === opts)) {
36
- // Once per close: the X sits in the modal's shadow root, so its click
37
- // also reaches the host's backdrop handler and close() emits twice.
38
- // Re-armed when the modal opens again.
39
- let fired = false;
40
- el.addEventListener('open', (event) => { if (event.target === el) fired = false; });
41
- el.addEventListener('close', (event) => {
42
- // `close` bubbles and is composed: a modal opened INSIDE this one
43
- // closing must not count as this one closing.
44
- if (event.target !== el || fired) return;
45
- fired = true;
20
+ if (typeof component?.on === 'function') {
21
+ component.on('close', () => {
46
22
  try { fn(component); } catch { /* one cleanup failing must not stop the next */ }
47
23
  });
48
24
  return;
49
25
  }
26
+ const opts = component?.options;
50
27
  if (!opts) return;
51
28
  const previous = opts.onClose;
52
29
  opts.onClose = (instance) => {
@@ -316,3 +316,9 @@ by `inspectPdf`, text read, filed where the person may file, into their Recent).
316
316
  `tier: free`, no `closedSource` - no licence is needed or checked any more (the engine only checks a
317
317
  `closedSource` plugin). Included in every hosted plan and free to self-host; not `bundle: false`, so the next
318
318
  `make sync-free-tier` ships it in the engine. Docs Pro and Wiki Pro stay paid and still `requires: ["docs"]`.
319
+
320
+ ## 2.14.1 (2026-10-24): close hooks for domma-js 0.58
321
+
322
+ The version-history modal's cleanups (destroy after close, the context menu, the editor's refresh after a
323
+ restore) listen with `modal.once('close', fn)` instead of the modal element's unprefixed `close` DOM event,
324
+ which domma-js 0.58 removes. Same behaviour: once per close, whichever way it was closed.
@@ -44,10 +44,10 @@ export class VersionHistory {
44
44
  });
45
45
  modal.element.appendChild(this._build(docId, versions, modal, {session, canRestore}));
46
46
  // A closed modal is hidden, not removed: take it out once its close has run (2.10).
47
- modal.element.addEventListener('close', () => setTimeout(() => {
47
+ modal.once('close', () => setTimeout(() => {
48
48
  try { modal.destroy?.(); } catch { /* gone */ }
49
49
  modal.element?.remove();
50
- }, 400), {once: true});
50
+ }, 400));
51
51
  modal.open();
52
52
  this.modal = modal;
53
53
  return modal;
@@ -116,7 +116,7 @@ export class VersionHistory {
116
116
  return items;
117
117
  }
118
118
  });
119
- modal.element.addEventListener('close', () => menu?.destroy?.(), {once: true});
119
+ modal.once('close', () => menu?.destroy?.());
120
120
  return wrap;
121
121
  }
122
122
 
@@ -665,11 +665,11 @@ export const docsEditorView = {
665
665
  if (!modal) return;
666
666
  if (disposed) { modal.close(); return; }
667
667
  const off = panelLife.add(() => { try { modal.close(); } catch { /* gone */ } });
668
- modal.element.addEventListener('close', async () => {
668
+ modal.once('close', async () => {
669
669
  historyOpen = false;
670
670
  off();
671
671
  if (!disposed && versionHistory.restored) await refreshFromServer(true, {replace: true});
672
- }, {once: true});
672
+ });
673
673
  } finally {
674
674
  if (!modal || disposed) historyOpen = false;
675
675
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "docs",
3
3
  "displayName": "Docs",
4
- "version": "2.14.0",
4
+ "version": "2.14.1",
5
5
  "tier": "free",
6
6
  "description": "A document editor: sharing, public links, import and export, send to a page, blog or email, version history and templates. PDF documents: add a PDF and it is kept as it is - filed, shared, linked, emailed and versioned like any document, shown in the browser's own viewer.",
7
7
  "author": "Darryl Waterhouse",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "note": "Written by `make sync-free-tier` in dcms-marketplace. Do not edit these plugins here - edit them there and sync.",
3
- "source": "dcms-marketplace@397f460",
3
+ "source": "dcms-marketplace@ffeb277",
4
4
  "plugins": {
5
5
  "blog": {
6
6
  "version": "1.10.1",
@@ -127,9 +127,9 @@
127
127
  }
128
128
  },
129
129
  "docs": {
130
- "version": "2.14.0",
130
+ "version": "2.14.1",
131
131
  "files": {
132
- "CLAUDE.md": "7c3b32e6e4b3456b8d6acafde57cbe6af519d6771d81294cfb90318801da43e3",
132
+ "CLAUDE.md": "83e90576752ea15eb29db26c41497193743224fd40d0eef0e941a0c4550cd579",
133
133
  "admin/css/docs.css": "89304c596f2d36492198885359fa86998f9f36be522238983e32e5d01319c759",
134
134
  "admin/lib/api.js": "0ddd567995a79e2379b92049de3b09a8bdf1c0d798042c7fbe3937f14e3631bf",
135
135
  "admin/lib/convert.js": "37e8310aa0c225fad9c063649e31351c05fe4371081ede9fe4466aac64123b0e",
@@ -144,11 +144,11 @@
144
144
  "admin/lib/share.js": "bd1e4310a73416848281284da1fa1a5b06d996eeb49724cbf3dc4a14a7e45eb9",
145
145
  "admin/lib/shortcuts.js": "b96088bda42714ae92da37d28fb3ead5390e45b8d39d01c8f5e1e981e09df0b0",
146
146
  "admin/lib/templates.js": "3a2c678c8be5bd29baac39ab8e06e1c37d385d909fa6502bc9fb1a3ab4150917",
147
- "admin/lib/versions.js": "5affab802d1539b754427222afc8e232961cc3208e00251b033ee48ad5d02174",
147
+ "admin/lib/versions.js": "a2335d8cd22fb3c0f31431cc9a95251d18d83cb9fba6afef7300e9121fcb4c18",
148
148
  "admin/templates/docs.html": "4a621859200e6c2731db8f0924e6b76b03660dc01ae637d19de5ca2bbe92a33d",
149
149
  "admin/templates/editor.html": "cd937141373deeb8f3d204e47d11fe297a9b863499a95e19d62dbe1b2b05213a",
150
150
  "admin/views/docs.js": "52de890d32b63d522f8ae12b40e2525cf67b34584a62a745799e95ff352b0679",
151
- "admin/views/editor.js": "ded2998b0ef19f22874410363b6667b718219e0057ff3b1c8c3292693206b932",
151
+ "admin/views/editor.js": "2c8df525a2bd36e8a818b4b18c4ef6a727940644315d3f77782214dcbad0cb47",
152
152
  "config.js": "4435664c2d96088ad21d68241a2a6998b12c80592270deba77710b8c014de0a3",
153
153
  "docs/guide.md": "75f05f0665bd3b5a9ac00131df21c98c86fa71ad8fafdb8331d25b1adc0a61dd",
154
154
  "lib/extensions.js": "a449f10e309bcb16bb7d426315e85b2efe9be6d3420313c0e30315f146820d99",
@@ -157,7 +157,7 @@
157
157
  "lib/pdf.js": "83abc3aba0c322c50b528b8a037466a294303f55d7c30f3cd1445f811b78ae28",
158
158
  "lib/store.js": "bd2f629bfdc74e10a3ab56f37291eb8b09fb6479c04facdff9514c6298b0ba29",
159
159
  "plugin.js": "c9228fc20524fe43a1a05495d20be33a0723fa3d4ffb0c853844d45b58b8b216",
160
- "plugin.json": "35024c51c478b72b6aa0070a4ed18b9eb32d0334b120199c788b8d95ca4dbaf1",
160
+ "plugin.json": "b2ced266aeb08ca53599acfa804956053fd0f502445c526be0f388d1521c5d5e",
161
161
  "plugin.public.js": "a9cd7a9211f5b0006832054a15055a3c36afa9f9b284600cdc5fce19e892c178",
162
162
  "templates/public-doc.html": "7360cbeec5cba8a2b1b1d074730972bb4b90cfe913a799a06522b2e1a0f566d8",
163
163
  "tests/_env.js": "2daf6b0dd3211498298db79e5da80c17e2be98e380f777bc9c555c3eb99d128a",