Getting Element-Properties
Is there a way to access the Properties of the Web-Elements? I am especially interested in the text-Input from Editor. I want to save the code-input locally on the server.
Hey @hvoges,
Yes, you can! There's an upload button which can be added to the top of the code editor. This will give you the code in $WebEvent.Data['value'] for the upload's scriptblock.
Hope that helps
Hi @Badgerati,
worked like a charm, thank you. Still, I think it would be more convenient if access would be possible in object-style like $Editor = -Name 'Editor' -Language 'powershell' -Value "myscript" <Button pushed> $Editor.Value
Just as an example for the Editor, but in fact for all Elements. This would be more Powershell or .net like. Do you think about implementing something like this in the future? Never the less, really great job that you did here! I love Pode and Pode.Web!
That's a good idea actually, though I'd probably opt for using $self instead so it's more like .NET's $this:
New-PodeWebCard -Content @(
New-PodeWebCodeEditor -Name 'Editor' -Language 'powershell' -Upload {
$self.value
}
)
That should work for most elements with scriptblocks 🤔
$self in most cases would be set internally, and likely just be something similar to $self = $WebEvent.Data. There is also an $ElementData available, which is the base configuration for the element.