posit-dev / publisher

MIT License
3 stars 0 forks source link

Display Content in IDE or external browser #1814

Closed sagerb closed 2 weeks ago

sagerb commented 4 weeks ago

Intent

Type of Change

Approach

VSCode configuration added, allowing the selection of three target modes used when launching links from within the publisher: (Note: VSCode has some additional display impacts depending on the naming of the configuration keys, so I have made some adjustments to the path setting as well.)

2024-06-07 at 1 24 PM

Then all of the existing env.openExternal calls were refactored into calling a new utility: src/utils/browser.ts, with the openUrl utility. This utility queries the VSCode configuration each time a request comes in, so changes to the setting are automatically used upon the next user action.

Screenshots of the different modes in action:

To the Right: (NOTE: We'll discuss/address the impact of the settings page on screen size separately) 2024-06-07 at 1 29 PM

Main Editor Window: 2024-06-07 at 1 28 PM

Automated Tests

Directions for Reviewers

Activate a successful deployment, bring up the settings and use the links present within the home view to view content, verifying that they are newly launched in the proper targets in sync with the configuration settings. (Obviously, you'll need to relaunch after changing the setting).

Checklist

sagerb commented 3 weeks ago

External help windows (github) error with following for embedded right window:

Error while parsing the 'sandbox' attribute: 'allow-frame-ancestors' is an invalid sandbox flag.
(anonymous) @ index.html?id=269bfdcc-1108-45c7-953d-e0fdf84b3861&origin=e9d27ca5-46a5-4c97-a133-41e8b5aa59e2&swVersion=4&extensionId=posit.publisher&platform=electron&vscode-resource-base-authority=vscode-resource.vscode-cdn.net&parentOrigin=vscode-file%3A%2F%2Fvscode-app:1026
Refused to frame 'https://github.com/' because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'none'".

chromewebdata/:1 

       Failed to load resource: the server responded with a status of 404 ()
sagerb commented 2 weeks ago

Discussed with group and concensus was that default should be external, especially since having it correctly open often requires additional browser header changes to be set within the Connect server. Even then, it is questionable if the current approach that VSCode exposes, will operate correctly for all auth types.

For now, putting this PR on hold, without merging. If we are so motivated, we can re-open and resume work on it.