-
Notifications
You must be signed in to change notification settings - Fork 208
SD-2524 - feat: implement context menu for lists #2918
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
chittolinag
merged 21 commits into
main
from
gabriel/sd-2524-feature-support-right-click-context-menu-on-list-markers-for
May 6, 2026
Merged
Changes from 11 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
5af3ec9
feat: implement context menu for lists
chittolina 58bffc3
fix: infinite loop
chittolina 499762a
refactor: simplified code
chittolina ba2bc6f
refactor: simplified continue/restart numbering logic
chittolina ed61181
refactor: simplified code
chittolina 641b1f2
refactor: perf optimization
chittolina b170c88
refactor: simplified logic on document-section/helpers.js
chittolina ebe3f67
refactor: created const for list marker class
chittolina bcd5de5
refactor: use list marker class naem on renderTableCell
chittolina fae4a96
refactor: move const to dom-contract
chittolina 16eb3a1
refactor: unify logic to create list marker element
chittolina 9518489
fix: default to ilvl 0
chittolina c352203
refactor: merge w/ main
chittolina 2cce922
fix: added missing imports
chittolina e870e62
fix: source anchor when rendering paragraph
chittolina 6d8c9c9
fix: build
chittolina c29f393
test: failing regression for headless continue/restart numbering disp…
caio-pizzol d33d978
Merge branch 'main' into gabriel/sd-2524-feature-support-right-click-…
chittolina ef93e57
fix: tests
chittolina 260042b
Merge remote-tracking branch 'origin/main' into gabriel/sd-2524-featu…
chittolina 63fdda6
Merge remote-tracking branch 'origin/main' into gabriel/sd-2524-featu…
chittolina File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| import { DOM_CLASS_NAMES } from '@superdoc/dom-contract'; | ||
| import { toCssFontFamily } from '@superdoc/font-utils'; | ||
| import { | ||
| resolveListMarkerGeometry, | ||
| resolveListTextStartPx, | ||
|
|
@@ -74,3 +76,46 @@ export const resolvePainterListTextStartPx = ({ | |
|
|
||
| // Re-export computeTabWidth from shared module | ||
| export { computeTabWidth }; | ||
|
|
||
| type MarkerRunStyle = { | ||
| fontFamily?: string | null; | ||
| fontSize?: number | null; | ||
| bold?: boolean | null; | ||
| italic?: boolean | null; | ||
| color?: string | null; | ||
| letterSpacing?: number | null; | ||
| }; | ||
|
|
||
| /** | ||
| * Build the marker container `<span class="superdoc-list-marker">` with the inner | ||
| * `<span class="superdoc-paragraph-marker">` already appended and styled from the | ||
| * given run. Callers handle positioning, suffix separators, and the final prepend. | ||
| */ | ||
| export const createListMarkerElement = (doc: Document, markerText: string, run: MarkerRunStyle): HTMLElement => { | ||
| const markerContainer = doc.createElement('span'); | ||
| markerContainer.classList.add(DOM_CLASS_NAMES.LIST_MARKER); | ||
| markerContainer.style.display = 'inline-block'; | ||
| markerContainer.style.wordSpacing = '0px'; | ||
|
|
||
| const markerEl = doc.createElement('span'); | ||
| markerEl.classList.add('superdoc-paragraph-marker'); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. since this PR is moving list-marker classes into |
||
| markerEl.textContent = markerText; | ||
| markerEl.style.pointerEvents = 'none'; | ||
| markerEl.style.fontFamily = toCssFontFamily(run.fontFamily) ?? run.fontFamily ?? ''; | ||
|
|
||
| if (run.fontSize != null) { | ||
| markerEl.style.fontSize = `${run.fontSize}px`; | ||
| } | ||
| markerEl.style.fontWeight = run.bold ? 'bold' : ''; | ||
| markerEl.style.fontStyle = run.italic ? 'italic' : ''; | ||
|
|
||
| if (run.color) { | ||
| markerEl.style.color = run.color; | ||
| } | ||
| if (run.letterSpacing != null) { | ||
| markerEl.style.letterSpacing = `${run.letterSpacing}px`; | ||
| } | ||
|
|
||
| markerContainer.appendChild(markerEl); | ||
| return markerContainer; | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?.sourceAnchorhere, like the renderer.ts call at 3231?