Comments (5)
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.
@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.
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.
@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.
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)
- Failed to execute 'querySelectorAll' on 'Element': 'map:not(svg map),canvas:not(svg canvas),del:not(svg del),ins:not(svg ins),a:not(svg a)' is not a valid selector HOT 2
- TinyMCE requires standards mode. HOT 2
- Chrome Browser Based Bug and high memory usage after sometime HOT 2
- Useless Image reload triggered at keyup event, when cache is disabled HOT 7
- Uploading images with TinyMCE does not replace the src attribute inside the image tag HOT 5
- Cursor jump back to start when pressed any key in the keyboard. HOT 2
- The editor refreshing anytime i click on other element
- Upload large video more than 100 MB HOT 2
- Selector type doesn't support string in react. HOT 2
- react18 + tinymce/tinymce-react, use image_caption and file_picker_callback HOT 2
- Error TS for use readonly with React JS (Editor) HOT 1
- About this.elementRef.current?.OwnerDocument.DefaultView question HOT 3
- Toolbar Sticky not working properly HOT 5
- Cursor jumps to the start when I start typing HOT 4
- I found a bug while trying to use the Merge Tags feature in "codepen"
- "@tinymce/tinymce-react": "^5.1.0" NOT FIND HOT 3
- Cannot find module '@tinymce/tinymce-react' or its corresponding type declarations HOT 2
- GPL usage not working HOT 1
- [Solved] `licenseKey` is not working as intended but `license_key` did. Test failing on `license_key` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tinymce-react.