Skip to content

ReferenceError Can't find variable: tinyMCE #485

@doug-wade

Description

@doug-wade

Currently, I'm seeing the error ReferenceError Can't find variable: tinyMCE. I'm sure there's a problem with my setup that I can figure out independently, but I thought I'd point out that based on the code, I should instead be seeing tinyMCE is not loaded. If you customized TINYMCE_JS_URL, double-check its content. as my error message. The reason this is not happening is because when we reference the global variable tinyMCE, we don't prefix it with the scope that we want javascript to search for the global variable, so the error message assumes that we're missing a variable in the local scope. I think if we change the check to

    if (!globalThis.tinyMCE) {
      throw 'tinyMCE is not loaded. If you customized TINYMCE_JS_URL, double-check its content.';
    }

it should throw the expected error instead. See, for example, this quick test from my browser console:

Image

Here's the MDN docs for globalThis for reference, in case that helps clarify anything.

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