From 8dd9cb49a01fa2b7c0d45897f3d819587622dcac Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Mon, 8 Jun 2026 20:03:31 +0530 Subject: [PATCH] feat: Add "open in new tab" link to history entries Each history entry now has a third action: a real anchor (rendered via the Button's href, target="_blank") linking to the editor with that entry's serialized state. Being a normal link, users can also copy it or open it in a new tab via the context menu. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/lib/components/History/History.svelte | 15 +++++++++++++++ tests/history.spec.ts | 19 +++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/lib/components/History/History.svelte b/src/lib/components/History/History.svelte index e091e7b1..444cb294 100644 --- a/src/lib/components/History/History.svelte +++ b/src/lib/components/History/History.svelte @@ -2,6 +2,7 @@ import Card from '$lib/components/Card/Card.svelte'; import type { HistoryEntry, HistoryType, State, Tab } from '$lib/types'; import { notify, prompt } from '$lib/util/notify'; + import { serializeState } from '$lib/util/serde'; import { inputStateStore } from '$lib/util/state'; import { logEvent } from '$lib/util/stats'; import dayjs from 'dayjs'; @@ -14,6 +15,7 @@ import UploadIcon from '~icons/material-symbols/upload-rounded'; import HistoryIcon from '~icons/mdi/clock-outline'; import GitAltIcon from '~icons/mdi/git'; + import OpenInNewIcon from '~icons/material-symbols/open-in-new-rounded'; import { Button } from '../ui/button'; import { Separator } from '../ui/separator'; import { @@ -99,6 +101,10 @@ const restoreHistoryItem = (state: State): void => { inputStateStore.set({ ...state, updateDiagram: true }); }; + + // Absolute editor URL for an entry, so the link can be opened in a new tab or copied. + const entryUrl = (state: State): string => + `${window.location.origin}${window.location.pathname}#${serializeState(state)}`; @@ -160,6 +166,15 @@ {dayjs(time).fromNow()} +