React Webpack & Tinymce
See original GitHub issueSo, 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).
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:
- Created 6 years ago
- Comments:9
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@fyrkant That’s pretty sad… Yet Thanks for helping!
@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.