Skip to content

Conversation

@neomorphic
Copy link
Contributor

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

  • Added a new button to the viewer top bar with a clipboard icon
  • The button programmatically constructs the complete URL from the current state and copies it to the clipboard

Changes

  • src/widget/copy_button.ts: Added makeCopyUrlButton() function that uses the clipboard icon
  • src/ui/url_hash_binding.ts: Added encodeStateAsFragment() helper function and refactored existing code to use it
  • src/viewer.ts: Added the copy URL button to the top bar

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant