@tideworthy/tidysites-platform 0.9.0 → 0.9.1

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,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.9.1
4
+
5
+ - Editor: one editor on the site. An article page (a post, a service area, a page with the article layout) gets the bar too, with Publish from the entry's draft state, Business details and Done, over EmDash's inline prose editing; EmDash's own pill is hidden under the bar everywhere. Inside sections and record regions this editor owns the fields and EmDash's inline editor does not mount; outside them (article prose) it keeps working.
6
+
3
7
  ## 0.9.0
4
8
 
5
9
  - Editor: sections are an EmDash `blocks` field (`sections` by default), and the forms come from the seed's block type definitions (`slug`, `type`, `validation.options`, `subFields`) instead of Block Kit shapes. Fields render by EmDash type: string, text, url, number, integer, boolean, datetime, select, multiSelect, image (the media picker, storing EmDash's media value) and repeater; Portable Text and file fields say "edit in the admin". New blocks carry no `_version` so EmDash stamps the active one; a saved block keeps its `_type`, `_key` and `_version`, and fields the form read as empty are left out rather than written as null.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tideworthy/tidysites-platform",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "The Tidysites platform integration for EmDash sites: bootstrap, sessions, maintenance, health, and publish hooks under /_tidy/*.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -9,10 +9,10 @@
9
9
  * block with `data-tidy-block` (its key) and `data-tidy-type`, and wraps the
10
10
  * list in `data-tidy-blocks`. A record region (`data-tidy-record`,
11
11
  * `data-tidy-record-id`, `data-tidy-record-label`) gets an "Edit details"
12
- * chip whose form comes from EmDash's manifest. A page without blocks (an
13
- * article) gets the bar only; EmDash's inline editing handles its prose and
14
- * its toolbar shows there. While editing is off, EmDash's toolbar is hidden:
15
- * the bar is the one control. The bar sets `--tidy-bar` on <html> (its
12
+ * chip whose form comes from EmDash's manifest. A page without sections (an
13
+ * article) gets the bar too: Publish, Business details and Done over EmDash's
14
+ * inline prose editing, whose own pill is always hidden under the bar, so the
15
+ * site has one editor. The bar sets `--tidy-bar` on <html> (its
16
16
  * height) so a template's sticky header can sit below it.
17
17
  */
18
18
  import type { Block, BlockTypeSchema } from "./ops";
@@ -35,9 +35,12 @@ const signedIn = Boolean(Astro.session ? await Astro.session.get("user") : null)
35
35
  const active = Astro.cookies.get("emdash-edit-mode")?.value === "true";
36
36
  const here = Astro.url.pathname + Astro.url.search;
37
37
  const toggle = (on: boolean) => `/_tidy/edit?on=${on ? 1 : 0}&to=${encodeURIComponent(here)}`;
38
- const editable = active && Boolean(collection && id && blocks && value);
39
- const config = editable ? JSON.stringify({ collection, id, field, blocks, value, records, done: toggle(false) }) : null;
40
- const htmlClass = !signedIn ? "" : !active ? "tidy-has-bar tidy-idle" : editable ? "tidy-has-bar" : "tidy-has-bar tidy-inline";
38
+ // Any entry page is editable: a sections page gets the frames and the picker,
39
+ // an article page gets the bar (Publish, Business details, Done) over EmDash's
40
+ // inline prose editing. One editor on the site, never two.
41
+ const editable = active && Boolean(collection && id);
42
+ const config = editable ? JSON.stringify({ collection, id, field, blocks: blocks ?? [], value: value ?? [], records, done: toggle(false) }) : null;
43
+ const htmlClass = !signedIn ? "" : !active ? "tidy-has-bar tidy-idle" : "tidy-has-bar";
41
44
  ---
42
45
  {signedIn && (
43
46
  <>
@@ -58,7 +61,8 @@ const htmlClass = !signedIn ? "" : !active ? "tidy-has-bar tidy-idle" : editable
58
61
  </>
59
62
  )}
60
63
  <style is:global>
61
- .tidy-editing #emdash-toolbar, .tidy-idle #emdash-toolbar { display: none !important; }
64
+ /* EmDash's own pill never shows under the bar; its inline prose editing keeps working underneath. */
65
+ html.tidy-has-bar #emdash-toolbar { display: none !important; }
62
66
  html.tidy-has-bar { --tidy-bar: 44px; }
63
67
  html.tidy-has-bar body { padding-top: var(--tidy-bar); }
64
68
  .tidy-bar { position: fixed; top: 0; left: 0; right: 0; height: var(--tidy-bar, 44px); z-index: 2147483000; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px; box-sizing: border-box; background: #17211c; color: #fff; font: 500 13px/1 system-ui, sans-serif; box-shadow: 0 1px 0 rgba(255,255,255,.08), 0 6px 20px rgba(0,0,0,.18); }
@@ -99,9 +99,11 @@ export function start(config: Config): void {
99
99
  const schemaOf = (type: string) => config.blocks.find((b) => b.slug === type);
100
100
  const frames = () => Array.from(document.querySelectorAll<HTMLElement>("[data-tidy-block]"));
101
101
 
102
- // EmDash's inline editor is for prose pages; here the sections and records own their fields.
102
+ // Inside the sections and the record regions this editor owns the fields, so
103
+ // EmDash's inline editor must not mount there; article prose outside them
104
+ // keeps EmDash's in-place editing under this bar.
103
105
  document.documentElement.classList.add("tidy-editing");
104
- document.querySelectorAll("[data-emdash-ref]").forEach((n) => n.removeAttribute("data-emdash-ref"));
106
+ document.querySelectorAll("[data-tidy-blocks] [data-emdash-ref], [data-tidy-record] [data-emdash-ref]").forEach((n) => n.removeAttribute("data-emdash-ref"));
105
107
 
106
108
  // --- pending publishes ---------------------------------------------------
107
109
  // Records whose publish failed after a save; the page itself is read from EmDash.
package/src/version.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  /** Kept in step with package.json by the release checklist in MAINTAINING.md. */
2
- export const VERSION = "0.9.0";
2
+ export const VERSION = "0.9.1";
3
3
  export const PLUGIN_ID = "tidy-platform";