This fixes closing Release Notes / Markdown Preview with Ctrl+W closing whole PWA.
PWAs can intercept the Ctrl+W/Ctrl+N keystrokes, and VSCode does this for editor tabs. However, webviews do not intercept these keystrokes.
If a webview such as Release Notes or Markdown Preview has focus:
- when the user presses Ctrl+N, another instance of the PWA is opened in a new window.
- when the user presses Ctrl+W, the whole PWA window closes.
See https://github.com/microsoft/vscode/issues/150735 for details.
This fixes the issue by ignoring Ctrl+W and Ctrl+N in webviews.
Tested on macOS 12.6 / Chrome Dev 109.0.5384.0:
- patch environmentService.ts webviewExternalEndpoint to use
http://localhost:8080/static/sources/out/vs/workbench/contrib/webview/browser/pre/
- followed the contributing instruction to run code-web
- in Chrome, More Tools -> Create Shortcut -> Open as window
- closed and re-opened Code OSS PWA window
- opened chrome://inspect and inspected the Code OSS window
- added an uncaught exception handler
- opened file.md and chose "Open preview"
- when it hit
`Expected '${parentOriginHash}' as hostname or subdomain!`
manually ran `start(parentOrigin)` in console and continued
- the markdown preview now displayed
- pressed Command+W
Before: the whole window closes
After: only the Markdown preview tab closes
* Change descriptions to just say “Enable…”
Previously these said “Enable or disable…”, which in the context of a tick box doesn’t make sense.
* Change “Enable/disable” wording in descriptions
* Highlight label should not create extra empty dom nodes
I noticed that the `HighlightedLabel` class creates extra `span` elements for text ranges. These should not be needed. Using text children directly should be faster for creation and also reduce the number of nodes in the document
I also related the conditional spread with a longer version that uses a simple call to push. This is worth doing since `HighlightedLabel` is so widely used in the editor
* Update tests
* Update smoke test selector
* Update css
* api feedback
- remove critical log level
- move log level off to be 0
* handle off log level
* fix disabling log level in tests
Co-authored-by: Raymond Zhao <7199958+rzhao271@users.noreply.github.com>