Files
cinny/src/app/components/message/content/EditDiffContext.ts
T
jaredandClaude Opus 5 2bdb2eb4cb
CI / Build & Quality Checks (push) Successful in 1m40s
CI / Docker image build & smoke test (push) Skipped
CI / Secret scan (gitleaks) (push) Successful in 8s
CI / Trigger Desktop Build (push) Successful in 7s
CI / Playwright smoke (e2e) (push) Canceled after 1m37s
feat(messages): word diff of the last edit on "(edited)" hover (#144)
Hovering or focusing "(edited)" shows a tooltip with only the most recent
edit as a word diff — removed words struck, added words bold — plus a
+N/−N summary. Clicking still opens the full history viewer. On touch, a
long-press on the label shows the same diff as a popout (a plain tap opens
the viewer; the message's own long-press action sheet is not triggered).

utils/wordDiff.ts is a unit-tested LCS over words that ignores whitespace-
only changes and gives up past 400 words. Only plain-text bodies are
diffed; formatted edits fall back to the viewer.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PPmy3tPq869XDW4njjVaKA
2026-09-19 23:34:38 -04:00

7 lines
333 B
TypeScript

import { createContext, useContext } from 'react';
import { DiffToken } from '../../../utils/wordDiff';
/** [Gitea #144] Word diff of the message's last edit, for the "(edited)" hover. */
export const EditDiffContext = createContext<DiffToken[] | undefined>(undefined);
export const useEditDiff = () => useContext(EditDiffContext);