feat(post): post actions toolbar (share / copy / print / reading time)
Adds a small toolbar next to the comment-count badge with four actions: - Share — uses `navigator.share()` on supporting devices, falls back to copy-link otherwise - Copy link — clipboard API with `<input>` + `execCommand` fallback, flashes a checkmark for 1.5s on success - Print — `window.print()`, hidden via `print:hidden` so it doesn't show up in the printed output itself - Reading time — server-computed from headline+body HTML at ~200 wpm, hidden when 0 Reading time + canonical URL come from `+page.server.ts` so SSR output is identical and shareable URLs render correctly. All labels go through the translations layer (5 new `post_action_*` keys). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -162,6 +162,12 @@ const TRANSLATION_KEYS = [
|
||||
"comments_pending_summary_other",
|
||||
"comments_count_aria",
|
||||
"comments_jump_to",
|
||||
// Post actions toolbar (share / copy link / print / reading time).
|
||||
"post_action_share",
|
||||
"post_action_copy",
|
||||
"post_action_copied",
|
||||
"post_action_print",
|
||||
"post_action_reading_time",
|
||||
] as const;
|
||||
|
||||
export type TranslationKey = (typeof TRANSLATION_KEYS)[number];
|
||||
|
||||
Reference in New Issue
Block a user