tinymce / tinymce-angular

Official TinyMCE Angular Component
MIT License
324 stars 93 forks source link

Mobile HTML attribute results in theme.js error #182

Closed tigbeans closed 3 years ago

tigbeans commented 3 years ago

I will preface this by saying, I am not sure if tinymce-angular is supposed to be support mobile yet because I have not found any documentation on it. I am attempting to use the mobile HTML attribute, similar to the non-angular version of TinyMCE. The mobile styling and functionality seem to work well in my form but when I select the back button in the mobile TinyMCE display and then attempt any other action I get the following error in my browser console:

core.js:4197 ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'document' of null
TypeError: Cannot read property 'document' of null
    at tp (theme.min.js:9)
    at Object.getActiveApi (theme.min.js:9)
    at Object.exit (theme.min.js:9)
    at theme.min.js:9
    at Object.each (theme.min.js:9)
    at Object.run (theme.min.js:9)
    at Object.exit (theme.min.js:9)
    at $E.<anonymous> (theme.min.js:9)
    at uE.fire (tinymce.min.js:9)
    at $E.fire (tinymce.min.js:9)
    at resolvePromise (zone-evergreen.js:798)
    at resolvePromise (zone-evergreen.js:750)
    at zone-evergreen.js:860
    at ZoneDelegate.invokeTask (zone-evergreen.js:399)
    at Object.onInvokeTask (core.js:27136)
    at ZoneDelegate.invokeTask (zone-evergreen.js:398)
    at Zone.runTask (zone-evergreen.js:167)
    at drainMicroTaskQueue (zone-evergreen.js:569)
    at ZoneTask.invokeTask [as invoke] (zone-evergreen.js:484)
    at invokeTask (zone-evergreen.js:1621)

This is more or less the HTML that I am trying to get working...

        <editor
          [init]="{
            mobile: {
              theme: 'mobile',
              plugins: [ 'advlist', 'autolink', 'autolink', 'lists', 'link', 'image', 'charmap', 'print',
              'preview', 'anchor', 'codesample', 'searchplace', 'visualblocks', 'code', 'fullscreen',
              'image', 'imagetools', 'insertdatetime', 'media', 'table', 'paste', 'help', 'wordcount' ],
              toolbar: [ 'undo', 'redo', 'formatselect', 'bold', 'italic', 'backcolor', 'underline',
              'styleselect',  'link', 'unlink', 'image', 'bullist', 'numlist', 'fontsizeselect', 'forecolor',
              'removeformat', 'codesample']
            },
            content_css: '//www.tiny.cloud/css/codepen.min.css'
        }"
        ></editor>

versions: tinymce: 5.2.1 @tinymce/tinymce-angular: 4.1.0

SimonFc commented 3 years ago

Is it possible for you to provide a minimal demo of the problem via codesandbox.io? Mobile theme should work with tinymce-angular yes, although it's difficult to say exactly what the issue is in your case.

tinydylan commented 3 years ago

As we haven't heard back, we'll be closing this issue for now. If you can provide a codesandbox example and let us know what platform you're testing on, that'll help us get to the root of the issue. Feel free to reopen this issue with those details.

Thanks!