Skip to content

SD-2524 - feat: implement context menu for lists#2918

Merged
chittolinag merged 21 commits intomainfrom
gabriel/sd-2524-feature-support-right-click-context-menu-on-list-markers-for
May 6, 2026
Merged

SD-2524 - feat: implement context menu for lists#2918
chittolinag merged 21 commits intomainfrom
gabriel/sd-2524-feature-support-right-click-context-menu-on-list-markers-for

Conversation

@chittolinag
Copy link
Copy Markdown
Contributor

@chittolinag chittolinag commented Apr 22, 2026

Issue

When a user right-clicks a numbered list marker (e.g., "1.") in the document, the context menu shows only generic editor actions. There is no way to perform list-specific operations — restart numbering, continue numbering, or change indentation — from the marker itself. Left-clicking a marker is also not distinguished from clicking paragraph text, so no "marker selected" visual feedback is given.

Proposed solution

  • Extend getEditorContext() to detect when a right-click lands on a .superdoc-list-marker element and expose isOnListMarker in the context.
  • Show list-specific items on the context menu (restart numbering, continue numbering, increase indent, decrease indent).
  • Add a list-marker section to the context menu with restart, continue, decrease-indent, and increase-indent actions, visible only when isOnListMarker is true.
Screenshot 2026-04-24 at 14 33 23

@linear
Copy link
Copy Markdown

linear Bot commented Apr 22, 2026

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@chittolinag chittolinag force-pushed the gabriel/sd-2524-feature-support-right-click-context-menu-on-list-markers-for branch from aba9ab9 to 58bffc3 Compare April 23, 2026 21:27
@chittolinag chittolinag marked this pull request as ready for review April 24, 2026 17:46
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b170c88c1b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@harbournick
Copy link
Copy Markdown
Collaborator

@artem-harbour can you please prioritize reviewing this one today? thank you!

Comment thread packages/layout-engine/painters/dom/src/table/renderTableCell.ts Outdated
Comment thread packages/layout-engine/painters/dom/src/renderer.ts Outdated
Comment thread packages/layout-engine/painters/dom/src/renderer.ts Outdated
Comment thread packages/layout-engine/painters/dom/src/table/renderTableCell.ts Outdated
Comment thread packages/super-editor/src/editors/v1/components/context-menu/utils.js Outdated
Comment thread packages/super-editor/src/editors/v1/core/Editor.ts Outdated
@chittolinag chittolinag requested a review from caio-pizzol April 30, 2026 21:14
@artem-harbour
Copy link
Copy Markdown
Contributor

@caio-pizzol, please check your comments and let us know if this is ready for merge.

…atch

Both commands set preventDispatch on the captured tr, expecting handleNumberingInvalidation to dispatch via editor.view?.dispatch. With no view that handler is a silent no-op and the captured tr is suppressed too, so no transaction flows and listRendering stays stale on the next read.

These tests fail today and will pass once the dispatch path no longer skips when there is no view.
caio-pizzol

This comment was marked as off-topic.

Copy link
Copy Markdown
Contributor

@caio-pizzol caio-pizzol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @chittolinag! thanks for addressing last round.

a few things to land before merge, left them inline. also worth a pnpm test:layout run before merge.

type MinimalWordLayout,
type ResolvedListMarkerGeometry,
} from '@superdoc/common/list-marker-utils';
import { applySourceAnchorDataset } from '../renderer';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file and renderer.ts import each other (helper pulls applySourceAnchorDataset from renderer; renderer pulls createListMarkerElement from here). works now, fragile. move applySourceAnchorDataset into its own small file. while you're there, import type { SourceAnchor } since it's only used as a type.

if (markerLayout?.run?.letterSpacing != null) {
markerEl.style.letterSpacing = `${markerLayout.run.letterSpacing}px`;
}
const markerContainer = createListMarkerElement(doc, markerLayout?.markerText ?? '', markerLayout?.run ?? {});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flow markers carry source anchors via the helper now, but this call passes 3 args so table markers don't. snapshot consumers walking markers will skip them. any reason not to pass markerLayout?.sourceAnchor here, like the renderer.ts call at 3231?

markerContainer.style.wordSpacing = '0px';

const markerEl = doc.createElement('span');
markerEl.classList.add('superdoc-paragraph-marker');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this PR is moving list-marker classes into DOM_CLASS_NAMES, superdoc-paragraph-marker is the obvious next one. fine as a follow-up.

@caio-pizzol caio-pizzol self-requested a review May 6, 2026 14:03
@chittolinag chittolinag merged commit da4cc56 into main May 6, 2026
68 checks passed
@chittolinag chittolinag deleted the gabriel/sd-2524-feature-support-right-click-context-menu-on-list-markers-for branch May 6, 2026 18:12
@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 6, 2026

🎉 This PR is included in @superdoc-dev/mcp v0.3.0-next.63

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 6, 2026

🎉 This PR is included in @superdoc-dev/react v1.2.0-next.105

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 6, 2026

🎉 This PR is included in superdoc-cli v0.8.0-next.79

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 6, 2026

🎉 This PR is included in vscode-ext v2.3.0-next.107

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 6, 2026

🎉 This PR is included in superdoc v1.30.0-next.61

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 6, 2026

🎉 This PR is included in superdoc-sdk v1.8.0-next.61

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 7, 2026

🎉 This PR is included in superdoc-cli v0.9.0

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 7, 2026

🎉 This PR is included in superdoc v1.32.0

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 7, 2026

🎉 This PR is included in @superdoc-dev/mcp v0.4.0

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 7, 2026

🎉 This PR is included in @superdoc-dev/react v1.3.0

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 7, 2026

🎉 This PR is included in vscode-ext v2.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants