Skip to content

Uncaught TypeError: Cannot read property 'font-styles' of undefined at f #207

@nmgeek

Description

@nmgeek

Here is some help for people who get this undefined 'font-styles' error. As best I can tell this is caused by an incompatiblity of the bootstrap3-wysiwyg package with some JS loaders. In my case the loader is SystemJS. I solved the problem by switching to this fork: https://github.com/sharathprabhal/bootstrap3-wysiwyg-commonjs

In my case switching to that fork also required adding the handlebars package as an explicit dependency for my project.

The implication is that the code in this bootstrap3-wysiwyg repository is not CommonJS compliant. See issue, #166.

Regarding the actual nature of the error message it looks to me like this package has a more-or-less global variable called wysihtml5 that gets split into two separate scopes when loaded by SystemJS. The 'font-styles' handlebars template is defined using the tpl property in the first scope but later looked up in the second scope where the tpl template property was never defined.

I suspect that when the .js file from this project is loaded directly from a script directive in html (instead of via SystemJS) the two scopes are one in the same.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions