controls/script-save-content-modal.ps1

function New-SaveScriptContentModal {
    
    param (
        [Parameter(Mandatory = $true)]
        $Script,

        [Parameter(Mandatory = $true)]
        $ScriptContent
    )

    Show-UDModal -Content {
        New-UDPageHeader -Text ("Committing Changes to: $($Script.Name)")
        New-UDParagraph -Text "Enter a Commit message to submit your changes."
        New-UDTextbox -Id "SaveScriptContentModalCommitMessage" -Label "Commit Message"
        
        New-UDElement -Tag div -Attributes @{
            style = @{
                textAlign = "right"
            }
        } -Content {

            New-UDButton -Text "Cancel" -Icon ban -OnClick {
                Hide-UDModal
            }
            
        
            New-UDButton -Text "Confirm" -Icon save -OnClick {
                $ScriptCommitMessage = ((Get-UDElement -Id 'SaveScriptContentModalCommitMessage').Attributes["value"])
                if ($null -eq $ScriptCommitMessage) { $ScriptCommitMessage = "None Specified" }
                $Script | Set-UAScript -Content $ScriptContent -Notes $ScriptCommitMessage
                Sync-UDElement -Id "ScriptPageScriptBlockEditor" -Broadcast
                Sync-UDElement -Id "ScriptPageEditDiv" -Broadcast
                Sync-UDElement -Id "ScriptHistoryGrid" -Broadcast
                Sync-UDElement -Id "ScriptPageParametersTable" -Broadcast                
                $Session:ScriptEditMode = $False
                Hide-UDModal
            }

        }

    } -Width '50%'
}