Open
Conversation
Bundle size reportBundle size will be reported once CircleCI build #29013 finishes. Status: 🟠 Processing... Check out the code infra dashboard for more information about this PR. |
12 tasks
…ontentEditable mode - Added tests for inserting text at the start of a framed line and after </p> without merging lines. - Improved handling of plain text input in fallback contentEditable mode. - Implemented logic to keep </div> on the next line when inserting after </p>. - Added functionality to repair merged lines before onChange when receiving a merged DOM. - Enhanced toString function to ensure newline character handling. - Introduced adjustCursorAtNewlineBoundary to correctly position the cursor at newline boundaries. - Updated useEditable state management to track pending content for better mutation handling. - Refactored source editing logic to prevent unnecessary updates when source matches.
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
…public into docs-infra/improve-live-editing
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
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.
Needed for #1145
Maintains the frame boundaries so that multiple highlighted lines expands when newlines are added within
Preview Deploy
Screencast.From.2026-04-07.19-17-59.webm
Because we use React's virtual DOM for rendering, only the changed line is actually mutated in the DOM. We also benefit from the browser native undo stack (I use Ctrl+Z to remove
plus undoin the video):Screencast.From.2026-04-07.19-19-20.webm
The virtual DOM avoid replacing unchanged DOM nodes all the way down to the token level:
Screencast.From.2026-04-16.12-59-56.webm
Important to note that only visible frames are rendered as html, so react doesn't need to diff the entire codeblock.
use-editablewhich hasn't been maintained in a while, so forked into this repouse-editable()to test browser specific fixesuseEditable()intouseCode()instead of userspace, so we can move comments while editing and abstract this complexity from the userreact-renderis still defined in userspace for now in theCodeControllerPerformance
Re-rendering the highlighted code occurs in a separate task, so input is not delayed by React Runner. To be considered performant, no task should delay input more than
50msOn my machine
Re-rendering the highlighted code on edit: 15ms
Rendering the code's result with React Runner: 5ms
Calibrated "Mid-Tier Mobile"
Re-rendering the highlighted code on edit: 27ms
Rendering the code's result with React Runner: 10ms