Bento, the office suite that fits in a file
TypeScript mit-licenseofficeoffice-365office-suiteoffice-toolsoffice365open-sourcepowerpointself-hostedsingle-page-appslidesslideshareslideshowslideshow-galleryslideshow-makerslideshows
Whole-slide comments: armed click off the slide anchors to the slide
nyblnet3978b03d0c52
diff --git a/CLAUDE.md b/CLAUDE.mdindex 9245112c..5a11b01a 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -73,7 +73,7 @@ One HTML file = the document + viewer + editor. See `README.md` for the vision.click, Esc cancels), or the slide. Author name in localStorage'bento-author'; unresolved threads badge the sidebar thumb. ONE entrypoint: the topbar π¬ tool (C) β armed click on an element anchors there,- on empty canvas anchors the point; near-full-slide backdrops never+ on empty canvas anchors the point; OFF the slide (grey canvas) anchors the WHOLE SLIDE; near-full-slide backdrops nevercapture (a comment on scenery means the spot). While armed, hover previews the pending anchor (amber outline on elements, pin+coords elsewhere); fresh markers pulse. `window.bento.comments()`returns the flat typed-anchor list β the entry point for AI agentsprocessing flagged issues in a deck.diff --git a/slides/src/editor/canvas.ts b/slides/src/editor/canvas.tsindex 1ce583ff..eeccfa06 100644--- a/slides/src/editor/canvas.ts+++ b/slides/src/editor/canvas.ts@@ -227,12 +227,24 @@ export class SlideCanvas {this.onCommentModeChange?.(false)}const onMove = (ev: MouseEvent) => {- const a = this.commentAnchorAt(ev.clientX, ev.clientY)- if (!a) {+ const inWrap = ev.target instanceof Element && !!ev.target.closest('.ed-canvas-wrap')+ const a = inWrap ? this.commentAnchorAt(ev.clientX, ev.clientY) : null+ if (!inWrap) {hl.style.display = 'none'return}hl.style.display = ''+ if (!a) {+ // on the canvas but off the slide: the WHOLE SLIDE is the anchor+ const { width, height } = this.store.doc.size+ hl.className = 'ed-comment-hl slide'+ hl.style.left = '-3px'+ hl.style.top = '-3px'+ hl.style.width = `${width * this.scale + 6}px`+ hl.style.height = `${height * this.scale + 6}px`+ hl.textContent = 'whole slide'+ return+ }if (a.el) {hl.className = 'ed-comment-hl element'hl.style.left = `${a.el.x * this.scale - 3}px`@@ -250,12 +262,18 @@ export class SlideCanvas {}}const onDown = (ev: MouseEvent) => {+ const t = ev.target instanceof Element ? ev.target : null+ if (t?.closest('.ed-topbar')) return // let the π¬ toggle (or other tools) handle it+ if (!t?.closest('.ed-canvas-wrap')) {+ cleanup() // clicked some other UI: disarm without placing+ return+ }const a = this.commentAnchorAt(ev.clientX, ev.clientY)cleanup()- if (!a) return // outside the slideev.preventDefault()ev.stopPropagation()- this.comments.openNew(a.el?.id, a.el ? undefined : { x: a.x, y: a.y })+ if (!a) this.comments.openNew() // off-slide canvas click = whole slide+ else this.comments.openNew(a.el?.id, a.el ? undefined : { x: a.x, y: a.y })}const onKey = (ev: KeyboardEvent) => {if (ev.key === 'Escape') cleanup()diff --git a/slides/src/styles.css b/slides/src/styles.cssindex 162a04a0..46f69db3 100644--- a/slides/src/styles.css+++ b/slides/src/styles.css@@ -543,6 +543,19 @@ html, body {border-radius: 6px;background: color-mix(in srgb, var(--accent) 8%, transparent);}+.ed-comment-hl.slide {+ border: 2px dashed var(--accent);+ border-radius: 8px;+ background: color-mix(in srgb, var(--accent) 5%, transparent);+ display: flex;+ align-items: flex-start;+ justify-content: flex-end;+ padding: 5px 8px;+ font: 700 9.5px/1 -apple-system, 'Segoe UI', system-ui, sans-serif;+ letter-spacing: 0.06em;+ text-transform: uppercase;+ color: var(--accent-ink);+}.ed-comment-hl.pin {width: 0; height: 0;font: 600 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;