ironmansoftware / powershell-universal

Issue tracker for PowerShell Universal
https://powershelluniversal.com
37 stars 4 forks source link

New-UDTinyMCE - Cannot Type in Modals When Declared Inside New-UDModal #2827

Open sean-sauve opened 1 year ago

sean-sauve commented 1 year ago

Version

4.1.8

Severity

Low

Steps to Reproduce

Declare a New-UDModal. Then declare a New-UDTinyMCE inside that modal that uses plugins when generate their own modal and require text, such as a link/url button on the toolbar.

The modals inside of TinyMCE cannot receive keyboard input.

When declaring a New-UDTinyMCE inside of New-UDModal, any modal that TinyMCE opens cannot be typed in. Modals in TinyMCE work for this:

########################## TinyMCE Full Editor ##########################
      New-UDTypography -Variant 'h5' -Text 'TinyMCE Full Editor'
      New-UDForm -Id 'TinyMCEFormID' -ButtonVariant 'contained' -Content {
          $TinyMCEOptions = @{
              'plugins' = @('advlist', 'autolink', 'link', 'image', 'lists', 'charmap', 'preview', 'anchor', 'pagebreak', 'searchreplace', 'wordcount', 'visualblocks', 'visualchars', 'code', 'fullscreen', 'insertdatetime', 'media', 'table', 'emoticons', 'template', 'help')
              'toolbar' = 'undo redo | styles | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link | preview fullscreen | forecolor backcolor emoticons | code | help'
              'menubar' = 'favs file edit view insert format tools table help'
              'icons'   = 'material'
          }
          New-UDElement -Tag 'div' -Attributes @{ 'style' = @{ 'display' = 'none' } } -Content {
              New-UDTextbox -Id 'TinyMCEFullTextID' -Multiline -Value 'Test initial value'
          }
          New-UDTinyMCE -Init $TinyMCEOptions -InitialValue 'Test initial value' -OnEditorChange {
              Set-UDElement -Id 'TinyMCEFullTextID' -Properties @{
                  'value' = $EventData
              }
          }
      } -OnSubmit {
          $EventData.TinyMCEFullTextID | Out-File C:\ProgramData\PowerShellUniversal\TinyFullTest.txt
      }

But not in this:

########################## TinyMCE Inside Modal ##########################
        New-UDTypography -Variant 'h5' -Text 'TinyMCE Inside Modal'
        New-UDButton -Text 'Open Modal' -Id 'btnOpenModal' -OnClick {
            New-UDModal -Content {
                New-UDForm -Id 'TinyMCEFormInsideModalID' -ButtonVariant 'contained' -Content {
                    $TinyMCEOptions = @{
                        'plugins' = @('advlist', 'autolink', 'link', 'image', 'lists', 'charmap', 'preview', 'anchor', 'pagebreak', 'searchreplace', 'wordcount', 'visualblocks', 'visualchars', 'code', 'fullscreen', 'insertdatetime', 'media', 'table', 'emoticons', 'template', 'help')
                        'toolbar' = 'undo redo | styles | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link | preview fullscreen | forecolor backcolor emoticons | code | help'
                        'menubar' = 'favs file edit view insert format tools table help'
                        'icons'   = 'material'
                    }
                    New-UDElement -Tag 'div' -Attributes @{ 'style' = @{ 'display' = 'none' } } -Content {
                        New-UDTextbox -Id 'TinyMCEFullInsideModalTextID' -Multiline -Value 'Test initial value'
                    }
                    New-UDTinyMCE -Init $TinyMCEOptions -InitialValue 'Test initial value' -OnEditorChange {
                        Set-UDElement -Id 'TinyMCEFullInsideModalTextID' -Properties @{
                            'value' = $EventData
                        }
                    }
                } -OnSubmit {
                    $EventData.TinyMCEFullInsideModalTextID | Out-File C:\ProgramData\PowerShellUniversal\TinyFullInsideModalTest.txt
                    Hide-UDModal
                }
            }
        }

Expected behavior

To be able to type inside a modal opened by TinyMCE even when TinyMCE is declared inside New-UDModal

Actual behavior

TinyMCE modals cannot receive keyboard input.  Keyboard input is ignored.

Additional Environment data

Windows

Visuals

No response

adamdriscoll commented 1 year ago

This issue has been mentioned on Ironman Software Forums. There might be relevant details there:

https://forums.ironmansoftware.com/t/new-udtinymce-cannot-type-in-modals-when-declared-inside-new-udmodal/9943/3