Repository navigation
fix(action-preview): skip text the previewed mark cannot go on - #76
Merged
Merged
Conversation
The phone status pill spans the docked bar's width 8px above it, in the band where the presence and Discord/GitHub/Privacy chips float, so a refused "/" pick, a removed format's Undo or an unavailable cell's reason covered them. Hide the chips while the bar holds a pill, as they already hide for the selection bar; they come back when it closes.
The colour hover preview drew one decoration over each selection range,
so Red text or Yellow highlight showed over inline code and code blocks
although applying never colours them: inlineCode excludes every mark
and a code block allows none.
setActionPreview now takes { attrs, mark } and decorates only the inline
nodes addMark would mark (the parent allows the mark and no mark on the
node excludes it), merging adjacent runs. A collaborator's redraw keeps
the same rule.
A highlight preview's run that starts after the selection nests the
blurred selection's span inside its mark, so the colour panel's
stylesheet keeps that tint off.
# Conflicts: # CHANGELOG.md
# Conflicts: # CHANGELOG.md
# Conflicts: # CHANGELOG.md
A "/" typed while an earlier fetch of the menu chunk was still failing (the chunk runtime fetches a failed chunk once more, a moment later) joined that fetch. When it failed, nothing loaded the chunk again while the menu stayed open, so the menu never showed even once the chunk could load. A failed load is now fetched once more straight away.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What and why
Resting on a colour swatch previewed the colour over inline code and code blocks in the selection (for example Red text or Yellow highlight over
bun install), although applying never colours them. The preview now shows only what applying does: it skips the text the mark cannot go on, and that text keeps its selection tint.Root cause
ActionPreviewdrew oneDecoration.inlineover each whole selection range. Applying goes throughsetMark→addMark, which marks only inline nodes whose parent allows the mark (a code block allows none) and that carry no mark excluding it (inlineCodehasexcludes: "_").Fix
setActionPreviewnow takes{ attrs, mark } | null(PreviewSpec). The eager plugin decorates only the inline nodesaddMarkwould mark, using the schema (parent.type.allowsMarkType, and theMark.addToSetexclusion rule), and merges adjacent runs into one decoration. The spec is stored on the decorations, so a collaborator's redraw applies the same rule.textColor/highlight, for "Default text" and "No highlight" too).markelement, so ProseMirror cannot merge the blurred selection's.selectionspan into it, and nests that span inside the mark instead. Its tint then covered the yellow on the last run. One rule in the lazycolor-panel.scss(.tiptap.ProseMirror .tt-preview .selection { background-color: transparent }) keeps it off. Span previews already absorb the class and were not affected.How verified
setMarkmarks.bun run test: 1241 pass.bun run check,bun run lintandbun run typecheckare clean.action-preview.spec.ts, for Red text and Yellow highlight over a line of text and inline code:code.--repeat-each=5.action-preview.spec.ts: 25 passed, 4 skipped (screenshot-only). The existing pixel-for-pixel "Default text" / "No highlight" checks now wrap the applied result with the same mark, so both renders skip the same code.text-style-marks,selection-bubble,lazy-surfaces): 49 passed.Bytes
Follow-ups
action-preview.spec.ts.canSetMarkdisables the kind in that case, so that path is never reached.