@tideworthy/tidysites-platform 0.5.0 → 0.5.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 +4 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/editor/runtime.ts +10 -1
- package/src/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.5.1
|
|
4
|
+
|
|
5
|
+
- Editor: a record region nested inside a section (a service card in the services grid) gets its own "Edit details" chip; clicking it edits the record instead of following the card's link, and leaving it hands the chip back to the section.
|
|
6
|
+
|
|
3
7
|
## 0.5.0
|
|
4
8
|
|
|
5
9
|
- Editor: image picker over the site's media library with upload, for block fields whose id names an image URL (`imageUrl`, `photoUrl`, …) and for record fields of kind image.
|
package/README.md
CHANGED
|
@@ -55,7 +55,7 @@ const editMode = Astro.cookies.get("emdash-edit-mode")?.value === "true";
|
|
|
55
55
|
{editMode && <TidyEditor collection="pages" id={page.data.id} blocks={blockSchema} value={content} />}
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
The template renders the block list inside `<div data-tidy-blocks>` and each custom block inside `<div data-tidy-block={_key} data-tidy-type={_type}>`, and passes `PortableText` a copy of the array (`[...blocks]`) so EmDash's inline editor does not mount on it. `blocks` is the plugin definition's `portableTextBlocks`. Hovering a block shows a chip (Edit, move, add below, remove); Edit opens a panel built from the block's fields; Save writes a draft through EmDash's content API with the signed-in editor's session and reloads; Publish publishes every entry saved in the session. A text field whose id ends in `imageUrl` (or `photoUrl`, `logoUrl`) gets an image picker over the media library with upload. Records: wrap a region in `data-tidy-record="services" data-tidy-record-id="…" data-tidy-record-label="Service details"` and pass `records` to the component; the form comes from EmDash's manifest and saves publish at once. Pass the business record in `records` and it is always one click away in the pill. On these pages EmDash's toolbar is hidden and its inline editing is off; article bodies keep EmDash's inline editor by passing the original array and not mounting this component.
|
|
58
|
+
The template renders the block list inside `<div data-tidy-blocks>` and each custom block inside `<div data-tidy-block={_key} data-tidy-type={_type}>`, and passes `PortableText` a copy of the array (`[...blocks]`) so EmDash's inline editor does not mount on it. `blocks` is the plugin definition's `portableTextBlocks`. Hovering a block shows a chip (Edit, move, add below, remove); Edit opens a panel built from the block's fields; Save writes a draft through EmDash's content API with the signed-in editor's session and reloads; Publish publishes every entry saved in the session. A text field whose id ends in `imageUrl` (or `photoUrl`, `logoUrl`) gets an image picker over the media library with upload. Records: wrap a region in `data-tidy-record="services" data-tidy-record-id="…" data-tidy-record-label="Service details"` and pass `records` to the component; the form comes from EmDash's manifest and saves publish at once. Pass the business record in `records` and it is always one click away in the pill. A section that lists records (a services grid) wraps each card in the same `data-tidy-record` attributes, so the card edits its record and the section's chip edits the section. On these pages EmDash's toolbar is hidden and its inline editing is off; article bodies keep EmDash's inline editor by passing the original array and not mounting this component.
|
|
59
59
|
|
|
60
60
|
## Bindings the routes read
|
|
61
61
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tideworthy/tidysites-platform",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.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",
|
package/src/editor/runtime.ts
CHANGED
|
@@ -202,6 +202,8 @@ export function start(config: Config): void {
|
|
|
202
202
|
for (const f of frames()) {
|
|
203
203
|
f.addEventListener("mouseenter", () => showBlockChip(f));
|
|
204
204
|
f.addEventListener("click", (e) => {
|
|
205
|
+
// A record listed inside the section (a service card) handles its own click.
|
|
206
|
+
if ((e.target as HTMLElement).closest("[data-tidy-record]")) return;
|
|
205
207
|
if (isInteractive(e.target)) return;
|
|
206
208
|
e.preventDefault();
|
|
207
209
|
showBlockChip(f);
|
|
@@ -209,14 +211,21 @@ export function start(config: Config): void {
|
|
|
209
211
|
});
|
|
210
212
|
}
|
|
211
213
|
for (const r of Array.from(document.querySelectorAll<HTMLElement>("[data-tidy-record]"))) {
|
|
214
|
+
const frame = r.parentElement?.closest<HTMLElement>("[data-tidy-block]") ?? null;
|
|
212
215
|
r.addEventListener("mouseenter", () => showRecordChip(r));
|
|
216
|
+
// Leaving a card inside a section hands the chip back to the section.
|
|
217
|
+
if (frame) r.addEventListener("mouseleave", () => showBlockChip(frame));
|
|
213
218
|
r.addEventListener("click", (e) => {
|
|
214
|
-
|
|
219
|
+
// Cards are often links; in edit mode a click edits instead of navigating.
|
|
220
|
+
if ((e.target as HTMLElement).closest("button,input,select,textarea,label")) return;
|
|
215
221
|
e.preventDefault();
|
|
222
|
+
e.stopPropagation();
|
|
216
223
|
showRecordChip(r);
|
|
217
224
|
void openRecord({ collection: r.dataset.tidyRecord ?? "", id: r.dataset.tidyRecordId ?? "", label: r.dataset.tidyRecordLabel ?? "" });
|
|
218
225
|
});
|
|
219
226
|
}
|
|
227
|
+
// The chip sits outside every frame; hovering it must not count as leaving.
|
|
228
|
+
chip.addEventListener("mouseenter", () => current?.classList.add("tidy-active"));
|
|
220
229
|
bEdit.addEventListener("click", () => {
|
|
221
230
|
if (!current) return;
|
|
222
231
|
if (current.dataset.tidyBlock) openBlock(current.dataset.tidyBlock);
|
package/src/version.ts
CHANGED