Code editor in modal does not show output

Product: PowerShell Universal
Version: 2.8.0

Hey @adam

Trying to show the output of a script on a code editor in a modal, but cannot get the output from the script. I can get the output if I just have it in a column.

Simple test:

Set-UDElement -Id 'test' -Properties @{
    code = 'test'
}
Show-UDModal -FullScreen -Content {
    New-UDCodeEditor -Id 'test' -Height 500
}

The above just shows a blank editor. Is there a way to display the output in a modal?

Thanks!

This is probably because the editor isn’t mounted yet when you call Set-UDElement.

Can you use session variables instead?

$Session:Code = 'test' 
Show-UDModal -FullScreen -Content {
    New-UDCodeEditor -Height 500 -Value $Session:Code
}

Awesome. Yeah that did the trick.

Thanks man

2 Likes