Bento, the office suite that fits in a file
TypeScript mit-licenseofficeoffice-365office-suiteoffice-toolsoffice365open-sourcepowerpointself-hostedsingle-page-appslidesslideshareslideshowslideshow-galleryslideshow-makerslideshows
Editable comment author: "you: <name> ✎" chip in the thread popover
nyblnetdeb47d0b2ab8
diff --git a/slides/src/editor/comments.ts b/slides/src/editor/comments.tsindex 0c5b5b56..189aac4e 100644--- a/slides/src/editor/comments.ts+++ b/slides/src/editor/comments.ts@@ -7,7 +7,8 @@import type { Store } from '../store'import { uid, type Comment } from '../model'-/** The commenter's name, remembered per browser; asked for on first use. */+/** The commenter's name, remembered per browser (localStorage, never sent+ * anywhere); asked for on first use. */export function commentAuthor(): string | null {let name = localStorage.getItem('bento-author')if (!name) {@@ -18,6 +19,14 @@ export function commentAuthor(): string | null {return name}+/** Re-ask for the name; existing threads keep their original author. */+export function changeCommentAuthor(): string | null {+ const next = window.prompt('Your name (shown on new comments):', localStorage.getItem('bento-author') ?? '')?.trim()+ if (!next) return null+ localStorage.setItem('bento-author', next)+ return next+}+function relTime(iso: string): string {const s = (Date.now() - new Date(iso).getTime()) / 1000if (!Number.isFinite(s) || s < 45) return 'just now'@@ -106,9 +115,19 @@ export class CommentsUI {const head = document.createElement('div')head.className = 'ed-comment-pop-head'- head.textContent = c.elementId+ const headLabel = document.createElement('span')+ headLabel.textContent = c.elementId? 'Comment · element': typeof c.x === 'number' ? `Comment · point (${c.x}, ${c.y})` : 'Comment · slide'+ const me = document.createElement('button')+ me.className = 'ed-comment-me'+ me.textContent = `you: ${localStorage.getItem('bento-author') ?? '—'} ✎`+ me.title = 'Change the name used for your new comments and replies'+ me.addEventListener('click', () => {+ const next = changeCommentAuthor()+ if (next) me.textContent = `you: ${next} ✎`+ })+ head.append(headLabel, me)pop.appendChild(head)const entries = document.createElement('div')diff --git a/slides/src/styles.css b/slides/src/styles.cssindex 6d1d1f49..14e7349e 100644--- a/slides/src/styles.css+++ b/slides/src/styles.css@@ -622,6 +622,23 @@ html, body {box-shadow: 0 12px 32px rgb(15 23 36 / 0.18);padding: 12px 14px;}+.ed-comment-me {+ float: right;+ border: none;+ background: none;+ font: 600 10px/1.4 inherit;+ font-family: inherit;+ color: var(--muted);+ cursor: pointer;+ padding: 0;+}+.ed-comment-me:hover { color: var(--accent-ink); }+.ed-comment-pop-head {+ display: flex;+ justify-content: space-between;+ align-items: baseline;+ gap: 8px;+}.ed-comment-pop-head {font-size: 10.5px;font-weight: 700;