samclarke / SCEditor

A lightweight HTML and BBCode WYSIWYG editor
http://www.sceditor.com/
Other
657 stars 187 forks source link

sceditor doesn't initialize in an Android WebView with CapacitorJS #965

Closed itemir closed 1 month ago

itemir commented 1 month ago

This is a bit of an odd problem and I am struggling to debug it further, so opinions welcome.

We initialize sceditor like this in our app:

sceditor.create(noteTextElement, {
          format: 'xhtml',
          toolbar: 'bold,italic,link,bulletlist,orderedlist,subscript,superscript,quote',
          style: 'https://cdn.jsdelivr.net/npm/sceditor@3/minified/themes/content/default.min.css',
          emoticons: {
            dropdown: {
              // List only the emoticons you want to include
            },
            more: {
              // Additional emoticons for the "more" dropdown, if needed
            }
          },
        });

It works without issues. And we then call this from several different environments, including web views from iOS and Android apps using CapacitorJS. It works on iOS but for some reason it doesn't work on Android. Opening this from a proper browser from Android still works.

A bit stuck how to troubleshoot it further. Opinions and suggestions welcome.

itemir commented 1 month ago

Found the problem, needed to initialize it with runWithoutWysiwygSupport: false. WebView on Android doesn't seem to support it.