Ad

React TinyMCE Without Node

- 1 answer

I am new to React and am trying to use the React TinyMCE Component in my website.

I can get a basic React application up and running but when I attempt to integrate the TinyMCE component I receive an "Uncaught ReferenceError: TinyMCE is not defined" error in the console.

From what limited knowlegde I have it seems to be using the Node "requires" feature? Is there any way of using the component without Node?

I have created this example in Plunker which shows the problem, removing the following line in the script.jsx file prevents the error:

            < TinyMCE content = "<p>This is the initial content of the editor</p>"
  config = {
    {
      plugins: 'autolink link image lists print preview',
      toolbar: 'undo redo | bold italic | alignleft aligncenter alignright'
    }
  }
  />
Ad

Answer

You've got two problems. First react-tinymce-min.js isn't being found. So you need to somehow pull that into your project. The brain-dead way of doing that is to just copy the source into your project. Second since you aren't using Webpack TinyMCE gets put into the global variable ReactTinymce. Edited plunk.

Ultimately you'll want to use Webpack. That's what all the cool kids use. And it will make your life a lot easier.

Ad
source: stackoverflow.com
Ad