-
Notifications
You must be signed in to change notification settings - Fork 61
fix: structured content renders correct on hover and select #1843
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
base: main
Are you sure you want to change the base?
fix: structured content renders correct on hover and select #1843
Conversation
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 58e6c67445
ℹ️ 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".
| const resolved = this.#resolveStructuredContentBlockFromElement(doc, structuredContentLabel); | ||
| if (resolved) { | ||
| try { | ||
| const tr = editor.state.tr.setSelection(TextSelection.create(doc, resolved.start, resolved.end)); | ||
| editor.view?.dispatch(tr); |
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.
Select structuredContentBlock with NodeSelection
Clicking a structured-content block label uses TextSelection.create(doc, resolved.start, resolved.end), but those positions are at the start/end of a structuredContentBlock (a block node with content: 'block*'), so ProseMirror throws “Not a text selection” and the try/catch silently drops the selection. In practice, clicking the block SDT label becomes a no-op; use NodeSelection.create(doc, resolved.pos) or select inside a textblock child to make label clicks work for block SDTs.
Useful? React with 👍 / 👎.
| const showLabel = isStart && !sdtLabelsRendered.has(currentKey); | ||
| if (showLabel) { | ||
| sdtLabelsRendered.add(currentKey); | ||
| } |
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.
Reset SDT label tracking during virtual scroll
showLabel is suppressed once a key is in sdtLabelsRendered, but that set is only cleared in paint(). In virtualized mode, updateVirtualWindow mounts/unmounts pages without calling paint(), so after scrolling away and back, the start fragment’s label won’t render because the key is still in the set. This makes SDT labels disappear on virtual scroll; reset the set per virtual window rebuild or scope it to mounted pages.
Useful? React with 👍 / 👎.
In layout engine, fix the rendered styling for structured content:
Adds VRTs.