Proper ConsoleLog text copying support#1919
Draft
AaronPlave wants to merge 2 commits into
Draft
Conversation
910f4a6 to
47ee2c6
Compare
Collaborator
|
Decided to defer this to 4.3.0 to minimize risk & decide if this is the best approach |
dandelany
reviewed
May 14, 2026
| // Multi-row selections are handled by the list-level handler in ./consoleLogCopy.ts, which | ||
| // walks <details>/<summary>/<pre> — keep that file in sync if you change this template's structure. | ||
| const selection = window.getSelection(); | ||
| if (!selection || selection.isCollapsed || !summaryEl) { |
Collaborator
There was a problem hiding this comment.
I think in cases of collapsed log lines, we should actually copy the entire expanded log line to clipboard, since this is most likely the user's intention
| return; | ||
| } | ||
| const selection = window.getSelection(); | ||
| if (!selection || selection.isCollapsed) { |
Collaborator
There was a problem hiding this comment.
same here re: copying expanded version of collapsed log lines
Collaborator
|
Discussed with @AaronPlave & we're not sure this is the right approach - it works but it also adds a lot of complexity to be "hijacking" the copy/paste mechanism. We'll work on a simpler version which may:
|
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.
Problem. Copying log rows produced broken text — each chunk (
timestamp,[,INFO,], message) on its own line. The flex layout makes each header a block item and browsers insert newlines between block items when serializing a selection.Fix. Two
copyevent handlers normalize the clipboard text:<summary>handler for single-row selectionsuse:consoleLogCopySvelte action on list containers for multi-row and summary which expanded selections (preserves<pre>newlines)Why not just CSS or inline restructure. CSS alone can't fix the header/message split — flex items are block-level by spec. An inline restructure works but forces giving up the message wrapping behavior and
text-ellipsistruncation.