feat: Adds copy view URL button to bypass browser URL truncation#868
Open
neomorphic wants to merge 2 commits intogoogle:masterfrom
Open
feat: Adds copy view URL button to bypass browser URL truncation#868neomorphic wants to merge 2 commits intogoogle:masterfrom
neomorphic wants to merge 2 commits intogoogle:masterfrom
Conversation
Adds a new button to the top bar that copies the complete view URL to the clipboard, including the full state fragment. This solves the issue where exceptionally long URLs are truncated when copied from the browser's address bar. Changes: - Adds makeCopyUrlButton() function using the clipboard icon - Creates encodeStateAsFragment() helper in url_hash_binding - Refactors UrlHashBinding.setUrlHash() to use new helper - Adds URL copy button to viewer top bar
Collaborator
|
Can you add a uiConfiguration option for controlling the presence of this to match other buttons in the top row? |
Adds a uiConfiguration toggle to control visibility of the copy view URL button, consistent with existing top row button options.
Contributor
Author
@jbms Added as requested. Please let me know if there is anything else missing. |
Contributor
|
I've pulled this down, tested it manually and all the automated tests are passing. Just wanted to add my support for hopefully getting this in soon since it seems to have been ready to go for a bit. |
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.
Summary
Adds a "Copy view URL to clipboard" button to the top bar that copies the complete URL including the full state fragment, bypassing browser truncation issues.
Problem
When neuroglancer state URLs become very long, browsers truncate them in the address bar. Copying the URL directly from the address bar results in an incomplete URL that cannot restore the full state when pasted into another browser
Solution
Changes
src/widget/copy_button.ts: AddedmakeCopyUrlButton()function that uses the clipboard iconsrc/ui/url_hash_binding.ts: AddedencodeStateAsFragment()helper function and refactored existing code to use itsrc/viewer.ts: Added the copy URL button to the top bar