You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bugIssue identified by VS Code Team member as probable bugupstreamIssue identified as 'upstream' component related (exists outside of VS Code)verifiedVerification succeeded
Johannes Rieken (@jrieken) I verified that the webview itself is as large as the editor, so it must be the content within. Can you share with me how to show dev tools for the web view?
/*--------------------------------------------------------- * Copyright (C) Microsoft Corporation. All rights reserved. *--------------------------------------------------------*/'use strict';import*asvscodefrom'vscode';exportfunctionactivate(context: vscode.ExtensionContext){letpreviewUri=vscode.Uri.parse('css-preview://authority/css-preview');classTextDocumentContentProviderimplementsvscode.TextDocumentContentProvider{private_onDidChange=newvscode.EventEmitter<vscode.Uri>();publicprovideTextDocumentContent(uri: vscode.Uri): string{// return `<html>// <body>// <div>Preview of the CSS properties</dev>// <hr>// <div id="el">Lorem ipsum dolor sit amet, mi et mauris nec ac luctus lorem, proin leo nulla integer metus vestibulum lobortis, eget</div>// </body>// </html>`;return"hello world"}getonDidChange(): vscode.Event<vscode.Uri>{returnthis._onDidChange.event;}publicupdate(uri: vscode.Uri){this._onDidChange.fire(uri);}}letprovider=newTextDocumentContentProvider();letregistration=vscode.workspace.registerTextDocumentContentProvider('css-preview',provider);vscode.workspace.onDidChangeTextDocument((e: vscode.TextDocumentChangeEvent)=>{if(e.document===vscode.window.activeTextEditor.document){provider.update(previewUri);}});vscode.window.onDidChangeTextEditorSelection((e: vscode.TextEditorSelectionChangeEvent)=>{if(e.textEditor===vscode.window.activeTextEditor){provider.update(previewUri);}})letdisposable=vscode.commands.registerCommand('extension.showCssPropertyPreview',()=>{returnvscode.commands.executeCommand('vscode.previewHtml',previewUri,vscode.ViewColumn.Two).then((success)=>{},(reason)=>{vscode.window.showErrorMessage(reason);});});context.subscriptions.push(disposable,registration);}exportfunctiondeactivate(){}
funky. I see it a little when resizing because the webview-body isn't styled, only the iframe. Maybe a resize event got lost - didn't make it to the iframe...
This seems to be related to the fact that I am running with "window.zoomLevel": 1. Also, once I resize the shell, the white background is filled. Maybe the zoom setting also needs to be applied explicitly to the webview.
This is better with the latest Electron update but initially, when loading the web view I still see a short flicker of white background, no matter if I statically set the background color to transparent or black etc
Johannes Rieken (@jrieken) ok, maybe follow up with Electron if you think webview should not have this flicker, I know that for the window itself they did quite some work for me to set the background color very early, even before the DOM gets any chance to set it.
bugIssue identified by VS Code Team member as probable bugupstreamIssue identified as 'upstream' component related (exists outside of VS Code)verifiedVerification succeeded
Activity
jrieken commentedon Apr 6, 2016
I don't see that Benjamin Pasero (@bpasero) Can you inspect how large the web view is drawn? And also how large the iframe is?
bpasero commentedon Apr 6, 2016
Johannes Rieken (@jrieken) I verified that the webview itself is as large as the editor, so it must be the content within. Can you share with me how to show dev tools for the web view?
bpasero commentedon Apr 6, 2016
My extension btw:
jrieken commentedon Apr 6, 2016
There is something to uncomment in
ManagedWebviewin htmlPreviewPart.tsbpasero commentedon Apr 7, 2016
Weird, now I don't see it at home. Will check tomorrow at work...
jrieken commentedon Apr 7, 2016
funky. I see it a little when resizing because the webview-body isn't styled, only the iframe. Maybe a resize event got lost - didn't make it to the iframe...
bpasero commentedon Apr 7, 2016
There is another issue where the background color of a webview is always white. I think this got fixed in newer versions of Electron though and might help us: https://github.com/electron/electron/releases/tag/v0.37.3
in addition to iframe, apply styles also to webview body, #5038
bpasero commentedon Apr 8, 2016
This seems to be related to the fact that I am running with
"window.zoomLevel": 1. Also, once I resize the shell, the white background is filled. Maybe the zoom setting also needs to be applied explicitly to the webview.jrieken commentedon Apr 14, 2016
This is better with the latest Electron update but initially, when loading the web view I still see a short flicker of white background, no matter if I statically set the background color to transparent or black etc
bpasero commentedon Apr 14, 2016
Johannes Rieken (@jrieken) ok, maybe follow up with Electron if you think webview should not have this flicker, I know that for the window itself they did quite some work for me to set the background color very early, even before the DOM gets any chance to set it.
jrieken commentedon Apr 15, 2016
electron/electron#5175
jrieken commentedon Apr 15, 2016
I might be able to workaround this by playing with
visibilitystyles...kieferrm commentedon May 31, 2016
This is also an issue for #6106.
opacity trick to workaround, #5038
opacity trick to workaround, #5038
jrieken commentedon Jul 5, 2016
Closing since we managed to workaround this using an opacity trick