Skip to content

Improve viewer handling of data URLs and add a corresponding test case - #1096

Open
david-hall wants to merge 3 commits into
vZome:mainfrom
david-hall:data-urls
Open

Improve viewer handling of data URLs and add a corresponding test case#1096
david-hall wants to merge 3 commits into
vZome:mainfrom
david-hall:data-urls

Conversation

@david-hall

Copy link
Copy Markdown
Contributor

Viewer already handles data URLs, but this improves the behavior in a few ways:

  1. Preemptively trims leading whitespace from incoming and outgoing text to ensure that downloaded vZome files can be opened in desktop.

  2. Avoids trying to find a .shapes.json preview file when opening a data URL since the preview file can't exist.

  3. Displays a truncated version of the data URL in the console rather than the full data URL which is typically several KB.

  4. Test case shows two different ways to encode data URLs and also pass the vZome file name to the viewer as part of the data URL for use when downloading the design from the viewer.

TODO: The option to open in vZome online should be disabled when the viewer's src is a data URL, but I couldn't figure out how to do that.

Viewer already handles data URLs, but this improves the behavior in a few ways:
1) Preemptively trims leading whitespace from incoming and outgoing text to ensure that downloaded vZome files can be opened in desktop.

2) Avoids trying to find a .shapes.json preview file when opening a data URL since the preview file can't exist.

3) Displays a truncated version of the data URL in the console rather than the full data URL which is typically several KB.

4) Test case shows two different ways to encode data URLs and also pass the vZome file name to the viewer as part of the data URL for use when downloading the design from the viewer.

TODO: The option to open in vZome online should be disabled when the viewer's src is a data URL, but I couldn't figure out how to do that.
Restored original console.log output for non-data URLs.
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