Code Monkey home page Code Monkey logo

Comments (5)

danoaky-tiny avatar danoaky-tiny commented on July 29, 2024

You're using the wrong tinymce-react package. https://www.npmjs.com/package/tinymce-react is not us. This is the correct npm package: https://www.npmjs.com/package/@tinymce/tinymce-react.
yarn add @tinymce/tinymce-react

Also, when setup correctly, tinymce is a global variable. So the ref error you're getting, hints at the global not being assigned. But anyway, as a first step, install our package and yarn remove tinymce-react

from tinymce-react.

northk avatar northk commented on July 29, 2024

@danoaky-tiny thanks for writing back. I've made sure the correct @tinymce/tinymce-react package is now installed. The package.json says "@tinymce/tinymce-react": "^4.3.2" and "tinymce": "^7.0.0". But, I still get the same problem. Where in the application should the TineMCE editor instance get instantiated? I suspect either that isn't happening, or it's happening in the wrong place. I don't think there is any global tinymce variable. I would appreciate your advice.

from tinymce-react.

danoaky-tiny avatar danoaky-tiny commented on July 29, 2024

If you followed the setup steps more or less how they are right now: within BundledTinyMceEditor.tsx, try replacing:

// TinyMCE so the global var exists
// eslint-disable-next-line no-unused-vars
import tinymce from 'tinymce/tinymce';

With this:

import 'tinymce/tinymce';

I noticed you're also using TinyMCE version 7, which will also require a license key. You can read more here https://www.tiny.cloud/docs/tinymce/7/license-key/

from tinymce-react.

northk avatar northk commented on July 29, 2024

@danoaky-tiny the import 'tinymce/tinymce'; fixed the problem! I'm not sure how that is different than import tinymce from 'tinymce/tinymce';, but it is. The editor is now rendering and seems to be working. Regarding the license key, it appears that I can do the following to declare that I'm using TinyMCE under the GPL license, in the init property:
license_key: 'gpl',

Is there any reason you can think of why this won't work? Now I just need to get image and file uploads configured and working.
Thanks again.

from tinymce-react.

danoaky-tiny avatar danoaky-tiny commented on July 29, 2024

No worries, glad to have helped.

As for why the named import of TinyMCE didn't work for you, it's hard to say without seeing your bundler, bundler config, etc. My guess is it could be that your bundler is removing that line as it thinks it's dead code, as in tinymce isn't directly used in that file.

And using 'gpl' just means you're agreeing to self host TinyMCE under the GPL license, and yes you can do that, if that's the case for you.
https://www.tiny.cloud/docs/tinymce/7/license-key/#use-tinymce-with-the-gplv2-license

from tinymce-react.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.