This note changed elsewhere. Copy your text before using the saved version.
+
+
diff --git a/public/journal.css b/public/journal.css
index fcd8343..fa1ac17 100644
--- a/public/journal.css
+++ b/public/journal.css
@@ -6,14 +6,15 @@ html { scrollbar-width:none; scroll-padding-bottom:calc(5rem + env(safe-area-ins
html::-webkit-scrollbar { display:none; }
html,body { margin:0; }
body { background:var(--bg); color:var(--ink); font:400 .875rem/1.4 Inter,system-ui,sans-serif; -webkit-font-smoothing:antialiased; }
-header,footer { position:fixed; left:0; right:0; z-index:1; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px max(16px,env(safe-area-inset-left)) 14px max(16px,env(safe-area-inset-right)); color:var(--muted); font-size:.8125rem; transition:opacity .6s ease; }
+/* The collection panel has its own footer inside Settings. */
+body > :is(header,footer) { position:fixed; left:0; right:0; z-index:1; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px max(16px,env(safe-area-inset-left)) 14px max(16px,env(safe-area-inset-right)); color:var(--muted); font-size:.8125rem; transition:opacity .6s ease; }
.context { min-width:0; display:flex; flex-wrap:wrap; align-items:center; gap:2px 10px; }
#menu-button { min-width:44px; min-height:44px; }
-header { top:0; padding-top:max(14px,env(safe-area-inset-top)); background:linear-gradient(var(--bg) 55%,transparent); }
-footer { bottom:0; flex-wrap:wrap; padding-bottom:max(14px,env(safe-area-inset-bottom)); pointer-events:none; }
-footer>* { pointer-events:auto; }
-body.quiet header:not(:focus-within),body.quiet .hint:not(:focus-within) { opacity:0; pointer-events:none; }
-@media (hover:none),(pointer:coarse) { body.quiet header:not(:focus-within) { opacity:1; pointer-events:auto; } body.quiet header:not(:focus-within) .context { opacity:0; } body.quiet header:not(:focus-within) #menu-button { opacity:.4; } }
+body > header { top:0; padding-top:max(14px,env(safe-area-inset-top)); background:linear-gradient(var(--bg) 55%,transparent); }
+body > footer { bottom:0; flex-wrap:wrap; padding-bottom:max(14px,env(safe-area-inset-bottom)); pointer-events:none; }
+body > footer > * { pointer-events:auto; }
+body.quiet > header:not(:focus-within),body.quiet .hint:not(:focus-within) { opacity:0; pointer-events:none; }
+@media (hover:none),(pointer:coarse) { body.quiet > header:not(:focus-within) { opacity:1; pointer-events:auto; } body.quiet > header:not(:focus-within) .context { opacity:0; } body.quiet > header:not(:focus-within) #menu-button { opacity:.4; } }
main { display:flex; justify-content:center; }
textarea { display:block; width:100%; max-width:680px; min-height:100vh; min-height:100dvh; overflow:hidden; padding:16vh 16px 40vh; border:0; outline:0; resize:none; background:transparent; color:var(--ink); caret-color:var(--caret); font:400 1.3125rem/1.6 Newsreader,Georgia,serif; font-optical-sizing:auto; }
/* The shared UI rings every :focus-visible element; the writing page is the focus itself. */
@@ -35,6 +36,7 @@ body.typing:not(.quiet) .hint,body.undo .hint,body.retry .hint,.hint:focus-withi
.hint button { min-height:44px; } #retry-button { margin:-6px 8px -6px -8px; color:var(--accent); } .count { margin-right:16px; font-variant-numeric:tabular-nums; }
@media (max-width:520px) { .hint .keys { display:none; } }
#menu,#entries { border:1px solid var(--faint); background:var(--panel); color:var(--ink); border-radius:12px; padding:0; width:min(420px,calc(100vw - 32px)); box-shadow:0 20px 60px rgb(0 0 0 / .18); }
+#menu { inset-block:max(16px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-bottom)); max-height:calc(100% - 32px); max-height:calc(100dvh - max(16px,env(safe-area-inset-top)) - max(16px,env(safe-area-inset-bottom))); overflow-y:auto; overscroll-behavior:contain; }
#menu::backdrop,#entries::backdrop { background:rgb(0 0 0 / .25); }
.context nav { display:flex; align-items:center; gap:8px; min-width:0; }
.context nav h1 { margin:0; min-width:0; font:inherit; }
diff --git a/src/view.ts b/src/view.ts
index fd9bac6..d3de434 100644
--- a/src/view.ts
+++ b/src/view.ts
@@ -37,6 +37,7 @@ export function mountJournal(document: Document, drafts: JournalDrafts, mdbase:
};
const page = element("page");
const menu = element("menu");
+ const copyFeedback = element("deleted-copy-feedback");
const typeChoice = element("entry-type");
const status = element("status");
const pending = element("pending-count");
@@ -69,6 +70,7 @@ export function mountJournal(document: Document, drafts: JournalDrafts, mdbase:
let inputEpoch = 0;
let displayedRecordRevision: string | null = null;
let conflicted = false;
+ let deletedCopyFeedback = "";
const retrying = new Set();
const edited = new Set();
const preferences = drafts.preferences();
@@ -156,6 +158,7 @@ export function mountJournal(document: Document, drafts: JournalDrafts, mdbase:
}
let renderedDraftId = current.id;
function renderPage(): void {
+ deletedCopyFeedback = "";
if (renderedDraftId !== current.id) conflicted = false;
renderedDraftId = current.id;
displayedRecordRevision = data?.snapshot(current.id)?.record.revision ?? null;
@@ -187,7 +190,11 @@ export function mountJournal(document: Document, drafts: JournalDrafts, mdbase:
conflicted = conflicted || current.reviewRequired === true || observed?.state === "conflict";
element("draft-conflict").hidden = !conflicted && !current.deletedElsewhere;
element("draft-conflict").setAttribute("aria-label", current.deletedElsewhere ? "Deleted entry" : "Conflicting note");
- element("draft-conflict").querySelector("p")!.textContent = current.deletedElsewhere ? `${DELETED_ENTRY_NOTICE} Copy it to keep writing in a new page.` : "This note changed elsewhere. Copy your text before using the saved version.";
+ element("draft-conflict").querySelector("p")!.textContent = current.deletedElsewhere ? DELETED_ENTRY_NOTICE : "This note changed elsewhere. Copy your text before using the saved version.";
+ if (!current.deletedElsewhere) deletedCopyFeedback = "";
+ copyFeedback.hidden = !deletedCopyFeedback;
+ if (copyFeedback.textContent !== deletedCopyFeedback) copyFeedback.textContent = deletedCopyFeedback;
+ element("start-new-after-deletion").hidden = !current.deletedElsewhere;
element("use-saved-version").hidden = !!current.deletedElsewhere;
element("use-saved-version").disabled = !!current.deletedElsewhere || current.reviewRequired === true && !data;
if (entriesDialog.open) renderEntries();
@@ -276,7 +283,7 @@ export function mountJournal(document: Document, drafts: JournalDrafts, mdbase:
typeChoice.replaceChildren(option("Choose a type…", ""), ...types.map(item => option(item.name, item.name)));
typeChoice.value = type?.name ?? "";
element("type-row").hidden = types.length < 2;
- element("new-button").hidden = !current.body.trim();
+ element("new-button").hidden = !current.body.trim() || !!current.deletedElsewhere;
element("undo-button").hidden = !undoId;
const retryCurrent = recovering(current.id), retryElement = element("retry-button");
retryElement.hidden = !retryCurrent; retryButton(retryElement, current.id);
@@ -310,7 +317,7 @@ export function mountJournal(document: Document, drafts: JournalDrafts, mdbase:
element("word-count").hidden = words === 0;
}
function newPage(): void {transaction(() => {
- if (!current.body.trim()) {page.focus(); return;}
+ if (!current.body.trim() && !current.deletedElsewhere) {page.focus(); return;}
if (memoryOnly) {problem = "Keep this page open: its text has not been preserved on this device."; render(); return;}
const previous = current;
try {
@@ -562,6 +569,7 @@ export function mountJournal(document: Document, drafts: JournalDrafts, mdbase:
}
listen(page, "input", () => {
clearUndo();
+ deletedCopyFeedback = "";
const body = page.value, base = current, wasUnpersisted = unpersistedDraft, owned = data;
const source = {body: base.body, revision: displayedRecordRevision}, epoch = ++inputEpoch;
current = {...base, body, revision: draftRevision(body)};
@@ -591,6 +599,7 @@ export function mountJournal(document: Document, drafts: JournalDrafts, mdbase:
if (viewport) listen(viewport, "resize", () => document.defaultView?.requestAnimationFrame(revealCaret));
listen(document, "keydown", event => {const key = event as KeyboardEvent; if ((key.ctrlKey || key.metaKey) && key.key === "Enter" && key.target === page && !document.querySelector("dialog[open]")) {key.preventDefault(); newPage();}});
listen(element("new-button"), "click", newPage);
+ listen(element("start-new-after-deletion"), "click", newPage);
listen(element("undo-button"), "click", undoNewPage);
listen(element("retry-button"), "click", () => retry(current.id));
let menuOpener: HTMLElement | null = null;
@@ -669,10 +678,22 @@ export function mountJournal(document: Document, drafts: JournalDrafts, mdbase:
applyTheme();
const unlistenApp = mdbase?.subscribe(() => transaction(changed)) ?? (() => {});
if (document.defaultView) for (const name of ["online", "offline"]) listen(document.defaultView, name, render);
- listen(element("copy-conflicting-text"), "click", () => {
+ listen(element("copy-conflicting-text"), "click", async () => {
const clipboard = document.defaultView?.navigator.clipboard;
- if (!clipboard) {page.focus(); page.select(); problem = current.deletedElsewhere ? "Your text is selected. Copy it before starting a new page." : "Your text is selected. Copy it before using the saved version."; render(); return;}
- void clipboard.writeText(page.value).then(() => {problem = current.deletedElsewhere ? "Text copied. Start a new page to keep writing." : "Text copied. You can now use the saved version."; render();}, () => {page.focus(); page.select(); problem = current.deletedElsewhere ? "Copy your selected text before starting a new page." : "Copy your selected text before using the saved version."; render();});
+ const id = current.id, epoch = inputEpoch, body = page.value;
+ let copied = false;
+ if (clipboard) {
+ try {await clipboard.writeText(body); copied = true;}
+ catch {/* Clipboard access can be denied. Select the text for manual copying. */}
+ }
+ if (disposed || current.id !== id || inputEpoch !== epoch || page.value !== body) return;
+ if (!copied) {page.focus(); page.select();}
+ if (current.deletedElsewhere) {
+ deletedCopyFeedback = copied ? "Text copied." : "Your text is selected. Copy it before starting a new page.";
+ } else {
+ problem = copied ? "Text copied. You can now use the saved version." : "Your text is selected. Copy it before using the saved version.";
+ }
+ render();
});
listen(element("use-saved-version"), "click", () => {
const id = current.id, chosenEpoch = inputEpoch;
diff --git a/tests/deleted-entries.test.ts b/tests/deleted-entries.test.ts
index 4ca30d2..59db7cd 100644
--- a/tests/deleted-entries.test.ts
+++ b/tests/deleted-entries.test.ts
@@ -77,7 +77,8 @@ for (const body of ["Unsaved local text", ""]) test(`a deleted record retains an
assert.equal(window.document.getElementById("draft-conflict")!.hidden, false);
assert.equal(window.document.getElementById("use-saved-version")!.hidden, true);
window.document.getElementById("copy-conflicting-text")!.click();
- assert.match(window.document.getElementById("status")!.textContent!, /Copy it before starting a new page/);
+ assert.match(window.document.getElementById("draft-conflict")!.textContent!, /Your text is selected\. Copy it before starting a new page/);
+ assert.match(window.document.getElementById("status")!.textContent!, /deleted elsewhere.*text.*device/i);
assert.equal(drafts.get(draft.id)?.savedBody, "Saved entry");
view.dispose(); window.close();
window = windowForJournal(); view = mountJournal(window.document, new JournalDrafts(storage), h.mdbase);
@@ -223,6 +224,18 @@ test("a queued autosave rejected as deleted offers to copy the unsaved text with
assert.equal(window.document.getElementById("use-saved-version")!.hidden, true);
window.document.getElementById("copy-conflicting-text")!.click();
assert.equal(await copied.promise, unsaved);
+ await until(() => !!recovery.textContent?.includes("Text copied"));
+ assert.equal(recovery.hidden, false);
+ assert.match(recovery.textContent!, /deleted elsewhere.*text.*device/i);
+ assert.match(status.textContent!, /deleted elsewhere.*text.*device/i);
+ assert.match(window.document.getElementById("status-button")!.getAttribute("aria-label")!, /^Journal settings\./);
+ const startNew = recovery.querySelector("#start-new-after-deletion")!;
+ assert.equal(startNew.hidden, false);
+ startNew.click();
+ await until(() => view.currentDraft().id !== draft.id);
+ assert.equal(recovery.hidden, true);
+ assert.equal(page.value, "");
+ assert.equal(drafts.get(draft.id)?.body, unsaved);
assert.equal(await h.records.find(recordId), null);
assert.equal(update.mock.callCount(), 1);
assert.equal(create.mock.callCount(), 0);
diff --git a/tests/setup-conflicts.test.ts b/tests/setup-conflicts.test.ts
index 4069032..e2844f8 100644
--- a/tests/setup-conflicts.test.ts
+++ b/tests/setup-conflicts.test.ts
@@ -92,6 +92,28 @@ function needsSetupSnapshot(ready: Awaited
};
}
+test("the collection panel footer stays in the scrollable Settings sheet during setup conflict", async () => {
+ const f = await applicationFixture();
+ const h = dom();
+ const {document} = h.window;
+ const style = document.createElement("style");
+ style.textContent = readFileSync(new URL("../public/journal.css", import.meta.url), "utf8");
+ document.head.append(style);
+ f.fixture.controls.setSetupPlan(nonAdoptablePlan());
+ f.fixture.controls.publishSnapshot({...needsSetupSnapshot(f.ready), links: {account: "https://fixture.example/account", manageAccess: "https://fixture.example/access"}});
+ const view = mountJournal(document, new JournalDrafts(memoryStorage()), f.mdbase);
+ try {
+ h.click("status-button");
+ const panelFooter = await until(() => h.menu.querySelector("#collection-panel footer") ?? undefined);
+ assert.equal(h.menu.open, true);
+ assert.match(panelFooter.textContent!, /Choose a different collection/);
+ assert.equal(panelFooter.querySelector("a")?.textContent, "Manage access");
+ assert.equal(h.window.getComputedStyle(document.querySelector("body > footer")!).position, "fixed");
+ assert.notEqual(h.window.getComputedStyle(panelFooter).position, "fixed");
+ assert.equal(h.window.getComputedStyle(h.menu).overflowY, "auto");
+ } finally {view.dispose(); h.window.close(); await f.fixture.close();}
+});
+
test("backupPathFor produces safe non-record, non-resource backup paths", () => {
const date = new Date("2026-11-27T08:30:15Z");
const path = backupPathFor(CONTRACT_TARGET, date, "journal-setup-backups", "abc123");
diff --git a/tests/view.test.ts b/tests/view.test.ts
index 54d127d..81ba034 100644
--- a/tests/view.test.ts
+++ b/tests/view.test.ts
@@ -42,11 +42,13 @@ test("the ready writing page has one level-one heading naming the current journa
const h = dom(), f = await applicationFixture();
const view = mountJournal(h.window.document, new JournalDrafts(memoryStorage()), f.mdbase);
try {
+ await until(() => h.window.document.getElementById("menu-connection")!.textContent === "Notes save to Writing.");
const headings = h.window.document.querySelectorAll("h1");
assert.equal(headings.length, 1);
const date = h.window.document.querySelector("#browse-button")!.textContent!.trim();
assert.ok(date);
assert.equal(headings[0]!.textContent!.trim(), date);
+ assert.equal(headings[0]!.querySelector("#browse-button")?.getAttribute("aria-controls"), "entries");
assert.equal(headings[0]!.closest("dialog, [hidden], [aria-hidden=true]"), null);
} finally {view.dispose(); f.close(); h.window.close();}
});