@tideworthy/tidysites-platform 0.10.1 → 0.10.2
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/package.json +1 -1
- package/src/editor/revisions.ts +12 -11
- package/src/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.10.2
|
|
4
|
+
|
|
5
|
+
- Editor: the Revisions list starts after the newest publish, which is what is live now and has nothing to view or restore; a deep link to it opens the list. Inside the revision viewer EmDash's pill is hidden along with the bar.
|
|
6
|
+
|
|
3
7
|
## 0.9.1
|
|
4
8
|
|
|
5
9
|
- 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.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tideworthy/tidysites-platform",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
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/revisions.ts
CHANGED
|
@@ -64,15 +64,16 @@ export function startRevisions(): void {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
function renderList() {
|
|
67
|
-
const head = el("div", { class: "tidy-panel-head" }, [el("h2", { text: "Revisions" }), el("p", { text: "Every
|
|
67
|
+
const head = el("div", { class: "tidy-panel-head" }, [el("h2", { text: "Revisions" }), el("p", { text: "Every earlier publish of the website. Open one to see this page as it was then." })]);
|
|
68
68
|
const list = el("div", { class: "tidy-add-list" });
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
// The newest revision is what is live now: nothing to view or restore, so the list starts after it.
|
|
70
|
+
revisions.slice(1).forEach((rev) => {
|
|
71
|
+
const note = rev.restoredFrom ? "Restored" : "";
|
|
71
72
|
const item = el("button", { type: "button", class: "tidy-add-item" }, [el("strong", { text: when(rev.at) }), el("span", { text: [note, rev.pages ? `${rev.pages} pages` : ""].filter(Boolean).join(" · ") })]);
|
|
72
|
-
item.addEventListener("click", () => void view(rev
|
|
73
|
+
item.addEventListener("click", () => void view(rev));
|
|
73
74
|
list.append(item);
|
|
74
75
|
});
|
|
75
|
-
if (revisions.length
|
|
76
|
+
if (revisions.length < 2) list.append(el("p", { class: "tidy-field-note", text: "No earlier revisions yet." }));
|
|
76
77
|
const closeBtn = el("button", { type: "button", class: "tidy-btn", text: "Close" });
|
|
77
78
|
closeBtn.addEventListener("click", close);
|
|
78
79
|
panel.replaceChildren(head, list, el("div", { class: "tidy-panel-actions" }, [closeBtn]));
|
|
@@ -91,10 +92,9 @@ export function startRevisions(): void {
|
|
|
91
92
|
document.body.append(viewer);
|
|
92
93
|
backBtn.addEventListener("click", () => { viewer.hidden = true; frame.removeAttribute("srcdoc"); renderList(); });
|
|
93
94
|
|
|
94
|
-
async function view(rev: Revision
|
|
95
|
+
async function view(rev: Revision) {
|
|
95
96
|
panel.hidden = true;
|
|
96
|
-
viewerLabel.textContent =
|
|
97
|
-
restoreBtn.hidden = isLive;
|
|
97
|
+
viewerLabel.textContent = when(rev.at);
|
|
98
98
|
const r = await fetch(`${ROUTE}?id=${encodeURIComponent(rev.id)}&path=${encodeURIComponent(here)}`, { credentials: "same-origin" });
|
|
99
99
|
if (!r.ok) {
|
|
100
100
|
const j = (await r.json().catch(() => ({}))) as { error?: string };
|
|
@@ -107,7 +107,7 @@ export function startRevisions(): void {
|
|
|
107
107
|
const own = (p: string) => `${ROUTE}?id=${encodeURIComponent(rev.id)}&path=${encodeURIComponent(p)}`;
|
|
108
108
|
frame.srcdoc = html
|
|
109
109
|
.replace(/(href|src)="(\/_astro\/[^"]+)"/g, (_m, attr: string, p: string) => `${attr}="${own(p)}"`)
|
|
110
|
-
.replace(/<head([^>]*)>/i, `<head$1><base href="${location.origin}/"><style>html.tidy-has-bar body{padding-top:0!important}#tidy-bar,.tidy-bar{display:none!important}</style>`);
|
|
110
|
+
.replace(/<head([^>]*)>/i, `<head$1><base href="${location.origin}/"><style>html.tidy-has-bar body{padding-top:0!important}#tidy-bar,.tidy-bar,#emdash-toolbar{display:none!important}</style>`);
|
|
111
111
|
}
|
|
112
112
|
viewer.hidden = false;
|
|
113
113
|
restoreBtn.onclick = async () => {
|
|
@@ -149,8 +149,9 @@ export function startRevisions(): void {
|
|
|
149
149
|
const want = params.get("tidy-revision");
|
|
150
150
|
if (want || params.get("tidy-revisions")) {
|
|
151
151
|
void load().then((list) => {
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
// The newest revision is live now and is not in the list, so a link to it opens the list.
|
|
153
|
+
const rev = want ? list.slice(1).find((x) => x.id === want) : null;
|
|
154
|
+
if (rev) void view(rev);
|
|
154
155
|
else renderList();
|
|
155
156
|
}).catch(() => undefined);
|
|
156
157
|
}
|
package/src/version.ts
CHANGED