Skip to content

feat: comments#882

Open
usman-khalid wants to merge 27 commits into
adobe:mainfrom
usman-khalid:comments
Open

feat: comments#882
usman-khalid wants to merge 27 commits into
adobe:mainfrom
usman-khalid:comments

Conversation

@usman-khalid

@usman-khalid usman-khalid commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

Should be merged with adobe/da-collab#132 which allows read-only users to write only to the comments map without touching actual document content.

Summary

Collaborative comments for DA.

Users can select text, an image or a table (block) and attach a comment. Comments live in a yjs map, so they stay in sync across concurrent editor and avoid last write wins.

Keyboard Shortcuts

  • CMD+Option+M — if there is a selection, will start composing a new thread. If not, will open the comments panel. Esc to cancel.
  • CMD+Enter to submit a comment/reply

Related Issue

Resolves #472

Other changes

  • new da-toast component as this is now being used in three places: da-list, da-sites and da-comments
  • shared util for generateColor

How Has This Been Tested?

Screenshots (if appropriate)

Screen.Recording.2026-04-20.at.15.1.mp4

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@usman-khalid usman-khalid force-pushed the comments branch 3 times, most recently from 18ec182 to 3ec1613 Compare April 28, 2026 13:34
@usman-khalid usman-khalid force-pushed the comments branch 3 times, most recently from 7034a47 to 3a87865 Compare May 6, 2026 15:38
@usman-khalid usman-khalid force-pushed the comments branch 5 times, most recently from 0fe8220 to 9741f47 Compare May 25, 2026 13:32
usman-khalid and others added 16 commits June 22, 2026 14:33
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The EW Comments tool-panel view set the controller but never told it the
panel was open, so the thread list and ProseMirror highlight decorations —
both gated on panelOpen — stayed empty until a comment was added (which
flips panelOpen via requestCompose). Mirror DA's behaviour by tying
panelOpen to the panel element's actual visibility via IntersectionObserver,
so highlights and threads appear whenever the Comments view is shown and
hide when it is switched away or the rail is closed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment highlight decorations carry the class da-comment-highlight, but its
CSS (and the --comment-highlight-* variables, scoped to .da-prose-mirror)
lived only in the DA editor's stylesheet, which the EW document editor never
loads — so the spans rendered unstyled. Extract the highlight rules to a
shared blocks/shared/comments/comment-highlight.css and adopt it in both the
DA editor (da-editor) and the EW document editor (ew-editor-doc).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Track a loaded flag on the comments store (notifying once after the first
  fetch, even with zero comments) and expose it via the controller, so the
  panel shows a spinner instead of flashing an empty "no comments" state
  while comments are still loading.
- Add an `embedded` flag to da-comments that suppresses the in-panel
  title/close row; the EW tool-panel owns the close control, so its Comments
  view sets embedded and starts at the compose prompt.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The panel hardcoded a white card surface and a white spinner overlay, which
looked broken on EW's dark theme while the rest of the panel already used
adaptive --s2-* tokens. Drive both from light-dark() so cards and the
submit overlay stay white in DA's light theme and become elevated dark
surfaces in EW, keeping the panel correct in both.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The highlight fills were hardcoded light-yellow/fuchsia, so EW's light editor
text became unreadable on them in dark mode. Drive the highlight variables
with light-dark(): light values are unchanged (DA preserved), dark values
follow Spectrum's dark yellow/pink ramp so light text stays readable. Uses
literals rather than --s2-* tokens so it works in both DA and EW regardless
of which token set the host app loads.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
usman-khalid and others added 10 commits June 22, 2026 17:39
# Conflicts:
#	blocks/canvas/editor-utils/command-defs.js
#	blocks/canvas/ew-editor-doc/ew-editor-doc.js
#	test/fixtures/nx/blocks/shared/menu/menu.js
…files)

DA is being de-emphasized in favour of Experience Workspace and comments has
never shipped, so commit to EW-only rather than carrying a DA-compatible
shared implementation:

- Relocate the comments engine and panel into the canvas (EW) block:
  blocks/shared/comments -> blocks/canvas/comments
  blocks/shared/da-comments -> blocks/canvas/da-comments
- Restore every blocks/edit/ file touched by the comments work to its
  upstream original (da-content, prose/index, edit.js, da-editor, slashMenu,
  imageFocalPoint, tableUtils) — blocks/edit/ is now identical to upstream.
- canvas comment anchoring imports getTableInfo from edit's tableUtils, the
  same way the canvas editor already reuses other edit prose plugins.
- Drop the DA-edit comments integration test; relocate engine/panel test
  imports to the canvas paths.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Follow the canvas naming/structure convention (ew-<feature> dirs that own
their component + supporting code, à la ew-editor-doc). Merge the engine
(blocks/canvas/comments) and panel (blocks/canvas/da-comments) into a single
blocks/canvas/ew-comments/:

- da-comments.js/.css -> ew-comments.js/.css; custom element da-comments ->
  ew-comments (class DaComments -> EwComments).
- commentPlugin.js -> comment-plugin.js (kebab, matching editor-utils).
- engine + panel helpers consolidated under ew-comments/helpers/.
- Update all imports (ew-editor-doc wiring, panel view, tests) and the
  highlight/sheet asset paths.

Internal .da-comments-* CSS class names are left as-is (scoped to the shadow
root; renaming them is cosmetic and high-churn).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Give the comment command its own toolbar-comment group rendered after the
image group, so it sits at the end of the toolbar next to the add-image
button instead of among the inline text marks.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Mirror the source move — comment engine/panel tests now live under
test/unit/blocks/canvas/ew-comments/ (was test/unit/blocks/edit/...).
Engine test import depths and the shared test-helpers path are updated for
the new location; panel tests move at equal depth (imports unchanged).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The comment action is a no-op without an anchorable selection, so hide it
unless the selection can be anchored. Add a canComment(state) predicate
(non-empty text, or an image/table node selection) and use it as the
add-comment command's visible() so the toolbar omits the button otherwise.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…idge

Mirror the existing getPort() thunk so the comment iframe bridge always
reads the current ProseMirror view (and no-ops if it's gone) rather than
capturing a possibly-stale reference at subscribe time.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[edit] Enable document comments

1 participant