Skip to content

Native iCloud apps for Windows and Linux, built in Rust. Notes, Reminders, Calendar, Contacts, Drive and Photos, offline and in sync with your iPhone.

Notes: iPhone pictures show in the note, links work, pictures open at once

Yashwanth Kamireddi9720a1f542cf
diff --git a/.uiverify/notes-links-pictures.mjs b/.uiverify/notes-links-pictures.mjs
new file mode 100644
index 0000000..ba9fa59
--- /dev/null
+++ b/.uiverify/notes-links-pictures.mjs
@@ -0,0 +1,84 @@
+// Notes as Notes on the Mac shows them: a web address in the text is a link — found, not
+// written into the note — and a click on it opens it; a picture in a note shows large in the
+// window on a click, at once, from the picture already drawn, with a way to open it elsewhere.
+import zlib from "node:zlib";
+import { engine } from "./engine.mjs";
+import { SERVICES, installStub, openScreen } from "./stub.mjs";
+const b = await engine.launch();
+const ctx = await b.newContext({ viewport: { width: 1280, height: 800 } });
+await ctx.addInitScript(() => { window.__mediaNote = true; window.__linkNote = true; window.__picBase = "http://pics.test"; });
+await ctx.addInitScript(installStub, { screen: "library", services: SERVICES, twoFactor: null, notesFixture: true });
+// A real picture behind the picture route: a 600×400 gradient, made here as a PNG.
+const png = (() => {
+ const { deflateSync, crc32 } = zlib;
+ const w = 600, h = 400;
+ const raw = Buffer.alloc((w * 3 + 1) * h);
+ for (let y = 0; y < h; y++) {
+ raw[y * (w * 3 + 1)] = 0;
+ for (let x = 0; x < w; x++) {
+ const o = y * (w * 3 + 1) + 1 + x * 3;
+ raw[o] = 74 + (y * 171) / h; raw[o + 1] = 144 + (y * 71) / h; raw[o + 2] = 217 - (y * 107) / h;
+ }
+ }
+ const chunk = (type, data) => {
+ const len = Buffer.alloc(4); len.writeUInt32BE(data.length);
+ const td = Buffer.concat([Buffer.from(type), data]);
+ const crc = Buffer.alloc(4); crc.writeUInt32BE(crc32(td));
+ return Buffer.concat([len, td, crc]);
+ };
+ const ihdr = Buffer.alloc(13); ihdr.writeUInt32BE(w, 0); ihdr.writeUInt32BE(h, 4); ihdr[8] = 8; ihdr[9] = 2;
+ return Buffer.concat([Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]), chunk("IHDR", ihdr), chunk("IDAT", deflateSync(raw)), chunk("IEND", Buffer.alloc(0))]);
+})();
+await ctx.route("http://pics.test/**", (r) => r.fulfill({ status: 200, contentType: "image/png", body: png }));
+await ctx.route("https://www.youtube.com/**", (r) => r.fulfill({ status: 200, body: "opened" }));
+const page = await ctx.newPage();
+page.on("pageerror", (e) => { console.log(`FAIL page error: ${e.message}`); process.exitCode = 1; });
+await page.goto("http://localhost:4173", { waitUntil: "networkidle" });
+await openScreen(page, "Notes");
+await page.waitForTimeout(400);
+let failures = 0;
+const ok = (p, m) => { console.log(`${p ? "PASS" : "FAIL"} ${m}`); if (!p) failures++; };
+
+await page.locator(".note-row", { hasText: "Links" }).first().click();
+await page.waitForTimeout(600);
+const links = await page.locator(".ProseMirror a.nf-autolink").evaluateAll((as) => as.map((a) => [a.textContent, a.getAttribute("href")]));
+ok(links.some(([t, h]) => t === "www.youtube.com/watch?v=5vVh0ZGx8aU" && h === "https://www.youtube.com/watch?v=5vVh0ZGx8aU"),
+ `an address without its scheme is a link to it ${JSON.stringify(links)}`);
+ok(links.some(([t]) => t === "https://example.org/a"), "a sentence's full stop is not part of the address");
+const saves = await page.evaluate(() => window.__noteSaves?.length ?? 0);
+ok(saves === 0, "found links change nothing in the note");
+// A click on it opens it (the app hands any address outside it to the browser).
+const [nav] = await Promise.all([
+ page.waitForEvent("framenavigated", { timeout: 3000 }).catch(() => null),
+ page.locator(".ProseMirror a.nf-autolink", { hasText: "youtube" }).click(),
+]);
+ok(nav && nav.url().startsWith("https://www.youtube.com/watch"), `a click opens the address ${nav?.url()}`);
+await page.goto("http://localhost:4173", { waitUntil: "networkidle" });
+await openScreen(page, "Notes");
+await page.waitForTimeout(400);
+
+await page.locator(".note-row", { hasText: "Trip" }).first().click();
+await page.waitForTimeout(800);
+const img = page.locator(".ProseMirror img.nf-image");
+ok((await img.count()) === 1 && (await img.evaluate((i) => i.complete && i.naturalWidth > 0)), "the picture is drawn in the note");
+await img.click();
+await page.waitForTimeout(150);
+const viewer = page.getByRole("dialog", { name: "beach.jpeg" });
+ok(await viewer.isVisible(), "a click shows it large, in the window");
+ok((await viewer.locator("img").getAttribute("src")) === (await img.getAttribute("src")), "from the picture already drawn: nothing fetched again");
+ok((await page.evaluate(() => window.__opened ?? [])).length === 0, "and nothing handed to another app");
+await viewer.getByRole("button", { name: "Open in Default App" }).click();
+await page.waitForTimeout(100);
+ok(JSON.stringify(await page.evaluate(() => window.__opened)) === JSON.stringify(["M1"]), "Open in Default App hands it over");
+await page.keyboard.press("Escape");
+await page.waitForTimeout(100);
+ok(!(await viewer.isVisible()), "Escape puts it away");
+await img.click();
+await page.waitForTimeout(150);
+ok(await viewer.isVisible(), "shown again");
+await page.mouse.click(10, 10);
+await page.waitForTimeout(100);
+ok(!(await viewer.isVisible()), "and so does a click outside");
+await page.screenshot({ path: `${process.env.TMPDIR ?? "/tmp"}/notes-links-${process.env.ENGINE}.png` });
+await b.close();
+process.exitCode = failures ? 1 : 0;
diff --git a/.uiverify/stub.mjs b/.uiverify/stub.mjs
index 0060622..b46e350 100644
--- a/.uiverify/stub.mjs
+++ b/.uiverify/stub.mjs
@@ -306,6 +306,10 @@ export function installStub({ screen, services, twoFactor, calendarFixture, note
if (window.__mediaNote && !noteList.some((n) => n.guid === "nM"))
noteList.unshift({ guid: "nM", folderGuid: "f1", title: "Trip", snippet: "", body: "Trip\n\uFFFC\n\uFFFC\nend",
locked: false, editable: true, pinned: false, createdAt: null, modifiedAt: 1789100000, etag: null });
+ // Opt-in: a note with web addresses in its text and no links of its own.
+ if (window.__linkNote && !noteList.some((n) => n.guid === "nL"))
+ noteList.unshift({ guid: "nL", folderGuid: "f1", title: "Links", snippet: "", body: "Links\nYashps://www.youtube.com/watch?v=5vVh0ZGx8aU\nRead https://example.org/a. Done",
+ locked: false, editable: true, pinned: false, createdAt: null, modifiedAt: 1789200000, etag: null });
if (window.__tableNote && !noteList.some((n) => n.guid === "nT"))
noteList.unshift({ guid: "nT", folderGuid: "f1", title: "Groceries", snippet: "", body: "Groceries\n\uFFFC\nend",
locked: false, editable: true, pinned: false, createdAt: null, modifiedAt: 1789000000, etag: null });
diff --git a/probe/examples/notes_heic_shown.rs b/probe/examples/notes_heic_shown.rs
new file mode 100644
index 0000000..bed4047
--- /dev/null
+++ b/probe/examples/notes_heic_shown.rs
@@ -0,0 +1,51 @@
+//! Read-only: a note's picture as the window gets it — fetched, and made a JPEG when it is
+//! HEIC. Prints sizes, kinds and timings only.
+use anyhow::{anyhow, Result};
+use std::time::Instant;
+#[tokio::main]
+async fn main() -> Result<()> {
+ let id = std::env::args()
+ .nth(1)
+ .ok_or_else(|| anyhow!("attachment id"))?;
+ let dir = std::path::PathBuf::from(std::env::var("HOME")?).join(".local/share/quince-probe");
+ let mut client = quince_auth::Client::new(&dir)?;
+ if !client.resume().await? {
+ return Err(anyhow!("no session"));
+ }
+ let root = client
+ .session()
+ .service_url("ckdatabasews")
+ .ok_or_else(|| anyhow!("no ck"))?;
+ let (http, p) = (client.http().clone(), client.service_params());
+ let info = quince_icloud::note_media::info(&http, &root, p.clone(), &id).await?;
+ println!(
+ "kind {} size {:?} {:?}x{:?} preview {}",
+ info.kind, info.size, info.width, info.height, info.has_preview
+ );
+ let t = Instant::now();
+ let bytes = quince_icloud::note_media::bytes(
+ &http,
+ &root,
+ p,
+ &id,
+ quince_icloud::note_media::Part::File,
+ )
+ .await?;
+ println!(
+ "fetched {} bytes in {} ms, HEIF: {}",
+ bytes.len(),
+ t.elapsed().as_millis(),
+ quince_media::is_heif(&bytes)
+ );
+ let t = Instant::now();
+ let jpeg = quince_media::heic_to_jpeg(&bytes).map_err(|e| anyhow!(e))?;
+ let img = image::load_from_memory(&jpeg)?;
+ println!(
+ "as JPEG: {} bytes, {}x{}, in {} ms",
+ jpeg.len(),
+ img.width(),
+ img.height(),
+ t.elapsed().as_millis()
+ );
+ Ok(())
+}
diff --git a/probe/examples/photos_pass_cost.rs b/probe/examples/photos_pass_cost.rs
index c203f69..5431f75 100644
--- a/probe/examples/photos_pass_cost.rs
+++ b/probe/examples/photos_pass_cost.rs
@@ -8,13 +8,24 @@ async fn main() -> Result<()> {
if !client.resume().await? {
return Err(anyhow!("no session"));
}
- let ck = client.session().service_url("ckdatabasews").ok_or_else(|| anyhow!("no ck"))?;
+ let ck = client
+ .session()
+ .service_url("ckdatabasews")
+ .ok_or_else(|| anyhow!("no ck"))?;
let (http, p) = (client.http().clone(), client.service_params());
let t = Instant::now();
let whole = quince_icloud::photos::fetch(&http, &ck, p.clone(), None).await?;
- println!("whole library: {} records in {:.1} s", whole.records.len(), t.elapsed().as_secs_f64());
+ println!(
+ "whole library: {} records in {:.1} s",
+ whole.records.len(),
+ t.elapsed().as_secs_f64()
+ );
let t = Instant::now();
let since = quince_icloud::photos::fetch(&http, &ck, p, whole.token.as_deref()).await?;
- println!("changes since: {} records in {:.2} s", since.records.len(), t.elapsed().as_secs_f64());
+ println!(
+ "changes since: {} records in {:.2} s",
+ since.records.len(),
+ t.elapsed().as_secs_f64()
+ );
Ok(())
}
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index 369fab0..18efbb6 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -247,6 +247,44 @@ async fn note_media_cached(
Ok(bytes)
}
+/// A note's picture as the window can draw it: a HEIC original (what an iPhone takes) made a
+/// JPEG on this computer once and kept beside it — the engine draws no HEIC, and the picture
+/// fell back to a file chip. Opening it elsewhere still hands over the original.
+async fn note_media_shown(
+ app: &tauri::AppHandle,
+ id: &str,
+ part: quince_icloud::note_media::Part,
+) -> Result<Vec<u8>, String> {
+ let bytes = note_media_cached(app, id, part).await?;
+ if !quince_media::is_heif(&bytes) {
+ return Ok(bytes);
+ }
+ let safe: String = id
+ .chars()
+ .map(|c| {
+ if c.is_ascii_alphanumeric() || c == '-' {
+ c
+ } else {
+ '_'
+ }
+ })
+ .collect();
+ let shown = state_dir(app)
+ .join("note-media")
+ .join(format!("{safe}-shown.jpg"));
+ if let Ok(jpeg) = tokio::fs::read(&shown).await {
+ return Ok(jpeg);
+ }
+ let jpeg = crate::cpu::run(move || quince_media::heic_to_jpeg(&bytes))
+ .await
+ .map_err(|e| e.to_string())??;
+ let part_path = shown.with_extension("part");
+ if tokio::fs::write(&part_path, &jpeg).await.is_ok() {
+ let _ = tokio::fs::rename(&part_path, &shown).await;
+ }
+ Ok(jpeg)
+}
+
/// A plain report of how this install is doing, for a bug report: versions, the system, and
/// each service's last sync and last error — never a name, an address, or anything from a
/// note, card or file. Written to Downloads for the person to read and send themselves;
@@ -4043,7 +4081,7 @@ fn main() {
}
// A note's picture, or the rendering of a document or film in it.
if let Some((id, part)) = attachment {
- let response = match note_media_cached(&app, &id, part).await {
+ let response = match note_media_shown(&app, &id, part).await {
Ok(bytes) => tauri::http::Response::builder()
.status(200)
.header("Content-Type", image_type(&bytes))
diff --git a/src/screens/NotesView.tsx b/src/screens/NotesView.tsx
index 27a1937..0a9c262 100644
--- a/src/screens/NotesView.tsx
+++ b/src/screens/NotesView.tsx
@@ -9,6 +9,7 @@ import { FormattedBody, type Run } from "./notes/Formatted";
import { carryRuns, runsFit } from "./notes/rich";
import { NoteEditor, refreshTables, type EditorHandle, type EditorStatus } from "./notes/NoteEditor";
import { FormatPanel } from "./notes/FormatPanel";
+import { NotePicture } from "./notes/NotePicture";
import { useSync } from "../lib/sync";
import { Picker } from "../components/Picker";
@@ -625,6 +626,7 @@ export function NotesView() {
return (
<div className={`notes${detail ? " is-detail" : ""}`}>
+ <NotePicture />
<aside className="notes-folders" aria-label="Note folders">
<p className="notes-side-heading">iCloud</p>
<button className="notes-folder" aria-current={folder === ALL} onClick={() => setFolder(ALL)}>
diff --git a/src/screens/notes/Formatted.tsx b/src/screens/notes/Formatted.tsx
index 3023ee0..58b1ebd 100644
--- a/src/screens/notes/Formatted.tsx
+++ b/src/screens/notes/Formatted.tsx
@@ -8,6 +8,7 @@
* lay over the text directly. Runs that do not add up to the text — a note edited here since
* the last sync — are not guessed at: the caller shows the plain text instead.
*/
+import { addressesIn, openLinkAt } from "./links";
export type Run = {
length: number;
style: number | null;
@@ -103,9 +104,28 @@ function paragraphs(text: string, runs: Run[]): Paragraph[] {
return out;
}
+/** Text with its web addresses made links, as the editor draws them (notes/links.ts). */
+function withAddresses(text: string): React.ReactNode {
+ const found = addressesIn(text);
+ if (found.length === 0) return text;
+ const out: React.ReactNode[] = [];
+ let at = 0;
+ for (const a of found) {
+ if (a.from > at) out.push(text.slice(at, a.from));
+ out.push(
+ <a key={a.from} className="nf-autolink" href={a.href} rel="noreferrer" onClick={(e) => { e.stopPropagation(); openLinkAt(e.nativeEvent); }}>
+ {text.slice(a.from, a.to)}
+ </a>,
+ );
+ at = a.to;
+ }
+ if (at < text.length) out.push(text.slice(at));
+ return out;
+}
+
function Inline({ span }: { span: Span }) {
const { run, text } = span;
- let node: React.ReactNode = text;
+ let node: React.ReactNode = run.link ? text : withAddresses(text);
if (run.bold) node = <strong>{node}</strong>;
if (run.italic) node = <em>{node}</em>;
if (run.underline) node = <u>{node}</u>;
@@ -113,7 +133,7 @@ function Inline({ span }: { span: Span }) {
if (run.emphasis) node = <span className={`nf-em-${run.emphasis}`}>{node}</span>;
if (run.link) {
node = (
- <a href={run.link} target="_blank" rel="noreferrer" onClick={(e) => e.stopPropagation()}>
+ <a href={run.link} rel="noreferrer" onClick={(e) => { e.stopPropagation(); openLinkAt(e.nativeEvent); }}>
{node}
</a>
);
diff --git a/src/screens/notes/NoteEditor.tsx b/src/screens/notes/NoteEditor.tsx
index 817d929..74562ba 100644
--- a/src/screens/notes/NoteEditor.tsx
+++ b/src/screens/notes/NoteEditor.tsx
@@ -10,6 +10,7 @@ import type { Run } from "./Formatted";
import { fromDoc, LIST_STYLES, schema, STYLE, tableCells, toDoc } from "./rich";
import { api, noteMediaSrc, type NoteAttachment } from "../../lib/ipc";
import { RowMenu, type MenuEntry } from "../../components/RowMenu";
+import { autolink, openLinkAt } from "./links";
/** `content` with every attachment taken out, a table's cells kept as text in its place. */
function withoutAttachments(content: Fragment): Fragment {
@@ -73,6 +74,10 @@ function size(bytes: number | null): string {
* name, anything else as a labelled chip. Clicking one opens it in the app this computer uses
* for it. A picture that cannot be had falls back to the chip, never a broken frame.
*/
+/** A note's picture asked to be shown large: the viewer (NotePicture) listens for it. */
+export const PICTURE_EVENT = "quince:note-picture";
+export type PictureShown = { id: string; name: string; src: string };
+
function drawMedia(dom: HTMLElement, info: NoteAttachment) {
const name = info.filename ?? info.title ?? (info.kind === "audio" ? "Recording" : "Attachment");
const open = () => void api.noteAttachmentOpen(info.id).catch(() => {});
@@ -110,7 +115,10 @@ function drawMedia(dom: HTMLElement, info: NoteAttachment) {
dom.title = `Open ${name}`;
if (info.kind === "image") {
const img = picture("file", "nf-image");
- img.addEventListener("click", open);
+ // Shown here at once, from the picture already drawn — never a wait on another app.
+ img.addEventListener("click", () =>
+ window.dispatchEvent(new CustomEvent<PictureShown>(PICTURE_EVENT, { detail: { id: info.id, name, src: img.src } })),
+ );
dom.className = "nf-attachment is-image";
dom.replaceChildren(img);
} else if ((info.kind === "document" || info.kind === "video") && info.hasPreview) {
@@ -444,6 +452,7 @@ export const NoteEditor = forwardRef<EditorHandle, Props>(function NoteEditor(
const state = EditorState.create({
doc: toDoc(text, runs),
plugins: [
+ autolink,
history(),
keymap({
"Mod-z": undo,
@@ -533,6 +542,7 @@ export const NoteEditor = forwardRef<EditorHandle, Props>(function NoteEditor(
return true;
},
handleDOMEvents: {
+ click: (_vw, event) => openLinkAt(event),
blur: () => {
if (later.current !== null) report();
callbacks.current.onBlur?.();
diff --git a/src/screens/notes/NotePicture.tsx b/src/screens/notes/NotePicture.tsx
new file mode 100644
index 0000000..c3134e4
--- /dev/null
+++ b/src/screens/notes/NotePicture.tsx
@@ -0,0 +1,63 @@
+/**
+ * A note's picture shown large, as clicking one in Notes on the Mac does: over the dimmed
+ * window, at once — the picture already drawn in the note, nothing fetched again — with its
+ * name and a way to open it in another app. Escape, the close button or a click outside put
+ * it away.
+ */
+import { useEffect, useState } from "react";
+import { X } from "lucide-react";
+import { Portal } from "../../components/Portal";
+import { api, messageOf } from "../../lib/ipc";
+import { PICTURE_EVENT, type PictureShown } from "./NoteEditor";
+
+export function NotePicture() {
+ const [shown, setShown] = useState<PictureShown | null>(null);
+ const [problem, setProblem] = useState<string | null>(null);
+ useEffect(() => {
+ const show = (e: Event) => {
+ setProblem(null);
+ setShown((e as CustomEvent<PictureShown>).detail);
+ };
+ window.addEventListener(PICTURE_EVENT, show);
+ return () => window.removeEventListener(PICTURE_EVENT, show);
+ }, []);
+ useEffect(() => {
+ if (!shown) return undefined;
+ const key = (e: KeyboardEvent) => {
+ if (e.key === "Escape") {
+ e.stopPropagation();
+ setShown(null);
+ }
+ };
+ window.addEventListener("keydown", key, true);
+ return () => window.removeEventListener("keydown", key, true);
+ }, [shown]);
+ if (!shown) return null;
+ return (
+ <Portal>
+ <div className="modal-veil nf-picture-veil" onClick={() => setShown(null)}>
+ <figure
+ className="nf-picture"
+ role="dialog"
+ aria-modal="true"
+ aria-label={shown.name}
+ onClick={(e) => e.stopPropagation()}
+ >
+ <img src={shown.src} alt={shown.name} draggable={false} />
+ <figcaption>
+ <span className="nf-picture-name">{problem ?? shown.name}</span>
+ <button
+ className="quiet"
+ onClick={() => void api.noteAttachmentOpen(shown.id).catch((e) => setProblem(messageOf(e)))}
+ >
+ Open in Default App
+ </button>
+ <button className="nf-picture-close" aria-label="Close" autoFocus onClick={() => setShown(null)}>
+ <X size={16} strokeWidth={2} />
+ </button>
+ </figcaption>
+ </figure>
+ </div>
+ </Portal>
+ );
+}
diff --git a/src/screens/notes/links.ts b/src/screens/notes/links.ts
new file mode 100644
index 0000000..d8e6c8b
--- /dev/null
+++ b/src/screens/notes/links.ts
@@ -0,0 +1,63 @@
+/**
+ * Web addresses in a note are links the moment they are there, as Notes' own data detectors
+ * make them: typed, pasted, or written on another device without a link of its own. Drawn as
+ * links (decorations), never written into the note — the note keeps exactly what Apple has.
+ */
+import { Plugin } from "prosemirror-state";
+import { Decoration, DecorationSet } from "prosemirror-view";
+import type { Node as PMNode } from "prosemirror-model";
+
+/** An address: with its scheme, or starting www. — ending before closing punctuation, as a
+ * sentence's full stop or a bracket is not part of it. */
+const ADDRESS = /\b(?:https?:\/\/|www\.)[^\s<>"'`]*[^\s<>"'`.,;:!?)\]}]/gi;
+
+export type Found = { from: number; to: number; href: string };
+
+/** The addresses in a piece of text, with where each starts and ends, and what it opens. */
+export function addressesIn(text: string): Found[] {
+ const out: Found[] = [];
+ for (const m of text.matchAll(ADDRESS)) {
+ const from = m.index ?? 0;
+ const href = /^www\./i.test(m[0]) ? `https://${m[0]}` : m[0];
+ out.push({ from, to: from + m[0].length, href });
+ }
+ return out;
+}
+
+function decorate(doc: PMNode): DecorationSet {
+ const found: Decoration[] = [];
+ doc.descendants((node, pos) => {
+ if (!node.isText || !node.text) return;
+ // A link of its own (made on the phone, or here) is drawn as that already.
+ if (node.marks.some((m) => m.type.name === "link")) return;
+ for (const a of addressesIn(node.text)) {
+ found.push(Decoration.inline(pos + a.from, pos + a.to, { nodeName: "a", href: a.href, class: "nf-autolink" }));
+ }
+ });
+ return DecorationSet.create(doc, found);
+}
+
+/** Addresses found again only when the text changed; a selection moving keeps them. */
+export const autolink = new Plugin<DecorationSet>({
+ state: {
+ init: (_, state) => decorate(state.doc),
+ apply: (tr, was) => (tr.docChanged ? decorate(tr.doc) : was),
+ },
+ props: {
+ decorations(state) {
+ return this.getState(state);
+ },
+ },
+});
+
+/** A click on a link (its own, or one found) opens it, as a click does in Notes on the Mac.
+ * Navigating is enough: the app hands any address outside it to this computer's browser. */
+export function openLinkAt(event: MouseEvent): boolean {
+ const a = (event.target as HTMLElement | null)?.closest?.("a[href]") as HTMLAnchorElement | null;
+ if (!a || event.button !== 0 || event.shiftKey || event.altKey) return false;
+ const href = a.getAttribute("href") ?? "";
+ if (!/^(https?:|mailto:|tel:)/i.test(href)) return false;
+ event.preventDefault();
+ window.location.assign(href);
+ return true;
+}
diff --git a/src/styles/notes.css b/src/styles/notes.css
index 1807503..d7265c6 100644
--- a/src/styles/notes.css
+++ b/src/styles/notes.css
@@ -424,6 +424,10 @@ textarea.note-title::placeholder { color: var(--text-3); }
its own proportions, a document or film as its rendering with its name, anything else a
chip. Each opens in the app this computer uses for it. */
.nf-attachment.is-image, .nf-attachment.is-doc, .nf-attachment.is-file { display: inline-block; vertical-align: top; max-width: 100%; }
+/* A picture, a document's rendering or a file chip stands on its own, as in Notes: no grey
+ box drawn around it (that box is for an attachment still being described). */
+.note-rich .nf-attachment.is-image, .note-rich .nf-attachment.is-doc, .note-rich .nf-attachment.is-file {
+ padding: 0; margin: 4px 0; background: none; border-radius: 0; }
.nf-image { display: block; max-width: min(100%, 640px); height: auto; border-radius: 10px; cursor: zoom-in; background: color-mix(in srgb, var(--text) 6%, transparent); }
.nf-doc { display: inline-flex; flex-direction: column; gap: 6px; padding: 8px; border: 0; border-radius: 12px; background: color-mix(in srgb, var(--text) 5%, transparent); color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.nf-doc:hover { background: color-mix(in srgb, var(--text) 9%, transparent); }
@@ -436,3 +440,18 @@ textarea.note-title::placeholder { color: var(--text-3); }
.nf-file.is-audio .nf-file-glyph, .nf-file.is-video .nf-file-glyph { font-size: 13px; }
.nf-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nf-file-meta { flex: none; color: var(--text-3); font-size: var(--t-11); }
+
+/* Web addresses found in a note: links, as Notes draws them. */
+.nf-autolink, .ProseMirror a[href] { color: var(--accent); text-decoration: underline; text-decoration-thickness: from-font; text-underline-offset: 2px; cursor: pointer; }
+
+/* A note's picture shown large, over the dimmed window. */
+.nf-picture-veil { display: grid; place-items: center; padding: 32px; }
+.nf-picture { margin: 0; display: flex; flex-direction: column; gap: 10px; max-width: min(92vw, 1400px); max-height: 90vh; }
+.nf-picture img { max-width: 100%; max-height: calc(90vh - 52px); object-fit: contain; border-radius: 12px; align-self: center;
+ box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); background: color-mix(in srgb, var(--text) 6%, transparent); }
+.nf-picture figcaption { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 14px; border-radius: 12px;
+ background: var(--glass-thick); box-shadow: var(--glass-float); color: var(--text); font-size: var(--t-13); align-self: center; max-width: 100%; }
+.nf-picture-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
+.nf-picture-close { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 0;
+ background: color-mix(in srgb, var(--text) 9%, transparent); color: var(--text); cursor: pointer; flex: none; }
+.nf-picture-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }