Skip to content

Set-VSCodeHtmlContentView should allow passing stylesheets and JavaScript files as a parameter #910

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mattmcnabb opened this issue Jun 22, 2017 · 6 comments
Labels
Area-HTML Content View Issue-Enhancement A feature request (enhancement).

Comments

@mattmcnabb
Copy link
Contributor

It would be great if we could style our HTML with the new *-VSCodeHtml cmdlets available with v1.4.0. It could possibly be implemented by giving us access to use tags, or by passing in stylesheets to a parameter.

@daviwil daviwil changed the title Styling in HTML Views Set-VSCodeHtmlContentView should allow passing stylesheets as a parameter Jun 22, 2017
@daviwil
Copy link
Contributor

daviwil commented Jun 22, 2017

Yep, passing stylesheets as a parameter is coming next!

@daviwil daviwil added Area-HTML Content View Issue-Enhancement A feature request (enhancement). labels Jun 22, 2017
@daviwil daviwil added this to the June 2017 milestone Jun 22, 2017
@kamilkosek
Copy link
Contributor

Hi Guys,
and what about JavaScript ?
I´ve played a little bit and removed the restriction from here and embedded some JavaScript to achieve a 'Out-GridView' like behaviour
20170622_160401

@daviwil
Copy link
Contributor

daviwil commented Jun 22, 2017

That's awesome Kamil :) Yes, I'll be adding the ability to pass JavaScript paths too! Just needed to enable it in a fairly secure way (no dynamic loading of JavaSscript from files on disk). There's a way I can set it up to work with that content policy so that we get the best of both worlds.

@daviwil daviwil changed the title Set-VSCodeHtmlContentView should allow passing stylesheets as a parameter Set-VSCodeHtmlContentView should allow passing stylesheets and JavaScript files as a parameter Jun 22, 2017
@kamilkosek
Copy link
Contributor

Thanks :)
And the absolute cherry on the cake would be if there were be an ability to trigger events from the ContentView to communicate with the LanguageServer 😈

@daviwil
Copy link
Contributor

daviwil commented Jun 22, 2017

Yep, this will ultimately be possible through PSES "editor commands" but we need to make it possible to send them parameters first.

VS Code allows you to invoke commands registered in the editor (like PSES editor commands) from within this HTML view, you just need to encode URIs in a certain way:

https://code.visualstudio.com/docs/extensionAPI/vscode-api-commands#_links

Not sure if there's a way to invoke them without having the URI inside of a link, though.

@kamilkosek
Copy link
Contributor

kamilkosek commented Jun 22, 2017

Cool :)
I just tested it, you don´t need to encode the command with encodeURI() if you a invoke a parameterless command.
I assume with

but we need to make it possible to send them parameters first.

you mean that we need to register a new vscode.command, maybe PowerShell.InvokeEditorCommand which accepts the desired command-name as a parameter and then invoke the command on the LanguageServer through the LanguageClient?

daviwil added a commit to daviwil/PowerShellEditorServices that referenced this issue Jul 11, 2017
This change adds new parameters to Set-VSCodeHtmlContentView which allow
the user to specify JavaScriptPaths and StyleSheetPaths to include local
JavaScript and CSS files into their HTML views.

Part of the fix for PowerShell/vscode-powershell#910.
daviwil added a commit to daviwil/vscode-powershell that referenced this issue Jul 11, 2017
This change adds the client-side behavior for new parameters to
Set-VSCodeHtmlContentView which allow the user to specify JavaScriptPaths
and StyleSheetPaths to include local JavaScript and CSS files into their
HTML views.

Resolves PowerShell#910.
daviwil added a commit to daviwil/PowerShellEditorServices that referenced this issue Jul 11, 2017
This change adds new parameters to Set-VSCodeHtmlContentView which allow
the user to specify JavaScriptPaths and StyleSheetPaths to include local
JavaScript and CSS files into their HTML views.

Part of the fix for PowerShell/vscode-powershell#910.
daviwil added a commit to PowerShell/PowerShellEditorServices that referenced this issue Jul 11, 2017
This change adds new parameters to Set-VSCodeHtmlContentView which allow
the user to specify JavaScriptPaths and StyleSheetPaths to include local
JavaScript and CSS files into their HTML views.

Part of the fix for PowerShell/vscode-powershell#910.
daviwil added a commit that referenced this issue Jul 11, 2017
This change adds the client-side behavior for new parameters to
Set-VSCodeHtmlContentView which allow the user to specify JavaScriptPaths
and StyleSheetPaths to include local JavaScript and CSS files into their
HTML views.

Resolves #910.
@daviwil daviwil modified the milestones: June 2017, July 2017 Jul 11, 2017
@daviwil daviwil modified the milestones: July 2017, 1.5.0 Oct 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-HTML Content View Issue-Enhancement A feature request (enhancement).
Projects
None yet
Development

No branches or pull requests

3 participants