@supersuit/artifacts 0.44.2 → 0.44.3

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
@@ -17,6 +17,16 @@ early. A page carrying four embeds ran about sixty words ahead by its end. The e
17
17
  - Tests: "an embed block is not read aloud" in render.test.tsx, both kinds, with and without a
18
18
  player, the wrapped words equal the narrated words.
19
19
 
20
+ ## 0.44.3
21
+
22
+ **Escape closes a comment card.** Pressing Escape cancels the comment being written (nothing is
23
+ saved), or closes the open thread, or the comments panel, topmost first. It ignores an Escape
24
+ another layer already handled, so the definition popover and page menu keep theirs.
25
+
26
+ - DETECTOR: select text, press Comment, press Escape. Before, the card stayed open.
27
+ - REMEDY: update the dependency.
28
+ - Tests: comment-layer.test.tsx, "Escape cancels the comment being written, saving nothing".
29
+
20
30
  ## 0.44.1
21
31
 
22
32
  **Highlighting text works like any page again.** A press in the gap between paragraphs, in a line's
@@ -251,6 +251,27 @@ export function CommentLayer({ artifactId, rootId, ownerName, comments, canShare
251
251
  ro.observe(root);
252
252
  return () => { live = false; window.removeEventListener('resize', relayout); ro?.disconnect(); };
253
253
  }, [artifactId, comments, signedIn, stateUrl, personalUrl, rootId, call, refreshDevice, host, audioDb]);
254
+ // Escape closes the top card: the comment being written, else the open thread, else the panel.
255
+ // Writing a comment is a draft nobody has saved, so Escape is its Cancel.
256
+ useEffect(() => {
257
+ if (!draft && !thread && !panel)
258
+ return;
259
+ const onKey = (e) => {
260
+ if (e.key !== 'Escape' || e.defaultPrevented)
261
+ return;
262
+ e.preventDefault();
263
+ if (draft)
264
+ setDraft(null);
265
+ else if (thread) {
266
+ setThread(null);
267
+ setExpanded(null);
268
+ }
269
+ else
270
+ setPanel(false);
271
+ };
272
+ document.addEventListener('keydown', onKey);
273
+ return () => document.removeEventListener('keydown', onKey);
274
+ }, [draft, thread, panel]);
254
275
  // Text selection inside the page shows the Comment chip.
255
276
  useEffect(() => {
256
277
  const root = document.getElementById(rootId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supersuit/artifacts",
3
- "version": "0.44.2",
3
+ "version": "0.44.3",
4
4
  "description": "Publish markdown as branded, read-aloud pages from a Next.js app: the artifacts store, the route factory, the read-along reader, brand packs, password and confidential pages, and share cards.",
5
5
  "license": "MIT",
6
6
  "type": "module",