Text Features - #362
Merged
Merged
Conversation
saa938
requested changes
Aug 8, 2026
saa938
left a comment
Collaborator
There was a problem hiding this comment.
- highlight cant be turned off
- cursor jumps to start of the field immediately after applying any formatting
- formatting text next to latex corrupts math rendering
- floating toolbar is keyboard unreachable
saa938
requested changes
Aug 11, 2026
saa938
left a comment
Collaborator
There was a problem hiding this comment.
- the highlight issue still exists for me. remove the mark directly instead of asking the browser to
- cursor issue is fixed, good job
- latex issue is kinda fixed but if someone uses shortcuts like ctrl + b then it doesn't work. what you can do is intercept these shortcuts and route them through the guarded path.
- floating toolbar is now keyboard reachable, good work
saa938
requested changes
Aug 12, 2026
saa938
left a comment
Collaborator
There was a problem hiding this comment.
enter doesnt start a new line anymore, and the highlight thing still doesnt work. its a small change so i will just finish up this PR
Two fixes to the rich-text question editor.
Enter no longer starts a new line. emitChange restored the caret on every
input, not just when sanitizing had replaced innerHTML and destroyed the
selection. Because a <br> contributes no characters to the plain-text offset
model, restoring on a freshly created empty line mapped the caret back onto
the end of the previous line, so "one", Enter, "two" produced
"onetwo<div><br></div>". Restore only when the rewrite actually happened, and
let callers that mutate the DOM themselves pass their offsets explicitly.
Highlight could not be turned off. removeHighlightFromSelection unwrapped only
the marks that range extraction pulled into the fragment, and extraction sees a
mark only when the range fully contains it. Selecting the highlighted words --
the natural gesture -- makes that mark the range's common ancestor, so nothing
was found and the highlight stayed. The branch guard made it worse: it read
active.highlight, derived from anchorNode.closest("mark"), which is true
exactly for the selections where removal did nothing and false for the one
selection where it worked, where the code instead added a second mark and
produced nested <mark> elements.
Unwrap by intersection instead, and derive the toggle state from the whole
range rather than the anchor, which also stops the reported state from
depending on drag direction.
Verified in a browser: Enter now yields "one<div>two</div>" and three lines
nest correctly; highlight adds and removes across all three selection
geometries with no nested marks; the LaTeX guard, bold toggling, mid-string
typing, and selection preservation across a sanitizer rewrite are unchanged.
8 tasks
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.
Description
Add multiple rich text features
Resolves #334
Pull request type
A summary of the change, anything else that will help review this PR
Checklist