Closed oDinZu closed 1 year ago
Hi @csharpee this is duplicate of https://github.com/SKLINET/strapi-plugin-tinymce/issues/8. As we said there, at the moment we don't have any plans to support self-hosted version in this plugin. If you want it, feel free to fork our repo and change it on your own.
Thanks
@poberbeck @csharpee For others coming here wondering how to do this the best solution at the moment might be patch-package (mentioned here https://docs.strapi.io/dev-docs/plugins-extension)
I just removed the apiKey property from the react component in this file admin/src/components/Editor/index.js and added a new one to load the JS locally...
return (
!loading && pluginConfig ?
<Editor
tinymceScriptSrc={'/tinymce/tinymce.min.js'}
value={value}
tagName={name}`
Apply the change with patch-package and then add a postinstall command to copy tinymce to your public folder...
package.json
"scripts": {
"postinstall": "node ./postinstall.js && patch-package"
},
postinstall.js
// Copy tinymce folder
const fse = require('fs-extra');
const path = require('path');
const topDir = __dirname;
fse.emptyDirSync(path.join(topDir, 'public', 'tinymce'));
fse.copySync(path.join(topDir, 'node_modules', 'tinymce'), path.join(topDir, 'public', 'tinymce'), { overwrite: true });
.gitignore
public/tinymce/*
This will remove the api key message from your tinymce editors. Would be good if the contributors would add a conditional for the tinymceScriptSrc property then it can be done natively? The above method might also be useful in the docs?
I am wondering why an API key is needed? We should be able to add the package and configure it as a self-hosted application within the Strapi app.
According to https://www.tiny.cloud/docs/tinymce/6/react-pm-host/, we shouldn't need an API key if we are hosting it on our own hosting service.
Also, how to integrate a react app into Strapi.. https://docs.strapi.io/dev-docs/integrations/react
Using the API is senseless and requires depending on another server to load the editor..what if that server is slow or offline?