question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

React Webpack & Tinymce

See original GitHub issue

So, I know I could add a link in head section to use TinyMCE in my react project but I will not, because of web pack in my project. I’m trying to add new TinyMCE loader but I can’t get it running, have no clue what is wrong with it. In the inspector I see all elements of Tiny and also I do not get any errors or warnings(but are not visible, only classes appear).

alt text

Here is how I done it:


plugins: [
new webpack.LoaderOptionsPlugin({
			options: {
				loaders: [
					{
						test: require.resolve('tinymce/tinymce'),
						use: [
							'imports-loader?this=>window',
							'exports-loader?window.tinymce',
						]
					},
					{
						test: /tinymce\/(themes|plugins)\//,
						use: [
							'imports-loader?this=>window'
						]
					},
				],
			}
		})]

I got following npm’s libs:

    "react-tinymce": "^0.5.1",
    "tinymce": "^4.6.4"
    "exports-loader": "^0.6.4",
    "imports-loader": "^0.7.1",

The script looks like that:

import React from 'react';
import tinymce from 'tinymce/tinymce'
import 'tinymce/themes/modern/theme'

import 'tinymce/plugins/paste/plugin'
import 'tinymce/plugins/link/plugin'
import 'tinymce/plugins/autoresize/plugin'

class Textarea extends React.Component {

	componentDidMount(){
		tinymce.init({
			selector: '.addAnswerArea',
			skin: false,
			plugins: ['paste', 'link', 'autoresize']
		})
	}

	render() {
		return (
			<div className="field">
					<textarea className="addAnswerArea" placeholder="Add a comment..."></textarea>
			</div>
		)
	}

}

export default Textarea;

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9

github_iconTop GitHub Comments

2reactions
ghostcommented, Jul 10, 2017

@fyrkant That’s pretty sad… Yet Thanks for helping!

1reaction
ghostcommented, Jul 14, 2017

@fyrkant I think that in the first place style should not be required at all. Just saying. I had many people complaining about it, my conclusion is that many people don’t use it because of poor web pack compatibility.I think that there should be check if a theme is actually available, and then, after all, it should be included.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bundling an npm version of TinyMCE with ES6 and Webpack
Bundling an npm version of TinyMCE in a project using ES6 and Webpack. ... If TinyMCE will be used with a JavaScript framework...
Read more >
An example of using webpack to bundle tinymce. - GitHub
Put the tinymce folder in a location for static files, such as the public folder in a project created by npx express-generator or...
Read more >
@tinymce/tinymce-react - npm
Official TinyMCE React Component. Latest version: 4.2.0, last published: 5 months ago. Start using @tinymce/tinymce-react in your project by ...
Read more >
TinyMCE Self-hosted with React - Stack Overflow
$ npm install --save @tinymce/tinymce-react. cp -r node_modules/tinymce/skins skins. create file webpack.config.js. const ...
Read more >
Create TinyMCE plugins with React, Typescript, Jest, and ...
Create TinyMCE plugins with React, Typescript, Jest, and Webpack. TTinyMCE is a WYSIWYG HTML editor that you can add both to your personal ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found